aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2012-10-19 17:35:23 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2012-10-19 17:35:23 +0000
commit12b46e4e74091ab6581aac1fc4047abd7d5491cf (patch)
tree110fd18ab59a4ef3504f9ec037b3bdd47e2899f1
parent430d25411725aaea3f1c621702b28ddea4c848d2 (diff)
downloadsg3_utils-12b46e4e74091ab6581aac1fc4047abd7d5491cf.tar.gz
sg_stpg: with --offline fix 'Invalid state 0xe'
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@463 6180dd3e-e324-4e3e-922d-17de1ae2f315
-rw-r--r--ChangeLog4
-rw-r--r--README2
-rw-r--r--debian/changelog2
-rw-r--r--doc/sg_stpg.88
-rw-r--r--sg3_utils.spec4
-rw-r--r--src/sg_stpg.c14
6 files changed, 22 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index f4ee5c4a..3249fe7b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,8 +2,8 @@ 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.35 [20121014] [svn: r462]
- - bump to 1.35
+Changelog for sg3_utils-1.35 [20121019] [svn: r463]
+ - sg_stpg: with --offline fix 'Invalid state 0xe'
Changelog for sg3_utils-1.34 [20121013] [svn: r461]
- sg_xcopy: new dd like utility for extended copy command
diff --git a/README b/README
index 8d36ae98..ad34afb3 100644
--- a/README
+++ b/README
@@ -373,4 +373,4 @@ See http://sg.danny.cz/sg/tools.html
Douglas Gilbert
-13th October 2012
+19th October 2012
diff --git a/debian/changelog b/debian/changelog
index f085469f..7a9eab17 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,7 +2,7 @@ sg3-utils (1.35-0.1) unstable; urgency=low
* New upstream version
- -- Douglas Gilbert <dgilbert@interlog.com> Sun, 14 Oct 2012 21:00:00 -0400
+ -- Douglas Gilbert <dgilbert@interlog.com> Fri, 19 Oct 2012 11:00:00 -0400
sg3-utils (1.34-0.1) unstable; urgency=low
diff --git a/doc/sg_stpg.8 b/doc/sg_stpg.8
index 7d6a8567..770a964b 100644
--- a/doc/sg_stpg.8
+++ b/doc/sg_stpg.8
@@ -1,4 +1,4 @@
-.TH SG_STPG "8" "September 2007" "sg3_utils\-1.25" SG3_UTILS
+.TH SG_STPG "8" "October 2012" "sg3_utils\-1.35" SG3_UTILS
.SH NAME
sg_stpg \- sends a SCSI SET TARGET PORT GROUPS command
.SH SYNOPSIS
@@ -29,8 +29,8 @@ whether a transition to the requested state is supported. If so the
SET TARGET PORT GROUPS command is sent.
.PP
Target port group access is described in SPC\-4 found at www.t10.org
-in section 5.8 (in rev 11 dated 2007/5/14). The SET TARGET PORT
-GROUPS command is also described in that document.
+in sections 5.8 and 5.16 (in rev 36e dated 2012/8/24). The SET TARGET PORT
+GROUPS command is also described in section 6.45 of that document.
.PP
.SH OPTIONS
Arguments to long options are mandatory for short options as well.
@@ -114,7 +114,7 @@ Written by Douglas Gilbert.
.SH "REPORTING BUGS"
Report bugs to <dgilbert at interlog dot com>.
.SH COPYRIGHT
-Copyright \(co 2007 Hannes Reinecke, Christophe Varoqui and Douglas Gilbert
+Copyright \(co 2007\-2012 Hannes Reinecke, Christophe Varoqui and Douglas Gilbert
.br
This software is distributed under a FreeBSD license. 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 a1cd846b..0cfca22a 100644
--- a/sg3_utils.spec
+++ b/sg3_utils.spec
@@ -79,8 +79,8 @@ fi
%{_libdir}/*.la
%changelog
-* Sun Oct 14 2012 - dgilbert at interlog dot com
-- xxxxxxxxxxxxxx
+* Fri Oct 19 2012 - dgilbert at interlog dot com
+- track t10 changes
* sg3_utils-1.35
* Sat Oct 13 2012 - dgilbert at interlog dot com
diff --git a/src/sg_stpg.c b/src/sg_stpg.c
index 6dcd194b..4ff3da6d 100644
--- a/src/sg_stpg.c
+++ b/src/sg_stpg.c
@@ -24,7 +24,7 @@
* to the given SCSI device.
*/
-static char * version_str = "1.4 20120322";
+static char * version_str = "1.5 20121019";
#define TGT_GRP_BUFF_LEN 1024
#define MX_ALLOC_LEN (0xc000 + 0x80)
@@ -36,6 +36,16 @@ static char * version_str = "1.4 20120322";
#define TPGS_STATE_OFFLINE 0xe /* SPC-4 rev 9 */
#define TPGS_STATE_TRANSITIONING 0xf
+/* See also table 306 - Target port group descriptor format in SPC-4 rev 36e */
+static const unsigned char state_sup_mask[] = {
+ [TPGS_STATE_OPTIMIZED] = 0x01,
+ [TPGS_STATE_NONOPTIMIZED] = 0x02,
+ [TPGS_STATE_STANDBY] = 0x04,
+ [TPGS_STATE_UNAVAILABLE] = 0x08,
+ [TPGS_STATE_OFFLINE] = 0x40,
+ [TPGS_STATE_TRANSITIONING] = 0x80,
+};
+
#define VPD_DEVICE_ID 0x83
#define DEF_VPD_DEVICE_ID_LEN 252
@@ -207,7 +217,7 @@ transition_tpgs_states(struct tgtgrp *tgtState, int numgrp, int portgroup,
return 1;
}
- if (!( (1 << newstate) & tgtState[i].valid )) {
+ if (!( state_sup_mask[newstate] & tgtState[i].valid )) {
printf("Portgroup 0x%02x: Invalid state 0x%x\n",
portgroup, newstate);
return 1;