aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2014-06-06 16:55:26 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2014-06-06 16:55:26 +0000
commit737cdcd23f0a13963f97840cd0acd4672e9eb3ee (patch)
tree17269cb10efa49d496744420fcb9be019220f0ad /lib
parent240dd15692debe127e57ff0fb4bc320f70614d5f (diff)
downloadsg3_utils-737cdcd23f0a13963f97840cd0acd4672e9eb3ee.tar.gz
sg_luns: add decoding for conglomerate LUNS; change struct sg_simple_inquiry_resp::rmb to byte_1
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@586 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'lib')
-rw-r--r--lib/sg_cmds_basic.c4
-rw-r--r--lib/sg_pt_common.c2
-rw-r--r--lib/sg_pt_linux.c33
3 files changed, 28 insertions, 11 deletions
diff --git a/lib/sg_cmds_basic.c b/lib/sg_cmds_basic.c
index 43c127c7..46e567be 100644
--- a/lib/sg_cmds_basic.c
+++ b/lib/sg_cmds_basic.c
@@ -27,7 +27,7 @@
#endif
-static const char * version_str = "1.67 20140514";
+static const char * version_str = "1.68 20140604";
#define SENSE_BUFF_LEN 64 /* Arbitrary, could be larger */
@@ -361,7 +361,7 @@ sg_simple_inquiry(int sg_fd, struct sg_simple_inquiry_resp * inq_data,
if (0 == ret) {
inq_data->peripheral_qualifier = (inq_resp[0] >> 5) & 0x7;
inq_data->peripheral_type = inq_resp[0] & 0x1f;
- inq_data->rmb = (inq_resp[1] & 0x80) ? 1 : 0;
+ inq_data->byte_1 = inq_resp[1];
inq_data->version = inq_resp[2];
inq_data->byte_3 = inq_resp[3];
inq_data->byte_5 = inq_resp[5];
diff --git a/lib/sg_pt_common.c b/lib/sg_pt_common.c
index cc84cc21..357816a4 100644
--- a/lib/sg_pt_common.c
+++ b/lib/sg_pt_common.c
@@ -14,7 +14,7 @@
#endif
-static const char * scsi_pt_version_str = "2.11 20140603";
+static const char * scsi_pt_version_str = "2.12 20140606";
const char *
scsi_pt_version()
diff --git a/lib/sg_pt_linux.c b/lib/sg_pt_linux.c
index 18c318c4..ea16fd27 100644
--- a/lib/sg_pt_linux.c
+++ b/lib/sg_pt_linux.c
@@ -5,7 +5,7 @@
* license that can be found in the BSD_LICENSE file.
*/
-/* sg_pt_linux version 1.21 20140603 */
+/* sg_pt_linux version 1.22 20140606 */
#include <stdio.h>
@@ -278,6 +278,9 @@ set_scsi_pt_task_attr(struct sg_pt_base * vp, int attribute, int priority)
#ifndef SG_FLAG_Q_AT_TAIL
#define SG_FLAG_Q_AT_TAIL 0x10
#endif
+#ifndef SG_FLAG_Q_AT_HEAD
+#define SG_FLAG_Q_AT_HEAD 0x20
+#endif
void
set_scsi_pt_flags(struct sg_pt_base * vp, int flags)
@@ -286,10 +289,13 @@ set_scsi_pt_flags(struct sg_pt_base * vp, int flags)
/* default action of sg driver [sg v3 interface] is QUEUE_AT_HEAD */
/* default action of block layer SG_IO ioctl is QUEUE_AT_TAIL */
- if (SCSI_PT_FLAGS_QUEUE_AT_TAIL & flags)
- ptp->io_hdr.flags |= SG_FLAG_Q_AT_TAIL;
- if (SCSI_PT_FLAGS_QUEUE_AT_HEAD & flags)
+ if (SCSI_PT_FLAGS_QUEUE_AT_HEAD & flags) { /* favour AT_HEAD */
+ ptp->io_hdr.flags |= SG_FLAG_Q_AT_HEAD;
ptp->io_hdr.flags &= ~SG_FLAG_Q_AT_TAIL;
+ } else if (SCSI_PT_FLAGS_QUEUE_AT_TAIL & flags) {
+ ptp->io_hdr.flags |= SG_FLAG_Q_AT_TAIL;
+ ptp->io_hdr.flags &= ~SG_FLAG_Q_AT_HEAD;
+ }
}
/* Executes SCSI command (or at least forwards it to lower layers).
@@ -747,11 +753,17 @@ set_scsi_pt_task_attr(struct sg_pt_base * vp, int attribute, int priority)
#ifndef BSG_FLAG_Q_AT_TAIL
#define BSG_FLAG_Q_AT_TAIL 0x10
#endif
+#ifndef BSG_FLAG_Q_AT_HEAD
+#define BSG_FLAG_Q_AT_HEAD 0x20
+#endif
/* Need this later if translated to v3 interface */
#ifndef SG_FLAG_Q_AT_TAIL
#define SG_FLAG_Q_AT_TAIL 0x10
#endif
+#ifndef SG_FLAG_Q_AT_HEAD
+#define SG_FLAG_Q_AT_HEAD 0x20
+#endif
void
set_scsi_pt_flags(struct sg_pt_base * vp, int flags)
@@ -760,10 +772,13 @@ set_scsi_pt_flags(struct sg_pt_base * vp, int flags)
/* default action of bsg driver (sg v4) is QUEUE_AT_HEAD */
/* default action of block layer SG_IO ioctl is QUEUE_AT_TAIL */
- if (SCSI_PT_FLAGS_QUEUE_AT_TAIL & flags)
- ptp->io_hdr.flags |= BSG_FLAG_Q_AT_TAIL;
- if (SCSI_PT_FLAGS_QUEUE_AT_HEAD & flags)
+ if (SCSI_PT_FLAGS_QUEUE_AT_HEAD & flags) { /* favour AT_HEAD */
+ ptp->io_hdr.flags |= BSG_FLAG_Q_AT_HEAD;
ptp->io_hdr.flags &= ~BSG_FLAG_Q_AT_TAIL;
+ } else if (SCSI_PT_FLAGS_QUEUE_AT_TAIL & flags) {
+ ptp->io_hdr.flags |= BSG_FLAG_Q_AT_TAIL;
+ ptp->io_hdr.flags &= ~BSG_FLAG_Q_AT_HEAD;
+ }
}
/* N.B. Returns din_resid and ignores dout_resid */
@@ -930,7 +945,9 @@ do_scsi_pt_v3(struct sg_pt_linux_scsi * ptp, int fd, int time_secs,
v3_hdr.mx_sb_len = (unsigned char)ptp->io_hdr.max_response_len;
}
v3_hdr.pack_id = (int)ptp->io_hdr.spare_in;
- if (BSG_FLAG_Q_AT_TAIL & ptp->io_hdr.flags)
+ if (BSG_FLAG_Q_AT_HEAD & ptp->io_hdr.flags)
+ v3_hdr.flags |= SG_FLAG_Q_AT_HEAD; /* favour AT_HEAD */
+ else if (BSG_FLAG_Q_AT_TAIL & ptp->io_hdr.flags)
v3_hdr.flags |= SG_FLAG_Q_AT_TAIL;
if (NULL == v3_hdr.cmdp) {