aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--aclocal.m46
-rwxr-xr-xconfigure6
-rw-r--r--debian/changelog2
-rw-r--r--doc/sg3_utils.82
-rw-r--r--lib/sg_cmds_basic.c14
-rw-r--r--lib/sg_pt_linux_nvme.c4
-rwxr-xr-xltmain.sh10
-rw-r--r--sg3_utils.spec2
-rw-r--r--src/sg_compare_and_write.c9
-rw-r--r--src/sg_dd.c9
-rw-r--r--src/sg_map26.c4
-rw-r--r--src/sg_rbuf.c6
-rw-r--r--src/sg_reset.c4
-rw-r--r--src/sg_ses.c4
-rw-r--r--src/sg_vpd.c6
-rw-r--r--src/sg_write_same.c8
-rw-r--r--src/sg_write_verify.c8
-rw-r--r--src/sg_write_x.c7
-rw-r--r--src/sgm_dd.c18
-rw-r--r--src/sgp_dd.c24
21 files changed, 101 insertions, 56 deletions
diff --git a/ChangeLog b/ChangeLog
index 64008fc5..9c08a8c6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,17 +2,19 @@ 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 [20200423] [svn: r849]
+Changelog for sg3_utils-1.46 [20200503] [svn: r850]
- sg_dd: separate category for miscompare errors
- sg_get_elem_status: add ralwd bit sbc4r20a
- sg_write_x: add dld bits to write(32) [sbc4r19a]
- 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_lib: restore elements and rebuild command added
- sg_lib: Linux NVMe SNTL: add read, write and verify;
synchronize cache and write same translations
- add dummy start stop unit and test unit ready commands
- wire cache mpage's WCE to nvme 'volatile write cache'
+ - sg_lib: reprint cdb with illegal request sense key
- testing/sgs_dd: add evfd flags and eventfd processing
- testing/sgh_dd: various fixes
diff --git a/aclocal.m4 b/aclocal.m4
index 2fd8809f..292ea325 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1055,8 +1055,8 @@ int forced_loaded() { return 2;}
_LT_EOF
echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD
$LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD
- echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD
- $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD
+ echo "$AR cr libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD
+ $AR cr libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD
echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD
$RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD
cat > conftest.c << _LT_EOF
@@ -1506,7 +1506,7 @@ need_locks=$enable_libtool_lock
m4_defun([_LT_PROG_AR],
[AC_CHECK_TOOLS(AR, [ar], false)
: ${AR=ar}
-: ${AR_FLAGS=cru}
+: ${AR_FLAGS=cr}
_LT_DECL([], [AR], [1], [The archiver])
_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive])
diff --git a/configure b/configure
index 8fd118bc..d503d531 100755
--- a/configure
+++ b/configure
@@ -5787,7 +5787,7 @@ esac
fi
: ${AR=ar}
-: ${AR_FLAGS=cru}
+: ${AR_FLAGS=cr}
@@ -7508,8 +7508,8 @@ int forced_loaded() { return 2;}
_LT_EOF
echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5
$LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
- echo "$AR cru libconftest.a conftest.o" >&5
- $AR cru libconftest.a conftest.o 2>&5
+ echo "$AR cr libconftest.a conftest.o" >&5
+ $AR cr libconftest.a conftest.o 2>&5
echo "$RANLIB libconftest.a" >&5
$RANLIB libconftest.a 2>&5
cat > conftest.c << _LT_EOF
diff --git a/debian/changelog b/debian/changelog
index da1320b7..5947daa9 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> Thu, 23 Apr 2020 21:00:00 -0400
+ -- Douglas Gilbert <dgilbert@interlog.com> Sun, 05 May 2020 18:00:00 -0400
sg3-utils (1.45-0.1) unstable; urgency=low
diff --git a/doc/sg3_utils.8 b/doc/sg3_utils.8
index 85be58ba..de3106b3 100644
--- a/doc/sg3_utils.8
+++ b/doc/sg3_utils.8
@@ -1,4 +1,4 @@
-.TH SG3_UTILS "8" "April 2020" "sg3_utils\-1.46" SG3_UTILS
+.TH SG3_UTILS "8" "May 2020" "sg3_utils\-1.46" SG3_UTILS
.SH NAME
sg3_utils \- a package of utilities for sending SCSI commands
.SH SYNOPSIS
diff --git a/lib/sg_cmds_basic.c b/lib/sg_cmds_basic.c
index c119c51f..323df25d 100644
--- a/lib/sg_cmds_basic.c
+++ b/lib/sg_cmds_basic.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999-2019 Douglas Gilbert.
+ * Copyright (c) 1999-2020 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.
@@ -42,7 +42,7 @@
#endif
-static const char * const version_str = "1.95 20191219";
+static const char * const version_str = "1.96 20200503";
#define SENSE_BUFF_LEN 64 /* Arbitrary, could be larger */
@@ -182,11 +182,11 @@ sg_cmds_process_helper(const char * leadin, int req_din_x, int act_din_x,
* call to the pass-through. pt_res is returned from do_scsi_pt(). If valid
* sense data is found it is decoded and output to sg_warnings_strm (def:
* stderr); depending on the 'noisy' and 'verbose' settings. Returns -2 for
- * "sense" category (may not be fatal), -1 for failed, 0, or a positive
- * number. If din type command (or bidi) returns actual number of bytes read
- * (din_len - resid); otherwise returns 0. If -2 returned then sense category
- * output via 'o_sense_cat' pointer (if not NULL). Note that several sense
- * categories also have data in bytes received; -2 is still returned. */
+ * o_sense_cat (sense category) written which may not be fatal. Returns
+ * -1 for other types of failure. Returns 0, or a positive number. If data-in
+ * type command (or bidi) then returns actual number of bytes read
+ * (din_len - resid); otherwise returns 0. Note that several sense categories
+ * also have data in bytes received; -2 is still returned. */
int
sg_cmds_process_resp(struct sg_pt_base * ptvp, const char * leadin,
int pt_res, bool noisy, int verbose, int * o_sense_cat)
diff --git a/lib/sg_pt_linux_nvme.c b/lib/sg_pt_linux_nvme.c
index 46e221bf..60e042e3 100644
--- a/lib/sg_pt_linux_nvme.c
+++ b/lib/sg_pt_linux_nvme.c
@@ -41,7 +41,7 @@
* MA 02110-1301, USA.
*/
-/* sg_pt_linux_nvme version 1.12 20200412 */
+/* sg_pt_linux_nvme version 1.13 20200501 */
/* This file contains a small "SPC-only" SNTL to support the SES pass-through
* of SEND DIAGNOSTIC and RECEIVE DIAGNOSTIC RESULTS through NVME-MI
@@ -1589,7 +1589,7 @@ sntl_write_same(struct sg_pt_linux_scsi * ptp, const uint8_t * cdbp,
if (vb > 3)
pr2ws("%s: ndob=%d, time_secs=%d\n", __func__, (int)ndob, time_secs);
if (! ndob) {
- int res, flbas, index, lbafx, lbads, lbsize;
+ int flbas, index, lbafx, lbads, lbsize;
uint8_t * up;
uint8_t * dp;
diff --git a/ltmain.sh b/ltmain.sh
index d11f1e02..0cb7f90d 100755
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -31,7 +31,7 @@
PROGRAM=libtool
PACKAGE=libtool
-VERSION="2.4.6 Debian-2.4.6-11"
+VERSION="2.4.6 Debian-2.4.6-14"
package_revision=2.4.6
@@ -387,7 +387,7 @@ EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
# putting '$debug_cmd' at the start of all your functions, you can get
# bash to show function call trace with:
#
-# debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
+# debug_cmd='echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
debug_cmd=${debug_cmd-":"}
exit_cmd=:
@@ -2141,7 +2141,7 @@ include the following information:
compiler: $LTCC
compiler flags: $LTCFLAGS
linker: $LD (gnu? $with_gnu_ld)
- version: $progname $scriptversion Debian-2.4.6-11
+ version: $progname $scriptversion Debian-2.4.6-14
automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q`
@@ -7368,10 +7368,12 @@ func_mode_link ()
# -stdlib=* select c++ std lib with clang
# -fsanitize=* Clang/GCC memory and address sanitizer
# -fuse-ld=* Linker select flags for GCC
+ # -static-* direct GCC to link specific libraries statically
+ # -fcilkplus Cilk Plus language extension features for C/C++
-64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
-t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
-O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*| \
- -specs=*|-fsanitize=*|-fuse-ld=*)
+ -specs=*|-fsanitize=*|-fuse-ld=*|-static-*|-fcilkplus)
func_quote_for_eval "$arg"
arg=$func_quote_for_eval_result
func_append compile_command " $arg"
diff --git a/sg3_utils.spec b/sg3_utils.spec
index 94a0a143..29eed7a3 100644
--- a/sg3_utils.spec
+++ b/sg3_utils.spec
@@ -84,7 +84,7 @@ fi
%{_libdir}/*.la
%changelog
-* Thu Apr 23 2020 - dgilbert at interlog dot com
+* Sun May 03 2020 - dgilbert at interlog dot com
- track t10 changes
* sg3_utils-1.46
diff --git a/src/sg_compare_and_write.c b/src/sg_compare_and_write.c
index d1905899..11f5e859 100644
--- a/src/sg_compare_and_write.c
+++ b/src/sg_compare_and_write.c
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2012-2019, Kaminario Technologies LTD
+* Copyright (c) 2012-2020, Kaminario Technologies LTD
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -56,7 +56,7 @@
#include "sg_unaligned.h"
#include "sg_pr2serr.h"
-static const char * version_str = "1.27 20191220";
+static const char * version_str = "1.28 20200429";
#define DEF_BLOCK_SIZE 512
#define DEF_NUM_BLOCKS (1)
@@ -415,6 +415,11 @@ sg_ll_compare_and_write(int sg_fd, uint8_t * buff, int blocks,
else
pr2serr("Miscompare reported\n");
break;
+ case SG_LIB_CAT_ILLEGAL_REQ:
+ if (verbose)
+ sg_print_command_len(cawCmd,
+ COMPARE_AND_WRITE_CDB_SIZE);
+ /* FALL THROUGH */
default:
ret = sense_cat;
break;
diff --git a/src/sg_dd.c b/src/sg_dd.c
index d51402d8..f950364b 100644
--- a/src/sg_dd.c
+++ b/src/sg_dd.c
@@ -66,7 +66,7 @@
#include "sg_unaligned.h"
#include "sg_pr2serr.h"
-static const char * version_str = "6.14 20200423";
+static const char * version_str = "6.15 20200429";
#define ME "sg_dd: "
@@ -678,6 +678,7 @@ sg_read_low(int sg_fd, uint8_t * buff, int blocks, int64_t from_block,
uint64_t * io_addrp)
{
bool info_valid;
+ bool print_cdb_after = false;
int res, slen;
const uint8_t * sbp;
uint8_t rdCmd[MAX_SCSI_CDBSZ];
@@ -786,6 +787,8 @@ sg_read_low(int sg_fd, uint8_t * buff, int blocks, int64_t from_block,
return SG_LIB_CAT_MEDIUM_HARD;
}
}
+ if (verbose > 0)
+ print_cdb_after = true;
#if defined(__GNUC__)
#if (__GNUC__ >= 7)
__attribute__((fallthrough));
@@ -796,6 +799,8 @@ sg_read_low(int sg_fd, uint8_t * buff, int blocks, int64_t from_block,
++unrecovered_errs;
if (verbose > 0)
sg_chk_n_print3("reading", &io_hdr, verbose > 1);
+ if (print_cdb_after)
+ sg_print_command_len(rdCmd, ifp->cdbsz);
return res;
}
if (diop && *diop &&
@@ -1163,6 +1168,8 @@ sg_write(int sg_fd, uint8_t * buff, int blocks, int64_t to_block,
case SG_LIB_CAT_MEDIUM_HARD:
default:
sg_chk_n_print3(op_str, &io_hdr, verbose > 1);
+ if ((SG_LIB_CAT_ILLEGAL_REQ == res) && verbose)
+ sg_print_command_len(wrCmd, ofp->cdbsz);
++unrecovered_errs;
if (ofp->coe) {
pr2serr(">> ignored errors for out blk=%" PRId64 " for %d "
diff --git a/src/sg_map26.c b/src/sg_map26.c
index b96eb042..ddee5c47 100644
--- a/src/sg_map26.c
+++ b/src/sg_map26.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005-2018 Douglas Gilbert.
+ * Copyright (c) 2005-2020 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.
@@ -47,7 +47,7 @@
#endif
#include "sg_lib.h"
-static const char * version_str = "1.16 20180724";
+static const char * version_str = "1.17 20200501";
#define ME "sg_map26: "
diff --git a/src/sg_rbuf.c b/src/sg_rbuf.c
index 760129d8..3126ed9b 100644
--- a/src/sg_rbuf.c
+++ b/src/sg_rbuf.c
@@ -1,5 +1,5 @@
/* A utility program originally written for the Linux OS SCSI subsystem.
- * Copyright (C) 1999-2019 D. Gilbert
+ * Copyright (C) 1999-2020 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)
@@ -57,7 +57,7 @@
#endif
-static const char * version_str = "5.07 20191226";
+static const char * version_str = "5.08 20200501";
static struct option long_options[] = {
{"buffer", required_argument, 0, 'b'},
@@ -632,6 +632,8 @@ main(int argc, char * argv[])
#ifdef DEBUG
if (clear) {
+ int j;
+
for (j = 0; j < buf_size; ++j) {
if (rbBuff[j] != 0) {
clear = false;
diff --git a/src/sg_reset.c b/src/sg_reset.c
index a84c3d83..d2cb2488 100644
--- a/src/sg_reset.c
+++ b/src/sg_reset.c
@@ -1,5 +1,5 @@
/* A utility program originally written for the Linux OS SCSI subsystem.
- * Copyright (C) 1999-2018 D. Gilbert
+ * Copyright (C) 1999-2020 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)
@@ -33,7 +33,7 @@
#define ME "sg_reset: "
-static const char * version_str = "0.66 20180515";
+static const char * version_str = "0.67 20200501";
#ifndef SG_SCSI_RESET
#define SG_SCSI_RESET 0x2284
diff --git a/src/sg_ses.c b/src/sg_ses.c
index 23fc3b95..7072c50f 100644
--- a/src/sg_ses.c
+++ b/src/sg_ses.c
@@ -38,7 +38,7 @@
* commands tailored for SES (enclosure) devices.
*/
-static const char * version_str = "2.48 20200206"; /* ses4r03 + 20-013r1 */
+static const char * version_str = "2.48 20200501"; /* ses4r04 */
#define MX_ALLOC_LEN ((64 * 1024) - 4) /* max allowable for big enclosures */
#define MX_ELEM_HDR 1024
@@ -2468,7 +2468,7 @@ find_sas_connector_type(int conn_type, bool abridged, char * buff,
return buff;
}
-/* 'Fan speed factor' new in 20-013r1, probably will be in ses4r04 */
+/* 'Fan speed factor' new in ses4r04 */
static int
calc_fan_speed(int fan_speed_factor, int actual_fan_speed)
{
diff --git a/src/sg_vpd.c b/src/sg_vpd.c
index 535f6c14..f088330c 100644
--- a/src/sg_vpd.c
+++ b/src/sg_vpd.c
@@ -40,7 +40,7 @@
*/
-static const char * version_str = "1.59 20200423"; /* spc6r01 + sbc4r20a */
+static const char * version_str = "1.60 20200501"; /* spc6r01 + sbc4r20a */
/* standard VPD pages, in ascending page number order */
#define VPD_SUPPORTED_VPDS 0x0
@@ -3552,7 +3552,7 @@ svpd_examine_all(int sg_fd, struct opts_t * op)
int k, res;
int max_pn = 255;
int any_err = 0;
- char b[64];
+ char b[80];
if (op->vpd_pn > 0)
max_pn = op->vpd_pn;
@@ -3577,8 +3577,6 @@ svpd_examine_all(int sg_fd, struct opts_t * op)
if (SG_LIB_CAT_ABORTED_COMMAND == res)
pr2serr("fetching VPD page failed, aborted command\n");
else if (res && (SG_LIB_CAT_ILLEGAL_REQ != res)) {
- char b[80];
-
/* SG_LIB_CAT_ILLEGAL_REQ expected as well examine all */
sg_get_category_sense_str(res, sizeof(b), b, op->verbose);
pr2serr("fetching VPD page failed: %s\n", b);
diff --git a/src/sg_write_same.c b/src/sg_write_same.c
index 9ba8c3a6..54168961 100644
--- a/src/sg_write_same.c
+++ b/src/sg_write_same.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009-2019 Douglas Gilbert.
+ * Copyright (c) 2009-2020 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.
@@ -33,7 +33,7 @@
#include "sg_unaligned.h"
#include "sg_pr2serr.h"
-static const char * version_str = "1.30 20191220";
+static const char * version_str = "1.31 20200430";
#define ME "sg_write_same: "
@@ -298,6 +298,10 @@ do_write_same(int sg_fd, const struct opts_t * op, const void * dataoutp,
}
ret = sense_cat;
break;
+ case SG_LIB_CAT_ILLEGAL_REQ:
+ if (op->verbose)
+ sg_print_command_len(ws_cdb, cdb_len);
+ /* FALL THROUGH */
default:
ret = sense_cat;
break;
diff --git a/src/sg_write_verify.c b/src/sg_write_verify.c
index 4a8ea248..5b394c93 100644
--- a/src/sg_write_verify.c
+++ b/src/sg_write_verify.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2019 Douglas Gilbert
+ * Copyright (c) 2014-2020 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.
@@ -40,7 +40,7 @@
#include "sg_unaligned.h"
#include "sg_pr2serr.h"
-static const char * version_str = "1.17 20191220";
+static const char * version_str = "1.18 20200430";
#define ME "sg_write_verify: "
@@ -175,6 +175,10 @@ run_scsi_transaction(int sg_fd, const uint8_t *cdbp, int cdb_len,
}
ret = sense_cat;
break;
+ case SG_LIB_CAT_ILLEGAL_REQ:
+ if (verbose)
+ sg_print_command_len(cdbp, cdb_len);
+ /* FALL THROUGH */
case SG_LIB_CAT_PROTECTION: /* PI failure */
case SG_LIB_CAT_MISCOMPARE: /* only in bytchk=1 case */
default:
diff --git a/src/sg_write_x.c b/src/sg_write_x.c
index 925aa92f..0a41d4ae 100644
--- a/src/sg_write_x.c
+++ b/src/sg_write_x.c
@@ -38,7 +38,7 @@
#include "sg_unaligned.h"
#include "sg_pr2serr.h"
-static const char * version_str = "1.23 20200331";
+static const char * version_str = "1.24 20200429";
/* Protection Information refers to 8 bytes of extra information usually
* associated with each logical block and is often abbreviated to PI while
@@ -1374,6 +1374,11 @@ do_write_x(int sg_fd, const void * dataoutp, int dout_len,
}
ret = sense_cat;
break;
+ case SG_LIB_CAT_ILLEGAL_REQ:
+ if (vb)
+ sg_print_command_len(x_cdb, cdb_len);
+ ret = sense_cat;
+ break;
default:
ret = sense_cat;
break;
diff --git a/src/sgm_dd.c b/src/sgm_dd.c
index 3932242b..2992e20a 100644
--- a/src/sgm_dd.c
+++ b/src/sgm_dd.c
@@ -69,7 +69,7 @@
#include "sg_pr2serr.h"
-static const char * version_str = "1.65 20200216";
+static const char * version_str = "1.66 20200429";
#define DEF_BLOCK_SIZE 512
#define DEF_BLOCKS_PER_TRANSFER 128
@@ -467,6 +467,7 @@ static int
sg_read(int sg_fd, uint8_t * buff, int blocks, int64_t from_block,
int bs, int cdbsz, bool fua, bool dpo, bool do_mmap)
{
+ bool print_cdb_after = false;
int res;
uint8_t rdCmd[MAX_SCSI_CDBSZ];
uint8_t senseBuff[SENSE_BUFF_LEN];
@@ -538,11 +539,16 @@ sg_read(int sg_fd, uint8_t * buff, int blocks, int64_t from_block,
case SG_LIB_CAT_NOT_READY:
case SG_LIB_CAT_MEDIUM_HARD:
return res;
+ case SG_LIB_CAT_ILLEGAL_REQ:
+ if (verbose)
+ print_cdb_after = true;
+ /* FALL THROUGH */
case SG_LIB_CAT_ABORTED_COMMAND:
case SG_LIB_CAT_UNIT_ATTENTION:
- case SG_LIB_CAT_ILLEGAL_REQ:
default:
sg_chk_n_print3("reading", &io_hdr, verbose > 1);
+ if (print_cdb_after)
+ sg_print_command_len(rdCmd, cdbsz);
return res;
}
sum_of_resids += io_hdr.resid;
@@ -558,6 +564,7 @@ static int
sg_write(int sg_fd, uint8_t * buff, int blocks, int64_t to_block,
int bs, int cdbsz, bool fua, bool dpo, bool do_mmap, bool * diop)
{
+ bool print_cdb_after = false;
int res;
uint8_t wrCmd[MAX_SCSI_CDBSZ];
uint8_t senseBuff[SENSE_BUFF_LEN];
@@ -631,11 +638,16 @@ sg_write(int sg_fd, uint8_t * buff, int blocks, int64_t to_block,
case SG_LIB_CAT_NOT_READY:
case SG_LIB_CAT_MEDIUM_HARD:
return res;
+ case SG_LIB_CAT_ILLEGAL_REQ:
+ if (verbose)
+ print_cdb_after = true;
+ /* FALL THROUGH */
case SG_LIB_CAT_ABORTED_COMMAND:
case SG_LIB_CAT_UNIT_ATTENTION:
- case SG_LIB_CAT_ILLEGAL_REQ:
default:
sg_chk_n_print3("writing", &io_hdr, verbose > 1);
+ if (print_cdb_after)
+ sg_print_command_len(wrCmd, cdbsz);
return res;
}
if (diop && *diop &&
diff --git a/src/sgp_dd.c b/src/sgp_dd.c
index 7f417b96..9dd089d1 100644
--- a/src/sgp_dd.c
+++ b/src/sgp_dd.c
@@ -192,7 +192,7 @@ typedef struct request_element
uint8_t * buffp;
uint8_t * alloc_bp;
struct sg_io_hdr io_hdr;
- uint8_t cmd[MAX_SCSI_CDBSZ];
+ uint8_t cdb[MAX_SCSI_CDBSZ];
uint8_t sb[SENSE_BUFF_LEN];
int bs;
int dio_incomplete_count;
@@ -689,18 +689,15 @@ sg_out_open(const char * fnp, struct flags_t * flagp, int bs, int bpt)
static void *
read_write_thread(void * v_tap)
{
- Thread_arg * tap;
- Rq_coll * clp;
+ Thread_arg * tap = (Thread_arg *)v_tap;
+ Rq_coll * clp = tap->clp;
Rq_elem rel;
Rq_elem * rep = &rel;
int sz;
volatile bool stop_after_write = false;
int64_t seek_skip;
- int blocks, status, id;
+ int blocks, status;
- tap = (Thread_arg *)v_tap;
- id = tap->id;
- clp = tap->clp;
sz = clp->bpt * clp->bs;
seek_skip = clp->seek - clp->skip;
memset(rep, 0, sizeof(Rq_elem));
@@ -732,7 +729,6 @@ read_write_thread(void * v_tap)
if (clp->mmap_active) {
int fd = clp->in_flags.mmap ? rep->infd : rep->outfd;
-pr2serr("%s: id=%d, fd=%d calling sgp_mem_mmap()\n", __func__, id, fd);
status = sgp_mem_mmap(fd, sz, &rep->buffp);
if (status) err_exit(status, "sgp_mem_mmap() failed");
} else {
@@ -1054,6 +1050,10 @@ sg_in_operation(Rq_coll * clp, Rq_elem * rep)
status = pthread_mutex_unlock(&clp->in_mutex);
if (0 != status) err_exit(status, "unlock in_mutex");
return;
+ case SG_LIB_CAT_ILLEGAL_REQ:
+ if (clp->debug)
+ sg_print_command_len(rep->cdb, rep->cdbsz_in);
+ /* FALL THROUGH */
default:
pr2serr("error finishing sg in command (%d)\n", res);
if (exit_status <= 0)
@@ -1128,6 +1128,10 @@ sg_out_operation(Rq_coll * clp, Rq_elem * rep)
status = pthread_mutex_unlock(&clp->out_mutex);
if (0 != status) err_exit(status, "unlock out_mutex");
return;
+ case SG_LIB_CAT_ILLEGAL_REQ:
+ if (clp->debug)
+ sg_print_command_len(rep->cdb, rep->cdbsz_out);
+ /* FALL THROUGH */
default:
pr2serr("error finishing sg out command (%d)\n", res);
if (exit_status <= 0)
@@ -1149,7 +1153,7 @@ sg_start_io(Rq_elem * rep)
int cdbsz = rep->wr ? rep->cdbsz_out : rep->cdbsz_in;
int res;
- if (sg_build_scsi_cdb(rep->cmd, cdbsz, rep->num_blks, rep->blk,
+ if (sg_build_scsi_cdb(rep->cdb, cdbsz, rep->num_blks, rep->blk,
rep->wr, fua, dpo)) {
pr2serr("%sbad cdb build, start_blk=%" PRId64 ", blocks=%d\n",
my_name, rep->blk, rep->num_blks);
@@ -1158,7 +1162,7 @@ sg_start_io(Rq_elem * rep)
memset(hp, 0, sizeof(struct sg_io_hdr));
hp->interface_id = 'S';
hp->cmd_len = cdbsz;
- hp->cmdp = rep->cmd;
+ hp->cmdp = rep->cdb;
hp->dxfer_direction = rep->wr ? SG_DXFER_TO_DEV : SG_DXFER_FROM_DEV;
hp->dxfer_len = rep->bs * rep->num_blks;
hp->dxferp = mmap ? NULL : rep->buffp;