libmultipath: add vend_id to get_vpd_sgio
authorBenjamin Marzinski <bmarzins@redhat.com>
Wed, 19 Feb 2020 06:48:30 +0000 (00:48 -0600)
committerChristophe Varoqui <christophe.varoqui@opensvc.com>
Mon, 2 Mar 2020 08:43:32 +0000 (09:43 +0100)
This tells multipath how it should decode vendor specific pages. It will
be used by a future patch.

Reviewed-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
libmultipath/discovery.c
libmultipath/discovery.h
libmultipath/propsel.c
tests/vpd.c

index 73e1fdb..e47b898 100644 (file)
@@ -1185,7 +1185,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];
@@ -1860,7 +1860,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";
                }
index 0516e41..6444887 100644 (file)
@@ -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);
index 27e8d68..b5b5b89 100644 (file)
@@ -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));
index 1e653ed..0331c48 100644 (file)
@@ -429,7 +429,7 @@ static void test_vpd_vnd_ ## len ## _ ## wlen(void **state)             \
        free(exp_wwid);                                                 \
        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);                       \
@@ -459,7 +459,7 @@ static void test_vpd_str_ ## typ ## _ ## len ## _ ## wlen(void **state) \
                exp_len = wlen - 1;                                     \
        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,                            \
@@ -496,7 +496,7 @@ static void test_vpd_naa_ ## naa ## _ ## wlen(void **state)             \
                         3, naa, 0);                                    \
        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);                         \
@@ -527,7 +527,7 @@ static void test_vpd_eui_ ## len ## _ ## wlen ## _ ## sml(void **state)     \
        }                                                               \
        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);                         \
@@ -554,7 +554,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);                           \