aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--README2
-rw-r--r--debian/changelog2
-rw-r--r--doc/rescan-scsi-bus.sh.8117
-rw-r--r--doc/sg3_utils.84
-rw-r--r--doc/sg_inq.815
-rw-r--r--doc/sg_vpd.89
-rw-r--r--lib/sg_lib_data.c8
-rw-r--r--sg3_utils.spec2
-rw-r--r--src/sg_inq.c27
-rw-r--r--src/sg_vpd.c132
-rw-r--r--src/sg_xcopy.c24
12 files changed, 223 insertions, 123 deletions
diff --git a/ChangeLog b/ChangeLog
index 9f9fe15f..9372c52f 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.42 [20151220] [svn: r654]
+Changelog for sg3_utils-1.42 [20160105] [svn: r655]
- sg_timestamp: new, to report or set timestamp
- sg_stpg: fix truncation of target port field
- sg_inq: cope with unicode strings, udev fixes
@@ -15,6 +15,8 @@ Changelog for sg3_utils-1.42 [20151220] [svn: r654]
- add Device constituents VPD page
- LB provisioning VPD page: expand LBPRZ, add
Minimum and Threshold percentage fields
+ - sg_inq+sg_vpd+sg_xcopy: add support for locally
+ assigned UUIDs in VPD page 0x83 (15-267r2)
- sg_sanitize: add --znr option (sbc4r07)
- sg_rep_zones: add --partial option (zbc-r04)
- sg_raw: document length relationships
diff --git a/README b/README
index eea3963a..5d91fd71 100644
--- a/README
+++ b/README
@@ -413,4 +413,4 @@ See http://sg.danny.cz/sg/tools.html
Douglas Gilbert
-20th December 2015
+3rd January 2016
diff --git a/debian/changelog b/debian/changelog
index 534d8913..e125edfb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,7 +2,7 @@ sg3-utils (1.42-0.1) unstable; urgency=low
* New upstream version
- -- Douglas Gilbert <dgilbert@interlog.com> Sun, 20 Dec 2015 11:00:00 -0500
+ -- Douglas Gilbert <dgilbert@interlog.com> Sun, 03 Jan 2016 13:00:00 -0500
sg3-utils (1.41-0.1) unstable; urgency=low
diff --git a/doc/rescan-scsi-bus.sh.8 b/doc/rescan-scsi-bus.sh.8
index 5dc3e6d9..a5eb7c47 100644
--- a/doc/rescan-scsi-bus.sh.8
+++ b/doc/rescan-scsi-bus.sh.8
@@ -1,93 +1,112 @@
-.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.41.2.
-.TH RESCAN-SCSI-BUS.SH "1" "leden 2014" "rescan-scsi-bus.sh 1.57" "User Commands"
+.TH RESCAN-SCSI-BUS.SH "1" "January 2016" "rescan-scsi-bus.sh" "User Commands"
.SH NAME
-rescan-scsi-bus.sh \- script for adding and removing SCSI devices without rebooting
+rescan-scsi-bus.sh \- script to add and remove SCSI devices without rebooting
.SH SYNOPSIS
.B rescan-scsi-bus.sh
-[\fIoptions\fR] [\fIhost \fR[\fIhost \fR...]]
+[\fI\-\-alltargets\fR] [\fI\-\-attachpq3\fR] [\fI\-c\fR] [\fI\-\-color\fR]
+[\fI\-\--channels=CLIST\fR] [\fI\-d\fR] [\fI\-\-flush\fR]
+[\fI\-\-forceremove\fR] [\fI\-\-forcerescan\fR] [\fI\-\-help\fR]
+[\fI\-\-hosts=HLIST\fR] [\fI\-\-ids=TLIST\fR] [\fI\-\-issue\-lip\fR]
+[\fI\-l\fR] [\fI\-L NUM\fR] [\fI\-\-luns=LLIST\fR] [\fI\-\-multipath\fR]
+[\fI\-\-nooptscan\fR] [\fI\-\-remove\fR] [\fI\-\-removelun2\fR]
+[\fI\-\-resize\fR] [\fI\-\-sparselun\fR] [\fI\-\-sync\fR] [\fI\-\-update\fR]
+[\fI\-\-version\fR] [\fI\-\-wide\fR] [\fIHOST1 \fR[\fIHOST2 \fR...]]
.SH OPTIONS
.TP
\fB\-a\fR, \fB\-\-alltargets\fR
scan all targets, not just currently existing [default: disabled]
.TP
+\fB\-\-attachpq3\fR
+tell kernel to attach sg to LUN 0 that reports PQ=3
+.TP
+\fB\-c\fR
+enables scanning of channels 0 1 [default: 0 / all detected ones]
+.TP
+\fB\-\-color\fR
+use coloured prefixes OLD/NEW/DEL
+.TP
+\fB\-\-channels\fR=\fICLIST\fR
+scan only channel(s) in \fICLIST\fR
+.TP
\fB\-d\fR
enable debug [default: 0]
.TP
-\fB\-l\fR
-activates scanning for LUNs 0\-\-7 [default: 0]
+\fB\-f\fR, \fB\-\-flush\fR
+flush failed multipath devices [default: disabled]
.TP
-\fB\-L\fR NUM
-activates scanning for LUNs 0\-\-NUM [default: 0]
+\fB\-\-forceremove\fR
+remove and readd every device (DANGEROUS)
.TP
-\fB\-w\fR, \fB\-\-wide\fR
-scan for target device IDs 0\-\-15 [default: 0\-\-7]
+\fB\-\-forcerescan\fR
+rescan existing devices
.TP
-\fB\-c\fR
-enables scanning of channels 0 1 [default: 0 / all detected ones]
+\fB\-h\fR, \fB\-\-help\fR
+print usage message then exit
.TP
-\fB\-r\fR, \fB\-\-remove\fR
-enables removing of devices [default: disabled]
+\fB\-\-hosts\fR=\fIHLIST\fR
+scan only host(s) in \fIHLIST\fR
.TP
-\fB\-f\fR, \fB\-\-flush\fR
-flush failed multipath devices [default: disabled]
+\fB\-\-ids\fR=\fITLIST\fR
+scan only target ID(s) in \fITLIST\fR
.TP
\fB\-i\fR, \fB\-\-issue\-lip\fR
issue a FibreChannel LIP reset [default: disabled]
.TP
-\fB\-m\fR, \fB\-\-multipath\fR
-update multipath devices [default: disabled]
+\fB\-l\fR
+activates scanning for LUNs 0\-\-7 [default: 0]
.TP
-\fB\-u\fR, \fB\-\-update\fR
-look for existing disks that have been remapped
+\fB\-L\fR NUM
+activates scanning for LUNs 0\-\-NUM [default: 0]
.TP
-\fB\-s\fR, \fB\-\-resize\fR
-look for resized disks and reload associated multipath devices, if applicable
+\fB\-\-largelun\fR
+tell kernel to support LUNs > 7 even on SCSI2 devs
.TP
-\fB\-\-forcerescan\fR
-rescan existing devices
+\fB\-\-luns\fR=\fINLIST\fR
+scan only lun(s) in \fINLIST\fR
.TP
-\fB\-\-forceremove\fR
-remove and readd every device (DANGEROUS)
+\fB\-m\fR, \fB\-\-multipath\fR
+update multipath devices [default: disabled]
.TP
\fB\-\-nooptscan\fR
don't stop looking for LUNs is 0 is not found
.TP
-\fB\-\-color\fR
-use coloured prefixes OLD/NEW/DEL
-.TP
-\fB\-\-hosts\fR=\fILIST\fR
-scan only host(s) in \fILIST\fR
+\fB\-r\fR, \fB\-\-remove\fR
+enables removing of devices [default: disabled]
.TP
-\fB\-\-channels\fR=\fILIST\fR
-scan only channel(s) in \fILIST\fR
+\fB\-\-reportlun2\fR
+tell kernel to try REPORT_LUN even on SCSI2 devices
.TP
-\fB\-\-ids\fR=\fILIST\fR
-scan only target ID(s) in \fILIST\fR
+\fB\-s\fR, \fB\-\-resize\fR
+look for resized disks and reload associated multipath devices, if applicable
.TP
-\fB\-\-luns\fR=\fILIST\fR
-scan only lun(s) in \fILIST\fR
+\fB\-\-sparselun\fR
+tell kernel to support sparse LUN numbering
.TP
\fB\-\-sync\fR, \fB\-\-nosync\fR
issue a sync / no sync [default: sync if remove]
.TP
-\fB\-\-attachpq3\fR
-tell kernel to attach sg to LUN 0 that reports PQ=3
-.TP
-\fB\-\-reportlun2\fR
-tell kernel to try REPORT_LUN even on SCSI2 devices
+\fB\-u\fR, \fB\-\-update\fR
+look for existing disks that have been remapped
.TP
-\fB\-\-largelun\fR
-tell kernel to support LUNs > 7 even on SCSI2 devs
+\fB\-V\fR, \fB\-\-version\fR
+shows version string then exits. The version string is a numeric datestamp
+of the form YYYYMMDD.
.TP
-\fB\-\-sparselun\fR
-tell kernel to support sparse LUN numbering
+\fB\-w\fR, \fB\-\-wide\fR
+scan for target device IDs 0\-\-15 [default: 0\-\-7]
.IP
Host numbers may thus be specified either directly on cmd line (deprecated) or
or with the \fB\-\-hosts\fR=\fILIST\fR parameter (recommended).
.PP
-\fILIST\fR: A[\-B][,C[\-D]]... is a comma separated list of single values and ranges
-(No spaces allowed.)
+Arguments to options that end in \fILIST\fR (e.g. \fITLIST\fR) can have this
+form:
+.br
+ A[\-B][,C[\-D]]...
+.br
+which is a comma separated list of single values and/or ranges (no spaces
+allowed).
.SH SEE ALSO
-\fBrescan-scsi-bus.sh\fR Homepage: \fBhttp://www.garloff.de/kurt/linux/#rescan-scsi\fR
+\fBrescan-scsi-bus.sh\fR Homepage:
+\fBhttp://www.garloff.de/kurt/linux/#rescan-scsi\fR
.PP
\fBsg3_utils\fR Homepage: \fBhttp://sg.danny.cz/sg\fR
diff --git a/doc/sg3_utils.8 b/doc/sg3_utils.8
index e9bd4d35..d9aff778 100644
--- a/doc/sg3_utils.8
+++ b/doc/sg3_utils.8
@@ -1,4 +1,4 @@
-.TH SG3_UTILS "8" "December 2015" "sg3_utils\-1.42" SG3_UTILS
+.TH SG3_UTILS "8" "January 2016" "sg3_utils\-1.42" SG3_UTILS
.SH NAME
sg3_utils \- a package of utilities for sending SCSI commands
.SH SYNOPSIS
@@ -492,7 +492,7 @@ CREDITS file and individual source files (in the 'src' directory).
.SH "REPORTING BUGS"
Report bugs to <dgilbert at interlog dot com>.
.SH COPYRIGHT
-Copyright \(co 1999\-2015 Douglas Gilbert
+Copyright \(co 1999\-2016 Douglas Gilbert
.br
Some utilities are distributed under a GPL version 2 license while
others, usually more recent ones, are under a FreeBSD license. The files
diff --git a/doc/sg_inq.8 b/doc/sg_inq.8
index c9d32629..11b4c168 100644
--- a/doc/sg_inq.8
+++ b/doc/sg_inq.8
@@ -1,4 +1,4 @@
-.TH SG_INQ "8" "July 2014" "sg3_utils\-1.40" SG3_UTILS
+.TH SG_INQ "8" "January 2016" "sg3_utils\-1.42" SG3_UTILS
.SH NAME
sg_inq \- issue SCSI INQUIRY command and/or decode its response
.SH SYNOPSIS
@@ -47,11 +47,12 @@ tried. If it succeeds then device identification strings are output. The
If the \fI\-\-ata\fR option is given then the SCSI INQUIRY is not performed
and the \fIDEVICE\fR is assumed to be ATA (or ATAPI).
.PP
-The reference document used for interpreting an INQUIRY is T10/1713\-D
-Revision 37 (SPC\-4, 17 May 2014) found at http://www.t10.org .
-Obsolete and reserved items in the standard INQUIRY response output are
-displayed in brackets. The reference document for the ATA IDENTIFY (PACKET)
-DEVICE command is ATA8\-ACS found at http://www.t13.org .
+The reference document used for interpreting an INQUIRY is T10/BSR INCITS
+502 Revision 07 which is draft SPC\-5 revision 07, 26 November 2015). It can
+be found at http://www.t10.org . Obsolete and reserved items in the standard
+INQUIRY response output are displayed in brackets. The reference document for
+the ATA IDENTIFY (PACKET) DEVICE command is ATA8\-ACS found at
+http://www.t13.org .
.SH OPTIONS
Arguments to long options are mandatory for short options as well.
The options are arranged in alphabetical order based on the long
@@ -427,7 +428,7 @@ Written by Douglas Gilbert
.SH "REPORTING BUGS"
Report bugs to <dgilbert at interlog dot com>.
.SH COPYRIGHT
-Copyright \(co 2001\-2014 Douglas Gilbert
+Copyright \(co 2001\-2016 Douglas Gilbert
.br
This software is distributed under the GPL version 2. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
diff --git a/doc/sg_vpd.8 b/doc/sg_vpd.8
index 60c63dfe..0110a783 100644
--- a/doc/sg_vpd.8
+++ b/doc/sg_vpd.8
@@ -1,4 +1,4 @@
-.TH SG_VPD "8" "January 2015" "sg3_utils\-1.41" SG3_UTILS
+.TH SG_VPD "8" "January 2016" "sg3_utils\-1.42" SG3_UTILS
.SH NAME
sg_vpd \- fetch SCSI VPD page and/or decode its response
.SH SYNOPSIS
@@ -25,8 +25,9 @@ has been flagged as mandatory. This page can be fetched by
using the \fI\-\-ident\fR option.
.PP
The reference document used for interpreting VPD pages (and the INQUIRY
-standard response) is T10/BSR INCITS 502 Revision 02 which is draft
-SPC\-5 revision 02, 7 January 2015). It can be found at http://www.t10.org .
+standard response) is T10/BSR INCITS 502 Revision 07 which is draft
+SPC\-5 revision 07, 26 November 2015). It can be found at
+http://www.t10.org .
.PP
When no options are given, other than a \fIDEVICE\fR, then the "Supported
VPD pages" (0x0) VPD page is fetched and decoded.
@@ -290,7 +291,7 @@ Written by Douglas Gilbert
.SH "REPORTING BUGS"
Report bugs to <dgilbert at interlog dot com>.
.SH COPYRIGHT
-Copyright \(co 2006\-2015 Douglas Gilbert
+Copyright \(co 2006\-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/lib/sg_lib_data.c b/lib/sg_lib_data.c
index 11b2c001..99a34e23 100644
--- a/lib/sg_lib_data.c
+++ b/lib/sg_lib_data.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007-2015 Douglas Gilbert.
+ * Copyright (c) 2007-2016 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.
@@ -17,7 +17,7 @@
#endif
-const char * sg_lib_version_str = "2.16 20151126"; /* spc5r07, sbc4r09 */
+const char * sg_lib_version_str = "2.17 20160103"; /* spc5r07, sbc4r09 */
/* indexed by pdt; those that map to own index do not decay */
@@ -1418,12 +1418,12 @@ const char * sg_lib_transport_proto_strs[] =
"Serial Bus Protocol for IEEE 1394 (SBP-3)",
"SCSI RDMA Protocol (SRP)",
"Internet SCSI (iSCSI)",
- "Serial Attached SCSI Protocol (SPL-3)",
+ "Serial Attached SCSI Protocol (SPL-4)",
"Automation/Drive Interface Transport (ADT-2)",
"AT Attachment Interface (ACS-2)", /* 0x8 */
"USB Attached SCSI (UAS-2)",
"SCSI over PCI Express (SOP)",
- "PCIe", /* added in spc5r<x> ?? */
+ "PCIe", /* added in spc5r02 */
"Oxc", "Oxd", "Oxe",
"No specific protocol"
};
diff --git a/sg3_utils.spec b/sg3_utils.spec
index abaf86e9..792c49cd 100644
--- a/sg3_utils.spec
+++ b/sg3_utils.spec
@@ -79,7 +79,7 @@ fi
%{_libdir}/*.la
%changelog
-* Sun Dec 20 2015 - dgilbert at interlog dot com
+* Sun Jan 03 2016 - dgilbert at interlog dot com
- track t10 changes
* sg3_utils-1.42
diff --git a/src/sg_inq.c b/src/sg_inq.c
index 7cbf4d04..bb878fff 100644
--- a/src/sg_inq.c
+++ b/src/sg_inq.c
@@ -1,5 +1,5 @@
/* A utility program originally written for the Linux OS SCSI subsystem.
-* Copyright (C) 2000-2015 D. Gilbert
+* Copyright (C) 2000-2016 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)
@@ -42,7 +42,7 @@
#include "sg_unaligned.h"
#include "sg_pr2serr.h"
-static const char * version_str = "1.52 20151219"; /* SPC-5 rev 06 */
+static const char * version_str = "1.54 20160104"; /* SPC-5 rev 07 */
/* INQUIRY notes:
* It is recommended that the initial allocation length given to a
@@ -1465,7 +1465,8 @@ static const char * desig_type_arr[] =
"MD5 logical unit identifier", /* SCSI_IDENT_DEVICE_MD5 */
"SCSI name string", /* SCSI_IDENT_DEVICE_SCSINAME */
"Protocol specific port identifier", /* spc4r36 */
- "[0xa]", "[0xb]", "[0xc]", "[0xd]", "[0xe]", "[0xf]",
+ "UUID identifier", /* 15-267r2 */
+ "[0xb]", "[0xc]", "[0xd]", "[0xe]", "[0xf]",
};
/* These are target port, device server (i.e. target) and LU identifiers */
@@ -1768,6 +1769,26 @@ decode_dev_ids(const char * leadin, unsigned char * buff, int len, int do_hex)
"identifier\n",
sg_get_trans_proto_str(p_id, sizeof(b), b));
break;
+ case 0xa: /* UUID identifier [15-267r2] */
+ if (1 != c_set) {
+ pr2serr(" << expected binary code_set >>\n");
+ dStrHexErr((const char *)ip, i_len, 0);
+ break;
+ }
+ if ((1 != ((ip[0] >> 4) & 0xf)) || (18 != i_len)) {
+ pr2serr(" << expected locally assigned UUID, 16 bytes "
+ "long >>\n");
+ dStrHexErr((const char *)ip, i_len, 0);
+ break;
+ }
+ printf(" Locally assigned UUID: ");
+ for (m = 0; m < 16; ++m) {
+ if ((4 == m) || (6 == m) || (8 == m) || (10 == m))
+ printf("-");
+ printf("%02x", (unsigned int)ip[2 + m]);
+ }
+ printf("\n");
+ break;
default: /* reserved */
pr2serr(" reserved designator=0x%x\n", desig_type);
dStrHexErr((const char *)ip, i_len, -1);
diff --git a/src/sg_vpd.c b/src/sg_vpd.c
index a37f0daf..c9b8886a 100644
--- a/src/sg_vpd.c
+++ b/src/sg_vpd.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2015 Douglas Gilbert.
+ * Copyright (c) 2006-2016 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.
@@ -36,7 +36,7 @@
*/
-static const char * version_str = "1.09 20151205"; /* spc5r07 + sbc4r07 */
+static const char * version_str = "1.11 20160104"; /* spc5r07 + sbc4r07 */
/* These structures are duplicates of those of the same name in
@@ -142,7 +142,7 @@ unsigned char rsp_buff[MX_ALLOC_LEN + 2];
static int decode_dev_ids(const char * print_if_found, unsigned char * buff,
int len, int m_assoc, int m_desig_type,
- int m_code_set, int long_out, int quiet);
+ int m_code_set, const struct opts_t * op);
static void decode_transport_id(const char * leadin, unsigned char * ucp,
int len);
@@ -785,8 +785,8 @@ static const char * assoc_arr[] =
};
static void
-decode_id_vpd(unsigned char * buff, int len, int subvalue, int do_long,
- int do_quiet)
+decode_id_vpd(unsigned char * buff, int len, int subvalue,
+ const struct opts_t * op)
{
int m_a, m_d, m_cs;
@@ -799,24 +799,23 @@ decode_id_vpd(unsigned char * buff, int len, int subvalue, int do_long,
m_cs = -1;
if (0 == subvalue) {
decode_dev_ids(assoc_arr[VPD_ASSOC_LU], buff + 4, len - 4,
- VPD_ASSOC_LU, m_d, m_cs, do_long, do_quiet);
+ VPD_ASSOC_LU, m_d, m_cs, op);
decode_dev_ids(assoc_arr[VPD_ASSOC_TPORT], buff + 4, len - 4,
- VPD_ASSOC_TPORT, m_d, m_cs, do_long, do_quiet);
+ VPD_ASSOC_TPORT, m_d, m_cs, op);
decode_dev_ids(assoc_arr[VPD_ASSOC_TDEVICE], buff + 4, len - 4,
- VPD_ASSOC_TDEVICE, m_d, m_cs, do_long, do_quiet);
+ VPD_ASSOC_TDEVICE, m_d, m_cs, op);
} else if (VPD_DI_SEL_AS_IS == subvalue)
- decode_dev_ids(NULL, buff + 4, len - 4, m_a, m_d, m_cs, do_long,
- do_quiet);
+ decode_dev_ids(NULL, buff + 4, len - 4, m_a, m_d, m_cs, op);
else {
if (VPD_DI_SEL_LU & subvalue)
decode_dev_ids(assoc_arr[VPD_ASSOC_LU], buff + 4, len - 4,
- VPD_ASSOC_LU, m_d, m_cs, do_long, do_quiet);
+ VPD_ASSOC_LU, m_d, m_cs, op);
if (VPD_DI_SEL_TPORT & subvalue)
decode_dev_ids(assoc_arr[VPD_ASSOC_TPORT], buff + 4, len - 4,
- VPD_ASSOC_TPORT, m_d, m_cs, do_long, do_quiet);
+ VPD_ASSOC_TPORT, m_d, m_cs, op);
if (VPD_DI_SEL_TARGET & subvalue)
decode_dev_ids(assoc_arr[VPD_ASSOC_TDEVICE], buff + 4, len - 4,
- VPD_ASSOC_TDEVICE, m_d, m_cs, do_long, do_quiet);
+ VPD_ASSOC_TDEVICE, m_d, m_cs, op);
}
}
@@ -926,14 +925,13 @@ decode_mode_policy_vpd(unsigned char * buff, int len, int do_hex)
/* VPD_SCSI_PORTS */
static void
-decode_scsi_ports_vpd(unsigned char * buff, int len, int do_hex, int do_long,
- int do_quiet)
+decode_scsi_ports_vpd(unsigned char * buff, int len, const struct opts_t * op)
{
int k, bump, rel_port, ip_tid_len, tpd_len;
unsigned char * ucp;
- if ((1 == do_hex) || (do_hex > 2)) {
- dStrHex((const char *)buff, len, (1 == do_hex) ? 1 : -1);
+ if ((1 == op->do_hex) || (op->do_hex > 2)) {
+ dStrHex((const char *)buff, len, (1 == op->do_hex) ? 1 : -1);
return;
}
if (len < 4) {
@@ -953,7 +951,7 @@ decode_scsi_ports_vpd(unsigned char * buff, int len, int do_hex, int do_long,
return;
}
if (ip_tid_len > 0) {
- if (do_hex > 1) {
+ if (op->do_hex > 1) {
printf(" Initiator port transport id:\n");
dStrHex((const char *)(ucp + 8), ip_tid_len, 1);
} else
@@ -966,14 +964,14 @@ decode_scsi_ports_vpd(unsigned char * buff, int len, int do_hex, int do_long,
return;
}
if (tpd_len > 0) {
- if (do_hex > 1) {
+ if (op->do_hex > 1) {
printf(" Target port descriptor(s):\n");
dStrHex((const char *)(ucp + bump + 4), tpd_len, 1);
} else {
- if ((0 == do_quiet) || (ip_tid_len > 0))
+ if ((0 == op->do_quiet) || (ip_tid_len > 0))
printf(" Target port descriptor(s):\n");
decode_dev_ids("SCSI Ports", ucp + bump + 4, tpd_len,
- VPD_ASSOC_TPORT, -1, -1, do_long, do_quiet);
+ VPD_ASSOC_TPORT, -1, -1, op);
}
}
bump += tpd_len + 4;
@@ -1003,7 +1001,8 @@ static const char * desig_type_arr[] =
"MD5 logical unit identifier",
"SCSI name string",
"Protocol specific port identifier", /* spc4r36 */
- "Reserved [0xa]", "Reserved [0xb]",
+ "UUID identifier", /* 15-267r2 */
+ "Reserved [0xb]",
"Reserved [0xc]", "Reserved [0xd]", "Reserved [0xe]", "Reserved [0xf]",
};
@@ -1035,7 +1034,7 @@ decode_dev_ids_quiet(unsigned char * buff, int len, int m_assoc,
desig_type = 3;
i_len = 16;
off = 16;
- goto decode;
+ goto skip_1st_iter;
}
while ((u = sg_vpd_dev_id_iter(buff, len, &off, m_assoc, m_desig_type,
m_code_set)) == 0) {
@@ -1053,7 +1052,7 @@ decode_dev_ids_quiet(unsigned char * buff, int len, int m_assoc,
is_sas = (piv && (6 == p_id)) ? 1 : 0;
assoc = ((ucp[1] >> 4) & 0x3);
desig_type = (ucp[1] & 0xf);
- decode:
+skip_1st_iter:
switch (desig_type) {
case 0: /* vendor specific */
break;
@@ -1177,7 +1176,17 @@ decode_dev_ids_quiet(unsigned char * buff, int len, int m_assoc,
*/
printf(" %s\n", (const char *)ip);
break;
- case 9: /* PCIe routing ID */
+ case 9: /* Protocol specific port identifier */
+ break;
+ case 0xa: /* UUID identifier */
+ if ((1 != c_set) || (18 != i_len) || (1 != ((ip[0] >> 4) & 0xf)))
+ break;
+ for (m = 0; m < 16; ++m) {
+ if ((4 == m) || (6 == m) || (8 == m) || (10 == m))
+ printf("-");
+ printf("%02x", (unsigned int)ip[2 + m]);
+ }
+ printf("\n");
break;
default: /* reserved */
break;
@@ -1199,7 +1208,8 @@ decode_dev_ids_quiet(unsigned char * buff, int len, int m_assoc,
static void
decode_designation_descriptor(const unsigned char * ip, int i_len,
int p_id, int c_set, int piv, int assoc,
- int desig_type, int long_out, int print_assoc)
+ int desig_type, int print_assoc,
+ const struct opts_t * op)
{
int m, ci_off, c_id, d_id, naa;
int vsi, k;
@@ -1245,7 +1255,7 @@ decode_designation_descriptor(const unsigned char * ip, int i_len,
}
break;
case 2: /* EUI-64 based */
- if (! long_out) {
+ if (! op->do_long) {
if ((8 != i_len) && (12 != i_len) && (16 != i_len)) {
pr2serr(" << expect 8, 12 and 16 byte EUI, got %d>>\n",
i_len);
@@ -1303,7 +1313,7 @@ decode_designation_descriptor(const unsigned char * ip, int i_len,
d_id = sg_get_unaligned_be16(ip) & 0xfff;
c_id = sg_get_unaligned_be24(ip + 2);
vsi = sg_get_unaligned_be24(ip + 5);
- if (long_out) {
+ if (op->do_long) {
printf(" NAA 2, vendor specific identifier A: "
"0x%x\n", d_id);
printf(" IEEE Company_id: 0x%x\n", c_id);
@@ -1325,7 +1335,7 @@ decode_designation_descriptor(const unsigned char * ip, int i_len,
dStrHexErr((const char *)ip, i_len, 0);
break;
}
- if (long_out)
+ if (op->do_long)
printf(" NAA 3, Locally assigned value:\n");
printf(" 0x");
for (m = 0; m < 8; ++m)
@@ -1339,7 +1349,7 @@ decode_designation_descriptor(const unsigned char * ip, int i_len,
dStrHexErr((const char *)ip, i_len, 0);
break;
}
- if (long_out) {
+ if (op->do_long) {
c_id = (((ip[0] & 0xf) << 20) | (ip[1] << 12) |
(ip[2] << 4) | ((ip[3] & 0xf0) >> 4));
vsei = ip[3] & 0xf;
@@ -1375,7 +1385,7 @@ decode_designation_descriptor(const unsigned char * ip, int i_len,
vsei <<= 8;
vsei |= ip[3 + m];
}
- if (long_out) {
+ if (op->do_long) {
printf(" NAA 6, IEEE Company_id: 0x%x\n", c_id);
printf(" Vendor Specific Identifier: 0x%" PRIx64
"\n", vsei);
@@ -1482,6 +1492,32 @@ decode_designation_descriptor(const unsigned char * ip, int i_len,
"identifier\n",
sg_get_trans_proto_str(p_id, sizeof(b), b));
break;
+ case 0xa: /* UUID identifier */
+ if (1 != c_set) {
+ pr2serr(" << expected binary code_set >>\n");
+ dStrHexErr((const char *)ip, i_len, 0);
+ break;
+ }
+ if ((1 != ((ip[0] >> 4) & 0xf)) || (18 != i_len)) {
+ pr2serr(" << expected locally assigned UUID, 16 bytes long "
+ ">>\n");
+ dStrHexErr((const char *)ip, i_len, 0);
+ break;
+ }
+ printf(" Locally assigned UUID: ");
+ for (m = 0; m < 16; ++m) {
+ if ((4 == m) || (6 == m) || (8 == m) || (10 == m))
+ printf("-"); /* RFC 4122 format */
+ printf("%02x", (unsigned int)ip[2 + m]);
+ }
+ printf("\n");
+ if (op->do_long) {
+ printf(" [0x");
+ for (m = 0; m < 16; ++m)
+ printf("%02x", (unsigned int)ip[2 + m]);
+ printf("]\n");
+ }
+ break;
default: /* reserved */
pr2serr(" reserved designator=0x%x\n", desig_type);
dStrHexErr((const char *)ip, i_len, 0);
@@ -1493,20 +1529,20 @@ decode_designation_descriptor(const unsigned char * ip, int i_len,
designator type and/or code set. */
static int
decode_dev_ids(const char * print_if_found, unsigned char * buff, int len,
- int m_assoc, int m_desig_type, int m_code_set, int long_out,
- int quiet)
+ int m_assoc, int m_desig_type, int m_code_set,
+ const struct opts_t * op)
{
int assoc, i_len, c_set, piv, p_id, desig_type;
int printed, off, u;
const unsigned char * ucp;
- if (quiet)
+ if (op->do_quiet)
return decode_dev_ids_quiet(buff, len, m_assoc, m_desig_type,
m_code_set);
if ( buff[2] != 0 ) {
if (m_assoc == VPD_ASSOC_LU)
- decode_designation_descriptor( buff, 16, 0, 1, 0, m_assoc, 3,
- long_out, 0);
+ decode_designation_descriptor(buff, 16, 0, 1, 0, m_assoc, 3, 0,
+ op);
return 0;
}
off = -1;
@@ -1532,7 +1568,7 @@ decode_dev_ids(const char * print_if_found, unsigned char * buff, int len,
piv = ((ucp[1] & 0x80) ? 1 : 0);
desig_type = (ucp[1] & 0xf);
decode_designation_descriptor(ucp + 4, i_len, p_id, c_set, piv, assoc,
- desig_type, long_out, 0);
+ desig_type, 0, op);
}
if (-2 == u) {
pr2serr("VPD page error: short designator around offset %d\n", off);
@@ -2400,7 +2436,7 @@ decode_proto_port_vpd(unsigned char * buff, int len, int do_hex)
!!(ucp[3] & 0x1)); /* added spl3r03 */
pidp = ucp + 8;
for (j = 0; j < desc_len; j += 4, pidp += 4)
- printf(" phy id=%d, ssp persistent capable=%d\n",
+ printf(" phy id=%d, SSP persistent capable=%d\n",
pidp[1], (0x1 & pidp[2]));
break;
default:
@@ -2584,7 +2620,7 @@ decode_b1_vpd(unsigned char * buff, int len, int do_hex, int pdt)
/* VPD_LB_PROVISIONING */
static int
-decode_block_lb_prov_vpd(unsigned char * b, int len)
+decode_block_lb_prov_vpd(unsigned char * b, int len, const struct opts_t * op)
{
int dp;
@@ -2624,7 +2660,7 @@ decode_block_lb_prov_vpd(unsigned char * b, int len)
assoc = ((ucp[1] >> 4) & 0x3);
desig_type = (ucp[1] & 0xf);
decode_designation_descriptor(ucp, i_len, p_id, c_set, piv, assoc,
- desig_type, 0, 1);
+ desig_type, 1, op);
}
return 0;
}
@@ -2769,15 +2805,16 @@ decode_tapealert_supported_vpd(unsigned char * b, int len)
/* VPD_LB_PROVISIONING sbc */
/* VPD_TA_SUPPORTED ssc */
static void
-decode_b2_vpd(unsigned char * buff, int len, int do_hex, int pdt)
+decode_b2_vpd(unsigned char * buff, int len, int pdt,
+ const struct opts_t * op)
{
- if (do_hex) {
- dStrHex((const char *)buff, len, (1 == do_hex) ? 0 : -1);
+ if (op->do_hex) {
+ dStrHex((const char *)buff, len, (1 == op->do_hex) ? 0 : -1);
return;
}
switch (pdt) {
case PDT_DISK: case PDT_WO: case PDT_OPTICAL: case PDT_ZBC:
- decode_block_lb_prov_vpd(buff, len);
+ decode_block_lb_prov_vpd(buff, len, op);
break;
case PDT_TAPE: case PDT_MCHANGER:
decode_tapealert_supported_vpd(buff, len);
@@ -3123,7 +3160,7 @@ svpd_decode_t10(int sg_fd, struct opts_t * op, int subvalue, int off)
printf(" [PQual=%d Peripheral device type: %s]\n",
(rp[0] & 0xe0) >> 5,
sg_get_pdt_str(pdt, sizeof(b), b));
- decode_id_vpd(rp, len, subvalue, op->do_long, op->do_quiet);
+ decode_id_vpd(rp, len, subvalue, op);
}
return 0;
}
@@ -3219,8 +3256,7 @@ svpd_decode_t10(int sg_fd, struct opts_t * op, int subvalue, int off)
printf(" [PQual=%d Peripheral device type: %s]\n",
(rp[0] & 0xe0) >> 5,
sg_get_pdt_str(pdt, sizeof(b), b));
- decode_scsi_ports_vpd(rp, len, op->do_hex, op->do_long,
- op->do_quiet);
+ decode_scsi_ports_vpd(rp, len, op);
}
return 0;
}
@@ -3453,7 +3489,7 @@ svpd_decode_t10(int sg_fd, struct opts_t * op, int subvalue, int off)
printf(" [PQual=%d Peripheral device type: %s]\n",
(rp[0] & 0xe0) >> 5,
sg_get_pdt_str(pdt, sizeof(b), b));
- decode_b2_vpd(rp, len, op->do_hex, pdt);
+ decode_b2_vpd(rp, len, pdt, op);
}
return 0;
} else if ((! op->do_raw) && (! op->do_quiet) && (op->do_hex < 3))
diff --git a/src/sg_xcopy.c b/src/sg_xcopy.c
index d0003583..9ac5d69f 100644
--- a/src/sg_xcopy.c
+++ b/src/sg_xcopy.c
@@ -1,7 +1,7 @@
/* A utility program for copying files. Similar to 'dd' but using
* the 'Extended Copy' command.
*
- * Copyright (c) 2011-2015 Hannes Reinecke, SUSE Labs
+ * Copyright (c) 2011-2016 Hannes Reinecke, SUSE Labs
*
* Largely taken from 'sg_dd', which has the
*
@@ -63,7 +63,7 @@
#include "sg_unaligned.h"
#include "sg_pr2serr.h"
-static const char * version_str = "0.50 20151227";
+static const char * version_str = "0.51 20160104";
#define ME "sg_xcopy: "
@@ -1182,6 +1182,26 @@ decode_designation_descriptor(const unsigned char * ucp, int i_len)
" with Protocol specific port "
"identifier\n", p_id);
break;
+ case 0xa: /* UUID identifier */
+ if (1 != c_set) {
+ pr2serr(" << expected binary code_set >>\n");
+ dStrHexErr((const char *)ip, i_len, 0);
+ break;
+ }
+ if ((1 != ((ip[0] >> 4) & 0xf)) || (18 != i_len)) {
+ pr2serr(" << expected locally assigned UUID, 16 bytes long "
+ ">>\n");
+ dStrHexErr((const char *)ip, i_len, 0);
+ break;
+ }
+ printf(" Locally assigned UUID: ");
+ for (m = 0; m < 16; ++m) {
+ if ((4 == m) || (6 == m) || (8 == m) || (10 == m))
+ printf("-");
+ printf("%02x", (unsigned int)ip[2 + m]);
+ }
+ printf("\n");
+ break;
default: /* reserved */
pr2serr(" reserved designator=0x%x\n", desig_type);
dStrHexErr((const char *)ip, i_len, 0);