Blame SOURCES/0039-libmultipath-factor-out-code-to-get-vpd-page-data.patch

60b218
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
60b218
From: Benjamin Marzinski <bmarzins@redhat.com>
60b218
Date: Tue, 3 Nov 2020 14:27:58 -0600
60b218
Subject: [PATCH] libmultipath: factor out code to get vpd page data
60b218
60b218
A future patch will reuse the code to get the vpd page data, so factor
60b218
it out from get_vpd_sgio().
60b218
60b218
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
60b218
---
60b218
 libmultipath/discovery.c | 19 +++++++++++++++----
60b218
 1 file changed, 15 insertions(+), 4 deletions(-)
60b218
60b218
diff --git a/libmultipath/discovery.c b/libmultipath/discovery.c
60b218
index aa5942c3..eb1e735d 100644
60b218
--- a/libmultipath/discovery.c
60b218
+++ b/libmultipath/discovery.c
60b218
@@ -1239,11 +1239,10 @@ get_vpd_sysfs (struct udev_device *parent, int pg, char * str, int maxlen)
60b218
 	return len;
60b218
 }
60b218
 
60b218
-int
60b218
-get_vpd_sgio (int fd, int pg, int vend_id, char * str, int maxlen)
60b218
+static int
60b218
+fetch_vpd_page(int fd, int pg, unsigned char *buff)
60b218
 {
60b218
-	int len, buff_len;
60b218
-	unsigned char buff[4096];
60b218
+	int buff_len;
60b218
 
60b218
 	memset(buff, 0x0, 4096);
60b218
 	if (sgio_get_vpd(buff, 4096, fd, pg) < 0) {
60b218
@@ -1264,6 +1263,18 @@ get_vpd_sgio (int fd, int pg, int vend_id, char * str, int maxlen)
60b218
 		condlog(3, "vpd pg%02x page truncated", pg);
60b218
 		buff_len = 4096;
60b218
 	}
60b218
+	return buff_len;
60b218
+}
60b218
+
60b218
+int
60b218
+get_vpd_sgio (int fd, int pg, int vend_id, char * str, int maxlen)
60b218
+{
60b218
+	int len, buff_len;
60b218
+	unsigned char buff[4096];
60b218
+
60b218
+	buff_len = fetch_vpd_page(fd, pg, buff);
60b218
+	if (buff_len < 0)
60b218
+		return buff_len;
60b218
 	if (pg == 0x80)
60b218
 		len = parse_vpd_pg80(buff, str, maxlen);
60b218
 	else if (pg == 0x83)
60b218
-- 
60b218
2.17.2
60b218