From 7901cc4a6d580fddd88afccd8096cf292048db0b Mon Sep 17 00:00:00 2001 From: Douglas Gilbert Date: Thu, 8 Apr 2021 01:08:07 +0000 Subject: tweaking utilities in testing directory git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@894 6180dd3e-e324-4e3e-922d-17de1ae2f315 --- ChangeLog | 2 +- debian/changelog | 2 +- doc/sg3_utils.8 | 2 +- sg3_utils.spec | 2 +- testing/sg_iovec_tst.cpp | 6 +++--- testing/sg_mrq_dd.cpp | 9 +++++---- testing/sg_take_snap.c | 25 ++++++++++++++++++++++++- testing/sg_tst_ioctl.c | 6 +++--- testing/sgh_dd.cpp | 17 ++++++++--------- testing/sgs_dd.c | 4 ++-- 10 files changed, 49 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index 911aea75..51bf984e 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 pre-release sg3_utils-1.47 [20210331] [svn: r893] +Changelog for pre-release sg3_utils-1.47 [20210407] [svn: r894] - move some hex file from examples to inhex directory - add testing/sg_take_snap diff --git a/debian/changelog b/debian/changelog index 07503bbb..07151408 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,7 +2,7 @@ sg3-utils (1.47-0.1) unstable; urgency=low * New upstream version - -- Douglas Gilbert Mon, 29 Mar 2021 22:00:00 -0400 + -- Douglas Gilbert Wed, 07 Apr 2021 21:00:00 -0400 sg3-utils (1.46-0.1) unstable; urgency=low diff --git a/doc/sg3_utils.8 b/doc/sg3_utils.8 index 1e640264..05d72695 100644 --- a/doc/sg3_utils.8 +++ b/doc/sg3_utils.8 @@ -1,4 +1,4 @@ -.TH SG3_UTILS "8" "March 2021" "sg3_utils\-1.47" SG3_UTILS +.TH SG3_UTILS "8" "April 2021" "sg3_utils\-1.47" SG3_UTILS .SH NAME sg3_utils \- a package of utilities for sending SCSI commands .SH SYNOPSIS diff --git a/sg3_utils.spec b/sg3_utils.spec index 52b58994..f46682ea 100644 --- a/sg3_utils.spec +++ b/sg3_utils.spec @@ -84,7 +84,7 @@ fi %{_libdir}/*.la %changelog -* Mon Mar 29 2021 - dgilbert at interlog dot com +* Wed Apr 07 2021 - dgilbert at interlog dot com - track t10 changes * sg3_utils-1.47 diff --git a/testing/sg_iovec_tst.cpp b/testing/sg_iovec_tst.cpp index 3ee728ac..73c6168c 100644 --- a/testing/sg_iovec_tst.cpp +++ b/testing/sg_iovec_tst.cpp @@ -114,7 +114,7 @@ usage(void) " [--skip=SKIP] [--verbose] [--version] " "SG_DEV OUT_F\n"); printf("where:\n" - " --async|-a async sg usage (def: use ioctl(SGIO) )\n"); + " --async|-a async sg usage (def: use ioctl(SG_IO) )\n"); printf(" --bs=BS|-b BS logical block size of SG_DEV (def: 512 " "bytes)\n"); printf(" --elem_sz=ES|-e ES iovec element size (def: BS bytes)\n"); @@ -126,9 +126,9 @@ usage(void) printf(" --help|-h this usage message\n"); printf(" --num=NUM|-n NUM number of blocks to read from SG_DEV\n"); printf(" --sgl=SFN|-S SFN Sgl FileName (SFN) that is written to, " - "with\n" + "with\n" " addresses and lengths having ES as " - "their unit\n"); + "their unit\n"); printf(" --sgv4|-4 use the sg v4 interface (def: v3 " "interface)\n"); printf(" --skip=SKIP|-s SKIP SKIP blocks before reading S_DEV " diff --git a/testing/sg_mrq_dd.cpp b/testing/sg_mrq_dd.cpp index 832a21a1..49f027ae 100644 --- a/testing/sg_mrq_dd.cpp +++ b/testing/sg_mrq_dd.cpp @@ -30,7 +30,7 @@ * */ -static const char * version_str = "1.25 20210331"; +static const char * version_str = "1.26 20210402"; #define _XOPEN_SOURCE 600 #ifndef _GNU_SOURCE @@ -879,10 +879,11 @@ usage(int pg_num) " null,sync]\n" " count number of blocks to copy (def: device size)\n" " if file or device to read from (def: stdin)\n" - " iflag comma separated list from: [coe,dio," + " iflag comma separated list from: [00,coe,dio," "direct,dpo,\n" - " dsync,excl,fua,masync,mmap,nodur,\n" - " null,order,qtail,serial,wq_excl]\n" + " dsync,excl,ff,fua,masync,mmap,nodur,null," + "order,\n" + " qhead,qtail,random,serial,wq_excl]\n" " of file or device to write to (def: /dev/null " "N.B. different\n" " from dd it defaults to stdout). If 'of=.' " diff --git a/testing/sg_take_snap.c b/testing/sg_take_snap.c index e0459dbc..852d3be6 100644 --- a/testing/sg_take_snap.c +++ b/testing/sg_take_snap.c @@ -55,7 +55,7 @@ #define ME "sg_take_snap: " -static const char * version_str = "1.00.67 20210330"; +static const char * version_str = "1.01 20210403"; #define SG_TAKE_MAX_DEVS 16 @@ -161,6 +161,29 @@ int main(int argc, char * argv[]) sg_fd = -1; goto fini; } + if (0 == k) { + int t; + + res = ioctl(sg_fd, SG_GET_VERSION_NUM, &t); + if ((res < 0) || (t < 30000)) { + pr2serr("sg driver prior to 3.0.00\n"); + ret = SG_LIB_FILE_ERROR; + goto fini; + } + if (verbose) { + pr2serr("sg driver version: %d.%02d.%02d\n", + t / 10000, (t % 10000) / 100, t % 100); + } + if (t < 40000) { + pr2serr("Warning: sg driver prior to 4.0.00\n"); + ret = SG_LIB_FILE_ERROR; + goto fini; + } else if (t < 40045) { + pr2serr("Warning: sg driver prior to 4.0.45\n"); + ret = SG_LIB_FILE_ERROR; + goto fini; + } + } seip = &sei; memset(seip, 0, sizeof(*seip)); diff --git a/testing/sg_tst_ioctl.c b/testing/sg_tst_ioctl.c index 0dff9f1a..f7a421e9 100644 --- a/testing/sg_tst_ioctl.c +++ b/testing/sg_tst_ioctl.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018-2020 D. Gilbert + * Copyright (C) 2018-2021 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) @@ -60,7 +60,7 @@ * later of the Linux sg driver. */ -static const char * version_str = "Version: 1.19 20200825"; +static const char * version_str = "Version: 1.20 20210406"; #define INQ_REPLY_LEN 128 #define INQ_CMD_LEN 6 @@ -1203,7 +1203,7 @@ dname_range_loop: } cp = do_fork ? relative_cp : ""; - if (! do_v3_only) { + if (! do_v3_only && (sg_drv_ver_num > 40030)) { if (tst_extended_ioctl(dname, sg_fd, second_fname, sg_fd2, sock, cp)) goto out; diff --git a/testing/sgh_dd.cpp b/testing/sgh_dd.cpp index 1d3bf6fc..7fb4ae06 100644 --- a/testing/sgh_dd.cpp +++ b/testing/sgh_dd.cpp @@ -36,7 +36,7 @@ * renamed [20181221] */ -static const char * version_str = "2.03 20210331"; +static const char * version_str = "2.04 20210402"; #define _XOPEN_SOURCE 600 #ifndef _GNU_SOURCE @@ -415,8 +415,7 @@ static const char * my_name = "sgh_dd: "; static const char * mrq_blk_s = "mrq: ordinary blocking"; static const char * mrq_vb_s = "mrq: variable blocking"; static const char * mrq_svb_s = "mrq: shared variable blocking (svb)"; -static const char * mrq_s_nb_s = "mrq: submit non-blocking"; -static const char * mrq_nw_nb_s = "mrq: waitless non-blocking"; +static const char * mrq_s_nb_s = "mrq: submit of full non-blocking"; #ifdef __GNUC__ @@ -2500,8 +2499,9 @@ fini: } #endif -/* do mrq 'submit (waitless) non-blocking' call. These are restricted to - * a single file descriptor (i.e. the 'fd' argument). */ +/* do mrq 'full non-blocking' invocation so both submission and completion + * is async (i.e. uses SGV4_FLAG_IMMED flag). This type of mrq is + * restricted to a single file descriptor (i.e. the 'fd' argument). */ static int sgh_do_async_mrq(Rq_elem * rep, mrq_arr_t & def_arr, int fd, struct sg_io_v4 * ctlop, int nrq) @@ -2520,11 +2520,11 @@ sgh_do_async_mrq(Rq_elem * rep, mrq_arr_t & def_arr, int fd, a_v4p = def_arr.first.data(); ctlop->flags = SGV4_FLAG_MULTIPLE_REQS; if (clp->in_flags.hipri || clp->out_flags.hipri) { - /* hipri non-blocking */ + /* submit of full non-blocking with HIPRI */ ctlop->flags |= (SGV4_FLAG_IMMED | SGV4_FLAG_HIPRI); if (!after1 && (clp->verbose > 1)) { after1 = true; - pr2serr_lk("%s: %s\n", __func__, mrq_nw_nb_s); + pr2serr_lk("%s: %s\n", __func__, mrq_s_nb_s); } } else { ctlop->flags |= SGV4_FLAG_IMMED; /* submit non-blocking */ @@ -2835,8 +2835,7 @@ sgh_do_deferred_mrq(Rq_elem * rep, mrq_arr_t & def_arr) v4hdr_out_lk("Controlling object before", &ctl_v4, id); } if (clp->mrq_async && (! rep->both_sg)) { - /* do 'submit non-blocking' or 'submit waitless non_blocking' - * multiple request */ + /* do 'submit non-blocking' or 'full non-blocking' mrq */ mrq_arr_t fd_def_arr; mrq_arr_t o_fd_def_arr; diff --git a/testing/sgs_dd.c b/testing/sgs_dd.c index 7f567d9f..64ff86cf 100644 --- a/testing/sgs_dd.c +++ b/testing/sgs_dd.c @@ -84,7 +84,7 @@ #include "sg_unaligned.h" -static const char * version_str = "4.18 20210331"; +static const char * version_str = "4.19 20210406"; static const char * my_name = "sgs_dd"; #ifndef SGV4_FLAG_HIPRI @@ -940,7 +940,7 @@ start_write(Rq_coll * clp) return blocks; } -/* Returns 0 if SGIO/SIGPOLL or (SIGRTMIN + 1) received, else returns negated +/* Returns 0 if SIGIO/SIGPOLL or (SIGRTMIN + 1) received, else returns negated * errno value; -EAGAIN for timeout. */ static int do_sigwait(Rq_coll * clp, bool inc1_clear0) -- cgit v1.2.3