From 9b6c3d14958e0b75077048fac9ed36e2a98246a8 Mon Sep 17 00:00:00 2001 From: Wenchao Hao Date: Mon, 2 Aug 2021 14:26:04 +0800 Subject: [PATCH] fix incorrect output of wwn number when execute "lsscsi -w" Signed-off-by: Wenchao Hao (cherry picked from commit 4eb1f018b1e939ed2cb25c6af60017a57380bfff) --- ...ice-parsing-and-make-WWN-printing-fo.patch | 38 +++++++++++++++++++ 0002-Fix-lsscsi-wwn-number-output-error.patch | 28 ++++++++++++++ lsscsi.spec | 8 +++- 3 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 0001-improve-NVMe-device-parsing-and-make-WWN-printing-fo.patch create mode 100644 0002-Fix-lsscsi-wwn-number-output-error.patch diff --git a/0001-improve-NVMe-device-parsing-and-make-WWN-printing-fo.patch b/0001-improve-NVMe-device-parsing-and-make-WWN-printing-fo.patch new file mode 100644 index 0000000..99248e7 --- /dev/null +++ b/0001-improve-NVMe-device-parsing-and-make-WWN-printing-fo.patch @@ -0,0 +1,38 @@ +From e06814242df16d7cb70b5ae739308b84390aa28c Mon Sep 17 00:00:00 2001 +From: dougg +Date: Thu, 9 Jul 2020 02:56:11 +0000 +Subject: [PATCH] improve NVMe device parsing and make WWN printing for NVMe + more consistent + +git-svn-id: https://svn.bingwo.ca/repos/lsscsi/trunk@163 aaa919c1-9816-4d37-901d-0171dbb97e96 + +Conflict: origin commit contains three changes: + - improve NVMe device parsing (e.g. /dev/nvme0c1n2) + - collect_disk_wwn_nodes: Fix WWN string copy + - make WWN printing for NVMe more consistent with + output from SCSI devices (e.g. with -u and -t) +Here we pick the change of collect_disk_wwn_nodes which fix the incorrect output of wwn number +Reference:https://github.com/doug-gilbert/lsscsi/commit/e06814242df16d7cb70b5ae739308b84390aa28c + +Signed-off-by: Wenchao Hao + +--- + src/lsscsi.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/src/lsscsi.c b/src/lsscsi.c +index 1fe1b3e..8fe85df 100644 +--- a/src/lsscsi.c ++++ b/src/lsscsi.c +@@ -1509,7 +1509,7 @@ collect_disk_wwn_nodes(void) + } + + cur_ent = &cur_list->nodes[cur_list->count]; +- my_strcopy(cur_ent->wwn, "0x", 2); ++ my_strcopy(cur_ent->wwn, "0x", 3); + my_strcopy(cur_ent->wwn + 2, dep->d_name + 5, + sizeof(cur_ent->wwn) - 2); + my_strcopy(cur_ent->disk_bname, basename(symlink_path), +-- +1.8.3.1 + diff --git a/0002-Fix-lsscsi-wwn-number-output-error.patch b/0002-Fix-lsscsi-wwn-number-output-error.patch new file mode 100644 index 0000000..4198797 --- /dev/null +++ b/0002-Fix-lsscsi-wwn-number-output-error.patch @@ -0,0 +1,28 @@ +From c13c9d3a90aec4779a0cbe484913f24bce947ab1 Mon Sep 17 00:00:00 2001 +From: Wenchao Hao +Date: Tue, 8 Jun 2021 16:26:04 +0800 +Subject: [PATCH] Fix lsscsi wwn number output error + +The true wwn number is from the sixth byte of scsi-* + +Signed-off-by: Wenchao Hao +--- + src/lsscsi.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/lsscsi.c b/src/lsscsi.c +index 6f6953f..2be3ab9 100644 +--- a/src/lsscsi.c ++++ b/src/lsscsi.c +@@ -1515,7 +1515,7 @@ collect_disk_wwn_nodes(void) + + cur_ent = &cur_list->nodes[cur_list->count]; + my_strcopy(cur_ent->wwn, "0x", 3); +- my_strcopy(cur_ent->wwn + 2, dep->d_name + 5, ++ my_strcopy(cur_ent->wwn + 2, dep->d_name + 6, + sizeof(cur_ent->wwn) - 2); + my_strcopy(cur_ent->disk_bname, basename(symlink_path), + sizeof(cur_ent->disk_bname)); +-- +1.8.3.1 + diff --git a/lsscsi.spec b/lsscsi.spec index 98013d0..83e1786 100644 --- a/lsscsi.spec +++ b/lsscsi.spec @@ -1,11 +1,14 @@ Name: lsscsi Version: 0.30 -Release: 3 +Release: 4 Summary: The lsscsi command lists information about SCSI devices in Linux. License: GPLv2+ URL: http://sg.danny.cz/scsi/lsscsi.html Source0: http://sg.danny.cz/scsi/%{name}-%{version}.tgz +Patch1: 0001-improve-NVMe-device-parsing-and-make-WWN-printing-fo.patch +Patch2: 0002-Fix-lsscsi-wwn-number-output-error.patch + BuildRequires: gcc %description @@ -43,6 +46,9 @@ Man pages and other related documents for %{name}. %changelog +* Mon Aug 2 2021 Wenchao Hao - 0.30-4 +- DESC: fix incorrect output of wwn number when execute "lsscsi -w" + * Fri Jul 30 2021 chenyanpanHW - 0.30-3 - DESC: delete -Sgit from %autosetup, and delete BuildRequires git -- Gitee