From 9ef90fc8775c4651ffbfdf1557feb63dbd0f81d2 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Thu, 16 Jun 2022 06:20:43 +0000 Subject: [PATCH] Auto sync2gitlab import of sg3_utils-1.44-6.el8.src.rpm --- sg3_utils.spec | 8 +- sg_ses-1.45-page_control_data_args.patch | 95 ++++++++++++++++++++++++ 2 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 sg_ses-1.45-page_control_data_args.patch diff --git a/sg3_utils.spec b/sg3_utils.spec index ed3a2ae..95c46f0 100644 --- a/sg3_utils.spec +++ b/sg3_utils.spec @@ -3,7 +3,7 @@ Summary: Utilities for devices that use SCSI command sets Name: sg3_utils Version: 1.44 -Release: 5%{?dist} +Release: 6%{?dist} License: GPLv2+ and BSD Group: Applications/System Source0: http://sg.danny.cz/sg/p/sg3_utils-%{version}.tar.xz @@ -20,6 +20,9 @@ Patch2: sg_raw-version.patch # https://bugzilla.redhat.com/show_bug.cgi?id=1760847 # FC_TARGET_LUN attribute assigned for non FC device Patch3: fc_wwpn_id-non_FC-devices.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=2078107 +# sg_ses: --page= is incorrectly overridden when --control and --data= are also used +Patch4: sg_ses-1.45-page_control_data_args.patch URL: http://sg.danny.cz/sg/sg3_utils.html Requires: %{name}-libs%{?_isa} = %{version}-%{release} BuildRequires: systemd @@ -113,6 +116,9 @@ install -p -m 755 scripts/fc_wwpn_id $RPM_BUILD_ROOT/usr/lib/udev %changelog +* Wed Jun 08 2022 Tomas Bzatek - 1.44-6 +- Fix sg_ses --page argument override when --control and --data are specified (#2078107) + * Thu Jan 02 2020 Tomas Bzatek - 1.44-5 - Reorder the udev rules to run after 60-persistent-storage.rules (RHBZ #1785062) diff --git a/sg_ses-1.45-page_control_data_args.patch b/sg_ses-1.45-page_control_data_args.patch new file mode 100644 index 0000000..d8082ae --- /dev/null +++ b/sg_ses-1.45-page_control_data_args.patch @@ -0,0 +1,95 @@ +From a00692315686c7bc061010aa215bcb381181758f Mon Sep 17 00:00:00 2001 +From: Douglas Gilbert +Date: Wed, 10 Oct 2018 06:50:03 +0000 +Subject: [PATCH] sg_ses: bug: --page= being overridden when --control and + --data= also given; fix; sg_opcodes: expand MLU (18-102r0) + +git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@793 6180dd3e-e324-4e3e-922d-17de1ae2f315 + +diff --git a/src/sg_ses.c b/src/sg_ses.c +index abb1feac..0cce8bd1 100644 +--- a/src/sg_ses.c ++++ b/src/sg_ses.c +@@ -70,7 +70,7 @@ static const char * version_str = "2.43 20180810"; /* ses4r02 */ + #define ELEM_DESC_DPC 0x7 + #define SHORT_ENC_STATUS_DPC 0x8 + #define ENC_BUSY_DPC 0x9 +-#define ADD_ELEM_STATUS_DPC 0xa ++#define ADD_ELEM_STATUS_DPC 0xa /* Additional Element Status dpage code */ + #define SUBENC_HELP_TEXT_DPC 0xb + #define SUBENC_STRING_DPC 0xc + #define SUPPORTED_SES_DPC 0xd /* should be 0x1 <= dpc <= 0x2f */ +@@ -108,6 +108,7 @@ static const char * version_str = "2.43 20180810"; /* ses4r02 */ + #define SAS_CONNECTOR_ETC 0x19 + #define LAST_ETC SAS_CONNECTOR_ETC /* adjust as necessary */ + ++#define TPROTO_PCIE_PS_NVME 1 /* NVMe regarded as subset of PCIe */ + #define NUM_ETC (LAST_ETC + 1) + + #define DEF_CLEAR_VAL 0 +@@ -1378,7 +1379,8 @@ parse_cmd_line(struct opts_t *op, int argc, char *argv[]) + return SG_LIB_SYNTAX_ERROR; + } + op->do_raw = 0; +- if (op->arr_len > 3) { ++ /* struct data_in_desc_t stuff does not apply when --control */ ++ if (op->do_status && (op->arr_len > 3)) { + int off; + int pc = 0; + const uint8_t * bp = op->data_arr + DATA_IN_OFF; +@@ -3476,9 +3478,9 @@ additional_elem_helper(const char * pad, const uint8_t * ae_bp, + if (len < 6) + break; + pcie_pt = (ae_bp[5] >> 5) & 0x7; +- if (1 == pcie_pt) ++ if (TPROTO_PCIE_PS_NVME == pcie_pt) + printf("%sPCIe protocol type: NVMe\n", pad); +- else { ++ else { /* no others currently defined */ + printf("%sTransport protocol: PCIe subprotocol=0x%x not " + "decoded\n", pad, pcie_pt); + if (op->verbose) +@@ -3490,7 +3492,7 @@ additional_elem_helper(const char * pad, const uint8_t * ae_bp, + ae_bp[5] & 1); + printf(", device slot number: %d\n", ae_bp[7]); + +- pcie_vid = sg_get_unaligned_le16(ae_bp + 10); ++ pcie_vid = sg_get_unaligned_le16(ae_bp + 10); /* N.B. LE */ + printf("%sPCIe vendor id: 0x%" PRIx16 "%s\n", pad, pcie_vid, + (0xffff == pcie_vid) ? " (not reported)" : ""); + printf("%sserial number: %.20s\n", pad, ae_bp + 12); +@@ -3505,14 +3507,14 @@ additional_elem_helper(const char * pad, const uint8_t * ae_bp, + (int)psn_valid, (int)bdf_valid, (int)cid_valid); + if (cid_valid) /* N.B. little endian */ + printf("%s controller id: 0x%" PRIx16 "\n", pad, +- sg_get_unaligned_le16(aep + 1)); ++ sg_get_unaligned_le16(aep + 1)); /* N.B. LEndian */ + if (bdf_valid) + printf("%s bus number: 0x%x, device number: 0x%x, " + "function number: 0x%x\n", pad, aep[4], + (aep[5] >> 3) & 0x1f, 0x7 & aep[5]); + if (psn_valid) /* little endian, top 3 bits assumed zero */ + printf("%s physical slot number: 0x%" PRIx16 "\n", pad, +- 0x1fff & sg_get_unaligned_le16(aep + 6)); ++ 0x1fff & sg_get_unaligned_le16(aep + 6)); /* N.B. LE */ + } + break; + default: +@@ -3524,7 +3526,7 @@ additional_elem_helper(const char * pad, const uint8_t * ae_bp, + } + } + +-/* ADD_ELEM_STATUS_DPC [0xa] ++/* ADD_ELEM_STATUS_DPC [0xa] Additional Element Status dpage + * Previously called "Device element status descriptor". Changed "device" + * to "additional" to allow for SAS expander and SATA devices */ + static void +@@ -5704,7 +5706,7 @@ main(int argc, char * argv[]) + uint16_t oacs; + + nvmsr = enc_stat_rsp[253]; +- oacs = sg_get_unaligned_le16(enc_stat_rsp + 256); ++ oacs = sg_get_unaligned_le16(enc_stat_rsp + 256); /* N.B. LE */ + if (vb > 3) + pr2serr("NVMe Identify ctl response: nvmsr=%u, oacs=0x%x\n", + nvmsr, oacs);