aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--doc/sg_luns.855
-rw-r--r--src/sg_inq.c2
-rw-r--r--src/sg_inq_data.c5
-rw-r--r--src/sg_logs.c19
-rw-r--r--src/sg_luns.c149
-rw-r--r--src/sg_ses.c35
7 files changed, 136 insertions, 136 deletions
diff --git a/ChangeLog b/ChangeLog
index 83c6c471..7b05af6c 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 [20160504] [svn: r701]
+Changelog for sg3_utils-1.43 [20160510] [svn: r702]
- sg_senddiag: add --timeout=SEC option
- sg_sanitize: add --timeout=SEC option
- sg_format: add --timeout=SEC option
@@ -10,13 +10,16 @@ Changelog for sg3_utils-1.43 [20160504] [svn: r701]
- sg_ses: handle 2 bit EIIOE field in aes dpage
- expand join handling of SAS connectors and others
- expand join debug code
+ - sg_luns: resync with drafts (sam6r02+spc5r10)
+ - remove undocumented test "W" format
+ - accept and output on request "quad dashed" format
- sg_logs: fix volume statistics lpage when subpage
is zero (ssc5r02a); decode mount history log parameter
- decode Requested recovery, TapeAlert response, and
Service buffer information lpages for tape
- add '--pdt=DT' option
- sg_inq: fix potential unbounded loop in --export
- - update version descriptor list to 20160420
+ - update version descriptor list to 20160510
- sg_inq+sg_vpd: update Extended inquiry data vpd
page (spc5r09)
- add --force option to bypass checking supported
diff --git a/doc/sg_luns.8 b/doc/sg_luns.8
index 4d14ca6e..d9a9aafe 100644
--- a/doc/sg_luns.8
+++ b/doc/sg_luns.8
@@ -1,4 +1,4 @@
-.TH SG_LUNS "8" "June" "sg3_utils\-1.39" SG3_UTILS
+.TH SG_LUNS "8" "May" "sg3_utils\-1.43" SG3_UTILS
.SH NAME
sg_luns \- send SCSI REPORT LUNS command or decode given LUN
.SH SYNOPSIS
@@ -9,7 +9,8 @@ sg_luns \- send SCSI REPORT LUNS command or decode given LUN
[\fI\-\-version\fR] \fIDEVICE\fR
.PP
.B sg_luns
-\fI\-\-test=ALUN\fR [\fI\-\-hex\fR] [\fI\-\-lu_cong\fR] [\fI\-\-verbose\fR]
+\fI\-\-test=ALUN\fR [\fI\-\-decode\fR] [\fI\-\-hex\fR] [\fI\-\-lu_cong\fR]
+[\fI\-\-verbose\fR]
.SH DESCRIPTION
.\" Add any additional description here
.PP
@@ -17,12 +18,14 @@ In the first form shown in the SYNOPSIS this utility sends the SCSI REPORT
LUNS command to the \fIDEVICE\fR and outputs the response. The response
should be a list of LUNs ("a LUN inventory") for the I_T nexus associated
with the \fIDEVICE\fR. Roughly speaking that is all LUNs that share the
-target device that the REPORT LUNS command is sent through. In the SPC\-3
-and SPC\-4 SCSI standards support for the REPORT LUNS command is mandatory.
+target device that the REPORT LUNS command is sent through. This command
+is defined in the SPC\-3 and SPC\-4 SCSI standards and its support is
+mandatory. The most recent draft if SPC\5 revision 9.
.PP
When the \fI\-\-test=ALUN\fR option is given (the second form in the
-SYNOPSIS), then the \fIALUN\fR value is decoded as outlined in SAM\-3,
-SAM\-4 and SAM\-5 (revision 13, section 4.7) .
+SYNOPSIS), then the \fIALUN\fR value is decoded as outlined in various
+SCSI Architecture Model (SAM) standards and recent drafts (e.g. SAM\-6
+revision 2, section 4.7) .
.PP
Where required below the first form shown in the SYNOPSIS is called "device
mode" and the second form is called "test mode".
@@ -32,6 +35,13 @@ Arguments to long options are mandatory for short options as well.
\fB\-d\fR, \fB\-\-decode\fR
decode LUNs into their component parts, as described in the LUN section
of SAM\-3, SAM\-4 and SAM\-5.
+.br
+[test mode] \fIALUN\fR is decoded irrespective of whether this option is
+given or not. If this option is given once then the given \fIALUN\fR is
+output in T10 preferred format (which is 8 pairs of hex digits, each
+separated by a space). If given twice then the given \fIALUN\fR is output
+in an alternate T10 format made up of four quads of hex digits with each
+quad separated by a "-" (e.g. C101-0000-0000-0000).
.TP
\fB\-h\fR, \fB\-\-help\fR
output the usage message then exit.
@@ -115,18 +125,22 @@ utility will accept any value between 0 and 255 (0xff) for \fISR\fR .
letter 'L' followed by a decimal number (see below). The hexadecimal number
can be up to 64 bits in size (i.e. 16 hexadecimal digits) and is padded to
the right if less than 16 hexadecimal digits are given (e.g.
-\fI\-\-test=0122003a\fR represents T10 LUN 0122003a00000000). \fIALUN\fR
-may be prefixed by '0x' or '0X' (e.g. the previous example could have been
-\fI\-\-test=0x0122003a\fR). \fIALUN\fR may also be given with spaces or
-tabs between each byte (or other grouping) but then \fIALUN\fR would need
-to be surrounded by single or double quotes.
-In the decimal number case (i.e. following a 'L') that number is assumed
-to be a Linux "word flipped" LUN which is converted into a T10 LUN
-representation and printed. In both cases the number is interpreted as a
-LUN and decoded as if the \fI\-\-decode\fR option had been given.
-Also when \fIALUN\fR is a hexadecimal number it can have a trailing 'L'
-in which case the corresponding Linux "word flipped" LUN value is output.
-The LUN is decoded in all cases.
+\fI\-\-test=0122003a\fR represents T10 LUN: 01 22 00 3a 00 00 00 00).
+\fIALUN\fR may be prefixed by '0x' or '0X' (e.g. the previous example could
+have been \fI\-\-test=0x0122003a\fR). \fIALUN\fR may also be given with
+spaces, tabs, or a '-' between each byte (or other grouping (e.g.
+c101-0000-0000-0000)). However in the case of space or tab separators the
+\fIALUN\fR would need to be surrounded by single or double quotes.
+.br
+In the leading 'L' case the, following decimal number (hex if preceded
+by '0x') is assumed to be a Linux "word flipped" LUN which is converted
+into a T10 LUN representation and printed. In both cases the number is
+interpreted as a LUN and decoded as if the \fI\-\-decode\fR option had been
+given. Also when \fIALUN\fR is a hexadecimal number it can have a
+trailing 'L' in which case the corresponding Linux "word flipped" LUN value
+is output. The LUN is decoded in all cases.
+.br
+The action when used with \fI\-\-decode\fR is explained under that option.
.TP
\fB\-v\fR, \fB\-\-verbose\fR
increase the level of verbosity, (i.e. debug output).
@@ -136,7 +150,8 @@ print the version string and then exit.
.SH NOTES
The SCSI REPORT LUNS command is important for Logical Unit (LU) discovery.
After a target device is discovered (usually via some transport specific
-mechanism), a REPORT LUNS command should either be sent to LUN 0 (which
+mechanism) and after sending an INQUIRY command (to determine the LU_CONG
+setting), a REPORT LUNS command should either be sent to LUN 0 (which
is Peripheral device addressing method with bus_id=0 and target/lun=0)
or to the REPORT LUNS well known LUN (i.e. 0xc101000000000000). SAM\-5
requires that one of these responds with an inventory of LUNS that are
@@ -296,7 +311,7 @@ Written by Douglas Gilbert.
.SH "REPORTING BUGS"
Report bugs to <dgilbert at interlog dot com>.
.SH COPYRIGHT
-Copyright \(co 2004\-2014 Douglas Gilbert
+Copyright \(co 2004\-2016 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/src/sg_inq.c b/src/sg_inq.c
index 05f4ee65..99e21953 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.61 20160428"; /* SPC-5 rev 09 */
+static const char * version_str = "1.62 20160510"; /* SPC-5 rev 10 */
/* INQUIRY notes:
* It is recommended that the initial allocation length given to a
diff --git a/src/sg_inq_data.c b/src/sg_inq_data.c
index 18e2d53c..c4e15133 100644
--- a/src/sg_inq_data.c
+++ b/src/sg_inq_data.c
@@ -48,8 +48,8 @@ struct sg_version_descriptor {
const char * name;
};
-/* table from SPC-5 revision 09 [sorted numerically (from Annex E.9)] */
-/* Can also be obtained from : http://www.t10.org/lists/stds.txt 20160402 */
+/* table from SPC-5 revision 10 [sorted numerically (from Annex E.9)] */
+/* Can also be obtained from : http://www.t10.org/lists/stds.txt 20160510 */
#ifdef SG_SCSI_STRINGS
@@ -514,6 +514,7 @@ struct sg_version_descriptor sg_version_descriptor_arr[] = {
{0x20e6, "SPL-3 T10/BSR INCITS 492 revision 7"},
{0x20e8, "SPL-3 ANSI INCITS 492-2015"},
{0x2100, "SPL-4 (no version claimed)"},
+ {0x2102, "SPL-4 T10/BSR INCITS 538 revision 08a"},
{0x21e0, "SOP (no version claimed)"},
{0x21e4, "SOP T10/BSR INCITS 489 revision 4"},
{0x21e6, "SOP T10/BSR INCITS 489 revision 5"},
diff --git a/src/sg_logs.c b/src/sg_logs.c
index 2c17695d..89cedd5a 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.42 20160329"; /* spc5r08 + sbc4r10 */
+static const char * version_str = "1.43 20160407"; /* spc5r08 + sbc4r10 */
#define MX_ALLOC_LEN (0xfffc)
#define SHORT_RESP_LEN 128
@@ -2548,18 +2548,20 @@ show_temperature_page(const uint8_t * resp, int len, const struct opts_t * op)
switch (pc) {
case 0:
if ((extra > 5) && (k > 5)) {
- if (bp[5] < 0xff)
- printf(" Current temperature = %d C", bp[5]);
+ if (0 == bp[5])
+ printf(" Current temperature = 0 C (or less)\n");
+ else if (bp[5] < 0xff)
+ printf(" Current temperature = %d C\n", bp[5]);
else
- printf(" Current temperature = <not available>");
+ printf(" Current temperature = <not available>\n");
}
break;
case 1:
if ((extra > 5) && (k > 5)) {
if (bp[5] < 0xff)
- printf(" Reference temperature = %d C", bp[5]);
+ printf(" Reference temperature = %d C\n", bp[5]);
else
- printf(" Reference temperature = <not available>");
+ printf(" Reference temperature = <not available>\n");
}
break;
default:
@@ -2573,9 +2575,8 @@ show_temperature_page(const uint8_t * resp, int len, const struct opts_t * op)
}
if (op->do_pcb) {
get_pcb_str(pcb, pcb_str, sizeof(pcb_str));
- printf("\n <%s>\n", pcb_str);
- } else
- printf("\n");
+ printf(" <%s>\n", pcb_str);
+ }
if (op->filter_given)
break;
}
diff --git a/src/sg_luns.c b/src/sg_luns.c
index 46a5bc81..84e7b244 100644
--- a/src/sg_luns.c
+++ b/src/sg_luns.c
@@ -9,6 +9,7 @@
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
+#include <stdbool.h>
#include <string.h>
#include <ctype.h>
#include <getopt.h>
@@ -30,7 +31,7 @@
* and decodes the response.
*/
-static const char * version_str = "1.31 20160419";
+static const char * version_str = "1.32 20160510";
#define MAX_RLUNS_BUFF_LEN (1024 * 1024)
#define DEF_RLUNS_BUFF_LEN (1024 * 8)
@@ -44,6 +45,7 @@ static struct option long_options[] = {
{"linux", no_argument, 0, 'l'},
#endif
{"lu_cong", no_argument, 0, 'L'},
+ {"lu-cong", no_argument, 0, 'L'},
{"maxlen", required_argument, 0, 'm'},
{"quiet", no_argument, 0, 'q'},
{"raw", no_argument, 0, 'r'},
@@ -74,7 +76,8 @@ usage()
" [--verbose] [--version] DEVICE\n");
#endif
pr2serr(" or\n"
- " sg_luns --test=ALUN [--hex] [--lu_cong] [--verbose]\n"
+ " sg_luns --test=ALUN [--decode] [--hex] [--lu_cong] "
+ "[--verbose]\n"
" where:\n"
" --decode|-d decode all luns into component parts\n"
" --help|-h print out usage message\n"
@@ -122,29 +125,27 @@ usage()
* defines its own "bridge addressing method" in place of the SAM-3
* "logical addressing method". */
static void
-decode_lun(const char * leadin, const unsigned char * lunp, int lu_cong,
+decode_lun(const char * leadin, const unsigned char * lunp, bool lu_cong,
int do_hex, int verbose)
{
- int k, j, x, a_method, bus_id, target, lun, len_fld, e_a_method;
- int next_level, lu_cong_admin;
- unsigned char not_spec[8] = {0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff};
+ int k, x, a_method, bus_id, target, lun, len_fld, e_a_method;
+ bool next_level, admin_lu_cong;
char l_leadin[128];
char b[256];
uint64_t ull;
- if (0 == memcmp(lunp, not_spec, sizeof(not_spec))) {
- printf("%sLogical unit not specified\n", leadin);
+ if (0xff == lunp[0]) {
+ printf("%sLogical unit _not_ specified\n", leadin);
return;
}
- lu_cong_admin = lu_cong;
+ admin_lu_cong = lu_cong;
memset(l_leadin, 0, sizeof(l_leadin));
for (k = 0; k < 4; ++k, lunp += 2) {
- next_level = 0;
+ next_level = false;
strncpy(l_leadin, leadin, sizeof(l_leadin) - 3);
if (k > 0) {
if (lu_cong) {
- lu_cong_admin = 0;
+ admin_lu_cong = false;
if ((0 == lunp[0]) && (0 == lunp[1])) {
printf("%s>>>> Administrative LU\n", l_leadin);
if (do_hex || verbose)
@@ -172,8 +173,8 @@ decode_lun(const char * leadin, const unsigned char * lunp, int lu_cong,
printf("%s0x%04x\n", b, x);
else
printf("%s%d\n", b, x);
- if (lu_cong_admin)
- next_level = 1;
+ if (admin_lu_cong)
+ next_level = true;
} else {
bus_id = lunp[0] & 0x3f;
snprintf(b, sizeof(b), "%sPeripheral device addressing: ",
@@ -192,7 +193,7 @@ decode_lun(const char * leadin, const unsigned char * lunp, int lu_cong,
(bus_id ? "target" : "lun"), lunp[1]);
}
if (bus_id)
- next_level = 1;
+ next_level = true;
}
break;
case 1: /* flat space addressing method */
@@ -264,12 +265,7 @@ decode_lun(const char * leadin, const unsigned char * lunp, int lu_cong,
printf("%sExtended flat space addressing: lun=%d\n",
l_leadin, x);
} else if ((2 == len_fld) && (2 == e_a_method)) {
- ull = 0;
- for (j = 0; j < 5; ++j) {
- if (j > 0)
- ull <<= 8;
- ull |= lunp[1 + j];
- }
+ ull = sg_get_unaligned_be(5, lunp + 1);
if (do_hex)
printf("%sLong extended flat space addressing: "
"lun=0x%010" PRIx64 "\n", l_leadin, ull);
@@ -292,13 +288,8 @@ decode_lun(const char * leadin, const unsigned char * lunp, int lu_cong,
"length=%d, e.a. method=%d, value=%d\n",
l_leadin, len_fld, e_a_method, x);
} else {
- ull = 0;
- x = (2 == len_fld) ? 5 : 7;
- for (j = 0; j < x; ++j) {
- if (j > 0)
- ull <<= 8;
- ull |= lunp[1 + j];
- }
+ ull = sg_get_unaligned_be(((2 == len_fld) ? 5 : 7),
+ lunp + 1);
if (do_hex) {
printf("%sExtended logical unit addressing: "
"length=%d, e. a. method=%d, ", l_leadin,
@@ -315,7 +306,7 @@ decode_lun(const char * leadin, const unsigned char * lunp, int lu_cong,
}
break;
default:
- printf("%s<<decode_lun: faulty logic>>\n", l_leadin);
+ printf("%s<<%s: faulty logic>>\n", l_leadin, __func__);
break;
}
if (next_level)
@@ -349,22 +340,6 @@ t10_2linux_lun(const unsigned char t10_lun[])
res = (res << 16) + sg_get_unaligned_be16(cp);
return res;
}
-
-/* Copy of t10_lun --> Linux unsigned int (i.e. 32 bit ) present in Linux
- * kernel, up to least lk 3.8.0, extended to 64 bits.
- * BEWARE: for sizeof(int==4) this function is BROKEN and is left here as
- * as example and may soon be removed. */
-static uint64_t
-t10_2linux_lun64bitBR(const unsigned char t10_lun[])
-{
- int i;
- uint64_t lun;
-
- lun = 0;
- for (i = 0; i < (int)sizeof(lun); i += 2)
- lun = lun | (((t10_lun[i] << 8) | t10_lun[i + 1]) << (i * 8));
- return lun;
-}
#endif /* SG_LIB_LINUX */
@@ -381,13 +356,13 @@ int
main(int argc, char * argv[])
{
int sg_fd, k, m, off, res, c, list_len, len_cap, luns, trunc;
- int decode = 0;
+ int decode_arg = 0;
int do_hex = 0;
#ifdef SG_LIB_LINUX
int do_linux = 0;
#endif
- int lu_cong = 0;
- int lu_cong_given = 0;
+ int lu_cong_arg = 0;
+ bool lu_cong_arg_given = false;
int maxlen = 0;
int do_quiet = 0;
int do_raw = 0;
@@ -396,8 +371,7 @@ main(int argc, char * argv[])
int verbose = 0;
#ifdef SG_LIB_LINUX
int test_linux_in = 0;
- int test_linux_out = 0;
- int test_linux_out2 = 0;
+ bool test_linux_out = false;
#endif
unsigned int h;
const char * test_arg = NULL;
@@ -423,7 +397,7 @@ main(int argc, char * argv[])
switch (c) {
case 'd':
- decode = 1;
+ ++decode_arg;
break;
case 'h':
case '?':
@@ -438,8 +412,8 @@ main(int argc, char * argv[])
break;
#endif
case 'L':
- ++lu_cong;
- ++lu_cong_given;
+ ++lu_cong_arg;
+ lu_cong_arg_given = true;
break;
case 'm':
maxlen = sg_get_num(optarg);
@@ -501,7 +475,11 @@ main(int argc, char * argv[])
if ('L' == toupper(cp[0])) {
uint64_t ull;
- if (1 != sscanf(cp + 1, " %" SCNu64, &ull)) {
+ if (('0' == cp[1]) && ('X' == toupper(cp[2])))
+ k = sscanf(cp + 3, " %" SCNx64, &ull);
+ else
+ k = sscanf(cp + 1, " %" SCNu64, &ull);
+ if (1 != k) {
pr2serr("Unable to read Linux style LUN integer given to "
"--test=\n");
return SG_LIB_SYNTAX_ERROR;
@@ -511,19 +489,22 @@ main(int argc, char * argv[])
} else
#endif
{
- /* Check if trailing 'L' or 'W' */
- m = strlen(cp); /* must be at least 1 char in test_arg */
+ /* Check if trailing 'L' */
#ifdef SG_LIB_LINUX
+ m = strlen(cp); /* must be at least 1 char in test_arg */
if ('L' == toupper(cp[m - 1]))
- test_linux_out = 1;
- else if ('W' == toupper(cp[m - 1]))
- test_linux_out2 = 1;
+ test_linux_out = true;
#endif
if (('0' == cp[0]) && ('X' == toupper(cp[1])))
cp += 2;
- if (strchr(cp, ' ') || strchr(cp, '\t')) {
- for (k = 0; k < 8; ++k, cp += m) {
- if (1 != sscanf(cp, " %2x%n", &h, &m))
+ if (strchr(cp, ' ') || strchr(cp, '\t') || strchr(cp, '-')) {
+ for (k = 0; k < 8; ++k, cp += 2) {
+ c = *cp;
+ if ('\0' == c)
+ break;
+ else if (! isxdigit(c))
+ ++cp;
+ if (1 != sscanf(cp, "%2x", &h))
break;
lun_arr[k] = h & 0xff;
}
@@ -541,14 +522,21 @@ main(int argc, char * argv[])
}
}
#ifdef SG_LIB_LINUX
- if (verbose || test_linux_in || test_linux_out2)
+ if (verbose || test_linux_in || decode_arg)
#else
- if (verbose)
+ if (verbose || decode_arg)
#endif
{
- printf("64 bit LUN in T10 preferred (hex) format: ");
- for (k = 0; k < 8; ++k)
- printf(" %02x", lun_arr[k]);
+ if (decode_arg > 1) {
+ printf("64 bit LUN in T10 (hex, dashed) format: ");
+ for (k = 0; k < 8; k += 2)
+ printf("%c%02x%02x", (k ? '-' : ' '), lun_arr[k],
+ lun_arr[k + 1]);
+ } else {
+ printf("64 bit LUN in T10 preferred (hex) format: ");
+ for (k = 0; k < 8; ++k)
+ printf(" %02x", lun_arr[k]);
+ }
printf("\n");
}
#ifdef SG_LIB_LINUX
@@ -562,20 +550,10 @@ main(int argc, char * argv[])
else
printf("Linux 'word flipped' integer LUN representation: %"
PRIu64 "\n", t10_2linux_lun(lun_arr));
- } else if (test_linux_out2) {
- if (do_hex > 1)
- printf("Linux internal 64 bit LUN representation: 0x%016"
- PRIx64 "\n", t10_2linux_lun64bitBR(lun_arr));
- else if (do_hex)
- printf("Linux internal 64 bit LUN representation: 0x%"
- PRIx64 "\n", t10_2linux_lun64bitBR(lun_arr));
- else
- printf("Linux internal 64 bit LUN representation: %"
- PRIu64 "\n", t10_2linux_lun64bitBR(lun_arr));
}
#endif
printf("Decoded LUN:\n");
- decode_lun(" ", lun_arr, (lu_cong % 2), do_hex, verbose);
+ decode_lun(" ", lun_arr, (lu_cong_arg % 2), do_hex, verbose);
return 0;
}
if (NULL == device_name) {
@@ -596,7 +574,10 @@ main(int argc, char * argv[])
pr2serr("open error: %s: %s\n", device_name, safe_strerror(-sg_fd));
return SG_LIB_FILE_ERROR;
}
- if (decode && (! lu_cong_given)) {
+ if (decode_arg && (! lu_cong_arg_given)) {
+ if (verbose > 1)
+ pr2serr("in order to decode LUN and since --lu_cong not given, "
+ "do standard\nINQUIRY to find LU_CONG bit\n");
/* check if LU_CONG set in standard INQUIRY response */
res = sg_simple_inquiry(sg_fd, &sir, 0, verbose);
ret = res;
@@ -604,8 +585,8 @@ main(int argc, char * argv[])
pr2serr("fetching standard INQUIRY response failed\n");
goto the_end;
}
- lu_cong = !!(0x40 & sir.byte_1);
- if (verbose && lu_cong)
+ lu_cong_arg = !!(0x40 & sir.byte_1);
+ if (verbose && lu_cong_arg)
pr2serr("LU_CONG bit set in standard INQUIRY response\n");
}
@@ -669,9 +650,9 @@ main(int argc, char * argv[])
}
#endif
printf("\n");
- if (decode)
- decode_lun(" ", reportLunsBuff + off, (lu_cong % 2),
- do_hex, verbose);
+ if (decode_arg)
+ decode_lun(" ", reportLunsBuff + off,
+ (bool)(lu_cong_arg % 2), do_hex, verbose);
}
} else if (SG_LIB_CAT_INVALID_OP == res)
pr2serr("Report Luns command not supported (support mandatory in "
diff --git a/src/sg_ses.c b/src/sg_ses.c
index bef3c290..7d88b8f6 100644
--- a/src/sg_ses.c
+++ b/src/sg_ses.c
@@ -31,7 +31,7 @@
* commands tailored for SES (enclosure) devices.
*/
-static const char * version_str = "2.14 20160504"; /* ses3r13 */
+static const char * version_str = "2.15 20160506"; /* ses3r13 */
#define MX_ALLOC_LEN ((64 * 1024) - 4) /* max allowable for big enclosures */
#define MX_ELEM_HDR 1024
@@ -1763,8 +1763,8 @@ truncated:
* Returns total number of type descriptor headers written to 'tdhp' or -1
* if there is a problem */
static int
-build_type_desc_hdr_arr(int fd, struct type_desc_hdr_t * tdhp,
- int max_elems, uint32_t * generationp,
+build_type_desc_hdr_arr(int fd, struct type_desc_hdr_t * tdhp, int max_elems,
+ uint32_t * generationp,
struct enclosure_info * primary_ip,
struct opts_t * op)
{
@@ -2821,7 +2821,7 @@ additional_elem_sas(const char * pad, const uint8_t * ae_bp, int etype,
jrp = find_join_row_cnst(tesp, m, FJ_EOE);
if ((NULL == jrp) || (NULL == jrp->enc_statp) ||
(SAS_CONNECTOR_ETC != jrp->etype))
- printf("broken");
+ printf("broken [conn_idx=%d]", m);
else {
enc_status_helper("", jrp->enc_statp, jrp->etype,
true, op);
@@ -2842,7 +2842,7 @@ additional_elem_sas(const char * pad, const uint8_t * ae_bp, int etype,
else
jrp = find_join_row_cnst(tesp, m, FJ_EOE);
if (NULL == jrp)
- printf("broken");
+ printf("broken [oth_elem_idx=%d]", m);
else if (jrp->elem_descp) {
cp = etype_str(jrp->etype, b, sizeof(b));
ed_bp = jrp->elem_descp;
@@ -2886,7 +2886,7 @@ additional_elem_sas(const char * pad, const uint8_t * ae_bp, int etype,
jrp = find_join_row_cnst(tesp, m, FJ_EOE);
if ((NULL == jrp) || (NULL == jrp->enc_statp) ||
(SAS_CONNECTOR_ETC != jrp->etype))
- printf("broken");
+ printf("broken [conn_idx=%d]", m);
else {
enc_status_helper("", jrp->enc_statp, jrp->etype,
true, op);
@@ -2906,7 +2906,7 @@ additional_elem_sas(const char * pad, const uint8_t * ae_bp, int etype,
else
jrp = find_join_row_cnst(tesp, m, FJ_EOE);
if (NULL == jrp)
- printf("broken");
+ printf("broken [oth_elem_idx=%d]", m);
else if (jrp->elem_descp) {
cp = etype_str(jrp->etype, b, sizeof(b));
ed_bp = jrp->elem_descp;
@@ -3596,8 +3596,8 @@ process_status_page(int sg_fd, struct opts_t * op)
break;
case ENC_STATUS_DPC:
num_ths = build_type_desc_hdr_arr(sg_fd, type_desc_hdr_arr,
- MX_ELEM_HDR, &ref_gen_code,
- &primary_info, op);
+ MX_ELEM_HDR, &ref_gen_code,
+ &primary_info, op);
if (num_ths < 0) {
ret = num_ths;
goto fini;
@@ -3630,8 +3630,8 @@ process_status_page(int sg_fd, struct opts_t * op)
break;
case THRESHOLD_DPC:
num_ths = build_type_desc_hdr_arr(sg_fd, type_desc_hdr_arr,
- MX_ELEM_HDR, &ref_gen_code,
- &primary_info, op);
+ MX_ELEM_HDR, &ref_gen_code,
+ &primary_info, op);
if (num_ths < 0) {
ret = num_ths;
goto fini;
@@ -3648,8 +3648,8 @@ process_status_page(int sg_fd, struct opts_t * op)
break;
case ELEM_DESC_DPC:
num_ths = build_type_desc_hdr_arr(sg_fd, type_desc_hdr_arr,
- MX_ELEM_HDR, &ref_gen_code,
- &primary_info, op);
+ MX_ELEM_HDR, &ref_gen_code,
+ &primary_info, op);
if (num_ths < 0) {
ret = num_ths;
goto fini;
@@ -3675,8 +3675,8 @@ process_status_page(int sg_fd, struct opts_t * op)
break;
case ADD_ELEM_STATUS_DPC:
num_ths = build_type_desc_hdr_arr(sg_fd, type_desc_hdr_arr,
- MX_ELEM_HDR, &ref_gen_code,
- &primary_info, op);
+ MX_ELEM_HDR, &ref_gen_code,
+ &primary_info, op);
if (num_ths < 0) {
ret = num_ths;
goto fini;
@@ -3981,9 +3981,8 @@ join_work(int sg_fd, struct opts_t * op, bool display)
memset(&primary_info, 0, sizeof(primary_info));
hex = op->do_hex;
blen = sizeof(b);
- num_ths = build_type_desc_hdr_arr(sg_fd, type_desc_hdr_arr,
- MX_ELEM_HDR, &ref_gen_code,
- &primary_info, op);
+ num_ths = build_type_desc_hdr_arr(sg_fd, type_desc_hdr_arr, MX_ELEM_HDR,
+ &ref_gen_code, &primary_info, op);
if (num_ths < 0)
return num_ths;
tesp = &tes;