From: David Zeuthen Date: Tue, 5 Jun 2012 18:44:48 +0000 (-0400) Subject: If a block device has ID_PATH set, consider it to be a drive X-Git-Tag: upstream/2.1.2~227 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=93e82ba32dd51d3b8d786060c4bbe44e62a85bb5;p=platform%2Fupstream%2Fudisks2.git 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 --- 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; }