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

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