Skip to content

Commit 5fb69fa

Browse files
committed
sg_read_buffer: add READ BUFFER(16) support (spc5r02); sync asc/ascq codes with T10 20150103
git-svn-id: svn://localhost/trunk@626 6180dd3e-e324-4e3e-922d-17de1ae2f315
1 parent b871c0a commit 5fb69fa

File tree

8 files changed

+317
-95
lines changed

8 files changed

+317
-95
lines changed

COVERAGE

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ READ(10) sg_dd, sgm_dd, sgp_dd, sg_read
4343
READ(12) sg_dd, sgm_dd, sgp_dd, sg_read
4444
READ(16) sg_dd, sgm_dd, sgp_dd, sg_read
4545
READ BLOCK LIMITS sg_read_block_limits, ++
46-
READ BUFFER sg_rbuf, sg_test_rwbuf, sg_read_buffer, sg_safte, ++
46+
READ BUFFER(10) sg_rbuf, sg_test_rwbuf, sg_read_buffer, sg_safte, ++
47+
READ BUFFER(16) sg_read_buffer
4748
READ CAPACITY(10) sg_readcap, sg_dd, sgm_dd, sgp_dd, sg_format, ++
4849
READ CAPACITY(16) sg_readcap, sg_dd, sgm_dd, sgp_dd, sg_format, ++
4950
READ DEFECT(10) sginfo('-d' or '-G'), sg_reassign('-g'), smartmontools, ++
@@ -128,4 +129,4 @@ THIRD PARTY COPY IN (0x83).
128129

129130

130131
Douglas Gilbert
131-
18th December 2014
132+
7th January 2015

ChangeLog

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ Each utility has its own version number, date of last change and
22
some description at the top of its ".c" file. All utilities in the main
33
directory have their own "man" pages. There is also a sg3_utils man page.
44

5-
Changelog for sg3_utils-1.41 [20141230] [svn: r625]
5+
Changelog for sg3_utils-1.41 [20150105] [svn: r626]
66
- sg_zone: new utility for open, close and finish
77
zone commands introduced in zbc-r02
88
- sg_rep_zones and sg_reset_wp: change opcodes as
99
indicated in zbc-r02
10+
- sg_read_buffer: add READ BUFFER(16) support (spc5r02)
1011
- sg_logs: add --enumerate and acronyms
1112
- allow decode from hex or binary in file
1213
- sg_lib interface: add sg_lib_pdt_decay(), TPROTO_PCIE
@@ -25,7 +26,7 @@ Changelog for sg3_utils-1.41 [20141230] [svn: r625]
2526
- additional element status dpage: add PCIe/NVMe
2627
- rescan-scsi-bus.sh: add --issue-lip-wait option and
2728
improve error handling
28-
- sg_lib_data: sync asc/ascq codes with T10 20141224
29+
- sg_lib_data: sync asc/ascq codes with T10 20150103
2930

3031
Changelog for sg3_utils-1.40 [20141110] [svn: r620]
3132
- sg_write_verify: new utility for WRITE AND VERIFY

