aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2014-07-10 16:59:45 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2014-07-10 16:59:45 +0000
commitddc4b6d7953970648dddaa03c7a28af13c5efb4e (patch)
tree52799af34a29545f0b727a275117f0162c9c0bc4 /src
parent2886948eff187f1000df449f07fb5d8d350cb1fa (diff)
downloadsg3_utils-ddc4b6d7953970648dddaa03c7a28af13c5efb4e.tar.gz
sg_format: make '-FFF' bypass mode sense/select, add --mode=MP; trim trailing spaces in dStrHex() and friends; add examples/sg_tst_async
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@591 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'src')
-rw-r--r--src/sg_format.c72
-rw-r--r--src/sg_inq.c29
-rw-r--r--src/sg_modes.c151
-rw-r--r--src/sg_vpd.c3
4 files changed, 144 insertions, 111 deletions
diff --git a/src/sg_format.c b/src/sg_format.c
index e84846ed..2d4effa7 100644
--- a/src/sg_format.c
+++ b/src/sg_format.c
@@ -13,23 +13,8 @@
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
- * http://www.t10.org/scsi-3.htm
- * http://www.tldp.org/HOWTO/SCSI-Generic-HOWTO
- *
- *
- * List of some (older) disk manufacturers' block counts.
- * These are not needed in newer disks which will automatically use
- * the manufacturers' recommended block count if a count of -1 is given.
- * Inquiry Block Count (@512 byte blocks)
- * ST150150N 8388315
- * IBM_DCHS04F 8888543
- * IBM_DGHS09Y 17916240
- * ST336704FC 71132960
- * ST318304FC 35145034 (Factory spec is 35885167 sectors)
- * ST336605FC ???
- * ST336753FC 71132960 (Factory spec is 71687372 sectors)
- * and a newer one:
- * ST33000650SS 5860533168 (3 TB SAS disk)
+ * See http://www.t10.org for relevant standards and drafts. The most recent
+ * draft is SBC-4 revision 2.
*/
#include <stdio.h>
@@ -47,13 +32,10 @@
#include "sg_cmds_basic.h"
#include "sg_cmds_extra.h"
-static const char * version_str = "1.26 20140516";
+static const char * version_str = "1.28 20140704";
-#define RW_ERROR_RECOVERY_PAGE 1 /* every disk should have one */
-#define FORMAT_DEV_PAGE 3 /* Format Device Mode Page [now obsolete] */
-#define CONTROL_MODE_PAGE 0xa /* alternative page all devices have?? */
-#define THIS_MPAGE_EXISTS RW_ERROR_RECOVERY_PAGE
+#define RW_ERROR_RECOVERY_PAGE 1 /* can give alternate with --mode=MP */
#define SHORT_TIMEOUT 20 /* 20 seconds unless --wait given */
#define FORMAT_TIMEOUT (20 * 3600) /* 20 hours ! */
@@ -88,6 +70,7 @@ static struct option long_options[] = {
{"help", no_argument, 0, 'h'},
{"ip_def", no_argument, 0, 'I'},
{"long", no_argument, 0, 'l'},
+ {"mode", required_argument, 0, 'M'},
{"pinfo", no_argument, 0, 'p'},
{"pfu", required_argument, 0, 'P'},
{"pie", required_argument, 0, 'q'},
@@ -111,19 +94,19 @@ usage()
"[--early]\n"
" [--fmtpinfo=FPI] [--format] [--help] "
"[--ip_def] [--long]\n"
- " [--pfu=PFU] [--pie=PIE] [--pinfo] "
- "[--poll=PT] [--resize]\n"
- " [--rto_req] [--security] [--six] "
- "[--size=SIZE] [--verbose]\n"
- " [--version] [--wait] DEVICE\n"
+ " [--mode=MP] [--pfu=PFU] [--pie=PIE] "
+ "[--pinfo] [--poll=PT]\n"
+ " [--resize] [--rto_req] [--security] "
+ "[--six] [--size=SIZE]\n"
+ " [--verbose] [--version] [--wait] DEVICE\n"
" where:\n"
" --cmplst=0|1\n"
" -C 0|1 sets CMPLST bit in format cdb "
"(default: 1)\n"
- " --count=COUNT|-c COUNT number of blocks to "
- "report after format or\n"
- " resize. With format "
- "defaults to same as current\n"
+ " --count=COUNT|-c COUNT number of blocks to report "
+ "after format or\n"
+ " resize. Format default is "
+ "same as current\n"
" --dcrt|-D disable certification (doesn't "
"verify media)\n"
" --early|-e exit once format started (user can "
@@ -132,12 +115,14 @@ usage()
"(default: 0)\n"
" --format|-F format unit (default: report current "
"count and size)\n"
+ " use thrice for FORMAT UNIT command "
+ "only\n"
" --help|-h prints out this usage message\n"
" --ip_def|-I initialization pattern: default\n"
" --long|-l allow for 64 bit lbas (default: assume "
"32 bit lbas)\n"
- " --pfu=PFU|-P PFU Protection Field Usage value "
- "(default: 0)\n"
+ " --mode=MP|-M MP mode page (def: 1 -> RW error "
+ "recovery mpage)\n"
" --pie=PIE|-q PIE Protection Information Exponent "
"(default: 0)\n"
" --pinfo|-p set upper bit of FMTPINFO field\n"
@@ -397,7 +382,7 @@ print_read_cap(int fd, int do_16, int verbose)
int
main(int argc, char **argv)
{
- const int mode_page = THIS_MPAGE_EXISTS; /* hopefully */
+ int mode_page = RW_ERROR_RECOVERY_PAGE;
int fd, res, calc_len, bd_len, dev_specific_param;
int offset, j, bd_blk_len, prob, len;
uint64_t ull;
@@ -431,7 +416,7 @@ main(int argc, char **argv)
int option_index = 0;
int c;
- c = getopt_long(argc, argv, "c:C:Def:FhIlpP:q:rRs:SvVwx:6",
+ c = getopt_long(argc, argv, "c:C:Def:FhIlM:pP:q:rRs:SvVwx:6",
long_options, &option_index);
if (c == -1)
break;
@@ -473,7 +458,7 @@ main(int argc, char **argv)
}
break;
case 'F':
- format = 1;
+ ++format;
break;
case 'h':
usage();
@@ -485,6 +470,14 @@ main(int argc, char **argv)
long_lba = 1;
do_rcap16 = 1;
break;
+ case 'M':
+ mode_page = sg_get_num(optarg);
+ if ((mode_page < 0) || ( mode_page > 62)) {
+ fprintf(stderr, "bad argument to '--mode', "
+ "accepts 0 to 62 inclusive\n");
+ return SG_LIB_SYNTAX_ERROR;
+ }
+ break;
case 'p':
pinfo = 1;
break;
@@ -603,6 +596,9 @@ main(int argc, char **argv)
return SG_LIB_FILE_ERROR;
}
+ if (format > 2)
+ goto format_only;
+
if (sg_simple_inquiry(fd, &inq_out, 1, verbose)) {
fprintf(stderr, "%s doesn't respond to a SCSI INQUIRY\n",
device_name);
@@ -835,7 +831,8 @@ again_with_long_lba:
goto out;
}
- if (format)
+ if (format) {
+format_only:
#if 1
printf("\nA FORMAT will commence in 15 seconds\n");
printf(" ALL data on %s will be DESTROYED\n", device_name);
@@ -861,6 +858,7 @@ again_with_long_lba:
#else
fprintf(stderr, "FORMAT ignored, testing\n");
#endif
+ }
out:
res = sg_cmds_close_device(fd);
diff --git a/src/sg_inq.c b/src/sg_inq.c
index 3d83ba41..b9591a51 100644
--- a/src/sg_inq.c
+++ b/src/sg_inq.c
@@ -41,7 +41,7 @@
#include "sg_cmds_basic.h"
#include "sg_pt.h"
-static const char * version_str = "1.39 20140527"; /* SPC-4 rev 37 */
+static const char * version_str = "1.40 20140704"; /* SPC-4 rev 37 */
/* INQUIRY notes:
* It is recommended that the initial allocation length given to a
@@ -2274,11 +2274,15 @@ decode_power_condition(unsigned char * buff, int len, int do_hex)
(buff[16] << 8) + buff[17]);
}
+/* VPD_BLOCK_LIMITS sbc */
+/* Sequential access device characteristics, ssc+smc */
+/* OSD information, osd */
static void
decode_b0_vpd(unsigned char * buff, int len, int do_hex)
{
- int pdt;
+ int pdt, m;
unsigned int u;
+ uint64_t mwsl;
if (do_hex) {
dStrHex((const char *)buff, len, (1 == do_hex) ? 0 : -1);
@@ -2325,6 +2329,27 @@ decode_b0_vpd(unsigned char * buff, int len, int do_hex)
(buff[33] << 16) | (buff[34] << 8) | buff[35];
printf(" Unmap granularity alignment: %u\n", u);
}
+ if (len > 43) { /* added in sbc3r26 */
+ mwsl = 0;
+ for (m = 0; m < 8; ++m) {
+ if (m > 0)
+ mwsl <<= 8;
+ mwsl |= buff[36 + m];
+ }
+ printf(" Maximum write same length: 0x%" PRIx64 " blocks\n",
+ mwsl);
+ }
+ if (len > 44) { /* added in sbc4r02 */
+ u = ((unsigned int)buff[44] << 24) | (buff[45] << 16) |
+ (buff[46] << 8) | buff[47];
+ printf(" Maximum atomic transfer length: %u\n", u);
+ u = ((unsigned int)buff[48] << 24) | (buff[49] << 16) |
+ (buff[50] << 8) | buff[51];
+ printf(" Atomic alignment: %u\n", u);
+ u = ((unsigned int)buff[52] << 24) | (buff[53] << 16) |
+ (buff[54] << 8) | buff[55];
+ printf(" Atomic transfer length granularity: %u\n", u);
+ }
break;
case PDT_TAPE: case PDT_MCHANGER:
printf(" WORM=%d\n", !!(buff[4] & 0x1));
diff --git a/src/sg_modes.c b/src/sg_modes.c
index 70335fb0..289af997 100644
--- a/src/sg_modes.c
+++ b/src/sg_modes.c
@@ -15,6 +15,7 @@
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
+#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include <getopt.h>
@@ -25,7 +26,7 @@
#include "sg_lib.h"
#include "sg_cmds_basic.h"
-static const char * version_str = "1.43 20140514";
+static const char * version_str = "1.44 20140708";
#define DEF_ALLOC_LEN (1024 * 4)
#define DEF_6_ALLOC_LEN 252
@@ -84,6 +85,28 @@ struct opts_t {
int opt_new;
};
+
+#ifdef __GNUC__
+static int pr2serr(const char * fmt, ...)
+ __attribute__ ((format (printf, 1, 2)));
+#else
+static int pr2serr(const char * fmt, ...);
+#endif
+
+
+static int
+pr2serr(const char * fmt, ...)
+{
+ va_list args;
+ int n;
+
+ va_start(args, fmt);
+ n = vfprintf(stderr, fmt, args);
+ va_end(args);
+ return n;
+}
+
+
static void
usage()
{
@@ -212,7 +235,7 @@ process_cl_new(struct opts_t * op, int argc, char * argv[])
case 'c':
n = sg_get_num(optarg);
if ((n < 0) || (n > 3)) {
- fprintf(stderr, "bad argument to '--control='\n");
+ pr2serr("bad argument to '--control='\n");
usage();
return SG_LIB_SYNTAX_ERROR;
}
@@ -246,7 +269,7 @@ process_cl_new(struct opts_t * op, int argc, char * argv[])
case 'm':
n = sg_get_num(optarg);
if ((n < 0) || (n > 65535)) {
- fprintf(stderr, "bad argument to '--maxlen='\n");
+ pr2serr("bad argument to '--maxlen='\n");
usage();
return SG_LIB_SYNTAX_ERROR;
}
@@ -261,15 +284,14 @@ process_cl_new(struct opts_t * op, int argc, char * argv[])
cp = strchr(optarg, ',');
n = sg_get_num_nomult(optarg);
if ((n < 0) || (n > 63)) {
- fprintf(stderr, "Bad argument to '--page='\n");
+ pr2serr("Bad argument to '--page='\n");
usage();
return SG_LIB_SYNTAX_ERROR;
}
if (cp) {
nn = sg_get_num_nomult(cp + 1);
if ((nn < 0) || (nn > 255)) {
- fprintf(stderr, "Bad second value in argument to "
- "'--page='\n");
+ pr2serr("Bad second value in argument to '--page='\n");
usage();
return SG_LIB_SYNTAX_ERROR;
}
@@ -295,7 +317,7 @@ process_cl_new(struct opts_t * op, int argc, char * argv[])
++op->do_version;
break;
default:
- fprintf(stderr, "unrecognised option code %c [0x%x]\n", c, c);
+ pr2serr("unrecognised option code %c [0x%x]\n", c, c);
if (op->do_help)
break;
usage();
@@ -309,7 +331,7 @@ process_cl_new(struct opts_t * op, int argc, char * argv[])
}
if (optind < argc) {
for (; optind < argc; ++optind)
- fprintf(stderr, "Unexpected extra argument: %s\n",
+ pr2serr("Unexpected extra argument: %s\n",
argv[optind]);
usage();
return SG_LIB_SYNTAX_ERROR;
@@ -395,7 +417,7 @@ process_cl_old(struct opts_t * op, int argc, char * argv[])
if (0 == strncmp("c=", cp, 2)) {
num = sscanf(cp + 2, "%x", &u);
if ((1 != num) || (u > 3)) {
- fprintf(stderr, "Bad page control after 'c=' option\n");
+ pr2serr("Bad page control after 'c=' option\n");
usage_old();
return SG_LIB_SYNTAX_ERROR;
}
@@ -403,7 +425,7 @@ process_cl_old(struct opts_t * op, int argc, char * argv[])
} else if (0 == strncmp("m=", cp, 2)) {
num = sscanf(cp + 2, "%d", &n);
if ((1 != num) || (n < 0) || (n > 65535)) {
- fprintf(stderr, "Bad argument after 'm=' option\n");
+ pr2serr("Bad argument after 'm=' option\n");
usage_old();
return SG_LIB_SYNTAX_ERROR;
}
@@ -412,16 +434,14 @@ process_cl_old(struct opts_t * op, int argc, char * argv[])
if (NULL == strchr(cp + 2, ',')) {
num = sscanf(cp + 2, "%x", &u);
if ((1 != num) || (u > 63)) {
- fprintf(stderr, "Bad page code value after 'p=' "
- "option\n");
+ pr2serr("Bad page code value after 'p=' option\n");
usage_old();
return SG_LIB_SYNTAX_ERROR;
}
op->pg_code = u;
} else if (2 == sscanf(cp + 2, "%x,%x", &u, &uu)) {
if (uu > 255) {
- fprintf(stderr, "Bad sub page code value after 'p=' "
- "option\n");
+ pr2serr("Bad subpage code value after 'p=' option\n");
usage_old();
return SG_LIB_SYNTAX_ERROR;
}
@@ -429,16 +449,15 @@ process_cl_old(struct opts_t * op, int argc, char * argv[])
op->subpg_code = uu;
op->subpg_code_set = 1;
} else {
- fprintf(stderr, "Bad page code, subpage code sequence "
- "after 'p=' option\n");
+ pr2serr("Bad page code, subpage code sequence after 'p=' "
+ "option\n");
usage_old();
return SG_LIB_SYNTAX_ERROR;
}
} else if (0 == strncmp("subp=", cp, 5)) {
num = sscanf(cp + 5, "%x", &u);
if ((1 != num) || (u > 255)) {
- fprintf(stderr, "Bad sub page code after 'subp=' "
- "option\n");
+ pr2serr("Bad sub page code after 'subp=' option\n");
usage_old();
return SG_LIB_SYNTAX_ERROR;
}
@@ -449,15 +468,15 @@ process_cl_old(struct opts_t * op, int argc, char * argv[])
} else if (0 == strncmp("-old", cp, 4))
;
else if (jmp_out) {
- fprintf(stderr, "Unrecognized option: %s\n", cp);
+ pr2serr("Unrecognized option: %s\n", cp);
usage_old();
return SG_LIB_SYNTAX_ERROR;
}
} else if (0 == op->device_name)
op->device_name = cp;
else {
- fprintf(stderr, "too many arguments, got: %s, not expecting: "
- "%s\n", op->device_name, cp);
+ pr2serr("too many arguments, got: %s, not expecting: %s\n",
+ op->device_name, cp);
usage_old();
return SG_LIB_SYNTAX_ERROR;
}
@@ -868,22 +887,22 @@ examine_pages(int sg_fd, int inq_pdt, int inq_byte6,
res = sg_ll_mode_sense6(sg_fd, 0, 0, k, 0, rbuf, mresp_len,
1, op->do_verbose);
if (SG_LIB_CAT_INVALID_OP == res) {
- fprintf(stderr, ">>>>>> try again without the '-6' "
- "switch for a 10 byte MODE SENSE command\n");
+ pr2serr(">>>>>> try again without the '-6' switch for a 10 "
+ "byte MODE SENSE command\n");
return res;
} else if (SG_LIB_CAT_NOT_READY == res) {
- fprintf(stderr, "MODE SENSE (6) failed, device not ready\n");
+ pr2serr("MODE SENSE (6) failed, device not ready\n");
return res;
}
} else {
res = sg_ll_mode_sense10(sg_fd, 0, 0, 0, k, 0, rbuf, mresp_len,
1, op->do_verbose);
if (SG_LIB_CAT_INVALID_OP == res) {
- fprintf(stderr, ">>>>>> try again with a '-6' "
- "switch for a 6 byte MODE SENSE command\n");
+ pr2serr(">>>>>> try again with a '-6' switch for a 6 byte "
+ "MODE SENSE command\n");
return res;
} else if (SG_LIB_CAT_NOT_READY == res) {
- fprintf(stderr, "MODE SENSE (10) failed, device not ready\n");
+ pr2serr("MODE SENSE (10) failed, device not ready\n");
return res;
}
}
@@ -911,8 +930,8 @@ examine_pages(int sg_fd, int inq_pdt, int inq_byte6,
char b[80];
sg_get_category_sense_str(res, sizeof(b), b, op->do_verbose - 1);
- fprintf(stderr, "MODE SENSE (%s) failed: %s\n",
- (op->do_six ? "6" : "10"), b);
+ pr2serr("MODE SENSE (%s) failed: %s\n", (op->do_six ? "6" : "10"),
+ b);
}
}
return res;
@@ -958,7 +977,7 @@ main(int argc, char * argv[])
return 0;
}
if (op->do_version) {
- fprintf(stderr, "Version string: %s\n", version_str);
+ pr2serr("Version string: %s\n", version_str);
return 0;
}
@@ -978,34 +997,31 @@ main(int argc, char * argv[])
}
return 0;
}
- fprintf(stderr, "No DEVICE argument given\n");
+ pr2serr("No DEVICE argument given\n");
usage_for(op);
return SG_LIB_SYNTAX_ERROR;
}
if (op->do_examine && (op->pg_code >= 0)) {
- fprintf(stderr, "can't give '-e' and a page number\n");
+ pr2serr("can't give '-e' and a page number\n");
return SG_LIB_SYNTAX_ERROR;
}
if ((op->do_six) && (op->do_llbaa)) {
- fprintf(stderr, "LLBAA not defined for MODE SENSE 6, try "
- "without '-L'\n");
+ pr2serr("LLBAA not defined for MODE SENSE 6, try without '-L'\n");
return SG_LIB_SYNTAX_ERROR;
}
if (op->maxlen > 0) {
if (op->do_six && (op->maxlen > 255)) {
- fprintf(stderr, "For Mode Sense (6) maxlen cannot exceed "
- "255\n");
+ pr2serr("For Mode Sense (6) maxlen cannot exceed 255\n");
return SG_LIB_SYNTAX_ERROR;
}
if (op->maxlen > DEF_ALLOC_LEN) {
malloc_rsp_buff = (unsigned char *)malloc(op->maxlen);
if (NULL == malloc_rsp_buff) {
- fprintf(stderr, "Unable to malloc maxlen=%d bytes\n",
- op->maxlen);
+ pr2serr("Unable to malloc maxlen=%d bytes\n", op->maxlen);
return SG_LIB_SYNTAX_ERROR;
- }
+ }
rsp_buff = malloc_rsp_buff;
} else
rsp_buff = def_rsp_buff;
@@ -1027,16 +1043,15 @@ main(int argc, char * argv[])
if ((sg_fd = sg_cmds_open_device(op->device_name, 1 /* ro */,
op->do_verbose)) < 0) {
- fprintf(stderr, "error opening file: %s: %s\n",
- op->device_name, safe_strerror(-sg_fd));
+ pr2serr("error opening file: %s: %s\n", op->device_name,
+ safe_strerror(-sg_fd));
if (malloc_rsp_buff)
free(malloc_rsp_buff);
return SG_LIB_FILE_ERROR;
}
if (sg_simple_inquiry(sg_fd, &inq_out, 1, op->do_verbose)) {
- fprintf(stderr, "%s doesn't respond to a SCSI INQUIRY\n",
- op->device_name);
+ pr2serr("%s doesn't respond to a SCSI INQUIRY\n", op->device_name);
ret = SG_LIB_CAT_OTHER;
goto finish;
}
@@ -1068,11 +1083,9 @@ main(int argc, char * argv[])
if (op->do_raw > 1) {
if (op->do_all) {
if (op->opt_new)
- fprintf(stderr, "'-R' requires a specific (sub)page, not "
- "all\n");
+ pr2serr("'-R' requires a specific (sub)page, not all\n");
else
- fprintf(stderr, "'-r' requires a specific (sub)page, not "
- "all\n");
+ pr2serr("'-r' requires a specific (sub)page, not all\n");
usage_for(op);
ret = SG_LIB_SYNTAX_ERROR;
goto finish;
@@ -1085,30 +1098,30 @@ main(int argc, char * argv[])
op->pg_code, op->subpg_code, rsp_buff,
rsp_buff_size, 1, op->do_verbose);
if (SG_LIB_CAT_INVALID_OP == res)
- fprintf(stderr, ">>>>>> try again without the '-6' "
- "switch for a 10 byte MODE SENSE command\n");
+ pr2serr(">>>>>> try again without the '-6' switch for a 10 byte "
+ "MODE SENSE command\n");
} else {
res = sg_ll_mode_sense10(sg_fd, op->do_llbaa, op->do_dbd,
op->page_control, op->pg_code,
op->subpg_code, rsp_buff, rsp_buff_size,
1, op->do_verbose);
if (SG_LIB_CAT_INVALID_OP == res)
- fprintf(stderr, ">>>>>> try again with a '-6' "
- "switch for a 6 byte MODE SENSE command\n");
+ pr2serr(">>>>>> try again with a '-6' switch for a 6 byte MODE "
+ "SENSE command\n");
}
if (SG_LIB_CAT_ILLEGAL_REQ == res) {
if (op->subpg_code > 0)
- fprintf(stderr, "invalid field in cdb (perhaps subpages "
- "not supported)\n");
+ pr2serr("invalid field in cdb (perhaps subpages not "
+ "supported)\n");
else if (op->page_control > 0)
- fprintf(stderr, "invalid field in cdb (perhaps "
- "page control (PC) not supported)\n");
+ pr2serr("invalid field in cdb (perhaps page control (PC) not "
+ "supported)\n");
else
- fprintf(stderr, "invalid field in cdb (perhaps "
- "page 0x%x not supported)\n", op->pg_code);
+ pr2serr("invalid field in cdb (perhaps page 0x%x not "
+ "supported)\n", op->pg_code);
} else if (res) {
sg_get_category_sense_str(res, sizeof(b), b, op->do_verbose);
- fprintf(stderr, "%s\n", b);
+ pr2serr("%s\n", b);
}
ret = res;
if (0 == res) {
@@ -1125,8 +1138,8 @@ main(int argc, char * argv[])
(0 == rsp_buff[5]) && (0 == rsp_buff[6])) {
rsp_buff[1] = num;
rsp_buff[0] = 0;
- fprintf(stderr, ">>> msense(10) but resp[0]=%d and "
- "not msense(6) response so fix length\n", num);
+ pr2serr(">>> msense(10) but resp[0]=%d and not msense(6) "
+ "response so fix length\n", num);
} else
resp_mode6 = 1;
}
@@ -1156,8 +1169,7 @@ main(int argc, char * argv[])
longlba = rsp_buff[4] & 1;
}
if ((bd_len + headerlen) > md_len) {
- fprintf(stderr, "Invalid block descriptor length=%d, ignore\n",
- bd_len);
+ pr2serr("Invalid block descriptor length=%d, ignore\n", bd_len);
bd_len = 0;
}
if (op->do_raw) {
@@ -1230,8 +1242,8 @@ main(int argc, char * argv[])
for (k = 0; md_len > 0; ++k) { /* got mode page(s) */
if ((k > 0) && (! op->do_all) &&
(SPG_CODE_ALL != op->subpg_code)) {
- fprintf(stderr, "Unexpectedly received extra mode page "
- "responses, ignore\n");
+ pr2serr("Unexpectedly received extra mode page responses, "
+ "ignore\n");
break;
}
uc = *ucp;
@@ -1241,10 +1253,9 @@ main(int argc, char * argv[])
if (0x0 == page_num) {
++num_ua_pages;
if((num_ua_pages > 3) && (md_len > 0xa00)) {
- fprintf(stderr, ">>> Seen 3 unit attention pages "
- "(only one should be at end)\n and mpage "
- "length=%d, looks malformed, try '-f' option\n",
- md_len);
+ pr2serr(">>> Seen 3 unit attention pages (only one "
+ "should be at end)\n and mpage length=%d, "
+ "looks malformed, try '-f' option\n", md_len);
break;
}
}
@@ -1281,8 +1292,8 @@ main(int argc, char * argv[])
num = (len > md_len) ? md_len : len;
if ((k > 0) && (num > 256)) {
num = 256;
- fprintf(stderr, ">>> page length (%d) > 256 bytes, unlikely "
- "trim\n Try '-f' option\n", len);
+ pr2serr(">>> page length (%d) > 256 bytes, unlikely trim\n"
+ " Try '-f' option\n", len);
}
dStrHex((const char *)ucp, num , 1);
ucp += len;
diff --git a/src/sg_vpd.c b/src/sg_vpd.c
index c363dc51..508d6bd3 100644
--- a/src/sg_vpd.c
+++ b/src/sg_vpd.c
@@ -33,8 +33,7 @@
*/
-static const char * version_str = "0.87 20140529"; /* spc4r37 + sbc4r01 */
- /* And with sbc3r35, vale Mark Evans */
+static const char * version_str = "0.88 20140704"; /* spc4r37 + sbc4r02 */
void svpd_enumerate_vendor(int vp_num);
int svpd_count_vendor_vpds(int num_vpd, int vp_num);