From 7144ac65deef1369c1c754c2e561c813878ab046 Mon Sep 17 00:00:00 2001 From: Douglas Gilbert Date: Tue, 31 Aug 2021 21:15:38 +0000 Subject: 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 --- lib/sg_io_linux.c | 7 +------ lib/sg_pt_linux.c | 19 ++++++++----------- 2 files changed, 9 insertions(+), 17 deletions(-) (limited to 'lib') 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; -- cgit v1.2.3