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