aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xconfigure20
-rw-r--r--configure.ac2
-rw-r--r--debian/changelog6
-rw-r--r--doc/sg_senddiag.820
-rw-r--r--sg3_utils.spec6
-rw-r--r--src/sg_senddiag.c56
6 files changed, 78 insertions, 32 deletions
diff --git a/configure b/configure
index 1f34fc70..b78dda23 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.42.
+# Generated by GNU Autoconf 2.69 for sg3_utils 1.43.
#
# 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.42'
-PACKAGE_STRING='sg3_utils 1.42'
+PACKAGE_VERSION='1.43'
+PACKAGE_STRING='sg3_utils 1.43'
PACKAGE_BUGREPORT='dgilbert@interlog.com'
PACKAGE_URL=''
@@ -1331,7 +1331,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.42 to adapt to many kinds of systems.
+\`configure' configures sg3_utils 1.43 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1401,7 +1401,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of sg3_utils 1.42:";;
+ short | recursive ) echo "Configuration of sg3_utils 1.43:";;
esac
cat <<\_ACEOF
@@ -1513,7 +1513,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-sg3_utils configure 1.42
+sg3_utils configure 1.43
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1791,7 +1791,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.42, which was
+It was created by sg3_utils $as_me 1.43, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2655,7 +2655,7 @@ fi
# Define the identity of the package.
PACKAGE='sg3_utils'
- VERSION='1.42'
+ VERSION='1.43'
cat >>confdefs.h <<_ACEOF
@@ -12340,7 +12340,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.42, which was
+This file was extended by sg3_utils $as_me 1.43, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -12406,7 +12406,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.42
+sg3_utils config.status 1.43
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/configure.ac b/configure.ac
index 4c63024c..b6ce4455 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT(sg3_utils, 1.42, dgilbert@interlog.com)
+AC_INIT(sg3_utils, 1.43, dgilbert@interlog.com)
AM_INIT_AUTOMAKE
AM_MAINTAINER_MODE
diff --git a/debian/changelog b/debian/changelog
index 2fab436b..6812b43d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+sg3-utils (1.43-0.1) unstable; urgency=low
+
+ * New upstream version
+
+ -- Douglas Gilbert <dgilbert@interlog.com> Thu, 18 Feb 2016 00:10:00 -0500
+
sg3-utils (1.42-0.1) unstable; urgency=low
* New upstream version
diff --git a/doc/sg_senddiag.8 b/doc/sg_senddiag.8
index 511ec7ed..53766773 100644
--- a/doc/sg_senddiag.8
+++ b/doc/sg_senddiag.8
@@ -1,4 +1,4 @@
-.TH SG_SENDDIAG "8" "April 2015" "sg3_utils\-1.41" SG3_UTILS
+.TH SG_SENDDIAG "8" "February 2016" "sg3_utils\-1.43" SG3_UTILS
.SH NAME
sg_senddiag \- performs a SCSI SEND DIAGNOSTIC command
.SH SYNOPSIS
@@ -6,13 +6,14 @@ sg_senddiag \- performs a SCSI SEND DIAGNOSTIC command
[\fI\-\-doff\fR] [\fI\-\-extdur\fR] [\fI\-\-help\fR] [\fI\-\-hex\fR]
[\fI\-\-list\fR] [\fI\-\-maxlen=LEN\fR] [\fI\-\-page=PG\fR] [\fI\-\-pf\fR]
[\fI\-\-raw=H,H...\fR] [\fI\-\-raw=\-\fR] [\fI\-\-selftest=ST\fR]
-[\fI\-\-test\fR] [\fI\-\-uoff\fR] [\fI\-\-verbose\fR] [\fI\-\-version\fR]
-\fIDEVICE\fR
+[\fI\-\-test\fR] [\fI\-\-timeout=SEC\fR] [\fI\-\-uoff\fR] [\fI\-\-verbose\fR]
+[\fI\-\-version\fR] \fIDEVICE\fR
.PP
.B sg_senddiag
[\fI\-doff\fR] [\fI\-e\fR] [\fI\-h\fR] [\fI\-H\fR] [\fI\-l\fR] [\fI\-pf\fR]
[\fI\-raw=H,H...\fR] [\fI\-raw=\-\fR] [\fI\-s=ST\fR] [\fI\-t\fR]
-[\fI\-uoff\fR] [\fI\-v\fR] [\fI\-V\fR] [\fI\-?\fR] \fIDEVICE\fR
+[\fI\-T=SEC\fR] [\fI\-uoff\fR] [\fI\-v\fR] [\fI\-V\fR] [\fI\-?\fR]
+\fIDEVICE\fR
.SH DESCRIPTION
.\" Add any additional description here
.PP
@@ -128,6 +129,11 @@ The \fI\-\-selftest=ST\fR option should not be active together with this
option. Both the \fI\-\-doff\fR and/or \fI\-\-uoff\fR options can be used
with this option.
.TP
+\fB\-T\fR, \fB\-\-timeout\fR=\fISEC\fR
+where \fISEC\fR is a timeout value (in seconds) for foreground self\-test
+operations. The default value is 7200 seconds (2 hours) and any values
+of \fISEC\fR less than the default are ignored.
+.TP
\fB\-u\fR, \fB\-\-uoff\fR
set the Unit Offline (UnitOffL) bit (default is clear). Only significant
when \fI\-\-test\fR option is set for the default self\-test. When set other
@@ -247,6 +253,10 @@ The \fI\-s=ST\fR option should not be active together with this option.
Both the \fI\-doff\fR and/or \fI\-uoff\fR options can be used with this
option.
.TP
+\fB\-T\fR=\fISEC\fR
+where \fISEC\fR is a timeout value (in seconds) for foreground self\-test
+operations. See the \fI\-\-timeout=SEC\fR option above.
+.TP
\fB\-uoff\fR
set the Unit Offline (UnitOffL) bit (default is clear). Equivalent to
\fI\-\-uoff\fR in the main description.
@@ -276,7 +286,7 @@ Written by Douglas Gilbert
.SH "REPORTING BUGS"
Report bugs to <dgilbert at interlog dot com>.
.SH COPYRIGHT
-Copyright \(co 2003\-2015 Douglas Gilbert
+Copyright \(co 2003\-2016 Douglas Gilbert
.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 7dc42dfd..6af382f2 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.42
+Version: 1.43
# Release: 1%{?dist}
Release: 1
License: GPL
@@ -79,6 +79,10 @@ fi
%{_libdir}/*.la
%changelog
+* Thu Feb 18 2016 - dgilbert at interlog dot com
+- track t10 changes
+ * sg3_utils-1.43
+
* Wed Feb 17 2016 - dgilbert at interlog dot com
- track t10 changes
* sg3_utils-1.42
diff --git a/src/sg_senddiag.c b/src/sg_senddiag.c
index 5e5de565..3cfd47fa 100644
--- a/src/sg_senddiag.c
+++ b/src/sg_senddiag.c
@@ -1,5 +1,5 @@
/* A utility program originally written for the Linux OS SCSI subsystem
-* Copyright (C) 2003-2015 D. Gilbert
+* Copyright (C) 2003-2016 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)
@@ -28,7 +28,7 @@
#include "sg_pr2serr.h"
-static const char * version_str = "0.47 20151219";
+static const char * version_str = "0.48 20160218";
#define ME "sg_senddiag: "
@@ -48,6 +48,7 @@ static struct option long_options[] = {
{"raw", required_argument, 0, 'r'},
{"selftest", required_argument, 0, 's'},
{"test", no_argument, 0, 't'},
+ {"timeout", required_argument, 0, 'T'},
{"uoff", no_argument, 0, 'u'},
{"verbose", no_argument, 0, 'v'},
{"version", no_argument, 0, 'V'},
@@ -66,6 +67,7 @@ struct opts_t {
int do_raw;
int do_selftest;
int do_deftest;
+ int timeout;
int do_uoff;
int do_verbose;
int do_version;
@@ -82,9 +84,9 @@ usage()
"[--list]\n"
" [--maxlen=LEN] [--page=PG] [--pf] "
"[--raw=H,H...]\n"
- " [--selftest=ST] [--test] [--uoff] "
- "[--verbose] [--version]\n"
- " [DEVICE]\n"
+ " [--selftest=ST] [--test] [--timeout=SEC] "
+ "[--uoff]\n"
+ " [--verbose] [--version] [DEVICE]\n"
" where:\n"
" --doff|-d device online (def: 0, only with '--test')\n"
" --extdur|-e duration of an extended self-test (from mode "
@@ -112,6 +114,8 @@ usage()
" 5->foreground short, 6->foreground "
"extended\n"
" --test|-t default self-test\n"
+ " --timeout=SEC|-T SEC timeout for foreground self tests\n"
+ " unit: second (def: 7200 seconds)\n"
" --uoff|-u unit offline (def: 0, only with '--test')\n"
" --verbose|-v increase verbosity\n"
" --version|-V output version string then exit\n\n"
@@ -125,7 +129,7 @@ usage_old()
{
printf("Usage: sg_senddiag [-doff] [-e] [-h] [-H] [-l] [-pf]"
" [-raw=H,H...]\n"
- " [-s=SF] [-t] [-uoff] [-v] [-V] "
+ " [-s=SF] [-t] [-T=SEC] [-uoff] [-v] [-V] "
"[DEVICE]\n"
" where:\n"
" -doff device online (def: 0, only with '-t')\n"
@@ -143,6 +147,7 @@ usage_old()
" 4->abort test\n"
" 5->foreground short, 6->foreground extended\n"
" -t default self-test\n"
+ " -T SEC timeout for foreground self tests\n"
" -uoff unit offline (def: 0, only with '-t')\n"
" -v increase verbosity (print issued SCSI cmds)\n"
" -V output version string\n"
@@ -160,7 +165,7 @@ process_cl_new(struct opts_t * op, int argc, char * argv[])
while (1) {
int option_index = 0;
- c = getopt_long(argc, argv, "dehHlm:NOpP:r:s:tuvV", long_options,
+ c = getopt_long(argc, argv, "dehHlm:NOpP:r:s:tT:uvV", long_options,
&option_index);
if (c == -1)
break;
@@ -224,6 +229,14 @@ process_cl_new(struct opts_t * op, int argc, char * argv[])
case 't':
op->do_deftest = 1;
break;
+ case 'T':
+ n = sg_get_num(optarg);
+ if (n < 0) {
+ pr2serr("bad argument to '--timeout=SEC'\n");
+ return SG_LIB_SYNTAX_ERROR;
+ }
+ op->timeout = n;
+ break;
case 'u':
op->do_uoff = 1;
break;
@@ -259,7 +272,7 @@ process_cl_new(struct opts_t * op, int argc, char * argv[])
static int
process_cl_old(struct opts_t * op, int argc, char * argv[])
{
- int k, jmp_out, plen, num;
+ int k, jmp_out, plen, num, n;
unsigned int u;
const char * cp;
@@ -342,6 +355,14 @@ process_cl_old(struct opts_t * op, int argc, char * argv[])
return SG_LIB_SYNTAX_ERROR;
}
op->do_selftest = u;
+ } else if (0 == strncmp("T=", cp, 2)) {
+ num = sscanf(cp + 2, "%d", &n);
+ if ((1 != num) || (n < 0)) {
+ printf("Bad page code after '-T=SEC' option\n");
+ usage_old();
+ return SG_LIB_SYNTAX_ERROR;
+ }
+ op->timeout = n;
} else if (0 == strncmp("-old", cp, 5))
;
else if (jmp_out) {
@@ -385,13 +406,18 @@ process_cl(struct opts_t * op, int argc, char * argv[])
/* Return of 0 -> success, otherwise see sg_ll_send_diag() */
static int
do_senddiag(int sg_fd, int sf_code, int pf_bit, int sf_bit, int devofl_bit,
- int unitofl_bit, void * outgoing_pg, int outgoing_len,
+ int unitofl_bit, void * outgoing_pg, int outgoing_len, int tmout,
int noisy, int verbose)
{
int long_duration = 0;
- if ((0 == sf_bit) && ((5 == sf_code) || (6 == sf_code)))
- long_duration = 1; /* foreground self-tests */
+ if ((0 == sf_bit) && ((5 == sf_code) || (6 == sf_code))) {
+ /* foreground self-tests */
+ if (tmout <= 0)
+ long_duration = 1;
+ else
+ long_duration = tmout;
+ }
return sg_ll_send_diag(sg_fd, sf_code, pf_bit, sf_bit, devofl_bit,
unitofl_bit, long_duration, outgoing_pg,
outgoing_len, noisy, verbose);
@@ -777,8 +803,8 @@ main(int argc, char * argv[])
} else if ((op->do_list) || (op->page_code >= 0x0)) {
pg = op->page_code;
if (pg < 0)
- res = do_senddiag(sg_fd, 0, 1 /* pf */, 0, 0, 0, rsp_buff, 4, 1,
- op->do_verbose);
+ res = do_senddiag(sg_fd, 0, 1 /* pf */, 0, 0, 0, rsp_buff, 4,
+ op->timeout, 1, op->do_verbose);
else
res = 0;
if (0 == res) {
@@ -820,14 +846,14 @@ main(int argc, char * argv[])
}
} else if (op->do_raw) {
res = do_senddiag(sg_fd, 0, op->do_pf, 0, 0, 0, read_in,
- read_in_len, 1, op->do_verbose);
+ read_in_len, op->timeout, 1, op->do_verbose);
if (res) {
ret = res;
goto err_out;
}
} else {
res = do_senddiag(sg_fd, op->do_selftest, op->do_pf, op->do_deftest,
- op->do_doff, op->do_uoff, NULL, 0, 1,
+ op->do_doff, op->do_uoff, NULL, 0, op->timeout, 1,
op->do_verbose);
if (0 == res) {
if ((5 == op->do_selftest) || (6 == op->do_selftest))