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