aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2021-09-04 17:23:12 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2021-09-04 17:23:12 +0000
commit15a477c9f6730cd98e40bbdbb0511cdf3a3c4319 (patch)
tree0a1cf10f69306878863481efa57b72170ba4cb26
parent7144ac65deef1369c1c754c2e561c813878ab046 (diff)
downloadsg3_utils-15a477c9f6730cd98e40bbdbb0511cdf3a3c4319.tar.gz
sg_xcopy: tweak CSCD identification descriptor
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@912 6180dd3e-e324-4e3e-922d-17de1ae2f315
-rw-r--r--CREDITS4
-rw-r--r--ChangeLog3
-rw-r--r--doc/sg_xcopy.84
-rw-r--r--src/sg_xcopy.c21
4 files changed, 18 insertions, 14 deletions
diff --git a/CREDITS b/CREDITS
index e48eb446..78bda745 100644
--- a/CREDITS
+++ b/CREDITS
@@ -10,6 +10,8 @@ Bart Van Assche <bart dot vanassche at sandisk dot com>
harden (improve) code in rescan-scsi-bus.sh [20160224]
configure.ac and Makefile.am cleanup plus sgp_dd code
to replace pthread_cancel with pthread_kill [20180102]
+ sg_xcopy: fix identification CSCD descriptor's designator
+ length, fix CSCD descriptor mask [20210902]
Bean Huo <beanhuo dot micron dot com>
sg_write_buffer: patch to allow comma or period separated bytes
@@ -146,7 +148,7 @@ Trent Piepho <xyzzy at speakeasy dot org> print out some "sense key specific"
data and "-6" switch for sg_modes
Xose Vazquez Perez <xose dot vazquez at gmail dot com>
- documentation corrections [20200117]
+ documentation corrections [20200117]
Douglas Gilbert
diff --git a/ChangeLog b/ChangeLog
index 13617ad2..aa5ed522 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 [20210831] [svn: r911]
+Changelog for pre-release sg3_utils-1.47 [20210903] [svn: r912]
- 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,7 @@ Changelog for pre-release sg3_utils-1.47 [20210831] [svn: r911]
- 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_xcopy: tweak CSCD identification descriptor
- sg_get_elem_status: fix issue with '--maxlen=' option
- add 2 depopulation revocation health attributes [sbc5r01]
- several utilities: override '--maxlen=LEN' when LEN
diff --git a/doc/sg_xcopy.8 b/doc/sg_xcopy.8
index 2e5a653e..1c2cd170 100644
--- a/doc/sg_xcopy.8
+++ b/doc/sg_xcopy.8
@@ -1,4 +1,4 @@
-.TH SG_XCOPY "8" "February 2019" "sg3_utils\-1.45" SG3_UTILS
+.TH SG_XCOPY "8" "September 2021" "sg3_utils\-1.47" SG3_UTILS
.SH NAME
sg_xcopy \- copy data to and from files and devices using SCSI EXTENDED
COPY (XCOPY)
@@ -354,7 +354,7 @@ Written by Hannes Reinecke and Douglas Gilbert.
.SH "REPORTING BUGS"
Report bugs to <dgilbert at interlog dot com>.
.SH COPYRIGHT
-Copyright \(co 2000\-2019 Hannes Reinecke and Douglas Gilbert
+Copyright \(co 2000\-2021 Hannes Reinecke and 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/src/sg_xcopy.c b/src/sg_xcopy.c
index e691a73e..1fb09c49 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-2020 Hannes Reinecke, SUSE Labs
+ * Copyright (c) 2011-2021 Hannes Reinecke, SUSE Labs
*
* Largely taken from 'sg_dd', which has the
*
@@ -69,7 +69,7 @@
#include "sg_unaligned.h"
#include "sg_pr2serr.h"
-static const char * version_str = "0.71 20200510";
+static const char * version_str = "0.72 20210902";
#define ME "sg_xcopy: "
@@ -1075,27 +1075,27 @@ desc_from_vpd_id(int sg_fd, uint8_t *desc, int desc_len,
if (verbose > 2)
pr2serr(" Desc %d: assoc %u desig %u len %d\n", off, assoc,
desig, i_len);
- /* Descriptor must be less than 16 bytes */
- if (i_len > 16)
+ /* Identification descriptor's Designator length must be <= 20. */
+ if (i_len > 20)
continue;
- if (desig == 3) {
+ if (desig == /*NAA=*/3) {
best = bp;
best_len = i_len;
break;
}
- if (desig == 2) {
+ if (desig == /*EUI64=*/2) {
if (!best || f_desig < 2) {
best = bp;
best_len = i_len;
f_desig = 2;
}
- } else if (desig == 1) {
+ } else if (desig == /*T10*/1) {
if (!best || f_desig == 0) {
best = bp;
best_len = i_len;
f_desig = desig;
}
- } else if (desig == 0) {
+ } else if (desig == /*vend.spec.=*/0) {
if (!best) {
best = bp;
best_len = i_len;
@@ -1108,9 +1108,10 @@ desc_from_vpd_id(int sg_fd, uint8_t *desc, int desc_len,
decode_designation_descriptor(best, best_len);
if (best_len + 4 < desc_len) {
memset(desc, 0, 32);
- desc[0] = 0xe4;
+ desc[0] = 0xe4; /* Identification Descriptor */
memcpy(desc + 4, best, best_len + 4);
- desc[4] &= 0x1f;
+ desc[4] &= 0x0f; /* code set */
+ desc[5] &= 0x3f; /* association and designator type */
if (pad)
desc[28] = 0x4;
sg_put_unaligned_be24((uint32_t)block_size, desc + 29);