From 93e82ba32dd51d3b8d786060c4bbe44e62a85bb5 Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Tue, 5 Jun 2012 14:44:48 -0400 Subject: [PATCH] If a block device has ID_PATH set, consider it to be a drive This fixes problems with the devices where ID_SERIAL or ID_WWN_WITH_EXTENSION is not set. For example, block devices from the rts_pstor driver. See https://bugzilla.redhat.com/show_bug.cgi?id=828492 Signed-off-by: David Zeuthen --- src/udiskslinuxdriveobject.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/udiskslinuxdriveobject.c b/src/udiskslinuxdriveobject.c index 41cc40e..1e8142a 100644 --- a/src/udiskslinuxdriveobject.c +++ b/src/udiskslinuxdriveobject.c @@ -665,17 +665,17 @@ udisks_linux_drive_object_uevent (UDisksLinuxDriveObject *object, static gchar * check_for_vpd (GUdevDevice *device) { - gchar *ret; + gchar *ret = NULL; const gchar *serial; const gchar *wwn; + const gchar *path; g_return_val_if_fail (G_UDEV_IS_DEVICE (device), FALSE); - ret = NULL; - - /* prefer WWN to serial */ + /* order of preference: WWN, serial, path */ serial = g_udev_device_get_property (device, "ID_SERIAL"); wwn = g_udev_device_get_property (device, "ID_WWN_WITH_EXTENSION"); + path = g_udev_device_get_property (device, "ID_PATH"); if (wwn != NULL && strlen (wwn) > 0) { ret = g_strdup (wwn); @@ -684,6 +684,10 @@ check_for_vpd (GUdevDevice *device) { ret = g_strdup (serial); } + else if (path != NULL && strlen (path) > 0) + { + ret = g_strdup (path); + } return ret; } -- 2.7.4