aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2010-10-27 22:37:48 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2010-10-27 22:37:48 +0000
commit007cb4ce8de924073966402ee16b11a42ac3c994 (patch)
treecc2a64218567f877f5cb1fc070dad47e38561ecb
parent366d25e56b092f06afc53491c52786805cedee5d (diff)
downloadsg3_utils-007cb4ce8de924073966402ee16b11a42ac3c994.tar.gz
sync with spcr27, allow UNMAP and ANCHOR bits on WRITE SAME(10)
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@360 6180dd3e-e324-4e3e-922d-17de1ae2f315
-rw-r--r--ChangeLog14
-rw-r--r--README2
-rw-r--r--debian/changelog2
-rw-r--r--doc/sg_unmap.88
-rw-r--r--doc/sg_write_same.840
-rw-r--r--lib/sg_lib_data.c12
-rw-r--r--sg3_utils.spec2
-rw-r--r--src/sg_inq.c9
-rw-r--r--src/sg_inq_data.c16
-rw-r--r--src/sg_vpd.c4
-rw-r--r--src/sg_write_same.c11
11 files changed, 73 insertions, 47 deletions
diff --git a/ChangeLog b/ChangeLog
index a691bcdc..9bfa0236 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,20 +2,26 @@ 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.30 [20100920] [svn: r359]
+Changelog for sg3_utils-1.30 [20101027] [svn: r360]
- sg_referrals: new utility for REPORT REFERRALS
- - sg_inq: update version descriptor list to spc4r26
- - sg_lib: sync asc/ascq list to spc4r25 (no change to r26)
+ - sg_inq: update version descriptor list to spc4r27
+ - extended inquiry vpd page add extended self test
+ completion minutes field
+ - sg_lib: sync asc/ascq list to spc4r27
- dStrHex(): trim excess trailing spaces
- sg_read_long: add --readonly option (open() is rw)
- sg_raw: add --readonly option (open() is rw)
- - relax restriction on bidirectional commands
+ - allow bidirectional commands
- sg_vpd: rdac vendor page [0xc8] parse corrections
+ - extended inquiry vpd page add extended self test
+ completion minutes field
- sg_ses: expand --date (in) buffer to 2048 bytes
- sg_opcodes: add extended parameter data for TMFs (spc4r26)
- sg_dd: clean count calculation, document nocache flag
- treat bsg devices as implicit sg_io
- sg_write_same: if READ CAPACITY(16) fails try 10 byte variant
+ - anticipate approval of proposal to allow UNMAP and ANCHOR
+ bits to be set on WRITE SAME(10)
- sg3_utils man page: sections added for OS device names
Changelog for sg3_utils-1.29 [20100406] [svn: r334]
diff --git a/README b/README
index 1f8d7081..0b40574e 100644
--- a/README
+++ b/README
@@ -345,4 +345,4 @@ See http://sg.danny.cz/sg/tools.html
Doug Gilbert
-13th September 2010
+25th October 2010
diff --git a/debian/changelog b/debian/changelog
index 2e94886c..5fc15c63 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,7 +2,7 @@ sg3-utils (1.30-0.1) unstable; urgency=low
* New upstream version
- -- Doug Gilbert <dgilbert@interlog.com> Mon, 13 Sep 2010 11:00:00 -0400
+ -- Doug Gilbert <dgilbert@interlog.com> Mon, 25 Oct 2010 12:00:00 -0400
sg3-utils (1.29-0.1) unstable; urgency=low
diff --git a/doc/sg_unmap.8 b/doc/sg_unmap.8
index be0b546d..941b13c1 100644
--- a/doc/sg_unmap.8
+++ b/doc/sg_unmap.8
@@ -1,4 +1,4 @@
-.TH SG_UNMAP "8" "March 2010" "sg3_utils\-1.29" SG3_UTILS
+.TH SG_UNMAP "8" "October 2010" "sg3_utils\-1.30" SG3_UTILS
.SH NAME
sg_unmap \- sends a SCSI UNMAP command
.SH SYNOPSIS
@@ -13,9 +13,9 @@ Send a SCSI UNMAP command to \fIDEVICE\fR to unmap one or more logical
blocks. This command was introduced in SBC\-3 revision 18 under the broad
heading of "logical block provisioning" or more specifically "thin
provisioning".
-Logical blocks may also be unmapped by the SCSI WRITE SAME (16 and 32
-byte cdbs); see sg_write_same. The unmap capability is closely related to
-the ATA DATA SET MANAGEMENT command with the "Trim" bit set.
+Logical blocks may also be unmapped by the SCSI WRITE SAME command; see
+sg_write_same. The unmap capability is closely related to the ATA DATA SET
+MANAGEMENT command with the "Trim" bit set.
.PP
Logical blocks to be unmapped can be specified in one of two ways to this
utility. One way is by supplying the (start) LBAs to the '\-\-lba=' option
diff --git a/doc/sg_write_same.8 b/doc/sg_write_same.8
index 775805bf..70b97585 100644
--- a/doc/sg_write_same.8
+++ b/doc/sg_write_same.8
@@ -1,4 +1,4 @@
-.TH SG_WRITE_SAME "8" "June 2010" "sg3_utils\-1.30" SG3_UTILS
+.TH SG_WRITE_SAME "8" "October 2010" "sg3_utils\-1.30" SG3_UTILS
.SH NAME
sg_write_same \- send the SCSI WRITE SAME command
.SH SYNOPSIS
@@ -24,8 +24,12 @@ set to 0xff. If READ CAPACITY(16) fails then READ CAPACITY(10) is
used to determine the block size.
.PP
By default WRITE SAME(10) is sent unless \fILBA\fR (plus \fINUM\fR)
-exceeds 32 bits, \fINUM\fR exceeds 65535 or the \fI\-\-unmap\fR option is
-given. In these cases WRITE SAME(16) is sent.
+exceeds 32 bits or \fINUM\fR exceeds 65535. In these cases WRIT
+SAME(16) is sent.
+.PP
+As of SBC\-3 revision 24 the UNMAP and ANCHOR bits are not supported by
+WRITE SAME (10). However there is a proposal to allow that case and
+this utility now allows those bits to be set for WRITE SAME (10).
.PP
.B Take care:
The WRITE SAME(10, 16 and 32) commands interpret a \fINUM\fR of zero
@@ -57,8 +61,7 @@ the absence of this option and the \fI\-\-16\fR option) is to send a SCSI
WRITE SAME (10) command.
.TP
\fB\-a\fR, \fB\-\-anchor\fR
-sets the 'Anchor' bit in the cdb. Ignored by WRITE SAME(10). Introduced in
-sbc3r22.
+sets the ANCHOR bit in the cdb. Introduced in SBC\-3 revision 22.
.TP
\fB\-g\fR, \fB\-\-grpnum\fR=\fIGN\fR
sets the 'Group number' field to \fIGN\fR. Defaults to a value of zero.
@@ -102,10 +105,8 @@ where \fITO\fR is the command timeout value in seconds. The default value is
considerably more time than 60 seconds to complete.
.TP
\fB\-U\fR, \fB\-\-unmap\fR
-sets the UNMAP bit in the WRITE SAME(16 and 32) cdb. When this option is
-given the default command becomes WRITE SAME(16) since the WRITE SAME(10)
-command does not offer this bit (in SBC\-3 draft revision 19). See UNMAP
-section below.
+sets the UNMAP bit in the WRITE SAME(10, 16 and 32) cdb. See UNMAP section
+below.
.TP
\fB\-v\fR, \fB\-\-verbose\fR
increase the degree of verbosity (debug messages).
@@ -126,7 +127,7 @@ data out buffer length. If both this option and the \fIIF\fR option are
given and \fILEN\fR exceeds the length of the \fIIF\fR file then \fILEN\fR
is the data out buffer length with zeroes used as pad bytes.
.SH UNMAP
-Thin provisioning is the sophisticated term used in SBC\-3 revision 19
+Thin provisioning is the complicated term used in SBC\-3 revision 19
for the ability to mark blocks as unused. It is closely related to the
ATA DATA SET MANAGEMENT command with the "Trim" bit set. For large
storage arrays, it is a way to provision less physical storage than the
@@ -145,16 +146,15 @@ response also contains a TPRZ bit which if set means that if unmapped
blocks are read then zeroes will be returned for the data (and if
protection information is active, 0xff bytes are returned for that).
.PP
-In the cases of WRITE SAME(16) and WRITE SAME(32) when the Unmap bit is
-set in the cdb then the data out buffer is also sent. Additionally the
-data section of that data out buffer should be full of 0x0 bytes while
-the data protection block, 8 bytes at the end if present, should be set
-to 0xff bytes. If these conditions are not met and the TPRZ bit is set
-then the Unmap bit is ignored and the data out buffer is written to
-the \fIDEVICE\fR as if the Unmap bit was zero. In the absence of the
-\fI\-\-in=IF\fR option, this utility will attempt build a data out
-buffer that meets the requirements for the Unmap bit in the cdb to be
-acted on by the \fIDEVICE\fR.
+When the UNMAP bit is set in the cdb then the data out buffer is also sent.
+Additionally the data section of that data out buffer should be full of 0x0
+bytes while the data protection block, 8 bytes at the end if present, should
+be set to 0xff bytes. If these conditions are not met and the TPRZ bit is
+set then the UNMAP bit is ignored and the data out buffer is written to the
+\fIDEVICE\fR as if the UNMAP bit was zero. In the absence of the
+\fI\-\-in=IF\fR option, this utility will attempt build a data out buffer
+that meets the requirements for the UNMAP bit in the cdb to be acted on by
+the \fIDEVICE\fR.
.PP
Logical blocks may also be unmapped by the SCSI UNMAP and FORMAT UNIT
commands (see the sg_unmap and sg_format utilities). Support for
diff --git a/lib/sg_lib_data.c b/lib/sg_lib_data.c
index abbf3555..d26979a6 100644
--- a/lib/sg_lib_data.c
+++ b/lib/sg_lib_data.c
@@ -15,7 +15,7 @@
#endif
-const char * sg_lib_version_str = "1.61 20100625"; /* spc-4 rev 25 */
+const char * sg_lib_version_str = "1.62 20101011"; /* spc-4 rev 27 */
struct sg_lib_value_name_t sg_lib_normal_opcodes[] = {
{0, 0, "Test Unit Ready"},
@@ -469,6 +469,7 @@ struct sg_lib_asc_ascq_t sg_lib_asc_ascq[] =
{0x10,0x01,"Logical block guard check failed"},
{0x10,0x02,"Logical block application tag check failed"},
{0x10,0x03,"Logical block reference tag check failed"},
+ {0x10,0x04,"Logical block protection error on recover buffered data"},
{0x11,0x00,"Unrecovered read error"},
{0x11,0x01,"Read retries exhausted"},
{0x11,0x02,"Error too long to correct"},
@@ -639,6 +640,7 @@ struct sg_lib_asc_ascq_t sg_lib_asc_ascq[] =
{0x2C,0x09,"Previous reservation conflict status"},
{0x2C,0x0A,"Partition or collection contains user objects"},
{0x2C,0x0B,"Not reserved"},
+ {0x2C,0x0C,"ORWRITE generation does not match"},
{0x2D,0x00,"Overwrite error on update in place"},
{0x2E,0x00,"Insufficient time for operation"},
{0x2F,0x00,"Commands cleared by another initiator"},
@@ -1059,12 +1061,12 @@ const char * sg_lib_pdt_strs[] = {
"processor", /* often SAF-TE (seldom scanner) device */
"write once optical disk",
/* 5 */ "cd/dvd",
- "scanner",
+ "scanner", /* obsolete */
"optical memory device",
"medium changer",
- "communications",
- /* 0xa */ "graphics [0xa]",
- "graphics [0xb]",
+ "communications", /* obsolete */
+ /* 0xa */ "graphics [0xa]", /* obsolete */
+ "graphics [0xb]", /* obsolete */
"storage array controller",
"enclosure services device",
"simplified direct access device",
diff --git a/sg3_utils.spec b/sg3_utils.spec
index 01b2ee19..5fad3e48 100644
--- a/sg3_utils.spec
+++ b/sg3_utils.spec
@@ -79,7 +79,7 @@ fi
%{_libdir}/*.la
%changelog
-* Mon Sep 13 2010 - dgilbert at interlog dot com
+* Mon Oct 25 2010 - dgilbert at interlog dot com
- add sg_referrals; track t10 changes
* sg3_utils-1.30
diff --git a/src/sg_inq.c b/src/sg_inq.c
index c7c95f84..6e4f069d 100644
--- a/src/sg_inq.c
+++ b/src/sg_inq.c
@@ -66,7 +66,7 @@
* information [MAINTENANCE IN, service action = 0xc]; see sg_opcodes.
*/
-static char * version_str = "0.92 20100913"; /* SPC-4 rev 26 */
+static char * version_str = "0.94 20101027"; /* SPC-4 rev 27 */
#define VPD_SUPPORTED_VPDS 0x0
@@ -1292,6 +1292,8 @@ decode_x_inq_vpd(unsigned char * buff, int len, int do_hex)
!!(buff[7] & 0x10), !!(buff[7] & 0x1), !!(buff[8] & 0x1),
!!(buff[8] & 0x10));
printf(" Multi I_T nexus microcode download=%d\n", buff[9] & 0xf);
+ printf(" Extended self-test completion minutes=%d\n",
+ (buff[10] << 8) + buff[11]); /* spc4r27 */
}
/* VPD_SOFTW_INF_ID */
@@ -1816,7 +1818,10 @@ process_std_inq(int sg_fd, const struct opts_t * optsp)
"qualifier [%d]\n", pqual);
}
len = rsp_buff[4] + 5;
- ansi_version = rsp_buff[2] & 0x7;
+ /* N.B. rsp_buff[2] full byte is 'version' in SPC-2,3,4 but in SPC
+ * [spc-r11a (1997)] bits 6,7: ISO/IEC version; bits 3-5: ECMA
+ * version; bits 0-2: SCSI version */
+ ansi_version = rsp_buff[2] & 0x7; /* Only take SCSI version */
peri_type = rsp_buff[0] & 0x1f;
if ((len > SAFE_STD_INQ_RESP_LEN) && (len < 256) &&
(0 == optsp->resp_len)) {
diff --git a/src/sg_inq_data.c b/src/sg_inq_data.c
index 4788b5f9..113a901d 100644
--- a/src/sg_inq_data.c
+++ b/src/sg_inq_data.c
@@ -23,13 +23,13 @@
const char * sg_ansi_version_arr[] =
{
"no conformance claimed",
- "SCSI-1",
- "SCSI-2",
- "SPC",
+ "SCSI-1", /* obsolete */
+ "SCSI-2", /* obsolete */
+ "SPC", /* withdrawn */
"SPC-2",
"SPC-3",
"SPC-4",
- "ANSI version: 7",
+ "reserved [7h]",
};
@@ -39,7 +39,7 @@ struct sg_version_descriptor {
const char * name;
};
-/* table from SPC-4 revision 26 [sorted numerically (from Annex D.8)] */
+/* table from SPC-4 revision 27 [sorted numerically (from Annex D.8)] */
/* Can also be obtained from : http://www.t10.org/lists/stds.txt */
struct sg_version_descriptor sg_version_descriptor_arr[] = {
{0x0, "Version Descriptor not supported or No standard identified"},
@@ -174,6 +174,7 @@ struct sg_version_descriptor sg_version_descriptor_arr[] = {
{0x462, "SPC-4 T10/1731-D revision 18"},
{0x463, "SPC-4 T10/1731-D revision 23"},
{0x480, "SMC-3 (no version claimed)"},
+ {0x482, "SMC-3 T10/1730-D revision 15"},
{0x4a0, "ADC-2 (no version claimed)"},
{0x4a7, "ADC-2 T10/1741-D revision 7"},
{0x4aa, "ADC-2 T10/1741-D revision 8"},
@@ -290,6 +291,8 @@ struct sg_version_descriptor sg_version_descriptor_arr[] = {
{0xc2a, "SAS-2 ANSI INCITS 457-2010"},
{0xc40, "SAS-2.1 (no version claimed)"},
{0xc48, "SAS-2.1 T10/2125-D revision 04"},
+ {0xc4a, "SAS-2.1 T10/2125-D revision 06"},
+ {0xc60, "SAS-3 (no version claimed)"},
{0xd20, "FC-PH (no version claimed)"},
{0xd3b, "FC-PH ANSI INCITS 230-1994"},
{0xd3c, "FC-PH ANSI INCITS 230-1994 with Amnd 1 ANSI INCITS "
@@ -346,6 +349,7 @@ struct sg_version_descriptor sg_version_descriptor_arr[] = {
{0xf20, "FC-PI-5 (no version claimed)"},
{0xf27, "FC-PI-5 T11/2118-D revision 2.00"},
{0xf28, "FC-PI-5 T11/2118-D revision 3.00"},
+ {0xf2a, "FC-PI-5 T11/2118-D revision 6.00"},
{0xf40, "FC-PI-6 (no version claimed)"},
{0x12a0, "FC-SCM (no version claimed)"},
{0x12a3, "FC-SCM T11/1824DT revision 1.0"},
@@ -394,6 +398,7 @@ struct sg_version_descriptor sg_version_descriptor_arr[] = {
{0x1740, "UAS (no version claimed)"}, /* USB attached SCSI */
{0x1743, "UAS T10/2095-D revision 02"},
{0x1747, "UAS T10/2095-D revision 04"},
+ {0x1780, "UAS-2 (no version claimed)"},
{0x1ea0, "SAT (no version claimed)"},
{0x1ea7, "SAT T10/1711-D rev 8"},
{0x1eab, "SAT T10/1711-D rev 9"},
@@ -405,6 +410,7 @@ struct sg_version_descriptor sg_version_descriptor_arr[] = {
{0x20a0, "SPL (no version claimed)"},
{0x20a3, "SPL T10/2124-D revision 6a"},
{0x20a5, "SPL T10/2124-D revision 7"},
+ {0x20c0, "SPL-2 (no version claimed)"},
{0xffc0, "IEEE 1667 (no version claimed)"},
{0xffc1, "IEEE 1667-2006"},
{0xffc2, "IEEE 1667-2009"},
diff --git a/src/sg_vpd.c b/src/sg_vpd.c
index 63a56ee1..3ec264a3 100644
--- a/src/sg_vpd.c
+++ b/src/sg_vpd.c
@@ -30,7 +30,7 @@
*/
-static char * version_str = "0.44 20100913"; /* spc4r26 + sbc3r24 */
+static char * version_str = "0.45 20101011"; /* spc4r27 + sbc3r24 */
extern void svpd_enumerate_vendor(void);
extern int svpd_decode_vendor(int sg_fd, int num_vpd, int subvalue,
@@ -1090,6 +1090,8 @@ decode_x_inq_vpd(unsigned char * buff, int len, int do_hex)
!!(buff[7] & 0x10), !!(buff[7] & 0x1),
!!(buff[8] & 0x10), !!(buff[8] & 0x1));
printf(" Multi I_T nexus microcode download=%d\n", buff[9] & 0xf);
+ printf(" Extended self-test completion minutes=%d\n",
+ (buff[10] << 8) + buff[11]); /* spc4r27 */
}
/* VPD_SOFTW_INF_ID */
diff --git a/src/sg_write_same.c b/src/sg_write_same.c
index 324bf05b..3c235f47 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 char * version_str = "0.96 20100629";
+static char * version_str = "0.97 20101025";
#define ME "sg_write_same: "
@@ -144,8 +144,7 @@ do_write_same(int sg_fd, const struct opts_t * optsp, const void * dataoutp,
cdb_len = optsp->pref_cdb_size;
if (WRITE_SAME10_LEN == cdb_len) {
llba = optsp->lba + optsp->numblocks;
- if ((optsp->numblocks > 0xffff) || (llba > ULONG_MAX) ||
- optsp->unmap) {
+ if ((optsp->numblocks > 0xffff) || (llba > ULONG_MAX)) {
cdb_len = WRITE_SAME16_LEN;
if (optsp->verbose)
fprintf(stderr, "do_write_same: use WRITE SAME(16) instead "
@@ -159,6 +158,12 @@ do_write_same(int sg_fd, const struct opts_t * optsp, const void * dataoutp,
case WRITE_SAME10_LEN:
wsCmdBlk[0] = WRITE_SAME10_OP;
wsCmdBlk[1] = ((optsp->wrprotect & 0x7) << 5);
+ /* ANCHOR + UNMAP not allowed for WRITE_SAME10 in sbc3r24 but a
+ * proposal has been made to allow it. Anticipate approval. */
+ if (optsp->anchor)
+ wsCmdBlk[1] |= 0x10;
+ if (optsp->unmap)
+ wsCmdBlk[1] |= 0x8;
if (optsp->pbdata)
wsCmdBlk[1] |= 0x4;
if (optsp->lbdata)