aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--doc/sg3_utils.82
-rw-r--r--doc/sg_logs.88
-rw-r--r--doc/sg_reassign.84
-rw-r--r--examples/sdiag_sas_p0_prbs9.txt12
-rw-r--r--examples/sdiag_sas_p1_prbs15.txt12
-rw-r--r--lib/sg_lib_data.c2
-rw-r--r--src/sg_logs.c8
-rw-r--r--src/sg_reassign.c8
-rw-r--r--testing/sg_chk_asc.c9
-rw-r--r--testing/sg_iovec_tst.c2
-rw-r--r--testing/sg_tst_bidi.c13
-rw-r--r--testing/sg_tst_ioctl.c14
-rw-r--r--testing/sgh_dd.cpp20
-rw-r--r--testing/uapi_sg.h5
15 files changed, 90 insertions, 38 deletions
diff --git a/ChangeLog b/ChangeLog
index a75f4b81..a6a6d94b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,7 +2,7 @@ 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.45 [20190929] [svn: r833]
+Changelog for sg3_utils-1.45 [20191027] [svn: r834]
- sg_get_elem_status: new utility [sbc4r16]
- sg_ses: bug: --page= being overridden when --control
and --data= also given; fix
@@ -33,6 +33,11 @@ Changelog for sg3_utils-1.45 [20190929] [svn: r833]
statistics lpage (sbc4r17)
- zoned block device statistics log page: shorten
counter fields from 8 to 4 bytes (zbc2r02)
+ - change '-ll' option to suppress subpages=0xff
+ apart from page 0x0,0xff. Used three times:
+ list all pages and subpages names reported
+ - sg_reassign: for defect list format 6 (vendor
+ specfic) don't try to decode
- zbc: preparatory work for Zoned domains and
realms; add new zbc service actions [19-032r3]
- inhex directory: new, contains ASCII hex files
@@ -45,6 +50,7 @@ Changelog for sg3_utils-1.45 [20190929] [svn: r833]
- add sg_f2hex_arr()
- update some tables for NVMe 1.4
- sg_get_num()+sg_get_llnum(): add 'e' decoding,
+ - asc/ascq match asc-num.txt @t10 20191014
exabytes; allow addition (e.g. --count=3+1k)
- sg_pt_freebsd: fixes for FreeBSD 12.0 release
- scripts: update 54-before-scsi-sg3_id.rules,
@@ -60,6 +66,7 @@ Changelog for sg3_utils-1.45 [20190929] [svn: r833]
- testing/sg_tst_bidi: for sg 4.0 driver
- testing/sgh_dd: test request sharing, mreqs...
- testing/sgs_dd: back from archive, for testing
+ - testing/sg_chk_asc: allow LF and CR/LF in asc-num.txt
- testing: 'make' now builds both C and C++ programs
SIGPOLL (SIGIO) and realtime (RT) signals
- sg_pt: add sg_get_opcode_translation() to replace
diff --git a/doc/sg3_utils.8 b/doc/sg3_utils.8
index 54eeaa74..c60e7804 100644
--- a/doc/sg3_utils.8
+++ b/doc/sg3_utils.8
@@ -1,4 +1,4 @@
-.TH SG3_UTILS "8" "September 2019" "sg3_utils\-1.45" SG3_UTILS
+.TH SG3_UTILS "8" "October 2019" "sg3_utils\-1.45" SG3_UTILS
.SH NAME
sg3_utils \- a package of utilities for sending SCSI commands
.SH SYNOPSIS
diff --git a/doc/sg_logs.8 b/doc/sg_logs.8
index 29316d01..0158363e 100644
--- a/doc/sg_logs.8
+++ b/doc/sg_logs.8
@@ -1,4 +1,4 @@
-.TH SG_LOGS "8" "February 2019" "sg3_utils\-1.45" SG3_UTILS
+.TH SG_LOGS "8" "October 2019" "sg3_utils\-1.45" SG3_UTILS
.SH NAME
sg_logs \- access log pages with SCSI LOG SENSE command
.SH SYNOPSIS
@@ -161,7 +161,11 @@ treated as binary.
lists the names of all logs sense pages supported by this device. This is
done by reading the "supported log pages" log page. When used
twice (e.g. '\-ll') lists the names of all logs sense pages and subpages
-supported by this device. There is a list of common log page codes below.
+supported by this device, excluding pages whose subpage number is
+0xff (apart from page 0x0,0xff). When used three times then all supported
+pages and subpages reported by the device are list. So the page/subpage
+names and not thrie content is shown with this option. There is a list of
+common log page codes below.
.TP
\fB\-m\fR, \fB\-\-maxlen\fR=\fILEN\fR
sets the "allocation length" field in the LOG SENSE cdb. The is the maximum
diff --git a/doc/sg_reassign.8 b/doc/sg_reassign.8
index ecacc7fe..3ad0f8a0 100644
--- a/doc/sg_reassign.8
+++ b/doc/sg_reassign.8
@@ -1,4 +1,4 @@
-.TH SG_REASSIGN "8" "October 2017" "sg3_utils\-1.43" SG3_UTILS
+.TH SG_REASSIGN "8" "October 2019" "sg3_utils\-1.45" SG3_UTILS
.SH NAME
sg_reassign \- send SCSI REASSIGN BLOCKS command
.SH SYNOPSIS
@@ -142,7 +142,7 @@ Written by Douglas Gilbert.
.SH "REPORTING BUGS"
Report bugs to <dgilbert at interlog dot com>.
.SH COPYRIGHT
-Copyright \(co 2005\-2017 Douglas Gilbert
+Copyright \(co 2005\-2019 Douglas Gilbert
.br
This software is distributed under a FreeBSD license. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
diff --git a/examples/sdiag_sas_p0_prbs9.txt b/examples/sdiag_sas_p0_prbs9.txt
new file mode 100644
index 00000000..1b96f99d
--- /dev/null
+++ b/examples/sdiag_sas_p0_prbs9.txt
@@ -0,0 +1,12 @@
+# This is the hex for a SAS protocol specific diagnostic
+# page. It will attempt to put phy identifier 0 of the
+# given device into PRBS9 (jitter pattern) generation mode.
+# Physical transmission speed is 22.5 Gbps
+# N.B. This will turn the receiver off on phy id 0.
+#
+# Usage example: 'sg_senddiag --pf --raw=- /dev/sg2 < {this_file}'
+#
+3f,6,0,1c,0,1,3,c,
+0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0
diff --git a/examples/sdiag_sas_p1_prbs15.txt b/examples/sdiag_sas_p1_prbs15.txt
new file mode 100644
index 00000000..1248ab3a
--- /dev/null
+++ b/examples/sdiag_sas_p1_prbs15.txt
@@ -0,0 +1,12 @@
+# This is the hex for a SAS protocol specific diagnostic
+# page. It will attempt to put phy identifier 1 of the
+# given device into PRBS15 (jitter pattern) generation mode.
+# Physical transmission speed is 22.5 Gbps
+# N.B. This will turn the receiver off on phy id 1.
+#
+# Usage example: 'sg_senddiag --pf --raw=- /dev/sg2 < {this_file}'
+#
+3f,6,0,1c,1,1,4,c,
+0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0
diff --git a/lib/sg_lib_data.c b/lib/sg_lib_data.c
index d75168f0..21689d55 100644
--- a/lib/sg_lib_data.c
+++ b/lib/sg_lib_data.c
@@ -632,7 +632,7 @@ struct sg_lib_value_name_t sg_lib_read_attr_arr[] = {
/* A conveniently formatted list of SCSI ASC/ASCQ codes and their
* corresponding text can be found at: www.t10.org/lists/asc-num.txt
- * The following should match asc-num.txt dated 20150423 */
+ * The following should match asc-num.txt dated 20191014 */
#ifdef SG_SCSI_STRINGS
struct sg_lib_asc_ascq_range_t sg_lib_asc_ascq_range[] =
diff --git a/src/sg_logs.c b/src/sg_logs.c
index c23a62e5..92db53d7 100644
--- a/src/sg_logs.c
+++ b/src/sg_logs.c
@@ -36,7 +36,7 @@
#include "sg_unaligned.h"
#include "sg_pr2serr.h"
-static const char * version_str = "1.78 20190913"; /* spc5r22 + sbc4r17 */
+static const char * version_str = "1.79 20191001"; /* spc5r22 + sbc4r17 */
#define MX_ALLOC_LEN (0xfffc)
#define SHORT_RESP_LEN 128
@@ -528,6 +528,10 @@ usage(int hval)
" --in=FN|-i FN FN is a filename containing a log page "
"in ASCII hex\n"
" or binary if --raw also given.\n"
+ " --list|-l list supported log pages; twice: list log "
+ "pages and\n"
+ " subpages (exclude 0xff subpages); thrice: "
+ "all pg+spgs\n"
" --page=PG|-p PG PG is either log page acronym, PGN or "
"PGN,SPGN\n"
" where (S)PGN is a (sub) page number\n");
@@ -1540,6 +1544,8 @@ show_supported_pgs_sub_page(const uint8_t * resp, int len,
for (k = 0; k < num; k += 2) {
pg_code = bp[k];
subpg_code = bp[k + 1];
+ if ((op->do_list == 2) && (subpg_code == 0xff) && (pg_code > 0))
+ continue;
if (NOT_SPG_SUBPG == subpg_code)
snprintf(b, sizeof(b) - 1, " 0x%02x ", pg_code);
else
diff --git a/src/sg_reassign.c b/src/sg_reassign.c
index f522ed70..173b2481 100644
--- a/src/sg_reassign.c
+++ b/src/sg_reassign.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005-2018 Douglas Gilbert.
+ * Copyright (c) 2005-2019 Douglas Gilbert.
* All rights reserved.
* Use of this source code is governed by a BSD-style
* license that can be found in the BSD_LICENSE file.
@@ -39,7 +39,7 @@
* vendor specific data is written.
*/
-static const char * version_str = "1.26 20180523";
+static const char * version_str = "1.27 20191001";
#define DEF_DEFECT_LIST_FORMAT 4 /* bytes from index */
@@ -469,6 +469,10 @@ main(int argc, char * argv[])
case 5: /* physical sector */
div = 8;
break;
+ case 6: /* vendor specific */
+ if (verbose)
+ pr2serr("defect list format: vendor specific\n");
+ break;
default:
pr2serr("defect list format %d unknown\n", dl_format);
break;
diff --git a/testing/sg_chk_asc.c b/testing/sg_chk_asc.c
index dd320fd5..a7844441 100644
--- a/testing/sg_chk_asc.c
+++ b/testing/sg_chk_asc.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018 Douglas Gilbert.
+ * Copyright (c) 2006-2019 Douglas Gilbert.
* All rights reserved.
* Use of this source code is governed by a BSD-style
* license that can be found in the BSD_LICENSE file.
@@ -27,7 +27,7 @@
* http://www.t10.org/lists/asc-num.txt
*/
-static const char * version_str = "1.07 20181207";
+static const char * version_str = "1.08 20191014";
#define MAX_LINE_LEN 1024
@@ -163,10 +163,9 @@ printf("\"%s\",\n", b);
strncpy(b , line + offset, sizeof(b) - 1);
b[sizeof(b) - 1] = '\0';
num = strlen(b);
- if (0xd == b[num - 2]) {
+ if (0xd == b[num - 2])
b[num - 2] = '\0';
- b[num - 1] = '\0';
- }
+ b[num - 1] = '\0';
num = strlen(b);
for (j = 0; j < num; ++j)
b[j] = toupper(b[j]);
diff --git a/testing/sg_iovec_tst.c b/testing/sg_iovec_tst.c
index b066e8b0..f95dc67f 100644
--- a/testing/sg_iovec_tst.c
+++ b/testing/sg_iovec_tst.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003-2018 D. Gilbert
+ * Copyright (C) 2003-2019 D. Gilbert
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
diff --git a/testing/sg_tst_bidi.c b/testing/sg_tst_bidi.c
index d2a4ccfb..2fbb98ce 100644
--- a/testing/sg_tst_bidi.c
+++ b/testing/sg_tst_bidi.c
@@ -53,7 +53,7 @@
is implemented by the scsi_debug driver is used. */
-static const char * version_str = "Version: 1.05 20190501";
+static const char * version_str = "Version: 1.06 20191021";
#define INQ_REPLY_LEN 96
#define INQ_CMD_OP 0x12
@@ -265,8 +265,7 @@ main(int argc, char * argv[])
verbose += 1;
else if (0 == memcmp("-V", argv[k], 2)) {
printf("%s\n", version_str);
- file_name = 0;
- break;
+ return 0;
} else if (0 == memcmp("-w", argv[k], 2))
disable_write = false;
else if (*argv[k] == '-') {
@@ -378,7 +377,7 @@ rep_sg_io:
cat = sg_err_category_new(rio_v4.device_status,
rio_v4.transport_status,
rio_v4.driver_status,
- (const uint8_t *)(unsigned long)rio_v4.response,
+ (const uint8_t *)(unsigned long)rio_v4.response,
rio_v4.response_len);
switch (cat) {
case SG_LIB_CAT_CLEAN:
@@ -392,7 +391,7 @@ rep_sg_io:
sg_linux_sense_print(NULL, rio_v4.device_status,
rio_v4.transport_status,
rio_v4.driver_status,
- (const uint8_t *)(unsigned long)rio_v4.response,
+ (const uint8_t *)(unsigned long)rio_v4.response,
rio_v4.response_len, true);
break;
}
@@ -546,7 +545,7 @@ rep_async:
cat = sg_err_category_new(rio_v4.device_status,
rio_v4.transport_status,
rio_v4.driver_status,
- (const uint8_t *)(unsigned long)rio_v4.response,
+ (const uint8_t *)(unsigned long)rio_v4.response,
rio_v4.response_len);
switch (cat) {
case SG_LIB_CAT_CLEAN:
@@ -560,7 +559,7 @@ rep_async:
sg_linux_sense_print(NULL, rio_v4.device_status,
rio_v4.transport_status,
rio_v4.driver_status,
- (const uint8_t *)(unsigned long)rio_v4.response,
+ (const uint8_t *)(unsigned long)rio_v4.response,
rio_v4.response_len, true);
break;
}
diff --git a/testing/sg_tst_ioctl.c b/testing/sg_tst_ioctl.c
index f5ef9fbb..65b7c49d 100644
--- a/testing/sg_tst_ioctl.c
+++ b/testing/sg_tst_ioctl.c
@@ -58,7 +58,7 @@
* later of the Linux sg driver. */
-static const char * version_str = "Version: 1.11 20190523";
+static const char * version_str = "Version: 1.13 20191021";
#define INQ_REPLY_LEN 128
#define INQ_CMD_LEN 6
@@ -392,24 +392,25 @@ tst_extended_ioctl(const char * fnp, int sg_fd, const char * fn2p, int sg_fd2,
memset(seip, 0, sizeof(*seip));
seip->sei_wr_mask |= SG_SEIM_READ_VAL;
seip->sei_rd_mask |= SG_SEIM_READ_VAL;
- seip->read_value = SG_SEIRV_FL_RQS;
+ seip->read_value = SG_SEIRV_INACT_RQS;
if (ioctl(sg_fd, SG_SET_GET_EXTENDED, seip) < 0) {
pr2serr("ioctl(SG_SET_GET_EXTENDED) failed, errno=%d %s\n", errno,
strerror(errno));
return 1;
}
- printf(" %sread_value[SG_SEIRV_FL_RQS]= %u\n", cp, seip->read_value);
+ printf(" %sread_value[SG_SEIRV_INACT_RQS]= %u\n", cp, seip->read_value);
memset(seip, 0, sizeof(*seip));
seip->sei_wr_mask |= SG_SEIM_READ_VAL;
seip->sei_rd_mask |= SG_SEIM_READ_VAL;
- seip->read_value = SG_SEIRV_DEV_FL_RQS;
+ seip->read_value = SG_SEIRV_DEV_INACT_RQS;
if (ioctl(sg_fd, SG_SET_GET_EXTENDED, seip) < 0) {
pr2serr("ioctl(SG_SET_GET_EXTENDED) failed, errno=%d %s\n", errno,
strerror(errno));
return 1;
}
- printf(" %sread_value[SG_SEIRV_DEV_FL_RQS]= %u\n", cp, seip->read_value);
+ printf(" %sread_value[SG_SEIRV_DEV_INACT_RQS]= %u\n", cp,
+ seip->read_value);
memset(seip, 0, sizeof(*seip));
seip->sei_wr_mask |= SG_SEIM_READ_VAL;
@@ -751,8 +752,7 @@ main(int argc, char * argv[])
verbose += 1;
else if (0 == memcmp("-V", argv[k], 2)) {
printf("%s\n", version_str);
- file_name = 0;
- break;
+ return 0;
} else if (0 == memcmp("-w", argv[k], 2))
write_only = true;
else if (*argv[k] == '-') {
diff --git a/testing/sgh_dd.cpp b/testing/sgh_dd.cpp
index f13efa09..fddc2f4a 100644
--- a/testing/sgh_dd.cpp
+++ b/testing/sgh_dd.cpp
@@ -108,7 +108,7 @@
using namespace std;
-static const char * version_str = "1.49 20190929";
+static const char * version_str = "1.51 20191010";
#ifdef __GNUC__
#ifndef __clang__
@@ -576,8 +576,10 @@ v4hdr_out_lk(const char * leadin, const sg_io_v4 * h4p, int id)
pr2serr(" response_len=%d driver/transport/device_status="
"0x%x/0x%x/0x%x\n", h4p->response_len, h4p->driver_status,
h4p->transport_status, h4p->device_status);
- pr2serr(" info=0x%x din_resid=%u dout_resid=%u spare_out=%u\n",
- h4p->info, h4p->din_resid, h4p->dout_resid, h4p->spare_out);
+ pr2serr(" info=0x%x din_resid=%u dout_resid=%u spare_out=%u "
+ "dur=%u\n",
+ h4p->info, h4p->din_resid, h4p->dout_resid, h4p->spare_out,
+ h4p->duration);
pthread_mutex_unlock(&strerr_mut);
}
@@ -1782,11 +1784,15 @@ sg_wr_swap_share(Rq_elem * rep, int to_fd, bool before)
{
bool not_first = false;
int err = 0;
+ int k;
int master_fd = rep->infd; /* in (READ) side is master */
Gbl_coll * clp = rep->clp;
struct sg_extended_info sei;
struct sg_extended_info * seip = &sei;
+ if (rep->clp->debug > 2)
+ pr2serr_lk("%s: tid=%d: to_fd=%d, before=%d\n", __func__, rep->id,
+ to_fd, (int)before);
memset(seip, 0, sizeof(*seip));
seip->sei_wr_mask |= SG_SEIM_CHG_SHARE_FD;
seip->sei_rd_mask |= SG_SEIM_CHG_SHARE_FD;
@@ -1798,11 +1804,13 @@ sg_wr_swap_share(Rq_elem * rep, int to_fd, bool before)
seip->ctl_flags_wr_mask |= SG_CTL_FLAGM_MASTER_FINI;
seip->ctl_flags &= SG_CTL_FLAGM_MASTER_FINI;/* would be 0 anyway */
}
- while ((ioctl(master_fd, SG_SET_GET_EXTENDED, seip) < 0) &&
- (EBUSY == errno)) {
+ for (k = 0; (ioctl(master_fd, SG_SET_GET_EXTENDED, seip) < 0) &&
+ (EBUSY == errno); ++k) {
err = errno;
+ if (k > 10000)
+ break;
if (! not_first) {
- if (clp->debug > 9)
+ if (clp->debug > 3)
pr2serr_lk("tid=%d: ioctl(EXTENDED(change_shared_fd=%d), "
"failed errno=%d %s\n", rep->id, master_fd, err,
strerror(err));
diff --git a/testing/uapi_sg.h b/testing/uapi_sg.h
index 8bf5b7aa..5adee693 100644
--- a/testing/uapi_sg.h
+++ b/testing/uapi_sg.h
@@ -216,10 +216,11 @@ typedef struct sg_req_info { /* used by SG_GET_REQUEST_TABLE ioctl() */
#define SG_SEIRV_INT_MASK 0x0 /* get SG_SEIM_ALL_BITS */
#define SG_SEIRV_BOOL_MASK 0x1 /* get SG_CTL_FLAGM_ALL_BITS */
#define SG_SEIRV_VERS_NUM 0x2 /* get driver version number as int */
-#define SG_SEIRV_FL_RQS 0x3 /* number of requests in free list */
-#define SG_SEIRV_DEV_FL_RQS 0x4 /* sum(fl rqs) on all dev's fds */
+#define SG_SEIRV_INACT_RQS 0x3 /* number of inactive requests */
+#define SG_SEIRV_DEV_INACT_RQS 0x4 /* sum(inactive rqs) on owning dev */
#define SG_SEIRV_SUBMITTED 0x5 /* number of mrqs submitted+unread */
#define SG_SEIRV_DEV_SUBMITTED 0x6 /* sum(submitted) on all dev's fds */
+#define SG_SEIRV_MAX_RSV_REQS 0x7 /* maximum reserve requests */
/*
* A pointer to the following structure is passed as the third argument to