aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2010-06-26 02:42:57 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2010-06-26 02:42:57 +0000
commit200de6f6a8e0e9311d76df776534696a398f239f (patch)
treea5091d3a054f0257c8446b754922dad9ad1e241f /src
parentc8f76fa4732628750e95e82f1d257ece168a2b33 (diff)
downloadsg3_utils-200de6f6a8e0e9311d76df776534696a398f239f.tar.gz
sync with spc4r25, small sg_dd+sg_ses cleanup
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@345 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'src')
-rw-r--r--src/sg_dd.c18
-rw-r--r--src/sg_inq.c2
-rw-r--r--src/sg_inq_data.c7
-rw-r--r--src/sg_ses.c14
4 files changed, 24 insertions, 17 deletions
diff --git a/src/sg_dd.c b/src/sg_dd.c
index e3b20cff..953343e6 100644
--- a/src/sg_dd.c
+++ b/src/sg_dd.c
@@ -34,7 +34,7 @@
/* A utility program for copying files. Specialised for "files" that
* represent devices that understand the SCSI command set.
*
-* Copyright (C) 1999 - 2008 D. Gilbert and P. Allworth
+* Copyright (C) 1999 - 2010 D. Gilbert and P. Allworth
* 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)
@@ -58,7 +58,7 @@
This version is designed for the linux kernel 2.4 and 2.6 series.
*/
-static char * version_str = "5.73 20090205";
+static char * version_str = "5.74 20100613";
#define ME "sg_dd: "
@@ -1650,6 +1650,7 @@ main(int argc, char * argv[])
if ((dd_count < 0) || ((verbose > 0) && (0 == dd_count))) {
in_num_sect = -1;
+ in_sect_sz = -1;
if (FT_SG & in_type) {
res = scsi_read_capacity(infd, &in_num_sect, &in_sect_sz);
if (SG_LIB_CAT_UNIT_ATTENTION == res) {
@@ -1669,8 +1670,7 @@ main(int argc, char * argv[])
else
fprintf(stderr, "Unable to read capacity on %s\n", inf);
in_num_sect = -1;
- }
- if (in_sect_sz != blk_sz)
+ } else if (in_sect_sz != blk_sz)
fprintf(stderr, ">> warning: block size on %s confusion: "
"bs=%d, device claims=%d\n", inf, blk_sz, in_sect_sz);
} else if (FT_BLOCK & in_type) {
@@ -1688,11 +1688,11 @@ main(int argc, char * argv[])
in_num_sect -= skip;
out_num_sect = -1;
+ out_sect_sz = -1;
if (FT_SG & out_type) {
res = scsi_read_capacity(outfd, &out_num_sect, &out_sect_sz);
if (SG_LIB_CAT_UNIT_ATTENTION == res) {
- fprintf(stderr,
- "Unit attention (readcap out), continuing\n");
+ fprintf(stderr, "Unit attention (readcap out), continuing\n");
res = scsi_read_capacity(outfd, &out_num_sect, &out_sect_sz);
} else if (SG_LIB_CAT_ABORTED_COMMAND == res) {
fprintf(stderr,
@@ -1706,8 +1706,7 @@ main(int argc, char * argv[])
else
fprintf(stderr, "Unable to read capacity on %s\n", outf);
out_num_sect = -1;
- }
- if (blk_sz != out_sect_sz)
+ } else if (blk_sz != out_sect_sz)
fprintf(stderr, ">> warning: block size on %s confusion: "
"bs=%d, device claims=%d\n", outf, blk_sz,
out_sect_sz);
@@ -1717,8 +1716,7 @@ main(int argc, char * argv[])
fprintf(stderr, "Unable to read block capacity on %s\n",
outf);
out_num_sect = -1;
- }
- if (blk_sz != out_sect_sz) {
+ } else if (blk_sz != out_sect_sz) {
fprintf(stderr, "block size on %s confusion: bs=%d, "
"device claims=%d\n", outf, blk_sz, out_sect_sz);
out_num_sect = -1;
diff --git a/src/sg_inq.c b/src/sg_inq.c
index 012f2de7..416d0c5d 100644
--- a/src/sg_inq.c
+++ b/src/sg_inq.c
@@ -66,7 +66,7 @@
* information [MAINTENANCE IN, service action = 0xc]; see sg_opcodes.
*/
-static char * version_str = "0.89 20100416"; /* SPC-4 rev 24 */
+static char * version_str = "0.90 20100625"; /* SPC-4 rev 25 */
#define VPD_SUPPORTED_VPDS 0x0
diff --git a/src/sg_inq_data.c b/src/sg_inq_data.c
index 1b31fd61..46355b67 100644
--- a/src/sg_inq_data.c
+++ b/src/sg_inq_data.c
@@ -39,7 +39,7 @@ struct sg_version_descriptor {
const char * name;
};
-/* table from SPC-4 revision 24 [sorted numerically (from Annex D.8)] */
+/* table from SPC-4 revision 25 [sorted numerically (from Annex D.8)] */
/* Can also be obtained from : http://www.t10.org/lists/stds.txt */
struct sg_version_descriptor sg_version_descriptor_arr[] = {
{0x0, "Version Descriptor not supported or No standard identified"},
@@ -287,6 +287,7 @@ struct sg_version_descriptor sg_version_descriptor_arr[] = {
{0xc23, "SAS-2 T10/1760-D revision 14"},
{0xc27, "SAS-2 T10/1760-D revision 15"},
{0xc28, "SAS-2 T10/1760-D revision 16"},
+ {0xc2a, "SAS-2 ANSI INCITS 457-2010"},
{0xc40, "SAS-2.1 (no version claimed)"},
{0xc48, "SAS-2.1 T10/2125-D revision 04"},
{0xd20, "FC-PH (no version claimed)"},
@@ -326,6 +327,7 @@ struct sg_version_descriptor sg_version_descriptor_arr[] = {
{0xe60, "FC-PI-3 (no version claimed)"},
{0xe62, "FC-PI-3 T11/1625-D revision 2.0"},
{0xe68, "FC-PI-3 T11/1625-D revision 2.1"},
+ {0xe6a, "FC-PI-3 T11/1625-D revision 4.0"},
{0xe80, "FC-PI-4 (no version claimed)"},
{0xe82, "FC-PI-4 T11/1647-D revision 8.0"},
{0xea0, "FC 10GFC (no version claimed)"},
@@ -341,6 +343,8 @@ struct sg_version_descriptor sg_version_descriptor_arr[] = {
{0xf03, "FC-LS-2 T11/2103-D revision 2.11"},
{0xf20, "FC-PI-5 (no version claimed)"},
{0xf27, "FC-PI-5 T11/2118-D revision 2.00"},
+ {0xf28, "FC-PI-5 T11/2118-D revision 3.00"},
+ {0xf40, "FC-PI-6 (no version claimed)"},
{0x12a0, "FC-SCM (no version claimed)"},
{0x12a3, "FC-SCM T11/1824DT revision 1.0"},
{0x12c0, "FC-DA-2 (no version claimed)"},
@@ -380,6 +384,7 @@ struct sg_version_descriptor sg_version_descriptor_arr[] = {
{0x1623, "ATA/ATAPI-8 ATA-ACS ATA/ATAPI command set (no version "
"claimed)"},
{0x1628, "ATA/ATAPI-8 ATA-AAM ANSI INCITS 451-2008"},
+ {0x162a, "ATA/ATAPI-8 ATA8-ACS ANSI INCITS 452-2009 w/ Amendment 1"},
{0x1728, "Universal Serial Bus Specification, Revision 1.1"},
{0x1729, "Universal Serial Bus Specification, Revision 2.0"},
{0x1730, "USB Mass Storage Class Bulk-Only Transport, Revision 1.0"},
diff --git a/src/sg_ses.c b/src/sg_ses.c
index 9ed1ccf3..96592dee 100644
--- a/src/sg_ses.c
+++ b/src/sg_ses.c
@@ -24,10 +24,11 @@
* commands tailored for SES (enclosure) devices.
*/
-static char * version_str = "1.47 20100312"; /* ses3r02 */
+static char * version_str = "1.48 20100610"; /* ses3r02 */
#define MX_ALLOC_LEN 4096
#define MX_ELEM_HDR 1024
+#define MX_DATA_IN 2048
#define TEMPERATURE_OFFSET 20 /* 8 bits represents -19 C to +235 C */
/* value of 0 (would imply -20 C) reserved */
@@ -1524,7 +1525,8 @@ read_hex(const char * inp, unsigned char * arr, int * arr_len)
*arr_len = 0;
}
if ('-' == inp[0]) { /* read from stdin */
- for (j = 0, off = 0; j < 512; ++j) {
+ for (j = 0, off = 0; j < MX_DATA_IN; ++j) {
+ /* limit lines read to MX_DATA_IN */
if (NULL == fgets(line, sizeof(line), stdin))
break;
in_len = strlen(line);
@@ -1550,7 +1552,7 @@ read_hex(const char * inp, unsigned char * arr, int * arr_len)
"line %d, pos %d\n", j + 1, m + k + 1);
return 1;
}
- for (k = 0; k < 1024; ++k) {
+ for (k = 0; k < (MX_DATA_IN - off); ++k) {
if (1 == sscanf(lcp, "%x", &h)) {
if (h > 0xff) {
fprintf(stderr, "read_hex: hex number "
@@ -1573,6 +1575,8 @@ read_hex(const char * inp, unsigned char * arr, int * arr_len)
}
}
off += k + 1;
+ if (off >= MX_DATA_IN)
+ break;
}
*arr_len = off;
} else { /* hex string on command line */
@@ -1582,7 +1586,7 @@ read_hex(const char * inp, unsigned char * arr, int * arr_len)
k + 1);
return 1;
}
- for (k = 0; k < 1024; ++k) {
+ for (k = 0; k < MX_DATA_IN; ++k) {
if (1 == sscanf(lcp, "%x", &h)) {
if (h > 0xff) {
fprintf(stderr, "read_hex: hex number larger "
@@ -1795,7 +1799,7 @@ main(int argc, char * argv[])
int byte1 = 0;
const char * device_name = NULL;
char buff[48];
- unsigned char data_arr[1024];
+ unsigned char data_arr[MX_DATA_IN + 16];
int arr_len = 0;
int pd_type = 0;
int ret = 0;