aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2013-06-04 20:33:26 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2013-06-04 20:33:26 +0000
commit5667f0c5f1da0038ea9afe75b098fe632c857bc0 (patch)
tree33aee328ac9213c59893213c9c5bdbe3248e29c9
parentdac0bec87054e0a862033d9304c45c9ecbe248c6 (diff)
downloadsg3_utils-5667f0c5f1da0038ea9afe75b098fe632c857bc0.tar.gz
sg_compare_and_write: fix wrprotect bug
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@498 6180dd3e-e324-4e3e-922d-17de1ae2f315
-rw-r--r--ChangeLog3
-rwxr-xr-xconfigure20
-rw-r--r--configure.ac2
-rw-r--r--debian/changelog6
-rw-r--r--doc/sg3_utils.82
-rw-r--r--lib/Makefile.am8
-rw-r--r--lib/Makefile.in5
-rw-r--r--lib/sg_lib.c4
-rw-r--r--lib/sg_lib_data.c2
-rw-r--r--sg3_utils.spec6
-rw-r--r--src/Makefile.am6
-rw-r--r--src/Makefile.in4
-rw-r--r--src/sg_compare_and_write.c50
-rw-r--r--src/sg_dd.c96
-rw-r--r--src/sg_ident.c11
-rw-r--r--src/sg_modes.c4
-rw-r--r--src/sg_persist.c24
-rw-r--r--src/sg_rbuf.c6
-rw-r--r--src/sg_read.c18
-rw-r--r--src/sg_sanitize.c4
-rw-r--r--src/sg_write_same.c4
-rw-r--r--src/sg_xcopy.c32
-rw-r--r--src/sginfo.c12
-rw-r--r--src/sgm_dd.c32
-rw-r--r--src/sgp_dd.c28
25 files changed, 212 insertions, 177 deletions
diff --git a/ChangeLog b/ChangeLog
index be00bd8e..6254e59f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,9 @@ 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.37 [20130604] [svn: r498]
+ - sg_compare_and_write: fix wrprotect setting
+
Changelog for sg3_utils-1.36 [20130531] [svn: r497]
- sg_vpd: Protocol-specific port information VPD page
for SAS SSP, persistent connection (spl3r2), power
diff --git a/configure b/configure
index d3348e8c..975ad0e9 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for sg3_utils 1.36.
+# Generated by GNU Autoconf 2.69 for sg3_utils 1.37.
#
# Report bugs to <dgilbert@interlog.com>.
#
@@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='sg3_utils'
PACKAGE_TARNAME='sg3_utils'
-PACKAGE_VERSION='1.36'
-PACKAGE_STRING='sg3_utils 1.36'
+PACKAGE_VERSION='1.37'
+PACKAGE_STRING='sg3_utils 1.37'
PACKAGE_BUGREPORT='dgilbert@interlog.com'
PACKAGE_URL=''
@@ -1325,7 +1325,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures sg3_utils 1.36 to adapt to many kinds of systems.
+\`configure' configures sg3_utils 1.37 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1395,7 +1395,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of sg3_utils 1.36:";;
+ short | recursive ) echo "Configuration of sg3_utils 1.37:";;
esac
cat <<\_ACEOF
@@ -1502,7 +1502,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-sg3_utils configure 1.36
+sg3_utils configure 1.37
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1780,7 +1780,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by sg3_utils $as_me 1.36, which was
+It was created by sg3_utils $as_me 1.37, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2596,7 +2596,7 @@ fi
# Define the identity of the package.
PACKAGE='sg3_utils'
- VERSION='1.36'
+ VERSION='1.37'
cat >>confdefs.h <<_ACEOF
@@ -12118,7 +12118,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by sg3_utils $as_me 1.36, which was
+This file was extended by sg3_utils $as_me 1.37, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -12184,7 +12184,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-sg3_utils config.status 1.36
+sg3_utils config.status 1.37
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index 5f50fa61..5e518469 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT(sg3_utils, 1.36, dgilbert@interlog.com)
+AC_INIT(sg3_utils, 1.37, dgilbert@interlog.com)
AM_INIT_AUTOMAKE
AM_MAINTAINER_MODE
diff --git a/debian/changelog b/debian/changelog
index 7f8c50c3..63357d47 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+sg3-utils (1.37-0.1) unstable; urgency=low
+
+ * New upstream version
+
+ -- Douglas Gilbert <dgilbert@interlog.com> Mon, 03 Jun 2013 16:00:00 -0400
+
sg3-utils (1.36-0.1) unstable; urgency=low
* New upstream version
diff --git a/doc/sg3_utils.8 b/doc/sg3_utils.8
index 497425d6..d8518ac1 100644
--- a/doc/sg3_utils.8
+++ b/doc/sg3_utils.8
@@ -1,4 +1,4 @@
-.TH SG3_UTILS "8" "May 2013" "sg3_utils\-1.36" SG3_UTILS
+.TH SG3_UTILS "8" "June 2013" "sg3_utils\-1.37" SG3_UTILS
.SH NAME
sg3_utils \- a package of utilities for sending SCSI commands
.SH SYNOPSIS
diff --git a/lib/Makefile.am b/lib/Makefile.am
index f23668f9..18f57dd9 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -138,12 +138,14 @@ EXTRA_libsgutils2_la_SOURCES = \
endif
-# For C++ testing
-# CC = g++
+# For C++/clang testing
+## CC = g++ -std=c++11
+## CC = g++
+## CC = clang
# -std=<s> can be c99, c11, gnu11, etc. Default is gnu89 (gnu90 is the same)
AM_CFLAGS = -I ../include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -W
-# AM_CFLAGS = -I ../include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -W -pedantic -std=c99
+# AM_CFLAGS = -I ../include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -W -pedantic -std=c11
lib_LTLIBRARIES = libsgutils2.la
diff --git a/lib/Makefile.in b/lib/Makefile.in
index f315a8b9..41c057fd 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -397,12 +397,11 @@ top_srcdir = @top_srcdir@
@OS_WIN32_MINGW_TRUE@ getopt_long.c
-# For C++ testing
-# CC = g++
+# For C++/clang testing
# -std=<s> can be c99, c11, gnu11, etc. Default is gnu89 (gnu90 is the same)
AM_CFLAGS = -I ../include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -W
-# AM_CFLAGS = -I ../include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -W -pedantic -std=c99
+# AM_CFLAGS = -I ../include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -W -pedantic -std=c11
lib_LTLIBRARIES = libsgutils2.la
libsgutils2_la_LDFLAGS = -version-info 2:0:0
libsgutils2_la_LIBADD = @GETOPT_O_FILES@ @os_libs@
diff --git a/lib/sg_lib.c b/lib/sg_lib.c
index 3284ee97..cfc2fd28 100644
--- a/lib/sg_lib.c
+++ b/lib/sg_lib.c
@@ -468,7 +468,7 @@ uds_referral_descriptor_str(char * b, int blen, const unsigned char * dp,
ull <<= 8;
ull |= dp[4 + j];
}
- n += my_snprintf(b + n, blen - n, " first uds LBA: 0x%"PRIx64
+ n += my_snprintf(b + n, blen - n, " first uds LBA: 0x%" PRIx64
"\n", ull);
ull = 0;
for (j = 0; j < 8; ++j) {
@@ -476,7 +476,7 @@ uds_referral_descriptor_str(char * b, int blen, const unsigned char * dp,
ull <<= 8;
ull |= dp[12 + j];
}
- n += my_snprintf(b + n, blen - n, " last uds LBA: 0x%"PRIx64
+ n += my_snprintf(b + n, blen - n, " last uds LBA: 0x%" PRIx64
"\n", ull);
for (j = 0; j < tpgd; ++j) {
tp = dp + 20 + (j * 4);
diff --git a/lib/sg_lib_data.c b/lib/sg_lib_data.c
index c2330ad4..e884848a 100644
--- a/lib/sg_lib_data.c
+++ b/lib/sg_lib_data.c
@@ -15,7 +15,7 @@
#endif
-const char * sg_lib_version_str = "1.83 20130530"; /* spc4r36, sbc3r32 */
+const char * sg_lib_version_str = "1.84 20130603"; /* spc4r36, sbc3r32 */
#ifdef SG_SCSI_STRINGS
struct sg_lib_value_name_t sg_lib_normal_opcodes[] = {
diff --git a/sg3_utils.spec b/sg3_utils.spec
index 05fbe2f4..d55f92eb 100644
--- a/sg3_utils.spec
+++ b/sg3_utils.spec
@@ -1,6 +1,6 @@
Summary: Utilities for devices that use SCSI command sets
Name: sg3_utils
-Version: 1.36
+Version: 1.37
# Release: 1%{?dist}
Release: 1
License: GPL
@@ -79,6 +79,10 @@ fi
%{_libdir}/*.la
%changelog
+* Mon Jun 03 2013 - dgilbert at interlog dot com
+- track t10 changes
+ * sg3_utils-1.37
+
* Fri May 31 2013 - dgilbert at interlog dot com
- track t10 changes
* sg3_utils-1.36
diff --git a/src/Makefile.am b/src/Makefile.am
index c33f46b0..da68e118 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -119,12 +119,14 @@ bin_PROGRAMS = \
endif
-# For C++ testing
+# For C++/clang testing
+## CC = g++ -std=c++11
## CC = g++
+## CC = clang
# -std=<s> can be c99, c11, gnu11, etc. Default is gnu89 (gnu90 is the same)
AM_CFLAGS = -I ../include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -W
-# AM_CFLAGS = -I ../include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -W -pedantic -std=c99
+# AM_CFLAGS = -I ../include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -W -pedantic -std=c11
sg_dd_SOURCES = sg_dd.c
sg_dd_LDADD = ../lib/libsgutils2.la @os_libs@
diff --git a/src/Makefile.in b/src/Makefile.in
index c7865e48..a158c3cd 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -666,11 +666,11 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-# For C++ testing
+# For C++/clang testing
# -std=<s> can be c99, c11, gnu11, etc. Default is gnu89 (gnu90 is the same)
AM_CFLAGS = -I ../include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -W
-# AM_CFLAGS = -I ../include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -W -pedantic -std=c99
+# AM_CFLAGS = -I ../include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -W -pedantic -std=c11
sg_dd_SOURCES = sg_dd.c
sg_dd_LDADD = ../lib/libsgutils2.la @os_libs@
sg_decode_sense_SOURCES = sg_decode_sense.c
diff --git a/src/sg_compare_and_write.c b/src/sg_compare_and_write.c
index fddcba64..627031c9 100644
--- a/src/sg_compare_and_write.c
+++ b/src/sg_compare_and_write.c
@@ -1,23 +1,3 @@
-#define _XOPEN_SOURCE 500
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdlib.h>
-#include <string.h>
-#define __STDC_FORMAT_MACROS 1
-#include <inttypes.h>
-#include <getopt.h>
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include "sg_lib.h"
-#include "sg_cmds_basic.h"
-#include "sg_pt.h"
-
/* A utility program for the Linux OS SCSI generic ("sg") device driver.
*
* Copyright (c) 2012-2013, Kaminario Technologies LTD
@@ -48,7 +28,27 @@
*
*/
-static const char * version_str = "1.04 20130516";
+#define _XOPEN_SOURCE 500
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#define __STDC_FORMAT_MACROS 1
+#include <inttypes.h>
+#include <getopt.h>
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include "sg_lib.h"
+#include "sg_cmds_basic.h"
+#include "sg_pt.h"
+
+static const char * version_str = "1.06 20130604";
#define DEF_BLOCK_SIZE 512
#define DEF_NUM_BLOCKS (1)
@@ -288,7 +288,7 @@ sg_build_scsi_cdb(unsigned char * cdbp, unsigned int blocks,
{
memset(cdbp, 0, COMPARE_AND_WRITE_CDB_SIZE);
cdbp[0] = COMPARE_AND_WRITE_OPCODE;
- cdbp[1] = (flags.wrprotect && WRPROTECT_MASK) << WRPROTECT_SHIFT;
+ cdbp[1] = (flags.wrprotect & WRPROTECT_MASK) << WRPROTECT_SHIFT;
if (flags.dpo)
cdbp[1] |= FLAG_DPO;
if (flags.fua)
@@ -321,7 +321,7 @@ sg_compare_and_write(int sg_fd, unsigned char * buff, int blocks,
int res, ret;
if (sg_build_scsi_cdb(cawCmd, blocks, lba, flags)) {
- fprintf(stderr, ME "bad cdb build, lba=0x%"PRIx64", "
+ fprintf(stderr, ME "bad cdb build, lba=0x%" PRIx64 ", "
"blocks=%d\n", lba, blocks);
return -1;
}
@@ -375,8 +375,8 @@ sg_compare_and_write(int sg_fd, unsigned char * buff, int blocks,
if (valid)
fprintf(stderr, "Medium or hardware "
"error starting at lba=%"
- PRIu64" [0x%"PRIx64"]\n", ull,
- ull);
+ PRIu64 " [0x%" PRIx64 "]\n",
+ ull, ull);
}
ret = sense_cat;
break;
diff --git a/src/sg_dd.c b/src/sg_dd.c
index 5f8af5fd..1fd87d2e 100644
--- a/src/sg_dd.c
+++ b/src/sg_dd.c
@@ -58,7 +58,7 @@
#include "sg_cmds_extra.h"
#include "sg_io_linux.h"
-static const char * version_str = "5.77 20130507";
+static const char * version_str = "5.78 20130603";
#define ME "sg_dd: "
@@ -189,13 +189,14 @@ static void
print_stats(const char * str)
{
if (0 != dd_count)
- fprintf(stderr, " remaining block count=%"PRId64"\n", dd_count);
- fprintf(stderr, "%s%"PRId64"+%d records in\n", str, in_full - in_partial,
- in_partial);
- fprintf(stderr, "%s%"PRId64"+%d records out\n", str,
+ fprintf(stderr, " remaining block count=%" PRId64 "\n", dd_count);
+ fprintf(stderr, "%s%" PRId64 "+%d records in\n", str,
+ in_full - in_partial, in_partial);
+ fprintf(stderr, "%s%" PRId64 "+%d records out\n", str,
out_full - out_partial, out_partial);
if (oflag.sparse)
- fprintf(stderr, "%s%"PRId64" bypassed records out\n", str, out_sparse);
+ fprintf(stderr, "%s%" PRId64 " bypassed records out\n", str,
+ out_sparse);
if (recovered_errs > 0)
fprintf(stderr, "%s%d recovered errors\n", str, recovered_errs);
if (num_retries > 0)
@@ -448,8 +449,8 @@ scsi_read_capacity(int sg_fd, int64_t * num_sect, int * sect_sz)
(rcBuff[6] << 8) | rcBuff[7];
}
if (verbose)
- fprintf(stderr, " number of blocks=%"PRId64" [0x%"PRIx64"], "
- "block size=%d\n", *num_sect, *num_sect, *sect_sz);
+ fprintf(stderr, " number of blocks=%" PRId64 " [0x%" PRIx64
+ "], " "block size=%d\n", *num_sect, *num_sect, *sect_sz);
return 0;
}
@@ -475,7 +476,7 @@ read_blkdev_capacity(int sg_fd, int64_t * num_sect, int * sect_sz)
*num_sect = ((int64_t)ull / (int64_t)*sect_sz);
if (verbose)
fprintf(stderr, " [bgs64] number of blocks=%" PRId64 " [0x%"
- PRIx64"], block size=%d\n", *num_sect, *num_sect,
+ PRIx64 "], block size=%d\n", *num_sect, *num_sect,
*sect_sz);
#else
unsigned long ul;
@@ -486,7 +487,7 @@ read_blkdev_capacity(int sg_fd, int64_t * num_sect, int * sect_sz)
}
*num_sect = (int64_t)ul;
if (verbose)
- fprintf(stderr, " [bgs] number of blocks=%"PRId64" [0x%"
+ fprintf(stderr, " [bgs] number of blocks=%" PRId64 " [0x%"
PRIx64 "], block size=%d\n", *num_sect, *num_sect,
*sect_sz);
#endif
@@ -661,12 +662,12 @@ sg_read_low(int sg_fd, unsigned char * buff, int blocks, int64_t from_block,
info_valid = sg_get_sense_info_fld(sbp, slen, io_addrp);
if (info_valid) {
fprintf(stderr, " lba of last recovered error in this "
- "READ=0x%"PRIx64"\n", *io_addrp);
+ "READ=0x%" PRIx64 "\n", *io_addrp);
if (verbose > 1)
sg_chk_n_print3("reading", &io_hdr, 1);
} else {
fprintf(stderr, "Recovered error: [no info] reading from "
- "block=0x%"PRIx64", num=%d\n", from_block, blocks);
+ "block=0x%" PRIx64 ", num=%d\n", from_block, blocks);
sg_chk_n_print3("reading", &io_hdr, verbose > 1);
}
break;
@@ -786,8 +787,8 @@ sg_read(int sg_fd, unsigned char * buff, int blocks, int64_t from_block,
break;
case SG_LIB_CAT_MEDIUM_HARD_WITH_INFO:
if (retries_tmp > 0) {
- fprintf(stderr, ">>> retrying a sgio read, lba=0x%"PRIx64"\n",
- (uint64_t)lba);
+ fprintf(stderr, ">>> retrying a sgio read, lba=0x%" PRIx64
+ "\n", (uint64_t)lba);
--retries_tmp;
++num_retries;
if (unrecovered_errs > 0)
@@ -807,8 +808,8 @@ sg_read(int sg_fd, unsigned char * buff, int blocks, int64_t from_block,
may_coe = 1;
default:
if (retries_tmp > 0) {
- fprintf(stderr, ">>> retrying a sgio read, lba=0x%"PRIx64"\n",
- (uint64_t)lba);
+ fprintf(stderr, ">>> retrying a sgio read, lba=0x%" PRIx64
+ "\n", (uint64_t)lba);
--retries_tmp;
++num_retries;
if (unrecovered_errs > 0)
@@ -823,10 +824,10 @@ sg_read(int sg_fd, unsigned char * buff, int blocks, int64_t from_block,
continue;
if ((io_addr < (uint64_t)lba) ||
(io_addr >= (uint64_t)(lba + blks))) {
- fprintf(stderr, " Unrecovered error lba 0x%"PRIx64" not in "
- "correct range:\n\t[0x%"PRIx64",0x%"PRIx64"]\n", io_addr,
- (uint64_t)lba,
- (uint64_t)(lba + blks - 1));
+ fprintf(stderr, " Unrecovered error lba 0x%" PRIx64 " not "
+ "in correct range:\n\t[0x%" PRIx64 ",0x%" PRIx64
+ "]\n", io_addr, (uint64_t)lba,
+ (uint64_t)(lba + blks - 1));
may_coe = 1;
goto err_out;
}
@@ -881,7 +882,7 @@ sg_read(int sg_fd, unsigned char * buff, int blocks, int64_t from_block,
bp += (blks * bs);
lba += blks;
if ((0 != ifp->pdt) || (ifp->coe < 2)) {
- fprintf(stderr, ">> unrecovered read error at blk=%"PRId64", "
+ fprintf(stderr, ">> unrecovered read error at blk=%" PRId64 ", "
"pdt=%d, use zeros\n", lba, ifp->pdt);
memset(bp, 0, bs);
} else if (io_addr < UINT_MAX) {
@@ -950,8 +951,8 @@ sg_read(int sg_fd, unsigned char * buff, int blocks, int64_t from_block,
memset(bp, 0, bs);
free(buffp);
} else {
- fprintf(stderr, ">> read_long(10) cannot handle blk=%"PRId64", "
- "use zeros\n", lba);
+ fprintf(stderr, ">> read_long(10) cannot handle blk=%" PRId64
+ ", use zeros\n", lba);
memset(bp, 0, bs);
}
++xferred;
@@ -971,7 +972,7 @@ sg_read(int sg_fd, unsigned char * buff, int blocks, int64_t from_block,
err_out:
if (ifp->coe) {
memset(bp, 0, bs * blks);
- fprintf(stderr, ">> unable to read at blk=%"PRId64" for "
+ fprintf(stderr, ">> unable to read at blk=%" PRId64 " for "
"%d bytes, use zeros\n", lba, bs * blks);
if (blks > 1)
fprintf(stderr, ">> try reducing bpt to limit number "
@@ -1005,8 +1006,8 @@ sg_write(int sg_fd, unsigned char * buff, int blocks, int64_t to_block,
if (sg_build_scsi_cdb(wrCmd, ofp->cdbsz, blocks, to_block, 1, ofp->fua,
ofp->dpo)) {
- fprintf(stderr, ME "bad wr cdb build, to_block=%"PRId64", blocks=%d\n",
- to_block, blocks);
+ fprintf(stderr, ME "bad wr cdb build, to_block=%" PRId64
+ ", blocks=%d\n", to_block, blocks);
return SG_LIB_SYNTAX_ERROR;
}
@@ -1051,12 +1052,12 @@ sg_write(int sg_fd, unsigned char * buff, int blocks, int64_t to_block,
&io_addr);
if (info_valid) {
fprintf(stderr, " lba of last recovered error in this "
- "WRITE=0x%"PRIx64"\n", io_addr);
+ "WRITE=0x%" PRIx64 "\n", io_addr);
if (verbose > 1)
sg_chk_n_print3("writing", &io_hdr, 1);
} else {
fprintf(stderr, "Recovered error: [no info] writing to "
- "block=0x%"PRIx64", num=%d\n", to_block, blocks);
+ "block=0x%" PRIx64 ", num=%d\n", to_block, blocks);
sg_chk_n_print3("writing", &io_hdr, verbose > 1);
}
break;
@@ -1073,7 +1074,7 @@ sg_write(int sg_fd, unsigned char * buff, int blocks, int64_t to_block,
sg_chk_n_print3("writing", &io_hdr, verbose > 1);
++unrecovered_errs;
if (ofp->coe) {
- fprintf(stderr, ">> ignored errors for out blk=%"PRId64" for "
+ fprintf(stderr, ">> ignored errors for out blk=%" PRId64 " for "
"%d bytes\n", to_block, bs * blocks);
return 0; /* fudge success */
} else
@@ -1323,7 +1324,7 @@ open_if(const char * inf, int64_t skip, int bpt, struct flags_t * ifp,
}
if (verbose)
fprintf(stderr, " >> skip: lseek64 SEEK_SET, "
- "byte offset=0x%"PRIx64"\n",
+ "byte offset=0x%" PRIx64 "\n",
(uint64_t)offset);
}
#ifdef HAVE_POSIX_FADVISE
@@ -1465,7 +1466,7 @@ open_of(const char * outf, int64_t seek, int bpt, struct flags_t * ofp,
}
if (verbose)
fprintf(stderr, " >> seek: lseek64 SEEK_SET, "
- "byte offset=0x%"PRIx64"\n",
+ "byte offset=0x%" PRIx64 "\n",
(uint64_t)offset);
}
}
@@ -1832,7 +1833,7 @@ main(int argc, char * argv[])
out_num_sect -= seek;
#ifdef SG_DEBUG
fprintf(stderr, "Start of loop, count=%" PRId64 ", in_num_sect=%"
- PRId64 ", out_num_sect=%"PRId64"\n", dd_count, in_num_sect,
+ PRId64 ", out_num_sect=%" PRId64 "\n", dd_count, in_num_sect,
out_num_sect);
#endif
if (dd_count < 0) {
@@ -1888,7 +1889,7 @@ main(int argc, char * argv[])
blocks_per = bpt;
#ifdef SG_DEBUG
- fprintf(stderr, "Start of loop, count=%"PRId64", blocks_per=%d\n",
+ fprintf(stderr, "Start of loop, count=%" PRId64 ", blocks_per=%d\n",
dd_count, blocks_per);
#endif
if (do_time) {
@@ -1930,8 +1931,8 @@ main(int argc, char * argv[])
}
}
if (res) {
- fprintf(stderr, "sg_read failed,%s at or after lba=%"PRId64" "
- "[0x%"PRIx64"]\n",
+ fprintf(stderr, "sg_read failed,%s at or after lba=%" PRId64
+ " [0x%" PRIx64 "]\n",
((-2 == res) ? " try reducing bpt," : ""), skip, skip);
ret = res;
break;
@@ -1952,7 +1953,8 @@ main(int argc, char * argv[])
fprintf(stderr, "read(unix): count=%d, res=%d\n",
blocks * blk_sz, res);
if (res < 0) {
- snprintf(ebuff, EBUFF_SZ, ME "reading, skip=%"PRId64" ", skip);
+ snprintf(ebuff, EBUFF_SZ, ME "reading, skip=%" PRId64 " ",
+ skip);
perror(ebuff);
ret = -1;
break;
@@ -1979,8 +1981,8 @@ main(int argc, char * argv[])
fprintf(stderr, "write to of2: count=%d, res=%d\n",
blocks * blk_sz, res);
if (res < 0) {
- snprintf(ebuff, EBUFF_SZ, ME "writing to of2, seek=%"PRId64" ",
- seek);
+ snprintf(ebuff, EBUFF_SZ, ME "writing to of2, seek=%" PRId64
+ " ", seek);
perror(ebuff);
ret = -1;
break;
@@ -2008,7 +2010,8 @@ main(int argc, char * argv[])
out_sparse += blocks;
if (verbose > 2)
fprintf(stderr, "sparse bypassing sg_write: seek "
- "blk=%"PRId64", offset blks=%d\n", seek, blocks);
+ "blk=%" PRId64 ", offset blks=%d\n", seek,
+ blocks);
} else if (FT_DEV_NULL & out_type)
;
else {
@@ -2077,7 +2080,7 @@ main(int argc, char * argv[])
break;
else if (retries_tmp > 0) {
fprintf(stderr, ">>> retrying a sgio write, "
- "lba=0x%"PRIx64"\n", (uint64_t)seek);
+ "lba=0x%" PRIx64 "\n", (uint64_t)seek);
--retries_tmp;
++num_retries;
if (unrecovered_errs > 0)
@@ -2087,7 +2090,7 @@ main(int argc, char * argv[])
first = 0;
}
if (0 != ret) {
- fprintf(stderr, "sg_write failed,%s seek=%"PRId64"\n",
+ fprintf(stderr, "sg_write failed,%s seek=%" PRId64 "\n",
((-2 == ret) ? " try reducing bpt," : ""), seek);
break;
} else {
@@ -2105,7 +2108,8 @@ main(int argc, char * argv[])
fprintf(stderr, "write(unix): count=%d, res=%d\n",
blocks * blk_sz, res);
if (res < 0) {
- snprintf(ebuff, EBUFF_SZ, ME "writing, seek=%"PRId64" ", seek);
+ snprintf(ebuff, EBUFF_SZ, ME "writing, seek=%" PRId64 " ",
+ seek);
perror(ebuff);
ret = -1;
break;
@@ -2138,19 +2142,19 @@ main(int argc, char * argv[])
// rt = posix_fadvise(infd, 0, 0, POSIX_FADV_DONTNEED);
if (rt) /* returns error as result */
fprintf(stderr, "posix_fadvise on read, skip="
- "%"PRId64" ,err=%d\n", skip, rt);
+ "%" PRId64 " ,err=%d\n", skip, rt);
}
if ((oflag.nocache & 2) && (bytes_of2 > 0) && out2_valid) {
rt = posix_fadvise(out2fd, 0, 0, POSIX_FADV_DONTNEED);
if (rt)
fprintf(stderr, "posix_fadvise on of2, seek="
- "%"PRId64" ,err=%d\n", seek, rt);
+ "%" PRId64 " ,err=%d\n", seek, rt);
}
if ((oflag.nocache & 1) && (bytes_of > 0) && out_valid) {
rt = posix_fadvise(outfd, 0, 0, POSIX_FADV_DONTNEED);
if (rt)
fprintf(stderr, "posix_fadvise on output, seek="
- "%"PRId64" ,err=%d\n", seek, rt);
+ "%" PRId64 " ,err=%d\n", seek, rt);
}
}
#endif
@@ -2173,7 +2177,7 @@ main(int argc, char * argv[])
"res=%d\n", penult_blocks * blk_sz, res);
if (res < 0) {
snprintf(ebuff, EBUFF_SZ, ME "writing(sparse after error), "
- "seek=%"PRId64" ", seek);
+ "seek=%" PRId64 " ", seek);
perror(ebuff);
}
}
diff --git a/src/sg_ident.c b/src/sg_ident.c
index 67ef96d4..36c45b20 100644
--- a/src/sg_ident.c
+++ b/src/sg_ident.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005-2011 Douglas Gilbert.
+ * Copyright (c) 2005-2013 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 @@
* DEVICE IDENTIFIER and SET DEVICE IDENTIFIER prior to spc4r07.
*/
-static const char * version_str = "1.10 20130507";
+static const char * version_str = "1.11 20130603";
#define ME "sg_ident: "
@@ -49,10 +49,12 @@ static struct option long_options[] = {
static void decode_ii(const unsigned char * iip, int ii_len, int itype,
int ascii, int raw, int verbose)
{
- int k, n;
+ int k;
if (raw) {
if (ii_len > 0) {
+ int n;
+
if (sg_set_binary_mode(STDOUT_FILENO) < 0)
perror("sg_set_binary_mode");
#if 0
@@ -60,8 +62,9 @@ static void decode_ii(const unsigned char * iip, int ii_len, int itype,
#else
n = write(STDOUT_FILENO, iip, ii_len);
#endif
+ if (verbose && (n < 1))
+ fprintf(stderr, "unable to write to stdout\n");
}
- n = n; /* suppress warning */
return;
}
if (0x7f == itype) { /* list of available information types */
diff --git a/src/sg_modes.c b/src/sg_modes.c
index 7e0e0357..5392a565 100644
--- a/src/sg_modes.c
+++ b/src/sg_modes.c
@@ -25,7 +25,7 @@
#include "sg_lib.h"
#include "sg_cmds_basic.h"
-static const char * version_str = "1.41 20130507";
+static const char * version_str = "1.42 20130604";
#define DEF_ALLOC_LEN (1024 * 4)
#define DEF_6_ALLOC_LEN 252
@@ -1072,7 +1072,7 @@ main(int argc, char * argv[])
}
}
- memset(rsp_buff, 0, sizeof(rsp_buff));
+ memset(rsp_buff, 0, rsp_buff_size);
if (opts.do_six) {
res = sg_ll_mode_sense6(sg_fd, opts.do_dbd, opts.page_control,
opts.pg_code, opts.subpg_code, rsp_buff,
diff --git a/src/sg_persist.c b/src/sg_persist.c
index 977618f4..bfc345fd 100644
--- a/src/sg_persist.c
+++ b/src/sg_persist.c
@@ -26,7 +26,7 @@
#include "sg_cmds_basic.h"
#include "sg_cmds_extra.h"
-static const char * version_str = "0.38 20130507";
+static const char * version_str = "0.39 20130604";
#define PRIN_RKEY_SA 0x0
@@ -330,17 +330,24 @@ prin_work(int sg_fd, const struct opts_t * optsp)
res = sg_ll_persistent_reserve_in(sg_fd, optsp->prin_sa, pr_buff,
optsp->alloc_len, 1, optsp->verbose);
if (res) {
+ char b[64];
+
+ if (optsp->prin_sa < num_prin_sa_strs)
+ snprintf(b, sizeof(b), "%s", prin_sa_strs[optsp->prin_sa]);
+ else
+ snprintf(b, sizeof(b), "service action=0x%x", optsp->prin_sa);
+
if (SG_LIB_CAT_INVALID_OP == res)
- fprintf(stderr, "PR in: command not supported\n");
+ fprintf(stderr, "PR in (%s): command not supported\n", b);
else if (SG_LIB_CAT_ILLEGAL_REQ == res)
- fprintf(stderr, "PR in: bad field in cdb including "
- "unsupported service action\n");
+ fprintf(stderr, "PR in (%s): bad field in cdb including "
+ "unsupported service action\n", b);
else if (SG_LIB_CAT_UNIT_ATTENTION == res)
- fprintf(stderr, "PR in: unit attention\n");
+ fprintf(stderr, "PR in (%s): unit attention\n", b);
else if (SG_LIB_CAT_ABORTED_COMMAND == res)
- fprintf(stderr, "PR in: aborted command\n");
+ fprintf(stderr, "PR in (%s): aborted command\n", b);
else
- fprintf(stderr, "PR in: command failed\n");
+ fprintf(stderr, "PR in (%s): command failed\n", b);
return res;
}
if (PRIN_RCAP_SA == optsp->prin_sa) {
@@ -569,7 +576,8 @@ prout_work(int sg_fd, struct opts_t * optsp)
char buff[64];
if (optsp->prout_sa < num_prout_sa_strs)
- strncpy(buff, prout_sa_strs[optsp->prout_sa], sizeof(buff));
+ snprintf(buff, sizeof(buff), "%s",
+ prout_sa_strs[optsp->prout_sa]);
else
snprintf(buff, sizeof(buff), "service action=0x%x",
optsp->prout_sa);
diff --git a/src/sg_rbuf.c b/src/sg_rbuf.c
index f5c1b56b..f7bb9c26 100644
--- a/src/sg_rbuf.c
+++ b/src/sg_rbuf.c
@@ -51,7 +51,7 @@
#endif
-static const char * version_str = "4.89 20130507";
+static const char * version_str = "4.90 20130603";
static struct option long_options[] = {
{"buffer", 1, 0, 'b'},
@@ -608,8 +608,8 @@ main(int argc, char * argv[])
}
if (dio_incomplete)
printf(">> direct IO requested but not done\n");
- printf("Read %"PRId64" MiB (actual: %"PRId64" bytes), buffer size=%d KiB "
- "(%d bytes)\n", (total_size / (1024 * 1024)),
+ printf("Read %" PRId64 " MiB (actual: %" PRId64 " bytes), buffer "
+ "size=%d KiB (%d bytes)\n", (total_size / (1024 * 1024)),
(int64_t)num * buf_size, buf_size / 1024, buf_size);
if (rawp) free(rawp);
diff --git a/src/sg_read.c b/src/sg_read.c
index 9c7dbffb..43100f37 100644
--- a/src/sg_read.c
+++ b/src/sg_read.c
@@ -1,5 +1,5 @@
/* A utility program for the Linux OS SCSI generic ("sg") device driver.
-* Copyright (C) 2001 - 2012 D. Gilbert
+* Copyright (C) 2001 - 2013 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)
@@ -48,7 +48,7 @@
#include "sg_io_linux.h"
-static const char * version_str = "1.19 20121211";
+static const char * version_str = "1.20 20130603";
#define DEF_BLOCK_SIZE 512
#define DEF_BLOCKS_PER_TRANSFER 128
@@ -105,8 +105,9 @@ static void print_stats(int iters, const char * str)
{
if (orig_count > 0) {
if (0 != dd_count)
- fprintf(stderr, " remaining block count=%"PRId64"\n", dd_count);
- fprintf(stderr, "%"PRId64"+%d records in", in_full - in_partial,
+ fprintf(stderr, " remaining block count=%" PRId64 "\n",
+ dd_count);
+ fprintf(stderr, "%" PRId64 "+%d records in", in_full - in_partial,
in_partial);
if (iters > 0)
fprintf(stderr, ", %s commands issued: %d\n", (str ? str : ""),
@@ -307,8 +308,8 @@ static int sg_bread(int sg_fd, unsigned char * buff, int blocks,
struct sg_io_hdr io_hdr;
if (sg_build_scsi_cdb(rdCmd, cdbsz, blocks, from_block, 0, fua, dpo)) {
- fprintf(stderr, ME "bad cdb build, from_block=%"PRId64", blocks=%d\n",
- from_block, blocks);
+ fprintf(stderr, ME "bad cdb build, from_block=%" PRId64
+ ", blocks=%d\n", from_block, blocks);
return -1;
}
memset(&io_hdr, 0, sizeof(struct sg_io_hdr));
@@ -677,7 +678,7 @@ int main(int argc, char * argv[])
start_tm.tv_usec = 0;
if (verbose && (dd_count < 0))
- fprintf(stderr, "About to issue %"PRId64" zero block SCSI READs\n",
+ fprintf(stderr, "About to issue %" PRId64 " zero block SCSI READs\n",
0 - dd_count);
/* main loop */
@@ -754,7 +755,8 @@ int main(int argc, char * argv[])
(EINTR == errno))
;
if (res < 0) {
- snprintf(ebuff, EBUFF_SZ, ME "reading, skip=%"PRId64" ", skip);
+ snprintf(ebuff, EBUFF_SZ, ME "reading, skip=%" PRId64 " ",
+ skip);
perror(ebuff);
break;
} else if (res < blocks * bs) {
diff --git a/src/sg_sanitize.c b/src/sg_sanitize.c
index 10b0ac85..68f03aa5 100644
--- a/src/sg_sanitize.c
+++ b/src/sg_sanitize.c
@@ -26,7 +26,7 @@
#include "sg_cmds_basic.h"
#include "sg_cmds_extra.h"
-static const char * version_str = "0.91 20130507";
+static const char * version_str = "0.92 20130603";
/* Not all environments support the Unix sleep() */
#if defined(MSC_VER) || defined(__MINGW32__)
@@ -222,7 +222,7 @@ do_sanitize(int sg_fd, const struct opts_t * op, const void * param_lstp,
valid = sg_get_sense_info_fld(sense_b, slen, &ull);
if (valid)
fprintf(stderr, "Medium or hardware error starting at "
- "lba=%"PRIu64" [0x%"PRIx64"]\n", ull, ull);
+ "lba=%" PRIu64 " [0x%" PRIx64 "]\n", ull, ull);
}
ret = sense_cat;
break;
diff --git a/src/sg_write_same.c b/src/sg_write_same.c
index 7f10217b..09e2f5d4 100644
--- a/src/sg_write_same.c
+++ b/src/sg_write_same.c
@@ -26,7 +26,7 @@
#include "sg_cmds_basic.h"
#include "sg_cmds_extra.h"
-static const char * version_str = "1.02 20130516";
+static const char * version_str = "1.03 20130603";
#define ME "sg_write_same: "
@@ -293,7 +293,7 @@ do_write_same(int sg_fd, const struct opts_t * optsp, const void * dataoutp,
valid = sg_get_sense_info_fld(sense_b, slen, &ull);
if (valid)
fprintf(stderr, "Medium or hardware error starting at "
- "lba=%"PRIu64" [0x%"PRIx64"]\n", ull, ull);
+ "lba=%" PRIu64 " [0x%" PRIx64 "]\n", ull, ull);
}
ret = sense_cat;
break;
diff --git a/src/sg_xcopy.c b/src/sg_xcopy.c
index b2f3a015..13f986e8 100644
--- a/src/sg_xcopy.c
+++ b/src/sg_xcopy.c
@@ -61,7 +61,7 @@
#include "sg_cmds_extra.h"
#include "sg_io_linux.h"
-static const char * version_str = "0.34 20130507";
+static const char * version_str = "0.35 20130603";
#define ME "sg_xcopy: "
@@ -189,10 +189,10 @@ static void
print_stats(const char * str)
{
if (0 != dd_count)
- fprintf(stderr, " remaining block count=%"PRId64"\n", dd_count);
- fprintf(stderr, "%s%"PRId64"+%d records in\n", str, in_full - in_partial,
- in_partial);
- fprintf(stderr, "%s%"PRId64"+%d records out\n", str,
+ fprintf(stderr, " remaining block count=%" PRId64 "\n", dd_count);
+ fprintf(stderr, "%s%" PRId64 "+%d records in\n", str,
+ in_full - in_partial, in_partial);
+ fprintf(stderr, "%s%" PRId64 "+%d records out\n", str,
out_full - out_partial, out_partial);
#if 0
if (recovered_errs > 0)
@@ -623,9 +623,9 @@ scsi_read_capacity(struct xcopy_fp_t *xfp)
(rcBuff[6] << 8) | rcBuff[7];
}
if (verbose)
- fprintf(stderr, " %s: number of blocks=%"PRId64" [0x%"PRIx64"], "
- "block size=%d\n", xfp->fname, xfp->num_sect, xfp->num_sect,
- xfp->sect_sz);
+ fprintf(stderr, " %s: number of blocks=%" PRId64 " [0x%" PRIx64
+ "], block size=%d\n", xfp->fname, xfp->num_sect,
+ xfp->num_sect, xfp->sect_sz);
return 0;
}
@@ -1655,7 +1655,7 @@ main(int argc, char * argv[])
}
if (skip && ifp.num_sect < skip) {
fprintf(stderr, "argument to 'skip=' exceeds device size "
- "(max %"PRId64")\n", ifp.num_sect);
+ "(max %" PRId64 ")\n", ifp.num_sect);
return SG_LIB_SYNTAX_ERROR;
}
@@ -1681,7 +1681,7 @@ main(int argc, char * argv[])
}
if (seek && ofp.num_sect < seek) {
fprintf(stderr, "argument to 'seek=' exceeds device size "
- "(max %"PRId64")\n", ofp.num_sect);
+ "(max %" PRId64 ")\n", ofp.num_sect);
return SG_LIB_SYNTAX_ERROR;
}
if ((dd_count < 0) || ((verbose > 0) && (0 == dd_count))) {
@@ -1704,12 +1704,12 @@ main(int argc, char * argv[])
if (dd_bytes > ifp.num_sect * ifp.sect_sz) {
fprintf(stderr, "access beyond end of source device "
- "(max %"PRId64")\n", ifp.num_sect);
+ "(max %" PRId64 ")\n", ifp.num_sect);
return SG_LIB_SYNTAX_ERROR;
}
if (dd_bytes > ofp.num_sect * ofp.sect_sz) {
fprintf(stderr, "access beyond end of target device "
- "(max %"PRId64")\n", ofp.num_sect);
+ "(max %" PRId64 ")\n", ofp.num_sect);
return SG_LIB_SYNTAX_ERROR;
}
}
@@ -1838,8 +1838,8 @@ main(int argc, char * argv[])
#ifdef SG_DEBUG
fprintf(stderr,
- "Start of loop, count=%"PRId64", bpt=%d, "
- "lba_in=%"PRId64", lba_out=%"PRId64"\n",
+ "Start of loop, count=%" PRId64 ", bpt=%d, "
+ "lba_in=%" PRId64 ", lba_out=%" PRId64 "\n",
dd_count, bpt, skip, seek);
#endif
xcopy_fd = (on_src) ? infd : outfd;
@@ -1862,10 +1862,10 @@ main(int argc, char * argv[])
if (do_time)
calc_duration_throughput(0);
if (res)
- fprintf(stderr, "sg_xcopy: failed with error %d (%"PRId64
+ fprintf(stderr, "sg_xcopy: failed with error %d (%" PRId64
" blocks left)\n", res, dd_count);
else
- fprintf(stderr, "sg_xcopy: %"PRId64" blocks, %d command%s\n",
+ fprintf(stderr, "sg_xcopy: %" PRId64 " blocks, %d command%s\n",
in_full, num_xcopy, ((num_xcopy > 1) ? "s" : ""));
return res;
diff --git a/src/sginfo.c b/src/sginfo.c
index 6a8f0b93..b27f117c 100644
--- a/src/sginfo.c
+++ b/src/sginfo.c
@@ -122,7 +122,7 @@
#define _GNU_SOURCE
#endif
-static const char * version_str = "2.33 [20130507]";
+static const char * version_str = "2.34 [20130603]";
#include <stdio.h>
#include <string.h>
@@ -639,14 +639,14 @@ check_parm_type(int i)
if (i == 1 && is_hex[next_parameter] != 1) {
snprintf(reason, REASON_SZ,
- "simple number (pos %i) instead of @ hexdatafield: %"PRIu64,
- next_parameter, replacement_values[next_parameter]);
+ "simple number (pos %i) instead of @ hexdatafield: %"
+ PRIu64 , next_parameter, replacement_values[next_parameter]);
usage(reason);
}
if (i != 1 && is_hex[next_parameter]) {
snprintf(reason, REASON_SZ,
- "@ hexdatafield (pos %i) instead of a simple number: %"PRIu64,
- next_parameter, replacement_values[next_parameter]);
+ "@ hexdatafield (pos %i) instead of a simple number: %"
+ PRIu64 , next_parameter, replacement_values[next_parameter]);
usage(reason);
}
}
@@ -1783,7 +1783,7 @@ trytenbyte:
}
case 3: /* lba (64 bit) */
while (len > 0) {
- printf("%15"PRId64, getnbyte_ll(df, 8));
+ printf("%15" PRId64 , getnbyte_ll(df, 8));
len -= 8;
df += 8;
i++;
diff --git a/src/sgm_dd.c b/src/sgm_dd.c
index f6d8e3e4..f327ae6f 100644
--- a/src/sgm_dd.c
+++ b/src/sgm_dd.c
@@ -65,9 +65,9 @@
/* #define SG_WANT_SHARED_MMAP_IO 1 */
#ifdef SG_WANT_SHARED_MMAP_IO
-static const char * version_str = "1.37 20130507 shared_mmap";
+static const char * version_str = "1.38 20130603 shared_mmap";
#else
-static const char * version_str = "1.37 20130507";
+static const char * version_str = "1.38 20130603";
#endif
#define DEF_BLOCK_SIZE 512
@@ -176,10 +176,10 @@ static void
print_stats()
{
if (0 != dd_count)
- fprintf(stderr, " remaining block count=%"PRId64"\n", dd_count);
- fprintf(stderr, "%"PRId64"+%d records in\n", in_full - in_partial,
+ fprintf(stderr, " remaining block count=%" PRId64 "\n", dd_count);
+ fprintf(stderr, "%" PRId64 "+%d records in\n", in_full - in_partial,
in_partial);
- fprintf(stderr, "%"PRId64"+%d records out\n", out_full - out_partial,
+ fprintf(stderr, "%" PRId64 "+%d records out\n", out_full - out_partial,
out_partial);
}
@@ -627,8 +627,8 @@ sg_write(int sg_fd, unsigned char * buff, int blocks, int64_t to_block,
int k, res;
if (sg_build_scsi_cdb(wrCmd, cdbsz, blocks, to_block, 1, fua, dpo)) {
- fprintf(stderr, ME "bad wr cdb build, to_block=%"PRId64", blocks=%d\n",
- to_block, blocks);
+ fprintf(stderr, ME "bad wr cdb build, to_block=%" PRId64
+ ", blocks=%d\n", to_block, blocks);
return SG_LIB_SYNTAX_ERROR;
}
@@ -1056,7 +1056,7 @@ main(int argc, char * argv[])
}
if (verbose)
fprintf(stderr, " >> skip: lseek64 SEEK_SET, "
- "byte offset=0x%"PRIx64"\n",
+ "byte offset=0x%" PRIx64 "\n",
(uint64_t)offset);
}
}
@@ -1155,7 +1155,7 @@ main(int argc, char * argv[])
}
if (verbose)
fprintf(stderr, " >> seek: lseek64 SEEK_SET, "
- "byte offset=0x%"PRIx64"\n",
+ "byte offset=0x%" PRIx64 "\n",
(uint64_t)offset);
}
}
@@ -1240,7 +1240,7 @@ main(int argc, char * argv[])
out_num_sect -= seek;
#ifdef SG_DEBUG
fprintf(stderr, "Start of loop, count=%" PRId64 ", in_num_sect=%"
- PRId64 ", out_num_sect=%"PRId64"\n", dd_count, in_num_sect,
+ PRId64 ", out_num_sect=%" PRId64 "\n", dd_count, in_num_sect,
out_num_sect);
#endif
if (in_num_sect > 0) {
@@ -1320,7 +1320,7 @@ main(int argc, char * argv[])
blocks_per = bpt;
#ifdef SG_DEBUG
- fprintf(stderr, "Start of loop, count=%"PRId64", blocks_per=%d\n",
+ fprintf(stderr, "Start of loop, count=%" PRId64 ", blocks_per=%d\n",
dd_count, blocks_per);
#endif
if (do_time) {
@@ -1354,7 +1354,7 @@ main(int argc, char * argv[])
scsi_cdbsz_in, in_flags.fua, in_flags.dpo, 1);
}
if (0 != ret) {
- fprintf(stderr, "sg_read failed, skip=%"PRId64"\n", skip);
+ fprintf(stderr, "sg_read failed, skip=%" PRId64 "\n", skip);
break;
}
else
@@ -1368,7 +1368,8 @@ main(int argc, char * argv[])
fprintf(stderr, "read(unix): count=%d, res=%d\n",
blocks * blk_sz, res);
if (ret < 0) {
- snprintf(ebuff, EBUFF_SZ, ME "reading, skip=%"PRId64" ", skip);
+ snprintf(ebuff, EBUFF_SZ, ME "reading, skip=%" PRId64 " ",
+ skip);
perror(ebuff);
ret = -1;
break;
@@ -1411,7 +1412,7 @@ main(int argc, char * argv[])
&dio_res);
}
if (0 != ret) {
- fprintf(stderr, "sg_write failed, seek=%"PRId64"\n", seek);
+ fprintf(stderr, "sg_write failed, seek=%" PRId64 "\n", seek);
break;
}
else {
@@ -1430,7 +1431,8 @@ main(int argc, char * argv[])
fprintf(stderr, "write(unix): count=%d, res=%d\n",
blocks * blk_sz, res);
if (res < 0) {
- snprintf(ebuff, EBUFF_SZ, ME "writing, seek=%"PRId64" ", seek);
+ snprintf(ebuff, EBUFF_SZ, ME "writing, seek=%" PRId64 " ",
+ seek);
perror(ebuff);
break;
}
diff --git a/src/sgp_dd.c b/src/sgp_dd.c
index 06a0fa38..50822eba 100644
--- a/src/sgp_dd.c
+++ b/src/sgp_dd.c
@@ -57,7 +57,7 @@
#include "sg_io_linux.h"
-static const char * version_str = "5.43 20130507";
+static const char * version_str = "5.44 20130603";
#define DEF_BLOCK_SIZE 512
#define DEF_BLOCKS_PER_TRANSFER 128
@@ -225,14 +225,14 @@ print_stats(const char * str)
int64_t infull, outfull;
if (0 != rcoll.out_rem_count)
- fprintf(stderr, " remaining block count=%"PRId64"\n",
+ fprintf(stderr, " remaining block count=%" PRId64 "\n",
rcoll.out_rem_count);
infull = dd_count - rcoll.in_rem_count;
- fprintf(stderr, "%s%"PRId64"+%d records in\n", str,
+ fprintf(stderr, "%s%" PRId64 "+%d records in\n", str,
infull - rcoll.in_partial, rcoll.in_partial);
outfull = dd_count - rcoll.out_rem_count;
- fprintf(stderr, "%s%"PRId64"+%d records out\n", str,
+ fprintf(stderr, "%s%" PRId64 "+%d records out\n", str,
outfull - rcoll.out_partial, rcoll.out_partial);
}
@@ -655,7 +655,7 @@ normal_in_operation(Rq_coll * clp, Rq_elem * rep, int blocks)
if (res < 0) {
if (clp->in_flags.coe) {
memset(rep->buffp, 0, rep->num_blks * rep->bs);
- fprintf(stderr, ">> substituted zeros for in blk=%"PRId64" for "
+ fprintf(stderr, ">> substituted zeros for in blk=%" PRId64 " for "
"%d bytes, %s\n", rep->blk,
rep->num_blks * rep->bs,
tsafe_strerror(errno, strerr_buff));
@@ -700,7 +700,7 @@ normal_out_operation(Rq_coll * clp, Rq_elem * rep, int blocks)
;
if (res < 0) {
if (clp->out_flags.coe) {
- fprintf(stderr, ">> ignored error for out blk=%"PRId64" for "
+ fprintf(stderr, ">> ignored error for out blk=%" PRId64 " for "
"%d bytes, %s\n", rep->blk,
rep->num_blks * rep->bs,
tsafe_strerror(errno, strerr_buff));
@@ -829,7 +829,7 @@ sg_in_operation(Rq_coll * clp, Rq_elem * rep)
if (1 == res)
err_exit(ENOMEM, "sg starting in command");
else if (res < 0) {
- fprintf(stderr, ME "inputting to sg failed, blk=%"PRId64"\n",
+ fprintf(stderr, ME "inputting to sg failed, blk=%" PRId64 "\n",
rep->blk);
status = pthread_mutex_unlock(&clp->in_mutex);
if (0 != status) err_exit(status, "unlock in_mutex");
@@ -900,7 +900,7 @@ sg_out_operation(Rq_coll * clp, Rq_elem * rep)
if (1 == res)
err_exit(ENOMEM, "sg starting out command");
else if (res < 0) {
- fprintf(stderr, ME "outputting from sg failed, blk=%"PRId64"\n",
+ fprintf(stderr, ME "outputting from sg failed, blk=%" PRId64 "\n",
rep->blk);
status = pthread_mutex_unlock(&clp->out_mutex);
if (0 != status) err_exit(status, "unlock out_mutex");
@@ -929,8 +929,8 @@ sg_out_operation(Rq_coll * clp, Rq_elem * rep)
guarded_stop_both(clp);
return;
} else
- fprintf(stderr, ">> ignored error for out blk=%"PRId64" for "
- "%d bytes\n", rep->blk, rep->num_blks * rep->bs);
+ fprintf(stderr, ">> ignored error for out blk=%" PRId64
+ " for %d bytes\n", rep->blk, rep->num_blks * rep->bs);
/* fall through */
case 0:
if (rep->dio_incomplete || rep->resid) {
@@ -969,8 +969,8 @@ sg_start_io(Rq_elem * rep)
if (sg_build_scsi_cdb(rep->cmd, cdbsz, rep->num_blks, rep->blk,
rep->wr, fua, dpo)) {
- fprintf(stderr, ME "bad cdb build, start_blk=%"PRId64", blocks=%d\n",
- rep->blk, rep->num_blks);
+ fprintf(stderr, ME "bad cdb build, start_blk=%" PRId64
+ ", blocks=%d\n", rep->blk, rep->num_blks);
return -1;
}
memset(hp, 0, sizeof(struct sg_io_hdr));
@@ -988,7 +988,7 @@ sg_start_io(Rq_elem * rep)
if (dio)
hp->flags |= SG_FLAG_DIRECT_IO;
if (rep->debug > 8) {
- fprintf(stderr, "sg_start_io: SCSI %s, blk=%"PRId64" num_blks=%d\n",
+ fprintf(stderr, "sg_start_io: SCSI %s, blk=%" PRId64 " num_blks=%d\n",
rep->wr ? "WRITE" : "READ", rep->blk, rep->num_blks);
sg_print_command(hp->cmdp);
}
@@ -1054,7 +1054,7 @@ sg_finish_io(int wr, Rq_elem * rep, pthread_mutex_t * a_mutp)
{
char ebuff[EBUFF_SZ];
- snprintf(ebuff, EBUFF_SZ, "%s blk=%"PRId64,
+ snprintf(ebuff, EBUFF_SZ, "%s blk=%" PRId64,
wr ? "writing": "reading", rep->blk);
status = pthread_mutex_lock(a_mutp);
if (0 != status) err_exit(status, "lock aux_mutex");