Accepting request 237855 from home:jengelh:branches:Base:System
- Update to new upstream release 1.39 * This release adds some ZBC support in the form of sg_rep_zones and sg_reset_wp. * It tracks changes made by www.t10.org since April 2014. - Remove 0001-Split-59-scsi-sg_utils.rules-for-multipath-support.patch, 0003-sg_inq-compability-links-for-ata_id.patch, 0004-sg_inq-suppress-warning-messages-for-export.patch, sginfo-inq-fields-strip-blank.patch (merged upstream). OBS-URL: https://build.opensuse.org/request/show/237855 OBS-URL: https://build.opensuse.org/package/show/Base:System/sg3_utils?expand=0&rev=39
This commit is contained in:
parent
70eeca64ef
commit
6b1d80379c
@ -1,162 +0,0 @@
|
||||
From fbae79a402a00ab9c228a31fd800f524d57960fe Mon Sep 17 00:00:00 2001
|
||||
From: Hannes Reinecke <hare@suse.de>
|
||||
Date: Thu, 10 Apr 2014 11:18:44 +0200
|
||||
Subject: [PATCH] Split 59-scsi-sg_utils.rules for multipath support
|
||||
|
||||
The current rules file combines the setting of environment
|
||||
variables and the generation of persistent symlinks.
|
||||
The causes issues with multipathing, as multipath needs to have
|
||||
access to the WWID to be able to decide if the device should be
|
||||
handled by multipath (and hence no symlinks should be created)
|
||||
or not (and udev can proceed with creating symlinks).
|
||||
So this patch splits off the rules file in two sections,
|
||||
55-scsi-sg3_id.rules and 58-scsi-sg3_symlink.rules.
|
||||
This allows multipath rules to be inserted between them
|
||||
to make the correct decision.
|
||||
|
||||
References: bnc#873151
|
||||
|
||||
Signed-off-by: Hannes Reinecke <hare@suse.de>
|
||||
---
|
||||
scripts/55-scsi-sg3_id.rules | 35 ++++++++++++++++++++++++++++
|
||||
scripts/58-scsi-sg3_symlink.rules | 29 +++++++++++++++++++++++
|
||||
scripts/59-scsi-sg3_utils.rules | 49 ---------------------------------------
|
||||
3 files changed, 64 insertions(+), 49 deletions(-)
|
||||
create mode 100644 scripts/55-scsi-sg3_id.rules
|
||||
create mode 100644 scripts/58-scsi-sg3_symlink.rules
|
||||
delete mode 100644 scripts/59-scsi-sg3_utils.rules
|
||||
|
||||
diff --git a/scripts/55-scsi-sg3_id.rules b/scripts/55-scsi-sg3_id.rules
|
||||
new file mode 100644
|
||||
index 0000000..2f99157
|
||||
--- /dev/null
|
||||
+++ b/scripts/55-scsi-sg3_id.rules
|
||||
@@ -0,0 +1,35 @@
|
||||
+# SCSI-ID mappings for sg3_utils
|
||||
+
|
||||
+ACTION=="remove", GOTO="sg3_utils_id_end"
|
||||
+
|
||||
+SUBSYSTEM!="block", GOTO="sg3_utils_id_end"
|
||||
+
|
||||
+# Import values for partitions
|
||||
+ENV{DEVTYPE}=="partition", IMPORT{parent}="SCSI_*", ENV{ID_SCSI}="1"
|
||||
+# SCSI INQUIRY values
|
||||
+KERNEL=="sd*[!0-9]|sr*", IMPORT{program}="/usr/bin/sg_inq --export $tempnode", ENV{ID_SCSI}="1"
|
||||
+# scsi_id compat mappings
|
||||
+ENV{SCSI_VENDOR}=="?*", ENV{ID_VENDOR}="$env{SCSI_VENDOR}"
|
||||
+ENV{SCSI_VENDOR_ENC}=="?*", ENV{ID_VENDOR_ENC}="$env{SCSI_VENDOR_ENC}"
|
||||
+ENV{SCSI_MODEL}=="?*", ENV{ID_MODEL}="$env{SCSI_MODEL}"
|
||||
+ENV{SCSI_MODEL_ENC}=="?*", ENV{ID_MODEL_ENC}="$env{SCSI_MODEL_ENC}"
|
||||
+ENV{SCSI_REVISION}=="?*", ENV{ID_REVISION}="$env{SCSI_REVISION}"
|
||||
+ENV{SCSI_TYPE}=="?*", ENV{ID_TYPE}="$env{SCSI_TYPE}"
|
||||
+# SCSI EVPD page 0x80 values
|
||||
+KERNEL=="sd*[!0-9]|sr*", ENV{ID_SCSI}=="1", IMPORT{program}="/usr/bin/sg_inq --export --page=sn $tempnode"
|
||||
+# SCSI EVPD page 0x83 values
|
||||
+KERNEL=="sd*[!0-9]|sr*", ENV{ID_SCSI}=="1", IMPORT{program}="/usr/bin/sg_inq --export --page=di $tempnode"
|
||||
+
|
||||
+# ID_WWN compat mapping
|
||||
+ENV{SCSI_IDENT_LUN_NAA}=="?*", ENV{ID_WWN}!="?*", ENV{ID_WWN}="0x$env{SCSI_IDENT_LUN_NAA}"
|
||||
+ENV{SCSI_IDENT_LUN_NAA}=="?*", ENV{ID_WWN_WITH_EXTENSION}!="?*", ENV{ID_WWN_WITH_EXTENSION}="0x$env{SCSI_IDENT_LUN_NAA}"
|
||||
+
|
||||
+# ata_id compability
|
||||
+ENV{ID_SERIAL}!="?*", ENV{SCSI_VENDOR}=="ATA", ENV{ID_BUS}="ata", ENV{ID_ATA}="1", ENV{ID_SERIAL}="$env{SCSI_MODEL}_$env{SCSI_IDENT_LUN_VENDOR}"
|
||||
+# Compat ID_SERIAL setting
|
||||
+ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_NAA}=="?*", ENV{ID_BUS}="scsi", ENV{ID_SERIAL}="3$env{SCSI_IDENT_LUN_NAA}", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_NAA}"
|
||||
+ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_EUI64}=="?*", ENV{ID_BUS}="scsi", ENV{ID_SERIAL}="2$env{SCSI_IDENT_LUN_EUI64}", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_EUI64}"
|
||||
+ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_NAME}=="?*", ENV{ID_BUS}="scsi", ENV{ID_SERIAL}="8$env{SCSI_IDENT_LUN_NAME}", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_NAME}"
|
||||
+ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_T10}=="?*", ENV{ID_BUS}="scsi", ENV{ID_SERIAL}="1$env{SCSI_IDENT_LUN_T10}", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_T10}"
|
||||
+ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_VENDOR}=="?*", ENV{ID_BUS}="scsi", ENV{ID_SERIAL}="0$env{SCSI_VENDOR}_$env{SCSI_MODEL}_$env{SCSI_IDENT_LUN_VENDOR}", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_VENDOR}"
|
||||
+LABEL="sg3_utils_id_end"
|
||||
diff --git a/scripts/58-scsi-sg3_symlink.rules b/scripts/58-scsi-sg3_symlink.rules
|
||||
new file mode 100644
|
||||
index 0000000..a95cbcb
|
||||
--- /dev/null
|
||||
+++ b/scripts/58-scsi-sg3_symlink.rules
|
||||
@@ -0,0 +1,29 @@
|
||||
+# SCSI-ID symlinks for sg3_utils
|
||||
+
|
||||
+ACTION=="remove", GOTO="sg3_utils_symlink_end"
|
||||
+
|
||||
+SUBSYSTEM!="block", GOTO="sg3_utils_symlink_end"
|
||||
+
|
||||
+# Skip symlink generation for multipath
|
||||
+ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="sg3_utils_symlink_end"
|
||||
+
|
||||
+# Select which identifier to use per default
|
||||
+# 0: vpd page 0x80 identifier
|
||||
+ENV{SCSI_IDENT_SERIAL}=="?*", ENV{DEVTYPE}=="disk", SYMLINK+="disk/by-id/scsi-S$env{SCSI_VENDOR}_$env{SCSI_MODEL}_$env{SCSI_IDENT_SERIAL}"
|
||||
+# 1: NAA identifier (prefix 3)
|
||||
+ENV{SCSI_IDENT_LUN_NAA}=="?*", ENV{DEVTYPE}=="disk", SYMLINK+="disk/by-id/scsi-3$env{SCSI_IDENT_LUN_NAA}"
|
||||
+ENV{SCSI_IDENT_LUN_NAA}=="?*", ENV{DEVTYPE}=="partition", SYMLINK+="disk/by-id/scsi-3$env{SCSI_IDENT_LUN_NAA}-part%n"
|
||||
+# 2: EUI-64 identifer (prefix 2)
|
||||
+ENV{SCSI_IDENT_LUN_EUI64}=="?*", ENV{DEVTYPE}=="disk", SYMLINK+="disk/by-id/scsi-2$env{SCSI_IDENT_LUN_EUI64}"
|
||||
+ENV{SCSI_IDENT_LUN_EUI64}=="?*", ENV{DEVTYPE}=="partition", SYMLINK+="disk/by-id/scsi-2$env{SCSI_IDENT_LUN_EUI64}-part%n"
|
||||
+# 3: SCSI name identifier (prefix 8)
|
||||
+ENV{SCSI_IDENT_LUN_NAME}=="?*", ENV{DEVTYPE}=="disk", SYMLINK+="disk/by-id/scsi-8$env{SCSI_IDENT_LUN_NAME}"
|
||||
+ENV{SCSI_IDENT_LUN_NAME}=="?*", ENV{DEVTYPE}=="partition", SYMLINK+="disk/by-id/scsi-8$env{SCSI_IDENT_LUN_NAME}-part%n"
|
||||
+# 4: T10 Vendor identifer (prefix 1)
|
||||
+ENV{SCSI_IDENT_LUN_T10}=="?*", ENV{DEVTYPE}=="disk", SYMLINK+="disk/by-id/scsi-1$env{SCSI_IDENT_LUN_T10}"
|
||||
+ENV{SCSI_IDENT_LUN_T10}=="?*", ENV{DEVTYPE}=="partition", SYMLINK+="disk/by-id/scsi-1$env{SCSI_IDENT_LUN_T10}-part%n"
|
||||
+# 5: Vendor-specific identifier (prefix 0)
|
||||
+ENV{SCSI_IDENT_LUN_VENDOR}=="?*", ENV{DEVTYPE}=="disk", SYMLINK+="disk/by-id/scsi-0$env{SCSI_VENDOR}_$env{SCSI_MODEL}_$env{SCSI_IDENT_LUN_VENDOR}"
|
||||
+ENV{SCSI_IDENT_LUN_VENDOR}=="?*", ENV{DEVTYPE}=="partition", SYMLINK+="disk/by-id/scsi-0$env{SCSI_VENDOR}_$env{SCSI_MODEL}_$env{SCSI_IDENT_LUN_VENDOR}-part%n"
|
||||
+
|
||||
+LABEL="sg3_utils_symlink_end"
|
||||
diff --git a/scripts/59-scsi-sg3_utils.rules b/scripts/59-scsi-sg3_utils.rules
|
||||
deleted file mode 100644
|
||||
index 71a3df0..0000000
|
||||
--- a/scripts/59-scsi-sg3_utils.rules
|
||||
+++ /dev/null
|
||||
@@ -1,49 +0,0 @@
|
||||
-# SCSI-ID mappings for sg3_utils
|
||||
-
|
||||
-ACTION=="remove", GOTO="sg3_utils_end"
|
||||
-
|
||||
-SUBSYSTEM!="block", GOTO="sg3_utils_end"
|
||||
-
|
||||
-# Import values for partitions
|
||||
-ENV{DEVTYPE}=="partition", IMPORT{parent}="SCSI_*", ENV{ID_SCSI}="1"
|
||||
-# SCSI INQUIRY values
|
||||
-KERNEL=="sd*[!0-9]|sr*", IMPORT{program}="/usr/bin/sg_inq --export $tempnode", ENV{ID_SCSI}="1"
|
||||
-# scsi_id compat mappings
|
||||
-ENV{SCSI_VENDOR}=="?*", ENV{ID_VENDOR}="$env{SCSI_VENDOR}"
|
||||
-ENV{SCSI_VENDOR_ENC}=="?*", ENV{ID_VENDOR_ENC}="$env{SCSI_VENDOR_ENC}"
|
||||
-ENV{SCSI_MODEL}=="?*", ENV{ID_MODEL}="$env{SCSI_MODEL}"
|
||||
-ENV{SCSI_MODEL_ENC}=="?*", ENV{ID_MODEL_ENC}="$env{SCSI_MODEL_ENC}"
|
||||
-ENV{SCSI_REVISION}=="?*", ENV{ID_REVISION}="$env{SCSI_REVISION}"
|
||||
-ENV{SCSI_TYPE}=="?*", ENV{ID_TYPE}="$env{SCSI_TYPE}"
|
||||
-# SCSI EVPD page 0x80 values
|
||||
-KERNEL=="sd*[!0-9]|sr*", ENV{ID_SCSI}=="1", IMPORT{program}="/usr/bin/sg_inq --export --page=sn $tempnode"
|
||||
-ENV{SCSI_IDENT_SERIAL}=="?*", ENV{DEVTYPE}=="disk", SYMLINK+="disk/by-id/scsi-S$env{SCSI_VENDOR}_$env{SCSI_MODEL}_$env{SCSI_IDENT_SERIAL}"
|
||||
-# SCSI EVPD page 0x83 values
|
||||
-KERNEL=="sd*[!0-9]|sr*", ENV{ID_SCSI}=="1", IMPORT{program}="/usr/bin/sg_inq --export --page=di $tempnode"
|
||||
-# Select which identifier to use per default
|
||||
-# 1: NAA identifier (prefix 3)
|
||||
-ENV{SCSI_IDENT_LUN_NAA}=="?*", ENV{DEVTYPE}=="disk", SYMLINK+="disk/by-id/scsi-3$env{SCSI_IDENT_LUN_NAA}"
|
||||
-ENV{SCSI_IDENT_LUN_NAA}=="?*", ENV{DEVTYPE}=="partition", SYMLINK+="disk/by-id/scsi-3$env{SCSI_IDENT_LUN_NAA}-part%n"
|
||||
-ENV{SCSI_IDENT_LUN_NAA}=="?*", ENV{ID_WWN}!="?*", ENV{ID_WWN}="0x$env{SCSI_IDENT_LUN_NAA}"
|
||||
-ENV{SCSI_IDENT_LUN_NAA}=="?*", ENV{ID_WWN_WITH_EXTENSION}!="?*", ENV{ID_WWN_WITH_EXTENSION}="0x$env{SCSI_IDENT_LUN_NAA}"
|
||||
-# 2: EUI-64 identifer (prefix 2)
|
||||
-ENV{SCSI_IDENT_LUN_EUI64}=="?*", ENV{DEVTYPE}=="disk", SYMLINK+="disk/by-id/scsi-2$env{SCSI_IDENT_LUN_EUI64}"
|
||||
-ENV{SCSI_IDENT_LUN_EUI64}=="?*", ENV{DEVTYPE}=="partition", SYMLINK+="disk/by-id/scsi-2$env{SCSI_IDENT_LUN_EUI64}-part%n"
|
||||
-# 3: SCSI name identifier (prefix 8)
|
||||
-ENV{SCSI_IDENT_LUN_NAME}=="?*", ENV{DEVTYPE}=="disk", SYMLINK+="disk/by-id/scsi-8$env{SCSI_IDENT_LUN_NAME}"
|
||||
-ENV{SCSI_IDENT_LUN_NAME}=="?*", ENV{DEVTYPE}=="partition", SYMLINK+="disk/by-id/scsi-8$env{SCSI_IDENT_LUN_NAME}-part%n"
|
||||
-# 4: T10 Vendor identifer (prefix 1)
|
||||
-ENV{SCSI_IDENT_LUN_T10}=="?*", ENV{DEVTYPE}=="disk", SYMLINK+="disk/by-id/scsi-1$env{SCSI_IDENT_LUN_T10}"
|
||||
-ENV{SCSI_IDENT_LUN_T10}=="?*", ENV{DEVTYPE}=="partition", SYMLINK+="disk/by-id/scsi-1$env{SCSI_IDENT_LUN_T10}-part%n"
|
||||
-# 5: Vendor-specific identifier (prefix 0)
|
||||
-ENV{SCSI_IDENT_LUN_VENDOR}=="?*", ENV{DEVTYPE}=="disk", SYMLINK+="disk/by-id/scsi-0$env{SCSI_VENDOR}_$env{SCSI_MODEL}_$env{SCSI_IDENT_LUN_VENDOR}"
|
||||
-ENV{SCSI_IDENT_LUN_VENDOR}=="?*", ENV{DEVTYPE}=="partition", SYMLINK+="disk/by-id/scsi-0$env{SCSI_VENDOR}_$env{SCSI_MODEL}_$env{SCSI_IDENT_LUN_VENDOR}-part%n"
|
||||
-# ata_id compability
|
||||
-ENV{ID_SERIAL}!="?*", ENV{SCSI_VENDOR}=="ATA", ENV{ID_BUS}="ata", ENV{ID_ATA}="1", ENV{ID_SERIAL}="$env{SCSI_MODEL}_$env{SCSI_IDENT_LUN_VENDOR}"
|
||||
-# Compat ID_SERIAL setting
|
||||
-ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_NAA}=="?*", ENV{ID_BUS}="scsi", ENV{ID_SERIAL}="3$env{SCSI_IDENT_LUN_NAA}", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_NAA}"
|
||||
-ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_EUI64}=="?*", ENV{ID_BUS}="scsi", ENV{ID_SERIAL}="2$env{SCSI_IDENT_LUN_EUI64}", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_EUI64}"
|
||||
-ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_NAME}=="?*", ENV{ID_BUS}="scsi", ENV{ID_SERIAL}="8$env{SCSI_IDENT_LUN_NAME}", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_NAME}"
|
||||
-ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_T10}=="?*", ENV{ID_BUS}="scsi", ENV{ID_SERIAL}="1$env{SCSI_IDENT_LUN_T10}", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_T10}"
|
||||
-ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_VENDOR}=="?*", ENV{ID_BUS}="scsi", ENV{ID_SERIAL}="0$env{SCSI_VENDOR}_$env{SCSI_MODEL}_$env{SCSI_IDENT_LUN_VENDOR}", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_VENDOR}"
|
||||
-LABEL="sg3_utils_end"
|
||||
--
|
||||
1.8.1.4
|
||||
|
@ -1,53 +0,0 @@
|
||||
From 96300d5e6d62a9fd64183fe6c13a5227d07c6b1f Mon Sep 17 00:00:00 2001
|
||||
From: Hannes Reinecke <hare@suse.de>
|
||||
Date: Thu, 8 May 2014 15:59:33 +0200
|
||||
Subject: sg_inq: compability links for ata_id
|
||||
|
||||
The original 'ata_id' program would return the data provided by
|
||||
the 'IDENTIFY' ATA command.
|
||||
As the 'product' information from the IDENTIFY command is 40
|
||||
bytes long it doesn't fit into the 'product' field for the SCSI
|
||||
inquiry, causing it to be truncated.
|
||||
So we should be adding another field 'SCSI_IDENT_LUN_ATA'
|
||||
to provide ata_id compatible information for creating symlinks.
|
||||
|
||||
References: bnc#876344
|
||||
|
||||
Signed-off-by: Hannes Reinecke <hare@suse.de>
|
||||
---
|
||||
scripts/55-scsi-sg3_id.rules | 3 ++-
|
||||
src/sg_inq.c | 4 ++++
|
||||
2 files changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/scripts/55-scsi-sg3_id.rules b/scripts/55-scsi-sg3_id.rules
|
||||
index 2f99157..ab5a8e3 100644
|
||||
--- a/scripts/55-scsi-sg3_id.rules
|
||||
+++ b/scripts/55-scsi-sg3_id.rules
|
||||
@@ -25,7 +25,8 @@ ENV{SCSI_IDENT_LUN_NAA}=="?*", ENV{ID_WWN}!="?*", ENV{ID_WWN}="0x$env{SCSI_IDENT
|
||||
ENV{SCSI_IDENT_LUN_NAA}=="?*", ENV{ID_WWN_WITH_EXTENSION}!="?*", ENV{ID_WWN_WITH_EXTENSION}="0x$env{SCSI_IDENT_LUN_NAA}"
|
||||
|
||||
# ata_id compability
|
||||
-ENV{ID_SERIAL}!="?*", ENV{SCSI_VENDOR}=="ATA", ENV{ID_BUS}="ata", ENV{ID_ATA}="1", ENV{ID_SERIAL}="$env{SCSI_MODEL}_$env{SCSI_IDENT_LUN_VENDOR}"
|
||||
+ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_ATA}=="?*", ENV{ID_BUS}="ata", ENV{ID_ATA}="1", ENV{ID_SERIAL}="$env{SCSI_IDENT_LUN_ATA}"
|
||||
+ENV{ID_SERIAL_SHORT}!="?*", ENV{SCSI_VENDOR}=="ATA", ENV{SCSI_IDENT_LUN_VENDOR}=="?*", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_VENDOR}"
|
||||
# Compat ID_SERIAL setting
|
||||
ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_NAA}=="?*", ENV{ID_BUS}="scsi", ENV{ID_SERIAL}="3$env{SCSI_IDENT_LUN_NAA}", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_NAA}"
|
||||
ENV{ID_SERIAL}!="?*", ENV{SCSI_IDENT_LUN_EUI64}=="?*", ENV{ID_BUS}="scsi", ENV{ID_SERIAL}="2$env{SCSI_IDENT_LUN_EUI64}", ENV{ID_SERIAL_SHORT}="$env{SCSI_IDENT_LUN_EUI64}"
|
||||
diff --git a/src/sg_inq.c b/src/sg_inq.c
|
||||
index bfa4f58..7d8ada5 100644
|
||||
--- a/src/sg_inq.c
|
||||
+++ b/src/sg_inq.c
|
||||
@@ -1839,6 +1839,10 @@ export_dev_ids(unsigned char * buff, int len)
|
||||
if ((2 == c_set) || (3 == c_set)) {
|
||||
k = encode_whitespaces(ip, i_len);
|
||||
printf("%.*s\n", k, ip);
|
||||
+ if (!memcmp(ip, "ATA_", 4)) {
|
||||
+ printf("SCSI_IDENT_%s_ATA=%.*s\n", assoc_str,
|
||||
+ k - 4, ip + 4);
|
||||
+ }
|
||||
} else {
|
||||
for (m = 0; m < i_len; ++m)
|
||||
printf("%02x", (unsigned int)ip[m]);
|
||||
--
|
||||
1.7.12.4
|
||||
|
@ -1,251 +0,0 @@
|
||||
From 880ad9e51b2a2e1f3a8feb0c8e0bb4b5b840a7a3 Mon Sep 17 00:00:00 2001
|
||||
From: Hannes Reinecke <hare@suse.de>
|
||||
Date: Thu, 15 May 2014 12:27:22 +0200
|
||||
Subject: sg_inq: suppress warning messages for --export
|
||||
|
||||
When called with --export we should just print out the resulting
|
||||
strings. Printing out warnings in addition just confuses the
|
||||
caller. And if required the warnings can be enabled by specifying
|
||||
--verbose.
|
||||
|
||||
References: bnc#876454
|
||||
|
||||
Signed-off-by: Hannes Reinecke <hare@suse.de>
|
||||
---
|
||||
src/sg_inq.c | 111 +++++++++++++++++++++++++++++++++++++----------------------
|
||||
1 file changed, 70 insertions(+), 41 deletions(-)
|
||||
|
||||
diff --git a/src/sg_inq.c b/src/sg_inq.c
|
||||
index 7d8ada5..473d212 100644
|
||||
--- a/src/sg_inq.c
|
||||
+++ b/src/sg_inq.c
|
||||
@@ -1767,7 +1767,7 @@ decode_dev_ids(const char * leadin, unsigned char * buff, int len, int do_hex)
|
||||
}
|
||||
|
||||
static void
|
||||
-export_dev_ids(unsigned char * buff, int len)
|
||||
+export_dev_ids(unsigned char * buff, int len, int verbose)
|
||||
{
|
||||
int u, j, m, id_len, c_set, assoc, desig_type, i_len;
|
||||
int off, d_id, naa, k, p_id;
|
||||
@@ -1797,9 +1797,11 @@ export_dev_ids(unsigned char * buff, int len)
|
||||
i_len = ucp[3];
|
||||
id_len = i_len + 4;
|
||||
if ((off + id_len) > len) {
|
||||
- pr2serr("Device Identification VPD page error: designator "
|
||||
- "length longer than\n remaining response length=%d\n",
|
||||
- (len - off));
|
||||
+ if (verbose)
|
||||
+ pr2serr("Device Identification VPD page error: designator "
|
||||
+ "length longer than\n remaining response length=%d\n",
|
||||
+ (len - off));
|
||||
+
|
||||
return;
|
||||
}
|
||||
ip = ucp + 4;
|
||||
@@ -1819,7 +1821,8 @@ export_dev_ids(unsigned char * buff, int len)
|
||||
assoc_str = "TARGET";
|
||||
break;
|
||||
default:
|
||||
- pr2serr(" Invalid association %d\n", assoc);
|
||||
+ if (verbose)
|
||||
+ pr2serr(" Invalid association %d\n", assoc);
|
||||
return;
|
||||
}
|
||||
switch (desig_type) {
|
||||
@@ -1851,8 +1854,10 @@ export_dev_ids(unsigned char * buff, int len)
|
||||
break;
|
||||
case 2: /* EUI-64 based */
|
||||
if (1 != c_set) {
|
||||
- pr2serr(" << expected binary code_set (1)>>\n");
|
||||
- dStrHexErr((const char *)ip, i_len, 0);
|
||||
+ if (verbose) {
|
||||
+ pr2serr(" << expected binary code_set (1)>>\n");
|
||||
+ dStrHexErr((const char *)ip, i_len, 0);
|
||||
+ }
|
||||
break;
|
||||
}
|
||||
printf("SCSI_IDENT_%s_EUI64=", assoc_str);
|
||||
@@ -1862,21 +1867,27 @@ export_dev_ids(unsigned char * buff, int len)
|
||||
break;
|
||||
case 3: /* NAA */
|
||||
if (1 != c_set) {
|
||||
- pr2serr(" << expected binary code_set (1)>>\n");
|
||||
- dStrHexErr((const char *)ip, i_len, 0);
|
||||
+ if (verbose) {
|
||||
+ pr2serr(" << expected binary code_set (1)>>\n");
|
||||
+ dStrHexErr((const char *)ip, i_len, 0);
|
||||
+ }
|
||||
break;
|
||||
}
|
||||
naa = (ip[0] >> 4) & 0xff;
|
||||
if ((naa < 2) || (naa > 6) || (4 == naa)) {
|
||||
- pr2serr(" << unexpected naa [0x%x]>>\n", naa);
|
||||
- dStrHexErr((const char *)ip, i_len, 0);
|
||||
+ if (verbose) {
|
||||
+ pr2serr(" << unexpected naa [0x%x]>>\n", naa);
|
||||
+ dStrHexErr((const char *)ip, i_len, 0);
|
||||
+ }
|
||||
break;
|
||||
}
|
||||
if (6 != naa) {
|
||||
if (8 != i_len) {
|
||||
- pr2serr(" << unexpected NAA 2 identifier "
|
||||
- "length: 0x%x>>\n", i_len);
|
||||
- dStrHexErr((const char *)ip, i_len, 0);
|
||||
+ if (verbose) {
|
||||
+ pr2serr(" << unexpected NAA 2 identifier "
|
||||
+ "length: 0x%x>>\n", i_len);
|
||||
+ dStrHexErr((const char *)ip, i_len, 0);
|
||||
+ }
|
||||
break;
|
||||
}
|
||||
printf("SCSI_IDENT_%s_NAA=", assoc_str);
|
||||
@@ -1885,9 +1896,11 @@ export_dev_ids(unsigned char * buff, int len)
|
||||
printf("\n");
|
||||
} else { /* NAA IEEE Registered extended */
|
||||
if (16 != i_len) {
|
||||
- pr2serr(" << unexpected NAA 6 identifier "
|
||||
- "length: 0x%x>>\n", i_len);
|
||||
- dStrHexErr((const char *)ip, i_len, 0);
|
||||
+ if (verbose) {
|
||||
+ pr2serr(" << unexpected NAA 6 identifier "
|
||||
+ "length: 0x%x>>\n", i_len);
|
||||
+ dStrHexErr((const char *)ip, i_len, 0);
|
||||
+ }
|
||||
break;
|
||||
}
|
||||
printf("SCSI_IDENT_%s_NAA=", assoc_str);
|
||||
@@ -1898,9 +1911,11 @@ export_dev_ids(unsigned char * buff, int len)
|
||||
break;
|
||||
case 4: /* Relative target port */
|
||||
if ((1 != c_set) || (1 != assoc) || (4 != i_len)) {
|
||||
- pr2serr(" << expected binary code_set, target "
|
||||
- "port association, length 4>>\n");
|
||||
- dStrHexErr((const char *)ip, i_len, 0);
|
||||
+ if (verbose) {
|
||||
+ pr2serr(" << expected binary code_set, target "
|
||||
+ "port association, length 4>>\n");
|
||||
+ dStrHexErr((const char *)ip, i_len, 0);
|
||||
+ }
|
||||
break;
|
||||
}
|
||||
d_id = ((ip[2] << 8) | ip[3]);
|
||||
@@ -1908,9 +1923,11 @@ export_dev_ids(unsigned char * buff, int len)
|
||||
break;
|
||||
case 5: /* (primary) Target port group */
|
||||
if ((1 != c_set) || (1 != assoc) || (4 != i_len)) {
|
||||
- pr2serr(" << expected binary code_set, target "
|
||||
- "port association, length 4>>\n");
|
||||
- dStrHexErr((const char *)ip, i_len, 0);
|
||||
+ if (verbose) {
|
||||
+ pr2serr(" << expected binary code_set, target "
|
||||
+ "port association, length 4>>\n");
|
||||
+ dStrHexErr((const char *)ip, i_len, 0);
|
||||
+ }
|
||||
break;
|
||||
}
|
||||
d_id = ((ip[2] << 8) | ip[3]);
|
||||
@@ -1918,9 +1935,11 @@ export_dev_ids(unsigned char * buff, int len)
|
||||
break;
|
||||
case 6: /* Logical unit group */
|
||||
if ((1 != c_set) || (0 != assoc) || (4 != i_len)) {
|
||||
- pr2serr(" << expected binary code_set, logical "
|
||||
- "unit association, length 4>>\n");
|
||||
- dStrHexErr((const char *)ip, i_len, 0);
|
||||
+ if (verbose) {
|
||||
+ pr2serr(" << expected binary code_set, logical "
|
||||
+ "unit association, length 4>>\n");
|
||||
+ dStrHexErr((const char *)ip, i_len, 0);
|
||||
+ }
|
||||
break;
|
||||
}
|
||||
d_id = ((ip[2] << 8) | ip[3]);
|
||||
@@ -1928,9 +1947,11 @@ export_dev_ids(unsigned char * buff, int len)
|
||||
break;
|
||||
case 7: /* MD5 logical unit identifier */
|
||||
if ((1 != c_set) || (0 != assoc)) {
|
||||
- pr2serr(" << expected binary code_set, logical "
|
||||
- "unit association>>\n");
|
||||
- dStrHexErr((const char *)ip, i_len, 0);
|
||||
+ if (verbose) {
|
||||
+ pr2serr(" << expected binary code_set, logical "
|
||||
+ "unit association>>\n");
|
||||
+ dStrHexErr((const char *)ip, i_len, 0);
|
||||
+ }
|
||||
break;
|
||||
}
|
||||
printf("SCSI_IDENT_%s_MD5=", assoc_str);
|
||||
@@ -1938,8 +1959,10 @@ export_dev_ids(unsigned char * buff, int len)
|
||||
break;
|
||||
case 8: /* SCSI name string */
|
||||
if (3 != c_set) {
|
||||
- pr2serr(" << expected UTF-8 code_set>>\n");
|
||||
- dStrHexErr((const char *)ip, i_len, -1);
|
||||
+ if (verbose) {
|
||||
+ pr2serr(" << expected UTF-8 code_set>>\n");
|
||||
+ dStrHexErr((const char *)ip, i_len, -1);
|
||||
+ }
|
||||
break;
|
||||
}
|
||||
printf("SCSI_IDENT_%s_NAME=%.*s\n", assoc_str, i_len,
|
||||
@@ -1948,9 +1971,11 @@ export_dev_ids(unsigned char * buff, int len)
|
||||
case 9: /* Protocol specific port identifier */
|
||||
if (TPROTO_UAS == p_id) {
|
||||
if ((4 != i_len) || (1 != assoc)) {
|
||||
- pr2serr(" << UAS (USB) expected target "
|
||||
- "port association>>\n");
|
||||
- dStrHexErr((const char *)ip, i_len, 0);
|
||||
+ if (verbose) {
|
||||
+ pr2serr(" << UAS (USB) expected target "
|
||||
+ "port association>>\n");
|
||||
+ dStrHexErr((const char *)ip, i_len, 0);
|
||||
+ }
|
||||
break;
|
||||
}
|
||||
printf("SCSI_IDENT_%s_UAS_DEVICE_ADDRESS=0x%x\n", assoc_str,
|
||||
@@ -1959,9 +1984,11 @@ export_dev_ids(unsigned char * buff, int len)
|
||||
ip[2]);
|
||||
} else if (TPROTO_SOP == p_id) {
|
||||
if ((4 != i_len) && (8 != i_len)) { /* spc4r36h confused */
|
||||
- pr2serr(" << SOP (PCIe) descriptor "
|
||||
- "length=%d >>\n", i_len);
|
||||
- dStrHexErr((const char *)ip, i_len, 0);
|
||||
+ if (verbose) {
|
||||
+ pr2serr(" << SOP (PCIe) descriptor "
|
||||
+ "length=%d >>\n", i_len);
|
||||
+ dStrHexErr((const char *)ip, i_len, 0);
|
||||
+ }
|
||||
break;
|
||||
}
|
||||
printf("SCSI_IDENT_%s_SOP_ROUTING_ID=0x%x\n", assoc_str,
|
||||
@@ -1972,12 +1999,14 @@ export_dev_ids(unsigned char * buff, int len)
|
||||
}
|
||||
break;
|
||||
default: /* reserved */
|
||||
- pr2serr(" reserved designator=0x%x\n", desig_type);
|
||||
- dStrHexErr((const char *)ip, i_len, -1);
|
||||
+ if (verbose) {
|
||||
+ pr2serr(" reserved designator=0x%x\n", desig_type);
|
||||
+ dStrHexErr((const char *)ip, i_len, -1);
|
||||
+ }
|
||||
break;
|
||||
}
|
||||
}
|
||||
- if (-2 == u)
|
||||
+ if (-2 == u && verbose)
|
||||
pr2serr("Device identification VPD page error: "
|
||||
"around offset=%d\n", off);
|
||||
}
|
||||
@@ -3257,7 +3286,7 @@ vpd_decode(int sg_fd, const struct opts_t * op, int inhex_len)
|
||||
else if (op->do_hex > 2)
|
||||
dStrHex((const char *)rp, len, -1);
|
||||
else if (op->do_export)
|
||||
- export_dev_ids(rp + 4, len - 4);
|
||||
+ export_dev_ids(rp + 4, len - 4, op->do_verbose);
|
||||
else
|
||||
decode_id_vpd(rp, len, op->do_hex);
|
||||
break;
|
||||
--
|
||||
1.7.12.4
|
||||
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:a5fc292c74fdefc74de92f39f0f741f8c389ab8d3fa699fd8eee0751119d132b
|
||||
size 694804
|
3
sg3_utils-1.39.tar.xz
Normal file
3
sg3_utils-1.39.tar.xz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:5275d462f4c9d900b87ee0b35f92a3c506d108362a8d184eb34b5265146366ef
|
||||
size 714480
|
@ -1,3 +1,16 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue Jun 17 09:08:42 UTC 2014 - jengelh@inai.de
|
||||
|
||||
- Update to new upstream release 1.39
|
||||
* This release adds some ZBC support in the form of sg_rep_zones
|
||||
and sg_reset_wp.
|
||||
* It tracks changes made by www.t10.org since April 2014.
|
||||
- Remove
|
||||
0001-Split-59-scsi-sg_utils.rules-for-multipath-support.patch,
|
||||
0003-sg_inq-compability-links-for-ata_id.patch,
|
||||
0004-sg_inq-suppress-warning-messages-for-export.patch,
|
||||
sginfo-inq-fields-strip-blank.patch (merged upstream).
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu May 15 13:34:33 CEST 2014 - hare@suse.de
|
||||
|
||||
|
@ -18,18 +18,14 @@
|
||||
|
||||
Name: sg3_utils
|
||||
%define lname libsgutils2-2
|
||||
Version: 1.38
|
||||
Version: 1.39
|
||||
Release: 0
|
||||
Summary: A collection of tools that send SCSI commands to devices
|
||||
License: GPL-2.0+ and BSD-3-Clause
|
||||
Group: Hardware/Other
|
||||
Url: http://sg.danny.cz/sg/sg3_utils.html
|
||||
|
||||
Source: http://sg.danny.cz/sg/p/%name-%{version}.tar.xz
|
||||
Patch1: 0001-Split-59-scsi-sg_utils.rules-for-multipath-support.patch
|
||||
Patch2: sginfo-inq-fields-strip-blank.patch
|
||||
Patch3: 0003-sg_inq-compability-links-for-ata_id.patch
|
||||
Patch4: 0004-sg_inq-suppress-warning-messages-for-export.patch
|
||||
Source: http://sg.danny.cz/sg/p/%name-%version.tar.xz
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
BuildRequires: udev
|
||||
BuildRequires: xz
|
||||
@ -83,11 +79,7 @@ This subpackage contains libraries and header files for developing
|
||||
applications that want to make use of libsgutils.
|
||||
|
||||
%prep
|
||||
%setup -q -n %{name}-%{version}
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%setup -q
|
||||
|
||||
%build
|
||||
%configure --disable-static --with-pic
|
||||
@ -101,7 +93,7 @@ install -m 644 doc/rescan-scsi-bus.sh.8 $RPM_BUILD_ROOT%{_mandir}/man8
|
||||
mkdir -p $RPM_BUILD_ROOT%{_udevrulesdir}
|
||||
install -m 644 scripts/55-scsi-sg3_id.rules $RPM_BUILD_ROOT%{_udevrulesdir}
|
||||
install -m 644 scripts/58-scsi-sg3_symlink.rules $RPM_BUILD_ROOT%{_udevrulesdir}
|
||||
%{__rm} -f %{buildroot}%{_libdir}/*.la
|
||||
rm -f %{buildroot}%{_libdir}/*.la
|
||||
|
||||
%post -p /sbin/ldconfig -n %lname
|
||||
|
||||
|
@ -1,75 +0,0 @@
|
||||
From: Shirish Pargaonkar <spargaonkar@suse.com>
|
||||
Subject: sg3_utils: Strip out trailing info from vendor info products fields in inquiry
|
||||
commit 1756f3b04d4c45d7a0d78e128786b2a1c619565e
|
||||
Date: Tue Apr 15 10:31:23 2014 -0500
|
||||
Reference: bnc#863357
|
||||
|
||||
|
||||
sginfo <device> prints out various fields such as Vendor and Product in
|
||||
INQUIRY response with spaces (0x20) characters.
|
||||
This can confuse scripts some users have.
|
||||
Strip out those trailing spaces (if any).
|
||||
|
||||
|
||||
signed-of-by: Shirish Pargaonkar <spargaonkar@suse.com>
|
||||
---
|
||||
diff --git a/src/sginfo.c b/src/sginfo.c
|
||||
index b27f117..b9f3f77 100644
|
||||
--- a/src/sginfo.c
|
||||
+++ b/src/sginfo.c
|
||||
@@ -155,6 +155,7 @@ static char *device_name;
|
||||
#define MAX_BUFFER_SIZE MAX_RESP10_SIZE
|
||||
|
||||
#define INQUIRY_RESP_INITIAL_LEN 36
|
||||
+#define MAX_INQFIELD_LEN 17
|
||||
|
||||
#define MAX_HEADS 127
|
||||
#define HEAD_SORT_TOKEN 0x55
|
||||
@@ -3139,11 +3140,23 @@ do_user_page(struct mpage_info * mpi, int decode_in_hex)
|
||||
return status;
|
||||
}
|
||||
|
||||
+static void
|
||||
+inqfieldname(unsigned char *deststr, const unsigned char *srcbuf, int maxlen)
|
||||
+{
|
||||
+ int i;
|
||||
+
|
||||
+ memset(deststr, '\0', MAX_INQFIELD_LEN);
|
||||
+ for (i = maxlen - 1; i >= 0 && isspace(srcbuf[i]); --i)
|
||||
+ ;
|
||||
+ memcpy(deststr, srcbuf, i + 1);
|
||||
+}
|
||||
+
|
||||
static int
|
||||
do_inquiry(int * peri_type, int * resp_byte6, int inquiry_verbosity)
|
||||
{
|
||||
int status;
|
||||
unsigned char cmd[6];
|
||||
+ unsigned char fieldname[MAX_INQFIELD_LEN];
|
||||
unsigned char *pagestart;
|
||||
struct scsi_cmnd_io sci;
|
||||
|
||||
@@ -3214,14 +3227,17 @@ do_inquiry(int * peri_type, int * resp_byte6, int inquiry_verbosity)
|
||||
}
|
||||
if (x_interface)
|
||||
printf("\n");
|
||||
- printf("%s%.8s\n", (!x_interface ? "Vendor: " : ""),
|
||||
- pagestart + 8);
|
||||
+ inqfieldname(fieldname, pagestart + 8, 8);
|
||||
+ printf("%s%s\n", (!x_interface ? "Vendor: " : ""),
|
||||
+ fieldname);
|
||||
|
||||
- printf("%s%.16s\n", (!x_interface ? "Product: " : ""),
|
||||
- pagestart + 16);
|
||||
+ inqfieldname(fieldname, pagestart + 16, 16);
|
||||
+ printf("%s%s\n", (!x_interface ? "Product: " : ""),
|
||||
+ fieldname);
|
||||
|
||||
- printf("%s%.4s\n", (!x_interface ? "Revision level: " : ""),
|
||||
- pagestart + 32);
|
||||
+ inqfieldname(fieldname, pagestart + 32, 4);
|
||||
+ printf("%s%s\n", (!x_interface ? "Revision level: " : ""),
|
||||
+ fieldname);
|
||||
|
||||
printf("\n");
|
||||
return status;
|
Loading…
Reference in New Issue
Block a user