aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2020-05-13 05:04:24 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2020-05-13 05:04:24 +0000
commiteda62fa0cd1d5886bd9893ba2831a37c5e24d4c7 (patch)
tree38069e363793c431e6b151501bb7f28f290207a6 /src
parent0083e58d85910aa7c8599d06bfff48ea5f8c98d1 (diff)
downloadsg3_utils-eda62fa0cd1d5886bd9893ba2831a37c5e24d4c7.tar.gz
testing/sgh_dd: check for bs/READ_CAPACITY(LBsize) mismatch; fix some compile warnings and some --version issues
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@851 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'src')
-rw-r--r--src/sg_compare_and_write.c4
-rw-r--r--src/sg_xcopy.c6
-rw-r--r--src/sgm_dd.c12
-rw-r--r--src/sgp_dd.c10
4 files changed, 17 insertions, 15 deletions
diff --git a/src/sg_compare_and_write.c b/src/sg_compare_and_write.c
index 11f5e859..23d69b3a 100644
--- a/src/sg_compare_and_write.c
+++ b/src/sg_compare_and_write.c
@@ -56,7 +56,7 @@
#include "sg_unaligned.h"
#include "sg_pr2serr.h"
-static const char * version_str = "1.28 20200429";
+static const char * version_str = "1.29 20200509";
#define DEF_BLOCK_SIZE 512
#define DEF_NUM_BLOCKS (1)
@@ -292,6 +292,8 @@ parse_args(int argc, char* argv[], struct opts_t * op)
goto out_err;
}
}
+ if (op->version_given && (! op->verbose_given))
+ return 0;
if (NULL == op->device_name) {
pr2serr("missing device name!\n");
goto out_err;
diff --git a/src/sg_xcopy.c b/src/sg_xcopy.c
index 984dda5d..352b3887 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-2019 Hannes Reinecke, SUSE Labs
+ * Copyright (c) 2011-2020 Hannes Reinecke, SUSE Labs
*
* Largely taken from 'sg_dd', which has the
*
@@ -27,7 +27,7 @@
* in this case) is transferred to or from the sg device in a single SCSI
* command.
*
- * This version is designed for the linux kernel 2.4, 2.6, 3 and 4 series.
+ * This version is designed for the linux kernel 2.4, 2.6, 3, 4 and 5 series.
*/
#define _XOPEN_SOURCE 600
@@ -69,7 +69,7 @@
#include "sg_unaligned.h"
#include "sg_pr2serr.h"
-static const char * version_str = "0.70 20190501";
+static const char * version_str = "0.71 20200510";
#define ME "sg_xcopy: "
diff --git a/src/sgm_dd.c b/src/sgm_dd.c
index 2992e20a..bbd10e22 100644
--- a/src/sgm_dd.c
+++ b/src/sgm_dd.c
@@ -27,7 +27,7 @@
then only the read side will be mmap-ed, while the write side will
use normal IO.
- This version is designed for the linux kernel 2.4, 2.6, 3 and 4 series.
+ This version is designed for the linux kernel 2.4, 2.6, 3, 4 and 5 series.
*/
#define _XOPEN_SOURCE 600
@@ -69,7 +69,7 @@
#include "sg_pr2serr.h"
-static const char * version_str = "1.66 20200429";
+static const char * version_str = "1.67 20200510";
#define DEF_BLOCK_SIZE 512
#define DEF_BLOCKS_PER_TRANSFER 128
@@ -541,13 +541,13 @@ sg_read(int sg_fd, uint8_t * buff, int blocks, int64_t from_block,
return res;
case SG_LIB_CAT_ILLEGAL_REQ:
if (verbose)
- print_cdb_after = true;
+ print_cdb_after = true;
/* FALL THROUGH */
case SG_LIB_CAT_ABORTED_COMMAND:
case SG_LIB_CAT_UNIT_ATTENTION:
default:
sg_chk_n_print3("reading", &io_hdr, verbose > 1);
- if (print_cdb_after)
+ if (print_cdb_after)
sg_print_command_len(rdCmd, cdbsz);
return res;
}
@@ -640,13 +640,13 @@ sg_write(int sg_fd, uint8_t * buff, int blocks, int64_t to_block,
return res;
case SG_LIB_CAT_ILLEGAL_REQ:
if (verbose)
- print_cdb_after = true;
+ print_cdb_after = true;
/* FALL THROUGH */
case SG_LIB_CAT_ABORTED_COMMAND:
case SG_LIB_CAT_UNIT_ATTENTION:
default:
sg_chk_n_print3("writing", &io_hdr, verbose > 1);
- if (print_cdb_after)
+ if (print_cdb_after)
sg_print_command_len(wrCmd, cdbsz);
return res;
}
diff --git a/src/sgp_dd.c b/src/sgp_dd.c
index 9dd089d1..3975f038 100644
--- a/src/sgp_dd.c
+++ b/src/sgp_dd.c
@@ -22,7 +22,7 @@
* in this case) are transferred to or from the sg device in a single SCSI
* command.
*
- * This version is designed for the linux kernel 2.4, 2.6, 3 and 4 series.
+ * This version is designed for the linux kernel 2.4, 2.6, 3, 4 and 5 series.
*
* sgp_dd is a Posix threads specialization of the sg_dd utility. Both
* sgp_dd and sg_dd only perform special tasks when one or both of the given
@@ -84,7 +84,7 @@
#include "sg_pr2serr.h"
-static const char * version_str = "5.75 20200219";
+static const char * version_str = "5.76 20200510";
#define DEF_BLOCK_SIZE 512
#define DEF_BLOCKS_PER_TRANSFER 128
@@ -370,7 +370,7 @@ tsafe_strerror(int code, char * ebp)
* ISBN 0-201-63392-2 . [Highly recommended book.] Changed __FILE__
* to __func__ */
#define err_exit(code,text) do { \
- char strerr_buff[STRERR_BUFF_LEN]; \
+ char strerr_buff[STRERR_BUFF_LEN + 1]; \
pr2serr("%s at \"%s\":%d: %s\n", \
text, __func__, __LINE__, tsafe_strerror(code, strerr_buff)); \
exit(1); \
@@ -836,7 +836,7 @@ normal_in_operation(Rq_coll * clp, Rq_elem * rep, int blocks)
{
bool stop_after_write = false;
int res;
- char strerr_buff[STRERR_BUFF_LEN];
+ char strerr_buff[STRERR_BUFF_LEN + 1];
/* enters holding in_mutex */
while (((res = read(rep->infd, rep->buffp, blocks * clp->bs)) < 0) &&
@@ -882,7 +882,7 @@ static void
normal_out_operation(Rq_coll * clp, Rq_elem * rep, int blocks)
{
int res;
- char strerr_buff[STRERR_BUFF_LEN];
+ char strerr_buff[STRERR_BUFF_LEN + 1];
/* enters holding out_mutex */
while (((res = write(rep->outfd, rep->buffp, rep->num_blks * clp->bs))