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