doc/sg_write_same.8

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH SG_WRITE_SAME "8" "August 2014" "sg3_utils\-1.40" SG3_UTILS
1+
.TH SG_WRITE_SAME "8" "January 2015" "sg3_utils\-1.41" SG3_UTILS
22
.SH NAME
33
sg_write_same \- send SCSI WRITE SAME command
44
.SH SYNOPSIS
@@ -210,12 +210,12 @@ Various numeric arguments (e.g. \fILBA\fR) may include multiplicative
210210
suffixes or be given in hexadecimal. See the "NUMERIC ARGUMENTS" section
211211
in the sg3_utils(8) man page.
212212
.PP
213-
In Linux at this time the sg driver does not support cdb sizes greater than
214-
16 bytes. [This restriction will be removed in lk 3.17 .] Hence a device
215-
node like /dev/sg1 which is associated with the sg driver will fail with
216-
this utility if the \fI\-\-32\fR option is given (or implied by other
217-
options). The bsg driver with device nodes like /dev/bsg/6:0:0:1 does
218-
support cdb sizes greater than 16 bytes.
213+
In Linux, prior to lk 3.17, the sg driver did not support cdb sizes greater
214+
than 16 bytes. Hence a device node like /dev/sg1 which is associated with
215+
the sg driver would fail with this utility if the \fI\-\-32\fR option was
216+
given (or implied by other options). The bsg driver with device nodes like
217+
/dev/bsg/6:0:0:1 does support cdb sizes greater than 16 bytes since its
218+
introduction in lk 2.6.28 .
219219
.SH EXIT STATUS
220220
The exit status of sg_write_same is 0 when it is successful. Otherwise see
221221
the sg3_utils(8) man page.
@@ -307,7 +307,7 @@ Written by Douglas Gilbert.
307307
.SH "REPORTING BUGS"
308308
Report bugs to <dgilbert at interlog dot com>.
309309
.SH COPYRIGHT
310-
Copyright \(co 2009\-2014 Douglas Gilbert
310+
Copyright \(co 2009\-2015 Douglas Gilbert
311311
.br
312312
This software is distributed under a FreeBSD license. There is NO
313313
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

lib/sg_lib.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1469,12 +1469,12 @@ sg_get_category_sense_str(int sense_cat, int buff_len, char * buff,
14691469
break;
14701470
case SG_LIB_CAT_OTHER: /* 99 */
14711471
n = snprintf(buff, buff_len, "Some other error/warning has occurred");
1472-
if (verbose && (n < (buff_len - 1)))
1472+
if ((0 == verbose) && (n < (buff_len - 1)))
14731473
snprintf(buff + n, buff_len - n, ", possible transport of driver "
14741474
"issue");
14751475
default:
14761476
n = snprintf(buff, buff_len, "Sense category: %d", sense_cat);
1477-
if (verbose && (n < (buff_len - 1)))
1477+
if ((0 == verbose) && (n < (buff_len - 1)))
14781478
snprintf(buff + n, buff_len - n, ", try '-v' option for more "
14791479
"information");
14801480
break;

lib/sg_lib_data.c

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2007-2014 Douglas Gilbert.
2+
* Copyright (c) 2007-2015 Douglas Gilbert.
33
* All rights reserved.
44
* Use of this source code is governed by a BSD-style
55
* license that can be found in the BSD_LICENSE file.
@@ -17,7 +17,7 @@
1717
#endif
1818

1919

20-
const char * sg_lib_version_str = "2.10 20141225"; /* spc5r00a, sbc4r02 */
20+
const char * sg_lib_version_str = "2.11 20150115"; /* spc5r02, sbc4r02 */
2121

2222

2323
/* indexed by pdt; those that map to own index do not decay */
@@ -105,7 +105,7 @@ struct sg_lib_value_name_t sg_lib_normal_opcodes[] = {
105105
{0x39, 0, "Compare"}, /* obsolete in SPC-4 r11 */
106106
{0x3a, 0, "Copy and verify"}, /* obsolete in SPC-4 r11 */
107107
{0x3b, 0, "Write buffer"},
108-
{0x3c, 0, "Read buffer"},
108+
{0x3c, 0, "Read buffer(10)"},
109109
{0x3d, 0, "Update block"},
110110
{0x3e, 0, "Read long(10)"}, /* SBC-3 r31 recommends Read long(16) */
111111
{0x3f, 0, "Write long(10)"}, /* SBC-3 r31 recommends Write long(16) */
@@ -170,8 +170,9 @@ struct sg_lib_value_name_t sg_lib_normal_opcodes[] = {
170170
{0x92, PDT_TAPE, "Locate(16)"},
171171
{0x93, 0, "Write same(16)"},
172172
{0x93, PDT_TAPE, "Erase(16)"},
173-
{0x94, PDT_ZBC, "Zoning out"}, /* new sbc4r04, has service actions */
174-
{0x95, PDT_ZBC, "Zoning in"}, /* new sbc4r04, has service actions */
173+
{0x94, PDT_ZBC, "ZBC out"}, /* new sbc4r04, has service actions */
174+
{0x95, PDT_ZBC, "ZBC in"}, /* new sbc4r04, has service actions */
175+
{0x9b, 0, "Read buffer(16)"}, /* added spc5r02 */
175176
{0x9c, 0, "Write atomic(16)"},
176177
{0x9d, 0, "Service action bidirectional"}, /* added spc4r35 */
177178
{0x9e, 0, "Service action in(16)"},
@@ -549,7 +550,7 @@ struct sg_lib_value_name_t sg_lib_zoning_in_arr[] = {
549550

550551
/* A conveniently formatted list of SCSI ASC/ASCQ codes and their
551552
* corresponding text can be found at: www.t10.org/lists/asc-num.txt
552-
* The following should match asc-num.txt dated 20141224 */
553+
* The following should match asc-num.txt dated 20150103 */
553554

554555
#ifdef SG_SCSI_STRINGS
555556
struct sg_lib_asc_ascq_range_t sg_lib_asc_ascq_range[] =
@@ -662,6 +663,14 @@ struct sg_lib_asc_ascq_t sg_lib_asc_ascq[] =
662663
{0x0B,0x07,"Warning - degraded power to non-volatile cache"},
663664
{0x0B,0x08,"Warning - power loss expected"},
664665
{0x0B,0x09,"Warning - device statistics notification active"},
666+
{0x0B,0x0A,"Warning - high critical temperature limit exceeded"},
667+
{0x0B,0x0B,"Warning - low critical temperature limit exceeded"},
668+
{0x0B,0x0C,"Warning - high operating temperature limit exceeded"},
669+
{0x0B,0x0D,"Warning - low operating temperature limit exceeded"},
670+
{0x0B,0x0E,"Warning - high critical humidity limit exceeded"},
671+
{0x0B,0x0F,"Warning - low critical humidity limit exceeded"},
672+
{0x0B,0x10,"Warning - high operating humidity limit exceeded"},
673+
{0x0B,0x11,"Warning - low operating humidity limit exceeded"},
665674
{0x0C,0x00,"Write error"},
666675
{0x0C,0x01,"Write error - recovered with auto reallocation"},
667676
{0x0C,0x02,"Write error - auto reallocation failed"},
@@ -830,6 +839,7 @@ struct sg_lib_asc_ascq_t sg_lib_asc_ascq[] =
830839
{0x26,0x10,"Data decryption key fail limit reached"},
831840
{0x26,0x11,"Incomplete key-associated data set"},
832841
{0x26,0x12,"Vendor specific key reference not found"},
842+
{0x26,0x13,"Application tag mode page is invalid"},
833843
{0x27,0x00,"Write protected"},
834844
{0x27,0x01,"Hardware write protected"},
835845
{0x27,0x02,"Logical unit software write protected"},

0 commit comments

Comments
 (0)