aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--COVERAGE4
-rw-r--r--ChangeLog5
-rw-r--r--README2
-rw-r--r--debian/changelog2
-rw-r--r--doc/sg3_utils.82
-rwxr-xr-xscripts/rescan-scsi-bus.sh41
-rw-r--r--sg3_utils.spec2
-rw-r--r--src/sg_inq.c16
-rw-r--r--src/sg_vpd.c9
-rw-r--r--src/sg_write_same.c99
10 files changed, 100 insertions, 82 deletions
diff --git a/COVERAGE b/COVERAGE
index 2eb657e8..290eaf01 100644
--- a/COVERAGE
+++ b/COVERAGE
@@ -48,7 +48,7 @@ READ LONG (16) sg_read_long, ++
READ MEDIA SERIAL NUMBER sg_rmsn, ++
REASSIGN BLOCKS sg_reassign, ++
RECEIVE COPY RESULTS sg_copy_results, ++
-RECEIVE DIAGNOSTIC sg_senddiag, sg_ses, ++
+RECEIVE DIAGNOSTIC RESULTS sg_senddiag, sg_ses, ++
REPORT IDENTIFYING INFORMATION sg_ident, ++ (2)
REPORT LUNS sg_luns, ++
REPORT REFERRALS sg_referrals, ++
@@ -101,4 +101,4 @@ SMART READ DATA examples/sg_sat_smart_rd_data
Douglas Gilbert
-16th May 2013
+2nd December 2013
diff --git a/ChangeLog b/ChangeLog
index e99aaa02..62f7eaf5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,13 +2,16 @@ Each utility has its own version number, date of last change and
some description at the top of its ".c" file. All utilities in the main
directory have their own "man" pages. There is also a sg3_utils man page.
-Changelog for sg3_utils-1.38 [20131127] [svn: r535]
+Changelog for sg3_utils-1.38 [20131202] [svn: r536]
- sg_ses: add --dev-slot-num= and --sas-addr=
- error and warning message cleanup
- sg_inq: add --block=0|1 option to control opens
+ - add LU_CONG to standard inquiry response output
- sync version descriptors dated 20131126
- fix overflow in encode_whitespaces
+ - sg_vpd: add LU_CONG to standard inquiry response output
- sg_luns: guard against garbage response
+ - sg_write_same: repeat if unit attention
- sg_lib_data: sync asc/ascq codes with T10 dated 20131110
- examples: add sg_tst_excl3 for testing O_EXCL
- improve sg_tst_excl and sg_tst_excl2
diff --git a/README b/README
index d2c31b20..1d29b64d 100644
--- a/README
+++ b/README
@@ -401,4 +401,4 @@ See http://sg.danny.cz/sg/tools.html
Douglas Gilbert
-27th November 2013
+1st December 2013
diff --git a/debian/changelog b/debian/changelog
index c2548227..96665dbe 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,7 +2,7 @@ sg3-utils (1.38-0.1) unstable; urgency=low
* New upstream version
- -- Douglas Gilbert <dgilbert@interlog.com> Wed, 27 Nov 2013 11:00:00 -0500
+ -- Douglas Gilbert <dgilbert@interlog.com> Sun, 01 Dec 2013 05:00:00 +0100
sg3-utils (1.37-0.1) unstable; urgency=low
diff --git a/doc/sg3_utils.8 b/doc/sg3_utils.8
index 1a499b0b..67c50222 100644
--- a/doc/sg3_utils.8
+++ b/doc/sg3_utils.8
@@ -1,4 +1,4 @@
-.TH SG3_UTILS "8" "November 2013" "sg3_utils\-1.38" SG3_UTILS
+.TH SG3_UTILS "8" "December 2013" "sg3_utils\-1.38" SG3_UTILS
.SH NAME
sg3_utils \- a package of utilities for sending SCSI commands
.SH SYNOPSIS
diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh
index 81112c1a..320d7b5a 100755
--- a/scripts/rescan-scsi-bus.sh
+++ b/scripts/rescan-scsi-bus.sh
@@ -922,40 +922,43 @@ if test @$1 = @--help -o @$1 = @-h -o @$1 = @-?; then
echo "Usage: rescan-scsi-bus.sh [options] [host [host ...]]"
echo "Options:"
echo " -a scan all targets, not just currently existing [default: disabled]"
+ echo " -c enables scanning of channels 0 1 [default: 0 / all detected ones]"
echo " -d enable debug [default: 0]"
+ echo " -f flush failed multipath devices [default: disabled]"
+ echo " -h help: print this usage message then exit"
+ echo " -i issue a FibreChannel LIP reset [default: disabled]"
echo " -l activates scanning for LUNs 0--7 [default: 0]"
echo " -L NUM activates scanning for LUNs 0--NUM [default: 0]"
- echo " -w scan for target device IDs 0--15 [default: 0--7]"
- echo " -c enables scanning of channels 0 1 [default: 0 / all detected ones]"
echo " -r enables removing of devices [default: disabled]"
- echo " -f flush failed multipath devices [default: disabled]"
- echo " -i issue a FibreChannel LIP reset [default: disabled]"
- echo " -u look for existing disks that have been remapped"
echo " -s look for resized disks and reload associated multipath devices, if applicable"
+ echo " -u look for existing disks that have been remapped"
+ echo " -w scan for target device IDs 0--15 [default: 0--7]"
echo "--alltargets: same as -a"
- echo "--remove: same as -r"
+ echo "--attachpq3: Tell kernel to attach sg to LUN 0 that reports PQ=3"
+ echo "--channels=LIST: Scan only channel(s) in LIST"
+ echo "--color: use coloured prefixes OLD/NEW/DEL"
echo "--flush: same as -f"
- echo "--issue-lip: same as -i"
- echo "--wide: same as -w"
- echo "--forcerescan: Rescan existing devices"
echo "--forceremove: Remove and readd every device (DANGEROUS)"
- echo "--nooptscan: don't stop looking for LUNs is 0 is not found"
- echo "--color: use coloured prefixes OLD/NEW/DEL"
+ echo "--forcerescan: Rescan existing devices"
+ echo "--help: print this usage message then exit"
echo "--hosts=LIST: Scan only host(s) in LIST"
- echo "--channels=LIST: Scan only channel(s) in LIST"
echo "--ids=LIST: Scan only target ID(s) in LIST"
+ echo "--issue-lip: same as -i"
+ echo "--largelun: Tell kernel to support LUNs > 7 even on SCSI2 devs"
echo "--luns=LIST: Scan only lun(s) in LIST"
- echo "--sync/nosync: Issue a sync / no sync [default: sync if remove]"
- echo "--attachpq3: Tell kernel to attach sg to LUN 0 that reports PQ=3"
+ echo "--nooptscan: don't stop looking for LUNs is 0 is not found"
+ echo "--remove: same as -r"
echo "--reportlun2: Tell kernel to try REPORT_LUN even on SCSI2 devices"
- echo "--largelun: Tell kernel to support LUNs > 7 even on SCSI2 devs"
+ echo "--resize: same as -s"
echo "--sparselun: Tell kernel to support sparse LUN numbering"
+ echo "--sync/nosync: Issue a sync / no sync [default: sync if remove]"
echo "--update: same as -u"
- echo "--resize: same as -s"
- echo " Host numbers may thus be specified either directly on cmd line (deprecated) or"
- echo " or with the --hosts=LIST parameter (recommended)."
+ echo "--wide: same as -w"
+ echo ""
+ echo "Host numbers may thus be specified either directly on cmd line (deprecated)"
+ echo "or with the --hosts=LIST parameter (recommended)."
echo "LIST: A[-B][,C[-D]]... is a comma separated list of single values and ranges"
- echo " (No spaces allowed.)"
+ echo "(No spaces allowed.)"
exit 0
fi
diff --git a/sg3_utils.spec b/sg3_utils.spec
index bb8c7607..85f1081c 100644
--- a/sg3_utils.spec
+++ b/sg3_utils.spec
@@ -79,7 +79,7 @@ fi
%{_libdir}/*.la
%changelog
-* Wed Nov 27 2013 - dgilbert at interlog dot com
+* Sun Dec 01 2013 - dgilbert at interlog dot com
- track t10 changes
* sg3_utils-1.38
diff --git a/src/sg_inq.c b/src/sg_inq.c
index 86da4c47..6320bf86 100644
--- a/src/sg_inq.c
+++ b/src/sg_inq.c
@@ -67,7 +67,7 @@
* information [MAINTENANCE IN, service action = 0xc]; see sg_opcodes.
*/
-static const char * version_str = "1.21 20131127"; /* SPC-4 rev 36 */
+static const char * version_str = "1.23 20131202"; /* SPC-4 rev 36n */
/* Following VPD pages are in ascending page number order */
@@ -2453,9 +2453,15 @@ std_inq_process(int sg_fd, const struct opts_t * optsp)
dStrRaw((const char *)rsp_buff, act_len);
else if (optsp->do_hex)
dStrHex((const char *)rsp_buff, act_len, 0);
- else if (!optsp->do_export) {
- printf(" PQual=%d Device_type=%d RMB=%d version=0x%02x ",
- pqual, peri_type, !!(rsp_buff[1] & 0x80),
+ else if (optsp->do_export) {
+ printf("SCSI_TPGS=%d\n", (rsp_buff[5] & 0x30) >> 4);
+ cp = sg_get_pdt_str(peri_type, sizeof(buff), buff);
+ if (strlen(cp) > 0)
+ printf("SCSI_TYPE=%s\n", cp);
+ } else {
+ printf(" PQual=%d Device_type=%d RMB=%d LU_CONG=%d "
+ "version=0x%02x ", pqual, peri_type,
+ !!(rsp_buff[1] & 0x80), !!(rsp_buff[1] & 0x40),
(unsigned int)rsp_buff[2]);
printf(" [%s]\n", get_ansi_version_str(ansi_version, buff,
sizeof(buff)));
@@ -2476,7 +2482,7 @@ std_inq_process(int sg_fd, const struct opts_t * optsp)
printf("[MChngr=%d] [ACKREQQ=%d] Addr16=%d\n [RelAdr=%d] ",
!!(rsp_buff[6] & 0x08), !!(rsp_buff[6] & 0x04),
!!(rsp_buff[6] & 0x01), !!(rsp_buff[7] & 0x80));
- printf("WBus16=%d Sync=%d Linked=%d [TranDis=%d] ",
+ printf("WBus16=%d Sync=%d [Linked=%d] [TranDis=%d] ",
!!(rsp_buff[7] & 0x20), !!(rsp_buff[7] & 0x10),
!!(rsp_buff[7] & 0x08), !!(rsp_buff[7] & 0x04));
printf("CmdQue=%d\n", !!(rsp_buff[7] & 0x02));
diff --git a/src/sg_vpd.c b/src/sg_vpd.c
index ea21f121..168bcfff 100644
--- a/src/sg_vpd.c
+++ b/src/sg_vpd.c
@@ -30,7 +30,7 @@
*/
-static const char * version_str = "0.71 20131030"; /* spc4r36 + sbc3r35 */
+static const char * version_str = "0.72 20131202"; /* spc4r36 + sbc3r35 */
/* And with sbc3r35, vale Mark Evans */
void svpd_enumerate_vendor(void);
@@ -319,8 +319,9 @@ decode_std_inq(unsigned char * b, int len, int verbose)
else
printf("standard INQUIRY: [reserved or vendor specific "
"qualifier [%d]]\n", pqual);
- printf(" PQual=%d Device_type=%d RMB=%d version=0x%02x ",
- pqual, b[0] & 0x1f, !!(b[1] & 0x80), (unsigned int)b[2]);
+ printf(" PQual=%d Device_type=%d RMB=%d LU_CONG=%d version=0x%02x ",
+ pqual, b[0] & 0x1f, !!(b[1] & 0x80), !!(b[1] & 0x40),
+ (unsigned int)b[2]);
printf(" [%s]\n", sg_ansi_version_arr[b[2] & 0xf]);
printf(" [AERC=%d] [TrmTsk=%d] NormACA=%d HiSUP=%d "
" Resp_data_format=%d\n",
@@ -343,7 +344,7 @@ decode_std_inq(unsigned char * b, int len, int verbose)
printf("[MChngr=%d] [ACKREQQ=%d] Addr16=%d\n [RelAdr=%d] ",
!!(b[6] & 0x08), !!(b[6] & 0x04), !!(b[6] & 0x01),
!!(b[7] & 0x80));
- printf("WBus16=%d Sync=%d Linked=%d [TranDis=%d] ",
+ printf("WBus16=%d Sync=%d [Linked=%d] [TranDis=%d] ",
!!(b[7] & 0x20), !!(b[7] & 0x10), !!(b[7] & 0x08),
!!(b[7] & 0x04));
printf("CmdQue=%d\n", !!(b[7] & 0x02));
diff --git a/src/sg_write_same.c b/src/sg_write_same.c
index 3dd235e9..d4665d9d 100644
--- a/src/sg_write_same.c
+++ b/src/sg_write_same.c
@@ -26,7 +26,7 @@
#include "sg_cmds_basic.h"
#include "sg_cmds_extra.h"
-static const char * version_str = "1.04 20130730";
+static const char * version_str = "1.05 20131201";
#define ME "sg_write_same: "
@@ -140,7 +140,7 @@ usage()
}
static int
-do_write_same(int sg_fd, const struct opts_t * optsp, const void * dataoutp,
+do_write_same(int sg_fd, const struct opts_t * op, const void * dataoutp,
int * act_cdb_lenp)
{
int k, ret, res, sense_cat, cdb_len;
@@ -150,13 +150,13 @@ do_write_same(int sg_fd, const struct opts_t * optsp, const void * dataoutp,
unsigned char sense_b[SENSE_BUFF_LEN];
struct sg_pt_base * ptvp;
- cdb_len = optsp->pref_cdb_size;
+ cdb_len = op->pref_cdb_size;
if (WRITE_SAME10_LEN == cdb_len) {
- llba = optsp->lba + optsp->numblocks;
- if ((optsp->numblocks > 0xffff) || (llba > ULONG_MAX) ||
- optsp->ndob || (optsp->unmap && (0 == optsp->want_ws10))) {
+ llba = op->lba + op->numblocks;
+ if ((op->numblocks > 0xffff) || (llba > ULONG_MAX) ||
+ op->ndob || (op->unmap && (0 == op->want_ws10))) {
cdb_len = WRITE_SAME16_LEN;
- if (optsp->verbose)
+ if (op->verbose)
fprintf(stderr, "do_write_same: use WRITE SAME(16) instead "
"of 10 byte cdb\n");
}
@@ -167,76 +167,76 @@ do_write_same(int sg_fd, const struct opts_t * optsp, const void * dataoutp,
switch (cdb_len) {
case WRITE_SAME10_LEN:
wsCmdBlk[0] = WRITE_SAME10_OP;
- wsCmdBlk[1] = ((optsp->wrprotect & 0x7) << 5);
+ wsCmdBlk[1] = ((op->wrprotect & 0x7) << 5);
/* ANCHOR + UNMAP not allowed for WRITE_SAME10 in sbc3r24+r25 but
* a proposal has been made to allow it. Anticipate approval. */
- if (optsp->anchor)
+ if (op->anchor)
wsCmdBlk[1] |= 0x10;
- if (optsp->unmap)
+ if (op->unmap)
wsCmdBlk[1] |= 0x8;
- if (optsp->pbdata)
+ if (op->pbdata)
wsCmdBlk[1] |= 0x4;
- if (optsp->lbdata)
+ if (op->lbdata)
wsCmdBlk[1] |= 0x2;
- lba = (uint32_t)optsp->lba;
+ lba = (uint32_t)op->lba;
for (k = 3; k >= 0; --k) {
wsCmdBlk[2 + k] = (lba & 0xff);
lba >>= 8;
}
- wsCmdBlk[6] = (optsp->grpnum & 0x1f);
- wsCmdBlk[7] = ((optsp->numblocks >> 8) & 0xff);
- wsCmdBlk[8] = (optsp->numblocks & 0xff);
+ wsCmdBlk[6] = (op->grpnum & 0x1f);
+ wsCmdBlk[7] = ((op->numblocks >> 8) & 0xff);
+ wsCmdBlk[8] = (op->numblocks & 0xff);
break;
case WRITE_SAME16_LEN:
wsCmdBlk[0] = WRITE_SAME16_OP;
- wsCmdBlk[1] = ((optsp->wrprotect & 0x7) << 5);
- if (optsp->anchor)
+ wsCmdBlk[1] = ((op->wrprotect & 0x7) << 5);
+ if (op->anchor)
wsCmdBlk[1] |= 0x10;
- if (optsp->unmap)
+ if (op->unmap)
wsCmdBlk[1] |= 0x8;
- if (optsp->pbdata)
+ if (op->pbdata)
wsCmdBlk[1] |= 0x4;
- if (optsp->lbdata)
+ if (op->lbdata)
wsCmdBlk[1] |= 0x2;
- if (optsp->ndob)
+ if (op->ndob)
wsCmdBlk[1] |= 0x1;
- llba = optsp->lba;
+ llba = op->lba;
for (k = 7; k >= 0; --k) {
wsCmdBlk[2 + k] = (llba & 0xff);
llba >>= 8;
}
- unum = optsp->numblocks;
+ unum = op->numblocks;
for (k = 3; k >= 0; --k) {
wsCmdBlk[10 + k] = (unum & 0xff);
unum >>= 8;
}
- wsCmdBlk[14] = (optsp->grpnum & 0x1f);
+ wsCmdBlk[14] = (op->grpnum & 0x1f);
break;
case WRITE_SAME32_LEN:
/* Note: In Linux at this time the sg driver does not support
* cdb_s > 16 bytes long, but the bsg driver does. */
wsCmdBlk[0] = VARIABLE_LEN_OP;
- wsCmdBlk[6] = (optsp->grpnum & 0x1f);
+ wsCmdBlk[6] = (op->grpnum & 0x1f);
wsCmdBlk[7] = WRITE_SAME32_ADD;
wsCmdBlk[8] = ((WRITE_SAME32_SA >> 8) & 0xff);
wsCmdBlk[9] = (WRITE_SAME32_SA & 0xff);
- wsCmdBlk[10] = ((optsp->wrprotect & 0x7) << 5);
- if (optsp->anchor)
+ wsCmdBlk[10] = ((op->wrprotect & 0x7) << 5);
+ if (op->anchor)
wsCmdBlk[10] |= 0x10;
- if (optsp->unmap)
+ if (op->unmap)
wsCmdBlk[10] |= 0x8;
- if (optsp->pbdata)
+ if (op->pbdata)
wsCmdBlk[10] |= 0x4;
- if (optsp->lbdata)
+ if (op->lbdata)
wsCmdBlk[10] |= 0x2;
- if (optsp->ndob)
+ if (op->ndob)
wsCmdBlk[10] |= 0x1;
- llba = optsp->lba;
+ llba = op->lba;
for (k = 7; k >= 0; --k) {
wsCmdBlk[12 + k] = (llba & 0xff);
llba >>= 8;
}
- unum = optsp->numblocks;
+ unum = op->numblocks;
for (k = 3; k >= 0; --k) {
wsCmdBlk[28 + k] = (unum & 0xff);
unum >>= 8;
@@ -247,16 +247,16 @@ do_write_same(int sg_fd, const struct opts_t * optsp, const void * dataoutp,
return -1;
}
- if (optsp->verbose > 1) {
+ if (op->verbose > 1) {
fprintf(stderr, " Write same(%d) cmd: ", cdb_len);
for (k = 0; k < cdb_len; ++k)
fprintf(stderr, "%02x ", wsCmdBlk[k]);
fprintf(stderr, "\n Data-out buffer length=%d\n",
- optsp->xfer_len);
+ op->xfer_len);
}
- if ((optsp->verbose > 3) && (optsp->xfer_len > 0)) {
+ if ((op->verbose > 3) && (op->xfer_len > 0)) {
fprintf(stderr, " Data-out buffer contents:\n");
- dStrHexErr((const char *)dataoutp, optsp->xfer_len, 1);
+ dStrHexErr((const char *)dataoutp, op->xfer_len, 1);
}
ptvp = construct_scsi_pt_obj();
if (NULL == ptvp) {
@@ -265,10 +265,10 @@ do_write_same(int sg_fd, const struct opts_t * optsp, const void * dataoutp,
}
set_scsi_pt_cdb(ptvp, wsCmdBlk, cdb_len);
set_scsi_pt_sense(ptvp, sense_b, sizeof(sense_b));
- set_scsi_pt_data_out(ptvp, (unsigned char *)dataoutp, optsp->xfer_len);
- res = do_scsi_pt(ptvp, sg_fd, optsp->timeout, optsp->verbose);
+ set_scsi_pt_data_out(ptvp, (unsigned char *)dataoutp, op->xfer_len);
+ res = do_scsi_pt(ptvp, sg_fd, op->timeout, op->verbose);
ret = sg_cmds_process_resp(ptvp, "Write same", res, 0, sense_b,
- 1 /*noisy */, optsp->verbose, &sense_cat);
+ 1 /*noisy */, op->verbose, &sense_cat);
if (-1 == ret)
;
else if (-2 == ret) {
@@ -506,7 +506,13 @@ main(int argc, char * argv[])
prot_en = 0;
if (0 == opts.xfer_len) {
res = sg_ll_readcap_16(sg_fd, 0 /* pmi */, 0 /* llba */, resp_buff,
- RCAP16_RESP_LEN, 0, (vb ? (vb - 1): 0));
+ RCAP16_RESP_LEN, 1, (vb ? (vb - 1): 0));
+ if (SG_LIB_CAT_UNIT_ATTENTION == res) {
+ fprintf(stderr, "Read capacity(16) unit attention, try "
+ "again\n");
+ res = sg_ll_readcap_16(sg_fd, 0, 0, resp_buff,
+ RCAP16_RESP_LEN, 1, (vb ? (vb - 1): 0));
+ }
if (0 == res) {
if (vb > 3)
dStrHexErr((const char *)resp_buff, RCAP16_RESP_LEN, 1);
@@ -524,7 +530,7 @@ main(int argc, char * argv[])
fprintf(stderr, "Read capacity(16) not supported, try "
"Read capacity(10)\n");
res = sg_ll_readcap_10(sg_fd, 0 /* pmi */, 0 /* lba */,
- resp_buff, RCAP10_RESP_LEN, 0,
+ resp_buff, RCAP10_RESP_LEN, 1,
(vb ? (vb - 1): 0));
if (0 == res) {
if (vb > 3)
@@ -535,13 +541,12 @@ main(int argc, char * argv[])
(resp_buff[6] << 8) |
resp_buff[7]);
opts.xfer_len = block_size;
- }
+ } else
+ fprintf(stderr, "Read capacity(10) failed. Unable to "
+ "calculate block size\n");
} else if (vb)
fprintf(stderr, "Read capacity(16) failed. Unable to "
"calculate block size\n");
- if (res)
- fprintf(stderr, "Read capacity(10) failed. Unable to "
- "calculate block size\n");
}
if (opts.xfer_len < 1) {
fprintf(stderr, "unable to deduce block size, please give "