aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2011-02-06 15:47:05 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2011-02-06 15:47:05 +0000
commit349deaedcf2ed4d72c74c681f65466bf28869642 (patch)
tree6c94f4b27676dd4a78c88d2e5d5b907a258276d0 /src
parent5e078e06e9bf124af0edcab4d9f869322d7a2d96 (diff)
downloadsg3_utils-349deaedcf2ed4d72c74c681f65466bf28869642.tar.gz
bug fixes: sg_verify and sg_decode_sense plus other cleanup
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@376 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'src')
-rw-r--r--src/sg_decode_sense.c4
-rw-r--r--src/sg_get_lba_status.c12
-rw-r--r--src/sg_read_block_limits.c18
-rw-r--r--src/sg_start.c5
-rw-r--r--src/sg_verify.c6
5 files changed, 22 insertions, 23 deletions
diff --git a/src/sg_decode_sense.c b/src/sg_decode_sense.c
index b068418f..7ecae040 100644
--- a/src/sg_decode_sense.c
+++ b/src/sg_decode_sense.c
@@ -24,7 +24,7 @@
#include "sg_lib.h"
-static char * version_str = "1.00 20101204";
+static char * version_str = "1.01 20110202";
#define MAX_SENSE_LEN (256 + 8) /* max descriptor format currently */
@@ -185,7 +185,7 @@ static int file2hex_arr(const char * fname, unsigned char * mp_arr,
fn_len = strlen(fname);
if (0 == fn_len)
return 1;
- if ((1 == in_len) && ('-' == fname[0])) /* read from stdin */
+ if ((1 == fn_len) && ('-' == fname[0])) /* read from stdin */
fp = stdin;
else {
fp = fopen(fname, "r");
diff --git a/src/sg_get_lba_status.c b/src/sg_get_lba_status.c
index dc2f33a9..43a796d8 100644
--- a/src/sg_get_lba_status.c
+++ b/src/sg_get_lba_status.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009-2010 Douglas Gilbert.
+ * Copyright (c) 2009-2011 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.
@@ -27,7 +27,7 @@
* This program issues the SCSI GET LBA STATUS command to the given SCSI device.
*/
-static char * version_str = "1.02 20100329"; /* sbc2r22 */
+static char * version_str = "1.03 20110204"; /* sbc2r22 */
#define MAX_GLBAS_BUFF_LEN (1024 * 1024)
#define DEF_GLBAS_BUFF_LEN 24
@@ -280,8 +280,8 @@ main(int argc, char * argv[])
"descriptor:\n" " descriptor LBA: 0x");
for (j = 0; j < 8; ++j)
fprintf(stderr, "%02x", glbasBuffp[8 + j]);
- fprintf(stderr, " blocks: 0x%x p_status: %d\n", d_blocks,
- res);
+ fprintf(stderr, " blocks: 0x%x p_status: %d\n",
+ (unsigned int)d_blocks, res);
ret = SG_LIB_CAT_OTHER;
goto the_end;
}
@@ -306,12 +306,12 @@ main(int argc, char * argv[])
printf("0x");
for (j = 0; j < 8; ++j)
printf("%02x", ucp[j]);
- printf(" 0x%x %d\n", d_blocks, res);
+ printf(" 0x%x %d\n", (unsigned int)d_blocks, res);
} else {
printf("descriptor LBA: 0x");
for (j = 0; j < 8; ++j)
printf("%02x", ucp[j]);
- printf(" blocks: %d", d_blocks);
+ printf(" blocks: %u", (unsigned int)d_blocks);
switch (res) {
case 0:
printf(" mapped\n");
diff --git a/src/sg_read_block_limits.c b/src/sg_read_block_limits.c
index 8669065c..0f467a2e 100644
--- a/src/sg_read_block_limits.c
+++ b/src/sg_read_block_limits.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009-2010 Douglas Gilbert.
+ * Copyright (c) 2009-2011 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.
@@ -28,7 +28,7 @@
* SCSI device.
*/
-static char * version_str = "1.01 20100312";
+static char * version_str = "1.02 20110204";
#define MAX_READ_BLOCK_LIMITS_LEN 6
@@ -59,7 +59,7 @@ usage()
" --verbose|-v increase verbosity\n"
" --version|-V print version string and exit\n\n"
"Performs a SCSI READ BLOCK LIMITS command and decode the "
- "response\n"
+ "response\n"
);
}
@@ -156,20 +156,20 @@ main(int argc, char * argv[])
}
max_block_size = (readBlkLmtBuff[0] << 24) +
- (readBlkLmtBuff[1] << 16) +
- (readBlkLmtBuff[2] << 8) + readBlkLmtBuff[3];
+ (readBlkLmtBuff[1] << 16) +
+ (readBlkLmtBuff[2] << 8) + readBlkLmtBuff[3];
min_block_size = (readBlkLmtBuff[4] << 8) + readBlkLmtBuff[5];
k = min_block_size / 1024;
fprintf(stderr, "Read Block Limits results:\n");
- fprintf(stderr, "\tMinimum block size: %d byte(s)",
- (int)min_block_size);
+ fprintf(stderr, "\tMinimum block size: %u byte(s)",
+ (unsigned int)min_block_size);
if (k != 0)
fprintf(stderr, ", %d KB", k);
fprintf(stderr, "\n");
k = max_block_size / 1024;
m = max_block_size / 1048576;
- fprintf(stderr, "\tMaximum block size: %d byte(s)",
- max_block_size);
+ fprintf(stderr, "\tMaximum block size: %u byte(s)",
+ (unsigned int)max_block_size);
if (k != 0)
fprintf(stderr, ", %d KB", k);
if (m != 0)
diff --git a/src/sg_start.c b/src/sg_start.c
index 87af1865..df037d21 100644
--- a/src/sg_start.c
+++ b/src/sg_start.c
@@ -12,7 +12,7 @@
#include "sg_cmds_basic.h"
/*
- * Copyright (C) 1999-2010 D. Gilbert
+ * Copyright (C) 1999-2011 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)
@@ -30,7 +30,7 @@
*/
-static char * version_str = "0.57 20080325"; /* sbc3r14; mmc6r01a */
+static char * version_str = "0.58 20110129"; /* sbc3r14; mmc6r01a */
static struct option long_options[] = {
{"eject", 0, 0, 'e'},
@@ -97,7 +97,6 @@ usage()
"(def: 0) (sbc)\n"
" --noflush|-n no flush prior to operation that limits "
"access (sbc)\n"
- " --load|-l load medium then start the unit\n"
" --pc=PC|-p PC power condition: 0 (default) -> no "
"power condition,\n"
" 1 -> active, 2 -> idle, 3 -> standby, "
diff --git a/src/sg_verify.c b/src/sg_verify.c
index c1747485..0ae803e8 100644
--- a/src/sg_verify.c
+++ b/src/sg_verify.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004-2008 Douglas Gilbert.
+ * Copyright (c) 2004-2011 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.
@@ -26,7 +26,7 @@
* This program issues the SCSI VERIFY command to the given SCSI block device.
*/
-static char * version_str = "1.13 20100312";
+static char * version_str = "1.14 20110206";
#define ME "sg_verify: "
@@ -217,7 +217,7 @@ main(int argc, char * argv[])
break;
case SG_LIB_CAT_MEDIUM_HARD_WITH_INFO:
fprintf(stderr, "medium or hardware error, reported "
- "lba=0x%u\n", info);
+ "lba=0x%x\n", info);
break;
default:
fprintf(stderr, "Verify(10) failed near lba=%" PRIu64