aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2020-07-31 00:46:40 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2020-07-31 00:46:40 +0000
commit33f7b2296c779583acd5475484f57552ba437c41 (patch)
tree4d1c9a0b184f002cbdfd7401972ca2d2143c09f0
parent2d6de6e3c9fa1ef28360bbbc235a764aba708277 (diff)
downloadsg3_utils-33f7b2296c779583acd5475484f57552ba437c41.tar.gz
sg_raw: increase maximum data-in/out size from 64 KB to 1 MB; testing sgh_dd and sg_mrq_dd work
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@859 6180dd3e-e324-4e3e-922d-17de1ae2f315
-rw-r--r--ChangeLog4
-rw-r--r--debian/changelog2
-rw-r--r--doc/sg_raw.86
-rw-r--r--sg3_utils.spec2
-rw-r--r--src/sg_raw.c6
-rw-r--r--testing/sg_mrq_dd.cpp54
-rw-r--r--testing/sgh_dd.cpp226
7 files changed, 56 insertions, 244 deletions
diff --git a/ChangeLog b/ChangeLog
index e81ea08e..7d1bb03b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,7 +2,7 @@ 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.46 [20200724] [svn: r858]
+Changelog for sg3_utils-1.46 [20200730] [svn: r859]
- sg_rep_pip: report new provisioning initialization pattern cmd
- sg_turs: estimated time-to-ready [20-061r2]
- add --delay=MS option
@@ -13,6 +13,8 @@ Changelog for sg3_utils-1.46 [20200724] [svn: r858]
- sg_rep_zones: print invalid write pointer LBA as -1 rather
than 16 "f"s
- sg_ses: use fan speed factor field for calculation [ses4r04]
+ - sg_raw: increase maximum data-in and data-out buffer size
+ from 64 KB to 1 MB
- sg_pt_solaris+sg_pt_osf1: fix problem with clear_scsi_pt_obj()
which needs to remember is_nvme and dev_fd values
- sg_lib: restore elements and rebuild command added
diff --git a/debian/changelog b/debian/changelog
index 26aeef15..48199dfd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,7 +2,7 @@ sg3-utils (1.46-0.1) unstable; urgency=low
* New upstream version
- -- Douglas Gilbert <dgilbert@interlog.com> Fri, 24 Jul 2020 12:00:00 -0400
+ -- Douglas Gilbert <dgilbert@interlog.com> Thu, 30 Jul 2020 20:00:00 -0400
sg3-utils (1.45-0.1) unstable; urgency=low
diff --git a/doc/sg_raw.8 b/doc/sg_raw.8
index 3e01bd02..9073fe91 100644
--- a/doc/sg_raw.8
+++ b/doc/sg_raw.8
@@ -1,4 +1,4 @@
-.TH SG_RAW "8" "January 2019" "sg3_utils\-1.45" SG3_UTILS
+.TH SG_RAW "8" "July 2020" "sg3_utils\-1.46" SG3_UTILS
.SH NAME
sg_raw \- send arbitrary SCSI command to a device
.SH SYNOPSIS
@@ -88,7 +88,7 @@ it has a leading '0x' or a trailing 'h'.
It is the responsibility of the user to make sure that the "data\-out"
length implied or stated in the cdb matches \fISLEN\fR. Note that some
common SCSI commands such as WRITE(10) have a "transfer length" field whose
-units are logical blocks (which are often 512 bytes long).
+units are logical blocks (which are usually 512 or 4096 bytes long).
.TP
\fB\-k\fR, \fB\-\-skip\fR=\fIKLEN\fR
Skip the first \fIKLEN\fR bytes of the input file or stream. This option
@@ -212,7 +212,7 @@ Written by Ingo van Lil
.SH "REPORTING BUGS"
Report bugs to <inguin at gmx dot de> or to <dgilbert at interlog dot com>.
.SH COPYRIGHT
-Copyright \(co 2001\-2019 Ingo van Lil
+Copyright \(co 2001\-2020 Ingo van Lil
.br
This software is distributed under the GPL version 2. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
diff --git a/sg3_utils.spec b/sg3_utils.spec
index 0dccb8e2..20c11bbc 100644
--- a/sg3_utils.spec
+++ b/sg3_utils.spec
@@ -84,7 +84,7 @@ fi
%{_libdir}/*.la
%changelog
-* Fri Jul 24 2020 - dgilbert at interlog dot com
+* Thu Jul 30 2020 - dgilbert at interlog dot com
- track t10 changes
* sg3_utils-1.46
diff --git a/src/sg_raw.c b/src/sg_raw.c
index 07e40bfb..15763dce 100644
--- a/src/sg_raw.c
+++ b/src/sg_raw.c
@@ -1,7 +1,7 @@
/*
* A utility program originally written for the Linux OS SCSI subsystem.
*
- * Copyright (C) 2000-2019 Ingo van Lil <inguin@gmx.de>
+ * Copyright (C) 2000-2020 Ingo van Lil <inguin@gmx.de>
*
* 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
@@ -39,12 +39,12 @@
#include "sg_pr2serr.h"
#include "sg_unaligned.h"
-#define SG_RAW_VERSION "0.4.32 (2019-12-26)"
+#define SG_RAW_VERSION "0.4.33 (2020-07-30)"
#define DEFAULT_TIMEOUT 20
#define MIN_SCSI_CDBSZ 6
#define MAX_SCSI_CDBSZ 260
-#define MAX_SCSI_DXLEN (64 * 1024)
+#define MAX_SCSI_DXLEN (1024 * 1024)
#define NVME_ADDR_DATA_IN 0xfffffffffffffffe
#define NVME_ADDR_DATA_OUT 0xfffffffffffffffd
diff --git a/testing/sg_mrq_dd.cpp b/testing/sg_mrq_dd.cpp
index 83d921a2..ea17e665 100644
--- a/testing/sg_mrq_dd.cpp
+++ b/testing/sg_mrq_dd.cpp
@@ -30,7 +30,7 @@
*
*/
-static const char * version_str = "1.04 20200720";
+static const char * version_str = "1.05 20200728";
#define _XOPEN_SOURCE 600
#ifndef _GNU_SOURCE
@@ -899,7 +899,7 @@ usage(int pg_num)
);
return;
page2:
- pr2serr("Syntax: sgh_dd [operands] [options]\n\n"
+ pr2serr("Syntax: sg_mrq_dd [operands] [options]\n\n"
" where: operands have the form name=value and are pecular to "
"'dd'\n"
" style commands, and options start with one or "
@@ -919,8 +919,8 @@ page2:
"after copy\n"
" thr is number of threads, must be > 0, default 4, "
"max 1024\n"
- " time 0->no timing, 1->calc throughput(def), "
- "2->nanosec precision\n"
+ " time 0->no timing; 1/2->millisec/nanosec precision "
+ "(def: 1)\n"
" verbose increase verbosity (def: VERB=0)\n"
" --dry-run|-d prepare but bypass copy/read\n"
" --verbose|-v increase verbosity of utility\n\n"
@@ -928,7 +928,7 @@ page2:
);
return;
page3:
- pr2serr("Syntax: sgh_dd [operands] [options]\n\n"
+ pr2serr("Syntax: sg_mrq_dd [operands] [options]\n\n"
" where: 'iflag=<arg>' and 'oflag=<arg>' arguments are listed "
"below:\n\n"
" 00 use all zeros instead of if=IFILE (only in "
@@ -2434,10 +2434,13 @@ fini:
/* Returns reserved_buffer_size/mmap_size if success, else 0 for failure */
static int
-sg_prepare_resbuf(int fd, int bs, int bpt, bool unit_nano, bool no_dur,
- bool masync, bool wq_excl, uint8_t **mmpp)
+sg_prepare_resbuf(int fd, struct global_collection *clp, bool is_in,
+ uint8_t **mmpp)
{
static bool done = false;
+ bool no_dur = is_in ? clp->in_flags.no_dur : clp->out_flags.no_dur;
+ bool masync = is_in ? clp->in_flags.masync : clp->out_flags.masync;
+ bool wq_excl = is_in ? clp->in_flags.wq_excl : clp->out_flags.wq_excl;
int res, t, num;
uint8_t *mmp;
struct sg_extended_info sei;
@@ -2474,21 +2477,21 @@ sg_prepare_resbuf(int fd, int bs, int bpt, bool unit_nano, bool no_dur,
}
res = ioctl(fd, SG_SET_GET_EXTENDED, seip);
if (res < 0)
- pr2serr_lk("sgh_dd: %s: SG_SET_GET_EXTENDED(NO_DURATION) "
+ pr2serr_lk("sg_mrq_dd: %s: SG_SET_GET_EXTENDED(NO_DURATION) "
"error: %s\n", __func__, strerror(errno));
}
bypass:
- num = bs * bpt;
+ num = clp->bs * clp->bpt;
res = ioctl(fd, SG_SET_RESERVED_SIZE, &num);
if (res < 0) {
- perror("sgh_dd: SG_SET_RESERVED_SIZE error");
+ perror("sg_mrq_dd: SG_SET_RESERVED_SIZE error");
return 0;
} else {
int nn;
res = ioctl(fd, SG_GET_RESERVED_SIZE, &nn);
if (res < 0) {
- perror("sgh_dd: SG_GET_RESERVED_SIZE error");
+ perror("sg_mrq_dd: SG_GET_RESERVED_SIZE error");
return 0;
}
if (nn < num) {
@@ -2502,7 +2505,7 @@ bypass:
if (MAP_FAILED == mmp) {
int err = errno;
- pr2serr_lk("sgh_dd: %s: sz=%d, fd=%d, mmap() failed: %s\n",
+ pr2serr_lk("sg_mrq_dd: %s: sz=%d, fd=%d, mmap() failed: %s\n",
__func__, num, fd, strerror(err));
return 0;
}
@@ -2512,8 +2515,8 @@ bypass:
t = 1;
res = ioctl(fd, SG_SET_FORCE_PACK_ID, &t);
if (res < 0)
- perror("sgh_dd: SG_SET_FORCE_PACK_ID error");
- if (unit_nano) {
+ perror("sg_mrq_dd: SG_SET_FORCE_PACK_ID error");
+ if (clp->unit_nanosec) {
memset(seip, 0, sizeof(*seip));
seip->sei_wr_mask |= SG_SEIM_CTL_FLAGS;
seip->ctl_flags_wr_mask |= SG_CTL_FLAGM_TIME_IN_NS;
@@ -2524,12 +2527,13 @@ bypass:
errno, strerror(errno));
}
}
-#if 0
- t = 1;
- res = ioctl(fd, SG_SET_DEBUG, &t); /* more info in /proc/scsi/sg/debug */
- if (res < 0)
- perror("sgh_dd: SG_SET_DEBUG error");
-#endif
+ if (clp->verbose) {
+ t = 1;
+ /* more info in /proc/scsi/sg/debug */
+ res = ioctl(fd, SG_SET_DEBUG, &t);
+ if (res < 0)
+ perror("sg_mrq_dd: SG_SET_DEBUG error");
+ }
return (res < 0) ? 0 : num;
}
@@ -2719,9 +2723,7 @@ sg_in_open(struct global_collection *clp, const char *inf, uint8_t **mmpp,
perror(ebuff);
return -sg_convert_errno(err);
}
- n = sg_prepare_resbuf(fd, clp->bs, clp->bpt, clp->unit_nanosec,
- clp->in_flags.no_dur, clp->in_flags.masync,
- clp->in_flags.wq_excl, mmpp);
+ n = sg_prepare_resbuf(fd, clp, true, mmpp);
if (n <= 0)
return -SG_LIB_FILE_ERROR;
if (mmap_lenp)
@@ -2751,9 +2753,7 @@ sg_out_open(struct global_collection *clp, const char *outf, uint8_t **mmpp,
perror(ebuff);
return -sg_convert_errno(err);
}
- n = sg_prepare_resbuf(fd, clp->bs, clp->bpt, clp->unit_nanosec,
- clp->out_flags.no_dur, clp->out_flags.masync,
- clp->out_flags.wq_excl, mmpp);
+ n = sg_prepare_resbuf(fd, clp, false, mmpp);
if (n <= 0)
return -SG_LIB_FILE_ERROR;
if (mmap_lenp)
@@ -3062,7 +3062,7 @@ parse_cmdline_sanity(int argc, char * argv[], struct global_collection * clp,
* SG_IO ioctl. So reduce it in that case. */
if ((clp->bs >= 2048) && (! bpt_given))
clp->bpt = DEF_BLOCKS_PER_2048TRANSFER;
- if (clp->in_flags.order)
+ if (clp->in_flags.order && (! clp->out_flags.order))
pr2serr("Warning iflag=order is ignored, use with oflag=\n");
if ((num_threads < 1) || (num_threads > MAX_NUM_THREADS)) {
pr2serr("too few or too many threads requested\n");
diff --git a/testing/sgh_dd.cpp b/testing/sgh_dd.cpp
index 519f1f82..98b6fafe 100644
--- a/testing/sgh_dd.cpp
+++ b/testing/sgh_dd.cpp
@@ -36,7 +36,7 @@
* renamed [20181221]
*/
-static const char * version_str = "1.85 20200720";
+static const char * version_str = "1.86 20200729";
#define _XOPEN_SOURCE 600
#ifndef _GNU_SOURCE
@@ -117,10 +117,6 @@ using namespace std;
#endif
#endif
-/* <<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>> xxxxxxxx beware next line */
-// #define SGH_DD_READ_COMPLET_AFTER 1
-
-
/* comment out following line to stop ioctl(SG_CTL_FLAGM_SNAP_DEV) */
#define SGH_DD_SNAP_DEV 1
@@ -189,7 +185,7 @@ struct flags_t {
bool qtail;
bool random;
bool same_fds;
- bool swait;
+ bool swait; /* now ignore; kept for backward compatibility */
bool v3;
bool v4;
bool v4_given;
@@ -279,8 +275,6 @@ typedef struct request_element
bool same_sg;
bool only_in_sg;
bool only_out_sg;
- bool swait; /* interleave READ WRITE async copy segment: READ submit,
- * WRITE submit, READ receive, WRITE receive */
// bool mrq_abort_thread_active;
int id;
int infd;
@@ -384,8 +378,6 @@ static int sg_in_open(struct global_collection *clp, const char *inf,
uint8_t **mmpp, int *mmap_len);
static int sg_out_open(struct global_collection *clp, const char *outf,
uint8_t **mmpp, int *mmap_len);
-static void sg_in_out_interleave(struct global_collection *clp, Rq_elem * rep,
- mrq_arr_t & def_arr);
static int sgh_do_deferred_mrq(Rq_elem * rep, mrq_arr_t & def_arr);
#define STRERR_BUFF_LEN 128
@@ -404,7 +396,6 @@ static struct timeval start_tm;
static int64_t dd_count = -1;
static int num_threads = DEF_NUM_THREADS;
static int exit_status = 0;
-static volatile bool swait_reported = false;
static bool after1 = false;
static mutex rand_lba_mutex;
@@ -941,10 +932,6 @@ usage(int pg_num)
"copy. This utility is Linux specific and uses the\nv4 sg "
"driver 'share' capability if available. Use '-hh', '-hhh' or "
"'-hhhh'\nfor more information.\n"
-#ifdef SGH_DD_READ_COMPLET_AFTER
- "\nIn this version oflag=swait does read completion _after_ "
- "write completion\n"
-#endif
);
return;
page2:
@@ -1041,10 +1028,7 @@ page3:
"file\n"
" descriptors (def: each threads has own file "
"descriptors)\n"
- " swait slave wait: action under review, treat as "
- "dummy;\n"
- " [oflag only] and IFILE and OFILE must be sg "
- "devices\n"
+ " swait this option is now ignored\n"
" v3 use v3 sg interface (def: v3 unless sg driver "
"is v4)\n"
" v4 use v4 sg interface (def: v3 unless sg driver "
@@ -1461,13 +1445,9 @@ read_write_thread(void * v_tip)
pr2serr_lk("thread=%d: seed=%ld\n", rep->id, rep->seed);
srand48_r(rep->seed, &rep->drand);
}
- if (clp->in_flags.same_fds || clp->out_flags.same_fds) {
- /* we are sharing a single pair of fd_s across all threads */
- if (clp->out_flags.swait && (! swait_reported)) {
- swait_reported = true;
- pr2serr_lk("oflag=swait ignored because same_fds flag given\n");
- }
- } else {
+ if (clp->in_flags.same_fds || clp->out_flags.same_fds)
+ ;
+ else {
int fd;
if (in_is_sg && clp->infp) {
@@ -1510,13 +1490,6 @@ read_write_thread(void * v_tip)
if (vb > 2)
pr2serr_lk("thread=%d: opened local sg OFILE2\n", rep->id);
}
- if (clp->out_flags.swait) {
- if (num_sg < 2)
- pr2serr_lk("oflag=swait ignored since need both IFILE and "
- "OFILE to be sg devices\n");
- else
- rep->swait = true;
- }
}
if (vb > 2) {
if (in_is_sg && (! own_infd))
@@ -1581,12 +1554,9 @@ read_write_thread(void * v_tip)
// clp->in_count -= blocks;
pthread_cleanup_push(cleanup_in, (void *)clp);
- if (in_is_sg) {
- if (rep->swait && rep->has_share)
- sg_in_out_interleave(clp, rep, deferred_arr);
- else /* unlocks in_mutex mid op */
- sg_in_rd_cmd(clp, rep, deferred_arr);
- } else {
+ if (in_is_sg)
+ sg_in_rd_cmd(clp, rep, deferred_arr);
+ else {
stop_after_write = normal_in_rd(rep, blocks);
status = pthread_mutex_unlock(&clp->in_mutex);
if (0 != status) err_exit(status, "unlock in_mutex");
@@ -1644,14 +1614,9 @@ skip_force_out_sequence:
}
/* Output to OFILE */
wr_blks = rep->num_blks;
- if (out_is_sg) {
- if (rep->swait && rep->has_share) {
- /* done already in sg_in_out_interleave() */
- status = pthread_mutex_unlock(&clp->out_mutex);
- if (0 != status) err_exit(status, "unlock out_mutex");
- } else /* release out_mtx */
- sg_out_wr_cmd(rep, deferred_arr, false, clp->prefetch);
- } else if (FT_DEV_NULL == clp->out_type) {
+ if (out_is_sg)
+ sg_out_wr_cmd(rep, deferred_arr, false, clp->prefetch);
+ else if (FT_DEV_NULL == clp->out_type) {
/* skip actual write operation */
wr_blks = 0;
clp->out_rem_count -= blocks;
@@ -3484,164 +3449,6 @@ do_v4:
return 0;
}
-/* Enter holding in_mutex, exits holding nothing */
-static void
-sg_in_out_interleave(struct global_collection *clp, Rq_elem * rep,
- mrq_arr_t & def_arr)
-{
- int res, pid_read, pid_write;
- int status;
-
- while (1) {
- /* start READ */
- res = sg_start_io(rep, def_arr, pid_read, NULL);
- if (1 == res)
- err_exit(ENOMEM, "sg interleave starting in command");
- else if (res < 0) {
- pr2serr_lk("tid=%d: inputting to sg failed, blk=%" PRId64 "\n",
- rep->id, rep->iblk);
- status = pthread_mutex_unlock(&clp->in_mutex);
- if (0 != status) err_exit(status, "unlock in_mutex");
- stop_both(clp);
- return;
- }
-
- /* start WRITE */
- rep->wr = true;
- res = sg_start_io(rep, def_arr, pid_write, NULL);
- if (1 == res)
- err_exit(ENOMEM, "sg interleave starting out command");
- else if (res < 0) {
- pr2serr_lk("tid=%d: outputting to sg failed, blk=%" PRId64 "\n",
- rep->id, rep->oblk);
- status = pthread_mutex_unlock(&clp->in_mutex);
- if (0 != status) err_exit(status, "unlock in_mutex");
- stop_both(clp);
- return;
- }
- /* Now release in mutex to let other reads run in parallel */
- status = pthread_mutex_unlock(&clp->in_mutex);
- if (0 != status) err_exit(status, "unlock in_mutex");
-
-#ifdef SGH_DD_READ_COMPLET_AFTER
-#warning "SGH_DD_READ_COMPLET_AFTER is set (testing)"
- goto write_complet;
-read_complet:
-#endif
-
- /* finish READ */
- rep->wr = false;
- res = sg_finish_io(rep->wr, rep, pid_read, NULL);
- switch (res) {
- case SG_LIB_CAT_ABORTED_COMMAND:
- case SG_LIB_CAT_UNIT_ATTENTION:
- /* try again with same addr, count info */
- /* now re-acquire in mutex for balance */
- /* N.B. This re-read could now be out of read sequence */
- status = pthread_mutex_lock(&clp->in_mutex);
- if (0 != status) err_exit(status, "lock in_mutex");
- break; /* will loop again */
- case SG_LIB_CAT_MEDIUM_HARD:
- if (0 == clp->in_flags.coe) {
- pr2serr_lk("%s: finishing in (medium)\n", __func__);
- if (exit_status <= 0)
- exit_status = res;
- stop_both(clp);
- // return;
- break;
- } else {
- memset(get_buffp(rep), 0, rep->num_blks * clp->bs);
- pr2serr_lk("tid=%d: >> substituted zeros for in blk=%" PRId64
- " for %d bytes\n", rep->id, rep->iblk,
- rep->num_blks * clp->bs);
- }
-#if defined(__GNUC__)
-#if (__GNUC__ >= 7)
- __attribute__((fallthrough));
- /* FALL THROUGH */
-#endif
-#endif
- case 0:
- status = pthread_mutex_lock(&clp->in_mutex);
- if (0 != status) err_exit(status, "lock in_mutex");
- if (rep->dio_incomplete_count || rep->resid) {
- clp->dio_incomplete_count += rep->dio_incomplete_count;
- clp->sum_of_resids += rep->resid;
- }
- clp->in_rem_count -= rep->num_blks;
- status = pthread_mutex_unlock(&clp->in_mutex);
- if (0 != status) err_exit(status, "unlock in_mutex");
- // return;
- break;
- default:
- pr2serr_lk("%s: tid=%d: error finishing in (%d)\n", __func__,
- rep->id, res);
- if (exit_status <= 0)
- exit_status = res;
- stop_both(clp);
- // return;
- break;
- }
-
-
-#ifdef SGH_DD_READ_COMPLET_AFTER
- return;
-
-write_complet:
-#endif
- /* finish WRITE, no lock held */
- rep->wr = true;
- res = sg_finish_io(rep->wr, rep, pid_write, NULL);
- switch (res) {
- case SG_LIB_CAT_ABORTED_COMMAND:
- case SG_LIB_CAT_UNIT_ATTENTION:
- /* try again with same addr, count info */
- /* now re-acquire in mutex for balance */
- /* N.B. This re-write could now be out of write sequence */
- status = pthread_mutex_lock(&clp->in_mutex);
- if (0 != status) err_exit(status, "lock in_mutex");
- break; /* loops around */
- case SG_LIB_CAT_MEDIUM_HARD:
- if (0 == clp->out_flags.coe) {
- pr2serr_lk("error finishing sg out command (medium)\n");
- if (exit_status <= 0)
- exit_status = res;
- stop_both(clp);
- return;
- } else
- pr2serr_lk(">> ignored error for out blk=%" PRId64 " for %d "
- "bytes\n", rep->oblk, rep->num_blks * clp->bs);
-#if defined(__GNUC__)
-#if (__GNUC__ >= 7)
- __attribute__((fallthrough));
- /* FALL THROUGH */
-#endif
-#endif
- case 0:
- status = pthread_mutex_lock(&clp->in_mutex);
- if (0 != status) err_exit(status, "lock in_mutex");
- if (rep->dio_incomplete_count || rep->resid) {
- clp->dio_incomplete_count += rep->dio_incomplete_count;
- clp->sum_of_resids += rep->resid;
- }
- clp->out_rem_count -= rep->num_blks;
- status = pthread_mutex_unlock(&clp->in_mutex);
- if (0 != status) err_exit(status, "unlock out_mutex");
-
-#ifdef SGH_DD_READ_COMPLET_AFTER
- goto read_complet;
-#endif
- return;
- default:
- pr2serr_lk("error finishing sg out command (%d)\n", res);
- if (exit_status <= 0)
- exit_status = res;
- stop_both(clp);
- return;
- }
- } /* end of while (1) loop */
-}
-
/* Returns reserved_buffer_size/mmap_size if success, else 0 for failure */
static int
sg_prepare_resbuf(int fd, int bs, int bpt, bool def_res, int elem_sz,
@@ -4315,9 +4122,12 @@ parse_cmdline_sanity(int argc, char * argv[], struct global_collection * clp,
usage(1);
return SG_LIB_SYNTAX_ERROR;
}
- if (clp->in_flags.swait && (! clp->out_flags.swait)) {
- pr2serr("iflag=swait is treated as oflag=swait\n");
- clp->out_flags.swait = true;
+ if (clp->in_flags.swait || clp->out_flags.swait) {
+ if (clp->verbose)
+ pr2serr("the 'swait' flag is now ignored\n");
+ /* remnants ... */
+ if (clp->in_flags.swait && (! clp->out_flags.swait))
+ clp->out_flags.swait = true;
}
clp->unit_nanosec = (do_time > 1) || !!getenv("SG3_UTILS_LINUX_NANO");
#if 0