aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2021-08-31 21:15:38 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2021-08-31 21:15:38 +0000
commit7144ac65deef1369c1c754c2e561c813878ab046 (patch)
tree22ce45fa81c96651d7e3e32a426e516d882493b6
parentd4485d5b472462f2ee34bb18f1cef77d2c883b8e (diff)
downloadsg3_utils-7144ac65deef1369c1c754c2e561c813878ab046.tar.gz
sg_get_elem_status: fix issue with '--maxlen=' option, add 2 depopulation revocation health attributes [sbc5r01]
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@911 6180dd3e-e324-4e3e-922d-17de1ae2f315
-rw-r--r--ChangeLog4
-rw-r--r--doc/sg_get_elem_status.82
-rw-r--r--lib/sg_io_linux.c7
-rw-r--r--lib/sg_pt_linux.c19
-rw-r--r--src/sg_get_elem_status.c10
5 files changed, 20 insertions, 22 deletions
diff --git a/ChangeLog b/ChangeLog
index a1c8ce01..13617ad2 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 pre-release sg3_utils-1.47 [20210830] [svn: r910]
+Changelog for pre-release sg3_utils-1.47 [20210831] [svn: r911]
- transport error handling improved. To fix report of a
BAD_TARGET transport error but the utility still continued.
- introduce SG_LIB_TRANSPORT_ERROR [35] exit status
@@ -18,6 +18,8 @@ Changelog for pre-release sg3_utils-1.47 [20210830] [svn: r910]
- sg_dd, sgm_dd, sgp_dd: don't close negative file descriptors
- sg_dd: don't use srand48_r() and mrand48_r() as they are
GNU extensions. Use the non-reentrant versions instead
+ - sg_get_elem_status: fix issue with '--maxlen=' option
+ - add 2 depopulation revocation health attributes [sbc5r01]
- several utilities: override '--maxlen=LEN' when LEN
is < 16 (or 4), take default (or 4) instead
- sg_lib: add sg_scsi_status_is_good(),
diff --git a/doc/sg_get_elem_status.8 b/doc/sg_get_elem_status.8
index 27d9b2b5..d00c9ec7 100644
--- a/doc/sg_get_elem_status.8
+++ b/doc/sg_get_elem_status.8
@@ -1,4 +1,4 @@
-.TH SG_GET_ELEM_STATUS "8" "June 2021" "sg3_utils\-1.47" SG3_UTILS
+.TH SG_GET_ELEM_STATUS "8" "August 2021" "sg3_utils\-1.47" SG3_UTILS
.SH NAME
sg_get_elem_status \- send SCSI GET PHYSICAL ELEMENT STATUS command
.SH SYNOPSIS
diff --git a/lib/sg_io_linux.c b/lib/sg_io_linux.c
index 9bd4b7eb..968f5e7a 100644
--- a/lib/sg_io_linux.c
+++ b/lib/sg_io_linux.c
@@ -24,7 +24,7 @@
#include "sg_pr2serr.h"
-/* Version 1.12 20210830 */
+/* Version 1.13 20210831 */
void
@@ -87,11 +87,6 @@ sg_print_driver_status(int driver_status)
driv = driver_status & SG_LIB_DRIVER_MASK;
if (driv < (int)SG_ARRAY_SIZE(linux_driver_bytes))
driv_cp = linux_driver_bytes[driv];
-#if 0
- sugg = (driver_status & SG_LIB_SUGGEST_MASK) >> 4;
- if (sugg < (int)SG_ARRAY_SIZE(linux_driver_suggests))
- sugg_cp = linux_driver_suggests[sugg];
-#endif
pr2ws("Driver_status=0x%02x", driver_status);
pr2ws(" [%s] ", driv_cp);
}
diff --git a/lib/sg_pt_linux.c b/lib/sg_pt_linux.c
index c6fb9755..c65c5f94 100644
--- a/lib/sg_pt_linux.c
+++ b/lib/sg_pt_linux.c
@@ -71,7 +71,7 @@ static const char * linux_host_bytes[] = {
"DID_NEXUS_FAILURE (reservation conflict)",
"DID_ALLOC_FAILURE",
"DID_MEDIUM_ERROR",
- "DID_TRANSPORT_MARGINAL", /*0x14 */
+ "DID_TRANSPORT_MARGINAL", /*0x14 */
};
/* These where made obsolete around lk 5.12.0 . Only DRIVER_SENSE [0x8] is
@@ -956,16 +956,13 @@ get_scsi_pt_transport_err_str(const struct sg_pt_base * vp, int max_b_len,
return b;
}
cp += n;
- driv = ds & SG_LIB_DRIVER_MASK;
- if (driv < (int)SG_ARRAY_SIZE(linux_driver_bytes))
- driv_cp = linux_driver_bytes[driv];
-#if 0
- sugg = (ds & SG_LIB_SUGGEST_MASK) >> 4;
- if (sugg < SG_ARRAY_SIZE(linux_driver_suggests)
- sugg_cp = linux_driver_suggests[sugg];
-#endif
- n = snprintf(cp, m, "Driver_status=0x%02x [%s]\n", ds, driv_cp);
- m -= n;
+ if (ds) {
+ driv = ds & SG_LIB_DRIVER_MASK;
+ if (driv < (int)SG_ARRAY_SIZE(linux_driver_bytes))
+ driv_cp = linux_driver_bytes[driv];
+ n = snprintf(cp, m, "Driver_status=0x%02x [%s]\n", ds, driv_cp);
+ m -= n;
+ }
if (m < 1)
b[max_b_len - 1] = '\0';
return b;
diff --git a/src/sg_get_elem_status.c b/src/sg_get_elem_status.c
index 94f1813e..61533c7b 100644
--- a/src/sg_get_elem_status.c
+++ b/src/sg_get_elem_status.c
@@ -37,7 +37,7 @@
* given SCSI device.
*/
-static const char * version_str = "1.05 20210830"; /* sbc4r19 */
+static const char * version_str = "1.06 20210831"; /* sbc5r01 */
#ifndef UINT32_MAX
@@ -295,7 +295,7 @@ main(int argc, char * argv[])
}
if (0 == maxlen)
maxlen = DEF_GPES_BUFF_LEN;
- else if (n < MIN_MAXLEN) {
+ else if (maxlen < MIN_MAXLEN) {
pr2serr("Warning: --maxlen=LEN less than %d ignored\n",
MIN_MAXLEN);
maxlen = DEF_GPES_BUFF_LEN;
@@ -550,8 +550,12 @@ start_response:
printf("at manufacturer's specification limits <%d>", j);
else if (j < 0xd0)
printf("outside manufacturer's specification limits <%d>", j);
- else if (j < 0xfd)
+ else if (j < 0xfb)
printf("reserved [0x%x]", j);
+ else if (0xfb == j)
+ printf("depopulation revocation completed, errors detected");
+ else if (0xfc == j)
+ printf("depopulation revocation in progress");
else if (0xfd == j)
printf("depopulation completed, errors detected");
else if (0xfe == j)