Blame SOURCES/0050-libmultipath-make-protocol_name-global.patch

ca7c20
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
ca7c20
From: Benjamin Marzinski <bmarzins@redhat.com>
ca7c20
Date: Wed, 13 Apr 2022 23:27:36 -0500
ca7c20
Subject: [PATCH] libmultipath: make protocol_name global
ca7c20
ca7c20
Future patches will make use of this, so move it out of
ca7c20
snprint_path_protocol()
ca7c20
ca7c20
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
ca7c20
Reviewed-by: Martin Wilck <mwilck@suse.com>
ca7c20
---
ca7c20
 libmultipath/print.c   | 17 -----------------
ca7c20
 libmultipath/structs.c | 18 ++++++++++++++++++
ca7c20
 libmultipath/structs.h |  1 +
ca7c20
 3 files changed, 19 insertions(+), 17 deletions(-)
ca7c20
ca7c20
diff --git a/libmultipath/print.c b/libmultipath/print.c
ca7c20
index 8f1b18db..0dbd34e4 100644
ca7c20
--- a/libmultipath/print.c
ca7c20
+++ b/libmultipath/print.c
ca7c20
@@ -696,23 +696,6 @@ snprint_path_failures(struct strbuf *buff, const struct path * pp)
ca7c20
 int
ca7c20
 snprint_path_protocol(struct strbuf *buff, const struct path * pp)
ca7c20
 {
ca7c20
-	static const char * const protocol_name[LAST_BUS_PROTOCOL_ID + 1] = {
ca7c20
-		[SYSFS_BUS_UNDEF] = "undef",
ca7c20
-		[SYSFS_BUS_CCW] = "ccw",
ca7c20
-		[SYSFS_BUS_CCISS] = "cciss",
ca7c20
-		[SYSFS_BUS_NVME] = "nvme",
ca7c20
-		[SYSFS_BUS_SCSI + SCSI_PROTOCOL_FCP] = "scsi:fcp",
ca7c20
-		[SYSFS_BUS_SCSI + SCSI_PROTOCOL_SPI] = "scsi:spi",
ca7c20
-		[SYSFS_BUS_SCSI + SCSI_PROTOCOL_SSA] = "scsi:ssa",
ca7c20
-		[SYSFS_BUS_SCSI + SCSI_PROTOCOL_SBP] = "scsi:sbp",
ca7c20
-		[SYSFS_BUS_SCSI + SCSI_PROTOCOL_SRP] = "scsi:srp",
ca7c20
-		[SYSFS_BUS_SCSI + SCSI_PROTOCOL_ISCSI] = "scsi:iscsi",
ca7c20
-		[SYSFS_BUS_SCSI + SCSI_PROTOCOL_SAS] = "scsi:sas",
ca7c20
-		[SYSFS_BUS_SCSI + SCSI_PROTOCOL_ADT] = "scsi:adt",
ca7c20
-		[SYSFS_BUS_SCSI + SCSI_PROTOCOL_ATA] = "scsi:ata",
ca7c20
-		[SYSFS_BUS_SCSI + SCSI_PROTOCOL_USB] = "scsi:usb",
ca7c20
-		[SYSFS_BUS_SCSI + SCSI_PROTOCOL_UNSPEC] = "scsi:unspec",
ca7c20
-	};
ca7c20
 	const char *pn = protocol_name[bus_protocol_id(pp)];
ca7c20
 
ca7c20
 	assert(pn != NULL);
ca7c20
diff --git a/libmultipath/structs.c b/libmultipath/structs.c
ca7c20
index 2b7cde0c..d20e1eea 100644
ca7c20
--- a/libmultipath/structs.c
ca7c20
+++ b/libmultipath/structs.c
ca7c20
@@ -20,6 +20,24 @@
ca7c20
 #include "prioritizers/alua_spc3.h"
ca7c20
 #include "dm-generic.h"
ca7c20
 
ca7c20
+const char * const protocol_name[LAST_BUS_PROTOCOL_ID + 1] = {
ca7c20
+	[SYSFS_BUS_UNDEF] = "undef",
ca7c20
+	[SYSFS_BUS_CCW] = "ccw",
ca7c20
+	[SYSFS_BUS_CCISS] = "cciss",
ca7c20
+	[SYSFS_BUS_NVME] = "nvme",
ca7c20
+	[SYSFS_BUS_SCSI + SCSI_PROTOCOL_FCP] = "scsi:fcp",
ca7c20
+	[SYSFS_BUS_SCSI + SCSI_PROTOCOL_SPI] = "scsi:spi",
ca7c20
+	[SYSFS_BUS_SCSI + SCSI_PROTOCOL_SSA] = "scsi:ssa",
ca7c20
+	[SYSFS_BUS_SCSI + SCSI_PROTOCOL_SBP] = "scsi:sbp",
ca7c20
+	[SYSFS_BUS_SCSI + SCSI_PROTOCOL_SRP] = "scsi:srp",
ca7c20
+	[SYSFS_BUS_SCSI + SCSI_PROTOCOL_ISCSI] = "scsi:iscsi",
ca7c20
+	[SYSFS_BUS_SCSI + SCSI_PROTOCOL_SAS] = "scsi:sas",
ca7c20
+	[SYSFS_BUS_SCSI + SCSI_PROTOCOL_ADT] = "scsi:adt",
ca7c20
+	[SYSFS_BUS_SCSI + SCSI_PROTOCOL_ATA] = "scsi:ata",
ca7c20
+	[SYSFS_BUS_SCSI + SCSI_PROTOCOL_USB] = "scsi:usb",
ca7c20
+	[SYSFS_BUS_SCSI + SCSI_PROTOCOL_UNSPEC] = "scsi:unspec",
ca7c20
+};
ca7c20
+
ca7c20
 struct adapter_group *
ca7c20
 alloc_adaptergroup(void)
ca7c20
 {
ca7c20
diff --git a/libmultipath/structs.h b/libmultipath/structs.h
ca7c20
index 45294f11..618ff4fb 100644
ca7c20
--- a/libmultipath/structs.h
ca7c20
+++ b/libmultipath/structs.h
ca7c20
@@ -191,6 +191,7 @@ enum scsi_protocol {
ca7c20
  */
ca7c20
 #define LAST_BUS_PROTOCOL_ID (SYSFS_BUS_SCSI + SCSI_PROTOCOL_UNSPEC)
ca7c20
 unsigned int bus_protocol_id(const struct path *pp);
ca7c20
+extern const char * const protocol_name[];
ca7c20
 
ca7c20
 #define SCSI_INVALID_LUN ~0ULL
ca7c20