From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Benjamin Marzinski <bmarzins@redhat.com>
Date: Fri, 1 Nov 2019 12:35:47 -0500
Subject: [PATCH] libmultipath: add vend_id to get_vpd_sgio
This tells multipath how it should decode vendor specific pages. It will
be used by a future patch.
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
---
libmultipath/discovery.c | 4 ++--
libmultipath/discovery.h | 2 +-
libmultipath/propsel.c | 2 +-
tests/vpd.c | 10 +++++-----
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
index 3c72a80a..1d79cbae 100644
--- a/libmultipath/discovery.c
+++ b/libmultipath/discovery.c
@@ -1135,7 +1135,7 @@ get_vpd_sysfs (struct udev_device *parent, int pg, char * str, int maxlen)
}
int
-get_vpd_sgio (int fd, int pg, char * str, int maxlen)
+get_vpd_sgio (int fd, int pg, int vend_id, char * str, int maxlen)
{
int len, buff_len;
unsigned char buff[4096];
@@ -1810,7 +1810,7 @@ static ssize_t uid_fallback(struct path *pp, int path_state,
if (len < 0 && path_state == PATH_UP) {
condlog(1, "%s: failed to get sysfs uid: %s",
pp->dev, strerror(-len));
- len = get_vpd_sgio(pp->fd, 0x83, pp->wwid,
+ len = get_vpd_sgio(pp->fd, 0x83, 0, pp->wwid,
WWID_SIZE);
*origin = "sgio";
}
diff --git a/libmultipath/discovery.h b/libmultipath/discovery.h
index 8d04c2af..2f2fd9eb 100644
--- a/libmultipath/discovery.h
+++ b/libmultipath/discovery.h
@@ -35,7 +35,7 @@ int path_get_tpgs(struct path *pp); /* This function never returns TPGS_UNDEF */
int do_tur (char *);
int path_offline (struct path *);
int get_state (struct path * pp, struct config * conf, int daemon, int state);
-int get_vpd_sgio (int fd, int pg, char * str, int maxlen);
+int get_vpd_sgio (int fd, int pg, int vend_id, char * str, int maxlen);
int pathinfo (struct path * pp, struct config * conf, int mask);
int alloc_path_with_pathinfo (struct config *conf, struct udev_device *udevice,
const char *wwid, int flag, struct path **pp_ptr);
diff --git a/libmultipath/propsel.c b/libmultipath/propsel.c
index 27e8d68a..b5b5b89f 100644
--- a/libmultipath/propsel.c
+++ b/libmultipath/propsel.c
@@ -490,7 +490,7 @@ check_rdac(struct path * pp)
if (__do_set_from_hwe(checker_name, pp, checker_name) &&
strcmp(checker_name, RDAC))
return 0;
- len = get_vpd_sgio(pp->fd, 0xC9, buff, 44);
+ len = get_vpd_sgio(pp->fd, 0xC9, 0, buff, 44);
if (len <= 0)
return 0;
return !(memcmp(buff + 4, "vac1", 4));
diff --git a/tests/vpd.c b/tests/vpd.c
index 4dbce010..02d6e0bb 100644
--- a/tests/vpd.c
+++ b/tests/vpd.c
@@ -431,7 +431,7 @@ static void test_vpd_vnd_ ## len ## _ ## wlen(void **state) \
will_return(__wrap_ioctl, vt->vpdbuf); \
will_return(__wrap_ioctl, n); \
will_return(__wrap_ioctl, vt->vpdbuf); \
- ret = get_vpd_sgio(10, 0x83, vt->wwid, wlen); \
+ ret = get_vpd_sgio(10, 0x83, 0, vt->wwid, wlen); \
assert_correct_wwid("test_vpd_vnd_" #len "_" #wlen, \
exp_len, ret, '1', 0, false, \
exp_subst, vt->wwid); \
@@ -463,7 +463,7 @@ static void test_vpd_str_ ## typ ## _ ## len ## _ ## wlen(void **state) \
will_return(__wrap_ioctl, vt->vpdbuf); \
will_return(__wrap_ioctl, n); \
will_return(__wrap_ioctl, vt->vpdbuf); \
- ret = get_vpd_sgio(10, 0x83, vt->wwid, wlen); \
+ ret = get_vpd_sgio(10, 0x83, 0, vt->wwid, wlen); \
assert_correct_wwid("test_vpd_str_" #typ "_" #len "_" #wlen, \
exp_len, ret, byte0[type], 0, \
type != STR_IQN, \
@@ -502,7 +502,7 @@ static void test_vpd_naa_ ## naa ## _ ## wlen(void **state) \
will_return(__wrap_ioctl, vt->vpdbuf); \
will_return(__wrap_ioctl, n); \
will_return(__wrap_ioctl, vt->vpdbuf); \
- ret = get_vpd_sgio(10, 0x83, vt->wwid, wlen); \
+ ret = get_vpd_sgio(10, 0x83, 0, vt->wwid, wlen); \
assert_correct_wwid("test_vpd_naa_" #naa "_" #wlen, \
exp_len, ret, '3', '0' + naa, true, \
test_id, vt->wwid); \
@@ -530,7 +530,7 @@ static void test_vpd_eui_ ## len ## _ ## wlen ## _ ## sml(void **state) \
will_return(__wrap_ioctl, vt->vpdbuf); \
will_return(__wrap_ioctl, n); \
will_return(__wrap_ioctl, vt->vpdbuf); \
- ret = get_vpd_sgio(10, 0x83, vt->wwid, wlen); \
+ ret = get_vpd_sgio(10, 0x83, 0, vt->wwid, wlen); \
assert_correct_wwid("test_vpd_eui_" #len "_" #wlen "_" #sml, \
exp_len, ret, '2', 0, true, \
test_id, vt->wwid); \
@@ -557,7 +557,7 @@ static void test_vpd80_ ## size ## _ ## len ## _ ## wlen(void **state) \
size, len); \
will_return(__wrap_ioctl, n); \
will_return(__wrap_ioctl, vt->vpdbuf); \
- ret = get_vpd_sgio(10, 0x80, vt->wwid, wlen); \
+ ret = get_vpd_sgio(10, 0x80, 0, vt->wwid, wlen); \
assert_correct_wwid("test_vpd80_" #size "_" #len "_" #wlen, \
exp_len, ret, 0, 0, false, \
input, vt->wwid); \
--
2.17.2