Accepting request 196310 from home:olh:branches:Base:System

- Fixup T10 Vendor designator display (bnc#805059)
- In rescan-scsi-bus.sh, check if the HBA driver exports issue_lip
  in sysfs before using it (bnc#780946)

OBS-URL: https://build.opensuse.org/request/show/196310
OBS-URL: https://build.opensuse.org/package/show/Base:System/sg3_utils?expand=0&rev=28
This commit is contained in:
Robert Milasan 2013-08-26 09:57:56 +00:00 committed by Git OBS Bridge
parent d7a18b697d
commit 71bca36620
4 changed files with 104 additions and 0 deletions

View File

@ -0,0 +1,77 @@
From 5a20c030863cc14647651586ab07554d73a062a8 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Thu, 23 May 2013 09:26:40 +0200
Subject: [PATCH] Fixup T10 Vendor designator display
The T10 Vendor designator might have a code set of 'binary', in
which case the T10 Vendor ID is an 8 byte ASCII field, and the
vendor specific identifier is in binary.
References: bnc#805059
Signed-off-by: Hannes Reinecke <hare@suse.de>
diff --git a/src/sg_inq.c b/src/sg_inq.c
index 4848574..408ecdd 100644
--- a/src/sg_inq.c
+++ b/src/sg_inq.c
@@ -1115,8 +1115,16 @@ decode_dev_ids(const char * leadin, unsigned char * buff, int len, int do_hex)
break;
case 1: /* T10 vendor identification */
printf(" vendor id: %.8s\n", ip);
- if (i_len > 8)
- printf(" vendor specific: %.*s\n", i_len - 8, ip + 8);
+ if (i_len > 8) {
+ if ((2 == c_set) || (3 == c_set)) { /* ASCII or UTF-8 */
+ printf(" vendor specific: %.*s\n", i_len - 8, ip + 8);
+ } else {
+ printf(" vendor specific: 0x");
+ for (m = 8; m < i_len; ++m)
+ printf("%02x", (unsigned int)ip[m]);
+ printf("\n");
+ }
+ }
break;
case 2: /* EUI-64 based */
printf(" EUI-64 based %d byte identifier\n", i_len);
@@ -1405,8 +1413,15 @@ export_dev_ids(unsigned char * buff, int len)
printf("SCSI_IDENT_%s_VENDOR=%.*s\n", assoc_str, k, ip);
break;
case 1: /* T10 vendor identification */
- k = encode_whitespaces(ip, i_len);
- printf("SCSI_IDENT_%s_T10=%.*s\n", assoc_str, k, ip);
+ printf("SCSI_IDENT_%s_T10=", assoc_str);
+ if ((2 == c_set) || (3 == c_set)) {
+ k = encode_whitespaces(ip, i_len);
+ printf("%.*s\n", k, ip);
+ } else {
+ for (m = 0; m < i_len; ++m)
+ printf("%02x", (unsigned int)ip[m]);
+ printf("\n");
+ }
break;
case 2: /* EUI-64 based */
if (1 != c_set) {
diff --git a/src/sg_vpd.c b/src/sg_vpd.c
index f991623..f7345db 100644
--- a/src/sg_vpd.c
+++ b/src/sg_vpd.c
@@ -796,8 +796,16 @@ decode_designation_descriptor(const unsigned char * ip, int i_len,
break;
case 1: /* T10 vendor identification */
printf(" vendor id: %.8s\n", ip);
- if (i_len > 8)
- printf(" vendor specific: %.*s\n", i_len - 8, ip + 8);
+ if (i_len > 8) {
+ if ((2 == c_set) || (3 == c_set)) { /* ASCII or UTF-8 */
+ printf(" vendor specific: %.*s\n", i_len - 8, ip + 8);
+ } else {
+ printf(" vendor specific: 0x");
+ for (m = 8; m < i_len; ++m)
+ printf("%02x", (unsigned int)ip[m]);
+ printf("\n");
+ }
+ }
break;
case 2: /* EUI-64 based */
if (! long_out) {

View File

@ -0,0 +1,16 @@
Index: sg3_utils-1.35/scripts/rescan-scsi-bus.sh
===================================================================
--- sg3_utils-1.35.orig/scripts/rescan-scsi-bus.sh
+++ sg3_utils-1.35/scripts/rescan-scsi-bus.sh
@@ -750,8 +750,9 @@ for host in $hosts; do
echo -n "Scanning host $host "
if test -e /sys/class/fc_host/host$host ; then
# It's pointless to do a target scan on FC
- if test -n "$lipreset" ; then
- echo 1 > /sys/class/fc_host/host$host/issue_lip 2> /dev/null;
+ issue_lip=/sys/class/fc_host/host$host/issue_lip
+ if test -e $issue_lip -a -n "$lipreset" ; then
+ echo 1 > $issue_lip 2> /dev/null;
udevadm_settle
fi
channelsearch=

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Sun Aug 25 18:45:14 CEST 2013 - ohering@suse.de
- Fixup T10 Vendor designator display (bnc#805059)
- In rescan-scsi-bus.sh, check if the HBA driver exports issue_lip
in sysfs before using it (bnc#780946)
-------------------------------------------------------------------
Thu Jun 13 14:15:26 UTC 2013 - jengelh@inai.de

View File

@ -26,6 +26,8 @@ Group: Hardware/Other
Url: http://sg.danny.cz/sg/sg3_utils.html
Source: http://sg.danny.cz/sg/p/%name-%version.tar.xz
Patch0: sg3_utils-check-if-hba-supports-issue-lip.patch
Patch1: sg3_utils-Fixup-T10-Vendor-designator-display.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: xz
Requires(pre): %insserv_prereq
@ -79,6 +81,8 @@ applications that want to make use of libsgutils.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%build
%configure --disable-static --with-pic