aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--doc/sg_logs.82
-rw-r--r--doc/sg_read_attr.810
-rw-r--r--scripts/Makefile.am3
-rw-r--r--scripts/Makefile.in3
-rw-r--r--src/sg_inq.c6
-rw-r--r--src/sg_logs.c163
-rw-r--r--src/sg_read_attr.c7
-rw-r--r--src/sg_vpd.c10
9 files changed, 182 insertions, 30 deletions
diff --git a/ChangeLog b/ChangeLog
index cb216ed7..a9a4da86 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.43 [20170925] [svn: r717]
+Changelog for sg3_utils-1.43 [20171001] [svn: r718]
- sg_bg_ctl: new Background control command (sbc4r08)
- sg_write_atomic: new 16 and 32 byte cdbs (sbc4r04)
- also can issue plain WRITE(16 or 32)
@@ -31,6 +31,8 @@ Changelog for sg3_utils-1.43 [20170925] [svn: r717]
Service buffer information lpages for tape
- add min+max 'mounted' temperature and rel. humidity
fields to Environmental reporting lpage (spc5r10)
+ - add last n Inquiry/Mode_page data changed log
+ pages (spc5r17)
- add zoned block device statistics lpage (zbc2r?,
16-264r4)
- fixup enumeration in power condition transition
@@ -43,6 +45,8 @@ Changelog for sg3_utils-1.43 [20170925] [svn: r717]
add extra info about corner cases
- add --force option to bypass checking supported
vpd pages page and fetch requested page directly
+ - add maximum inquiry|mode_page change logs fields
+ to extended inquiry vpd page (spc5r17)
- sg_vpd: 3 party copy VPD page improvements
- improve handling of unknown pages
- sg_reassign+sg_write_same: fix ULONG_MAX problem
@@ -80,6 +84,8 @@ Changelog for sg3_utils-1.43 [20170925] [svn: r717]
- sg_sat_identify: expand to take --len=32
- rescan-scsi-bus.sh: harden code
- fixes from Suse; bump version to: 20160511
+ - add to install list in Makefile, hope it does
+ not clash with other package providing it
- 55-scsi-sg3_id.rules: fixes from Suse
- https://github.com/hreinecke/sg3_utils
branch sles15 synced 20170914
diff --git a/doc/sg_logs.8 b/doc/sg_logs.8
index 639c741e..c6f17a10 100644
--- a/doc/sg_logs.8
+++ b/doc/sg_logs.8
@@ -1,4 +1,4 @@
-.TH SG_LOGS "8" "September 2017" "sg3_utils\-1.43" SG3_UTILS
+.TH SG_LOGS "8" "October 2017" "sg3_utils\-1.43" SG3_UTILS
.SH NAME
sg_logs \- access log pages with SCSI LOG SENSE command
.SH SYNOPSIS
diff --git a/doc/sg_read_attr.8 b/doc/sg_read_attr.8
index 153ae221..191a8d82 100644
--- a/doc/sg_read_attr.8
+++ b/doc/sg_read_attr.8
@@ -1,4 +1,4 @@
-.TH SG_READ_ATTR "8" "February 2016" "sg3_utils\-1.42" SG3_UTILS
+.TH SG_READ_ATTR "8" "September 2017" "sg3_utils\-1.43" SG3_UTILS
.SH NAME
sg_read_attr \- send SCSI READ ATTRIBUTE command
.SH SYNOPSIS
@@ -12,8 +12,10 @@ sg_read_attr \- send SCSI READ ATTRIBUTE command
.\" Add any additional description here
.PP
Sends a SCSI READ ATTRIBUTE command to \fIDEVICE\fR and outputs the data
-returned. This command is found in the SPC\-5 draft standard, revision
-8 (spc5r08.pdf).
+returned. This command was introduced in SPC\-3 revision 1 and thus is
+applicable to all SCSI devices. In practice it is used mainly for tape
+systems. This utility is based on the SPC\-5 draft standard, revision
+17 (spc5r17.pdf).
.SH OPTIONS
Arguments to long options are mandatory for short options as well.
.TP
@@ -204,7 +206,7 @@ Written by Douglas Gilbert.
.SH "REPORTING BUGS"
Report bugs to <dgilbert at interlog dot com>.
.SH COPYRIGHT
-Copyright \(co 2016 Douglas Gilbert
+Copyright \(co 2016\-2017 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/scripts/Makefile.am b/scripts/Makefile.am
index 529a4e3e..4fe4d145 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -1,2 +1,3 @@
bin_SCRIPTS = scsi_logging_level scsi_mandat scsi_readcap scsi_ready \
- scsi_satl scsi_start scsi_stop scsi_temperature
+ scsi_satl scsi_start scsi_stop scsi_temperature \
+ rescan-scsi-bus.sh
diff --git a/scripts/Makefile.in b/scripts/Makefile.in
index e0ad947a..203a74b3 100644
--- a/scripts/Makefile.in
+++ b/scripts/Makefile.in
@@ -270,7 +270,8 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
bin_SCRIPTS = scsi_logging_level scsi_mandat scsi_readcap scsi_ready \
- scsi_satl scsi_start scsi_stop scsi_temperature
+ scsi_satl scsi_start scsi_stop scsi_temperature \
+ rescan-scsi-bus.sh
all: all-am
diff --git a/src/sg_inq.c b/src/sg_inq.c
index 62b3c7df..f8d26684 100644
--- a/src/sg_inq.c
+++ b/src/sg_inq.c
@@ -43,7 +43,7 @@
#include "sg_unaligned.h"
#include "sg_pr2serr.h"
-static const char * version_str = "1.66 20170917"; /* SPC-5 rev 14 */
+static const char * version_str = "1.67 20170926"; /* SPC-5 rev 17 */
/* INQUIRY notes:
* It is recommended that the initial allocation length given to a
@@ -2181,6 +2181,10 @@ decode_x_inq_vpd(unsigned char * buff, int len, int do_hex)
printf(" IBS=%d IAS=%d SAC=%d NRD1=%d NRD0=%d\n",
!!(buff[14] & 0x80), !!(buff[14] & 0x40), !!(buff[14] & 0x4),
!!(buff[14] & 0x2), !!(buff[14] & 0x1));
+ printf(" Maximum inquiry change logs=%u\n",
+ sg_get_unaligned_be16(buff + 15)); /* spc5r17 */
+ printf(" Maximum mode page change logs=%u\n",
+ sg_get_unaligned_be16(buff + 17)); /* spc5r17 */
}
/* VPD_SOFTW_INF_ID [0x84] */
diff --git a/src/sg_logs.c b/src/sg_logs.c
index 3666d4c8..8360e0f6 100644
--- a/src/sg_logs.c
+++ b/src/sg_logs.c
@@ -31,7 +31,7 @@
#include "sg_unaligned.h"
#include "sg_pr2serr.h"
-static const char * version_str = "1.50 20170917"; /* spc5r11 + sbc4r11 */
+static const char * version_str = "1.51 20171001"; /* spc5r17 + sbc4r11 */
#define MX_ALLOC_LEN (0xfffc)
#define SHORT_RESP_LEN 128
@@ -59,18 +59,18 @@ static const char * version_str = "1.50 20170917"; /* spc5r11 + sbc4r11 */
#define PCT_LPAGE 0x1a
#define TAPE_ALERT_LPAGE 0x2e
#define IE_LPAGE 0x2f
-#define NOT_SPG_SUBPG 0x0
-#define SUPP_SPGS_SUBPG 0xff
-#define LOW_GRP_STATS_SUBPG 0x1
-#define PENDING_DEFECTS_SUBPG 0x1
-#define BACKGROUND_OP_SUBPG 0x2
-#define HIGH_GRP_STATS_SUBPG 0x1f
-#define CACHE_STATS_SUBPG 0x20
-#define ENV_REPORTING_SUBPG 0x1
-#define UTILIZATION_SUBPG 0x1
-#define ENV_LIMITS_SUBPG 0x2
-#define LPS_MISALIGNMENT_SUBPG 0x3
-#define ZONED_BLOCK_DEV_STATS_SUBPG 0x1
+#define NOT_SPG_SUBPG 0x0 /* page: any */
+#define SUPP_SPGS_SUBPG 0xff /* page: any */
+#define PENDING_DEFECTS_SUBPG 0x1 /* page 0x15 */
+#define BACKGROUND_OP_SUBPG 0x2 /* page 0x15 */
+#define CACHE_STATS_SUBPG 0x20 /* page 0x19 */
+#define ENV_REPORTING_SUBPG 0x1 /* page 0xd */
+#define UTILIZATION_SUBPG 0x1 /* page 0xe */
+#define ENV_LIMITS_SUBPG 0x2 /* page 0xd */
+#define LPS_MISALIGNMENT_SUBPG 0x3 /* page 0x15 */
+#define ZONED_BLOCK_DEV_STATS_SUBPG 0x1 /* page 0x14 */
+#define LAST_N_INQUIRY_DATA_CH_SUBPG 0x1 /* page 0xb */
+#define LAST_N_MODE_PG_DATA_CH_SUBPG 0x2 /* page 0xb */
/* Vendor product identifiers followed by associated mask values */
#define VP_NONE (-1)
@@ -214,6 +214,10 @@ static bool show_format_status_page(const uint8_t * resp, int len,
const struct opts_t * op);
static bool show_last_n_deferred_error_page(const uint8_t * resp, int len,
const struct opts_t * op);
+static bool show_last_n_inq_data_ch_page(const uint8_t * resp, int len,
+ const struct opts_t * op);
+static bool show_last_n_mode_pg_data_ch_page(const uint8_t * resp, int len,
+ const struct opts_t * op);
static bool show_lb_provisioning_page(const uint8_t * resp, int len,
const struct opts_t * op);
static bool show_sequential_access_page(const uint8_t * resp, int len,
@@ -315,6 +319,12 @@ static struct log_elem log_arr[] = {
show_format_status_page}, /* 0x8, 0x0 SBC */
{LAST_N_DEFERRED_LPAGE, 0, 0, -1, 0, "Last n deferred error", "lnd",
show_last_n_deferred_error_page}, /* 0xb, 0x0 */
+ {LAST_N_DEFERRED_LPAGE, LAST_N_INQUIRY_DATA_CH_SUBPG, 0, -1, 0,
+ "Last n inquiry data changed", "lnic",
+ show_last_n_inq_data_ch_page}, /* 0xb, 0x1 */
+ {LAST_N_DEFERRED_LPAGE, LAST_N_MODE_PG_DATA_CH_SUBPG, 0, -1, 0,
+ "Last n mode page data changed", "lnmc",
+ show_last_n_mode_pg_data_ch_page}, /* 0xb, 0x2 */
{LB_PROV_LPAGE, 0, 0, 0, 0, "Logical block provisioning", "lbp",
show_lb_provisioning_page}, /* 0xc, 0x0 SBC */
{0xc, 0, 0, PDT_TAPE, 0, "Sequential access device", "sad",
@@ -556,10 +566,10 @@ usage(int hval)
"0)\n"
" --version|-V output version string then exit\n\n"
"If DEVICE and --select are given, a LOG SELECT command will be "
- "issued. If\nDEVICE is not given and '--in=FN' is given then FN "
- "will decoded as if it\nwere a log page. The contents of FN "
- "typically generated by a prior\n"
- "'sg_logs -HHH ...' invocation.\nPages defined in SPC are common "
+ "issued.\nIf DEVICE is not given and '--in=FN' is given then FN "
+ "will decoded as if\nit were a log page. The contents of FN "
+ "generated by either a prior\n'sg_logs -HHH ...' invocation or "
+ "by a text editor.\nLog pages defined in SPC are common "
"to all device types.\n");
}
}
@@ -2571,6 +2581,125 @@ show_last_n_deferred_error_page(const uint8_t * resp, int len,
return true;
}
+/* LAST_N_INQUIRY_DATA_CH_SUBPG [0xb,0x1] introduced: SPC-5 (rev 17) */
+static bool
+show_last_n_inq_data_ch_page(const uint8_t * resp, int len,
+ const struct opts_t * op)
+{
+ int j, num, pl, pc;
+ const uint8_t * bp;
+ char str[PCB_STR_LEN];
+
+ if (op->verbose || ((0 == op->do_raw) && (0 == op->do_hex)))
+ printf("Last n Inquiry data changed [0xb,0x1]\n");
+ num = len - 4;
+ bp = &resp[0] + 4;
+ while (num > 3) {
+ pc = sg_get_unaligned_be16(bp + 0);
+ pl = bp[3] + 4;
+ if (op->filter_given) {
+ if (pc != op->filter)
+ goto skip;
+ if (op->do_raw) {
+ dStrRaw((const char *)bp, pl);
+ break;
+ } else if (op->do_hex) {
+ dStrHex((const char *)bp, pl, ((1 == op->do_hex) ? 1 : -1));
+ break;
+ }
+ }
+ if (0 == pc) {
+ if (pl < 8) {
+ printf(" <<expect parameter 0x%x to be at least 8 bytes "
+ "long, got %d, skip>>\n", pc, pl);
+ goto skip;
+ }
+ printf(" Generation number of Inquiry data changed indication: "
+ "%u\n", sg_get_unaligned_be32(bp + 4));
+ if (pl > 11)
+ printf(" Generation number of Mode page data changed "
+ "indication: %u\n", sg_get_unaligned_be32(bp + 8));
+ for (j = 12; j < pl; j +=4)
+ printf(" Generation number of indication [0x%x]: %u\n",
+ (j / 4), sg_get_unaligned_be32(bp + j));
+ } else {
+ printf(" Parameter code 0x%x, ", pc);
+ if (1 & *(bp + 4))
+ printf("VPD page 0x%x changed\n", *(bp + 5));
+ else
+ printf("Standard Inquiry data changed\n");
+ }
+ if (op->do_pcb)
+ printf(" <%s>\n", get_pcb_str(bp[2], str, sizeof(str)));
+ if (op->filter_given)
+ break;
+skip:
+ num -= pl;
+ bp += pl;
+ }
+ return true;
+}
+
+/* LAST_N_MODE_PG_DATA_CH_SUBPG [0xb,0x2] introduced: SPC-5 (rev 17) */
+static bool
+show_last_n_mode_pg_data_ch_page(const uint8_t * resp, int len,
+ const struct opts_t * op)
+{
+ int j, num, pl, pc;
+ const uint8_t * bp;
+ char str[PCB_STR_LEN];
+
+ if (op->verbose || ((0 == op->do_raw) && (0 == op->do_hex)))
+ printf("Last n Mode page data changed [0xb,0x2]\n");
+ num = len - 4;
+ bp = &resp[0] + 4;
+ while (num > 3) {
+ pc = sg_get_unaligned_be16(bp + 0);
+ pl = bp[3] + 4;
+ if (op->filter_given) {
+ if (pc != op->filter)
+ goto skip;
+ if (op->do_raw) {
+ dStrRaw((const char *)bp, pl);
+ break;
+ } else if (op->do_hex) {
+ dStrHex((const char *)bp, pl, ((1 == op->do_hex) ? 1 : -1));
+ break;
+ }
+ }
+ if (0 == pc) { /* Same as LAST_N_INQUIRY_DATA_CH_SUBPG [0xb,0x1] */
+ if (pl < 8) {
+ printf(" <<expect parameter 0x%x to be at least 8 bytes "
+ "long, got %d, skip>>\n", pc, pl);
+ goto skip;
+ }
+ printf(" Generation number of Inquiry data changed indication: "
+ "%u\n", sg_get_unaligned_be32(bp + 4));
+ if (pl > 11)
+ printf(" Generation number of Mode page data changed "
+ "indication: %u\n", sg_get_unaligned_be32(bp + 8));
+ for (j = 12; j < pl; j +=4)
+ printf(" Generation number of indication [0x%x]: %u\n",
+ (j / 4), sg_get_unaligned_be32(bp + j));
+ } else {
+ printf(" Parameter code 0x%x, ", pc);
+ if (0x40 & *(bp + 5)) /* SPF bit set */
+ printf("Mode page 0x%x,0%x changed\n", (0x3f & *(bp + 5)),
+ *(bp + 6));
+ else
+ printf("Mode page 0x%x changed\n", (0x3f & *(bp + 5)));
+ }
+ if (op->do_pcb)
+ printf(" <%s>\n", get_pcb_str(bp[2], str, sizeof(str)));
+ if (op->filter_given)
+ break;
+skip:
+ num -= pl;
+ bp += pl;
+ }
+ return true;
+}
+
static const char * self_test_code[] = {
"default", "background short", "background extended", "reserved",
"aborted background", "foreground short", "foreground extended",
diff --git a/src/sg_read_attr.c b/src/sg_read_attr.c
index 7f11be78..371b9031 100644
--- a/src/sg_read_attr.c
+++ b/src/sg_read_attr.c
@@ -34,7 +34,7 @@
* and decodes the response. Based on spc5r08.pdf
*/
-static const char * version_str = "1.03 20170917";
+static const char * version_str = "1.03 20170926";
#define MAX_RATTR_BUFF_LEN (1024 * 1024)
#define DEF_RATTR_BUFF_LEN (1024 * 8)
@@ -227,8 +227,9 @@ usage()
" --sa=SA|-s SA SA is service action (def: 0)\n"
" --verbose|-v increase verbosity\n"
" --version|-V print version string and exit\n\n"
- "Performs a SCSI READ ATTRIBUTE command. It is typically used "
- "on tape\nsystems.\n");
+ "Performs a SCSI READ ATTRIBUTE command. Even though it is "
+ "defined in\nSPC-3 and later it is typically used on tape "
+ "systems.\n");
}
/* Invokes a SCSI READ ATTRIBUTE command (SPC+SMC). Return of 0 -> success,
diff --git a/src/sg_vpd.c b/src/sg_vpd.c
index 5fcbb918..ddb6e199 100644
--- a/src/sg_vpd.c
+++ b/src/sg_vpd.c
@@ -37,7 +37,7 @@
*/
-static const char * version_str = "1.27 20170920"; /* spc5r16 + sbc4r14 */
+static const char * version_str = "1.28 20170926"; /* spc5r16 + sbc4r14 */
/* standard VPD pages, in ascending page number order */
#define VPD_SUPPORTED_VPDS 0x0
@@ -1327,6 +1327,10 @@ decode_x_inq_vpd(unsigned char * b, int len, int do_hex, int do_long,
printf(" SAC=%d\n", !!(b[14] & 0x4)); /* spc5r09 */
printf(" NRD1=%d\n", !!(b[14] & 0x2)); /* spc5r09 */
printf(" NRD0=%d\n", !!(b[14] & 0x1)); /* spc5r09 */
+ printf(" Maximum inquiry change logs=%u\n",
+ sg_get_unaligned_be16(b + 15)); /* spc5r17 */
+ printf(" Maximum mode page change logs=%u\n",
+ sg_get_unaligned_be16(b + 17)); /* spc5r17 */
return;
}
printf(" ACTIVATE_MICROCODE=%d SPT=%d GRD_CHK=%d APP_CHK=%d "
@@ -1353,6 +1357,10 @@ decode_x_inq_vpd(unsigned char * b, int len, int do_hex, int do_long,
printf(" IBS=%d IAS=%d SAC=%d NRD1=%d NRD0=%d\n", !!(b[14] & 0x80),
!!(b[14] & 0x40), !!(b[14] & 0x4), !!(b[14] & 0x2),
!!(b[14] & 0x1)); /* added in spc5r09 */
+ printf(" Maximum inquiry change logs=%u\n",
+ sg_get_unaligned_be16(b + 15)); /* spc5r17 */
+ printf(" Maximum mode page change logs=%u\n",
+ sg_get_unaligned_be16(b + 17)); /* spc5r17 */
}
/* VPD_SOFTW_INF_ID */