summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Zeuthen <zeuthen@gmail.com>2012-06-05 14:44:48 -0400
committerDavid Zeuthen <zeuthen@gmail.com>2012-06-05 14:59:27 -0400
commit93e82ba32dd51d3b8d786060c4bbe44e62a85bb5 (patch)
tree89b4fc16041e741f0c2a36b6d65c522105b57a45
parent5dbb35efcae39b507293f4181dca8d50766fe5d3 (diff)
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 <zeuthen@gmail.com>
-rw-r--r--src/udiskslinuxdriveobject.c12
1 files 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;
}