return hostdev;
}
-static struct udev_device *handle_scsi_hyperv(struct udev_device *parent, char **path) {
+static struct udev_device *handle_scsi_hyperv(struct udev_device *parent, char **path, size_t guid_str_len) {
struct udev_device *hostdev;
struct udev_device *vmbusdev;
const char *guid_str;
_cleanup_free_ char *lun = NULL;
- char guid[38];
+ char guid[39];
size_t i, k;
assert(parent);
assert(path);
+ assert(guid_str_len < sizeof(guid));
hostdev = udev_device_get_parent_with_subsystem_devtype(parent, "scsi", "scsi_host");
if (!hostdev)
if (!guid_str)
return NULL;
- if (strlen(guid_str) < 37 || guid_str[0] != '{' || guid_str[36] != '}')
+ if (strlen(guid_str) < guid_str_len || guid_str[0] != '{' || guid_str[guid_str_len-1] != '}')
return NULL;
- for (i = 1, k = 0; i < 36; i++) {
+ for (i = 1, k = 0; i < guid_str_len-1; i++) {
if (guid_str[i] == '-')
continue;
guid[k++] = guid_str[i];
return handle_scsi_ata(parent, path);
if (strstr(name, "/vmbus_"))
- return handle_scsi_hyperv(parent, path);
+ return handle_scsi_hyperv(parent, path, 37);
+ else if (strstr(name, "/VMBUS"))
+ return handle_scsi_hyperv(parent, path, 38);
return handle_scsi_default(parent, path);
}