Accepting request 230262 from home:spargaonkar:branches:Base:System
- added patch sginfo-inq-fields-strip-blank.patch sg3_utils: Strip out trailing info from vendor info products fields in inq bnc#863357 - added patches: * sginfo-inq-fields-strip-blank.patch OBS-URL: https://build.opensuse.org/request/show/230262 OBS-URL: https://build.opensuse.org/package/show/Base:System/sg3_utils?expand=0&rev=35
This commit is contained in:
parent
1ccb58cb91
commit
27715e75b9
@ -1,4 +1,13 @@
|
|||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
|
Tue Apr 15 20:11:54 UTC 2014 - spargaonkar@suse.com
|
||||||
|
|
||||||
|
- added patch sginfo-inq-fields-strip-blank.patch
|
||||||
|
sg3_utils: Strip out trailing info from vendor info products fields in inq
|
||||||
|
bnc#863357
|
||||||
|
|
||||||
|
- added patches:
|
||||||
|
* sginfo-inq-fields-strip-blank.patch
|
||||||
|
-------------------------------------------------------------------
|
||||||
Fri Apr 11 12:12:47 CEST 2014 - hare@suse.de
|
Fri Apr 11 12:12:47 CEST 2014 - hare@suse.de
|
||||||
|
|
||||||
- Split off 59-scsi-sg_utils.rules to properly support
|
- Split off 59-scsi-sg_utils.rules to properly support
|
||||||
|
@ -27,6 +27,7 @@ Url: http://sg.danny.cz/sg/sg3_utils.html
|
|||||||
|
|
||||||
Source: http://sg.danny.cz/sg/p/%name-%{version}.tar.xz
|
Source: http://sg.danny.cz/sg/p/%name-%{version}.tar.xz
|
||||||
Patch1: 0001-Split-59-scsi-sg_utils.rules-for-multipath-support.patch
|
Patch1: 0001-Split-59-scsi-sg_utils.rules-for-multipath-support.patch
|
||||||
|
Patch2: sginfo-inq-fields-strip-blank.patch
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
BuildRequires: udev
|
BuildRequires: udev
|
||||||
BuildRequires: xz
|
BuildRequires: xz
|
||||||
@ -82,6 +83,7 @@ applications that want to make use of libsgutils.
|
|||||||
%prep
|
%prep
|
||||||
%setup -q -n %{name}-%{version}
|
%setup -q -n %{name}-%{version}
|
||||||
%patch1 -p1
|
%patch1 -p1
|
||||||
|
%patch2 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%configure --disable-static --with-pic
|
%configure --disable-static --with-pic
|
||||||
|
75
sginfo-inq-fields-strip-blank.patch
Normal file
75
sginfo-inq-fields-strip-blank.patch
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
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