@@ -218,12 +218,11 @@ declare_sysfs_get_str(vendor);
declare_sysfs_get_str(model);
declare_sysfs_get_str(rev);
-ssize_t
-sysfs_get_vpd (struct udev_device * udev, int pg,
- unsigned char * buff, size_t len)
+static ssize_t
+sysfs_get_binary (struct udev_device * udev, const char *attrname,
+ unsigned char *buff, size_t len)
{
ssize_t attr_len;
- char attrname[9];
const char * devname;
if (!udev) {
@@ -232,7 +231,6 @@ sysfs_get_vpd (struct udev_device * udev, int pg,
}
devname = udev_device_get_sysname(udev);
- sprintf(attrname, "vpd_pg%02x", pg);
attr_len = sysfs_bin_attr_get_value(udev, attrname, buff, len);
if (attr_len < 0) {
condlog(3, "%s: attribute %s not found in sysfs",
@@ -242,6 +240,21 @@ sysfs_get_vpd (struct udev_device * udev, int pg,
return attr_len;
}
+ssize_t sysfs_get_vpd(struct udev_device * udev, unsigned char pg,
+ unsigned char *buff, size_t len)
+{
+ char attrname[9];
+
+ snprintf(attrname, sizeof(attrname), "vpd_pg%02x", pg);
+ return sysfs_get_binary(udev, attrname, buff, len);
+}
+
+ssize_t sysfs_get_inquiry(struct udev_device * udev,
+ unsigned char *buff, size_t len)
+{
+ return sysfs_get_binary(udev, "inquiry", buff, len);
+}
+
int
sysfs_get_timeout(struct path *pp, unsigned int *timeout)
{
@@ -48,8 +48,10 @@ int sysfs_get_host_pci_name(const struct path *pp, char *pci_name);
int sysfs_get_iscsi_ip_address(const struct path *pp, char *ip_address);
int sysfs_get_host_adapter_name(const struct path *pp,
char *adapter_name);
-ssize_t sysfs_get_vpd (struct udev_device * udev, int pg, unsigned char * buff,
- size_t len);
+ssize_t sysfs_get_vpd (struct udev_device *udev, unsigned char pg,
+ unsigned char *buff, size_t len);
+ssize_t sysfs_get_inquiry(struct udev_device *udev,
+ unsigned char *buff, size_t len);
int sysfs_get_asymmetric_access_state(struct path *pp,
char *buff, int buflen);
int get_uid(struct path * pp, int path_state, struct udev_device *udev);
Provide a utility function to retrieve inquiry data from sysfs, like we do for VPDs. Signed-off-by: Martin Wilck <mwilck@suse.com> --- libmultipath/discovery.c | 23 ++++++++++++++++++----- libmultipath/discovery.h | 6 ++++-- 2 files changed, 22 insertions(+), 7 deletions(-)