From 48372f7b55a60cf5bc3e91bf97e02229e95cc47b Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Thu, 16 Apr 2009 13:04:33 -0400 Subject: [PATCH] properly detect devices with vfat on the whole disk See https://bugzilla.redhat.com/show_bug.cgi?id=495876 --- src/95-devkit-disks.rules | 3 --- src/devkit-disks-device.c | 16 ++++++++++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/95-devkit-disks.rules b/src/95-devkit-disks.rules index b29e5d0..fb8b745 100644 --- a/src/95-devkit-disks.rules +++ b/src/95-devkit-disks.rules @@ -19,9 +19,6 @@ KERNEL=="sr*", ENV{ID_CDROM_MEDIA_TRACK_COUNT}!="?*", GOTO="probe_parttable_end" # IMPORT{program}="devkit-disks-part-id $tempnode" -# clear all ID_FS_USAGE, TYPE if we're a partition table -ENV{DKD_PART_ID_PARTITION_TABLE_SCHEME}!="", ENV{ID_FS_USAGE}="", ENV{ID_FS_TYPE}="" - LABEL="probe_parttable_end" ############################################################################################################## diff --git a/src/devkit-disks-device.c b/src/devkit-disks-device.c index 633d716..968ad0d 100644 --- a/src/devkit-disks-device.c +++ b/src/devkit-disks-device.c @@ -1691,8 +1691,20 @@ update_info_partition_table (DevkitDisksDevice *device) if (!device->priv->device_is_partition && devkit_device_has_property (device->priv->d, "DKD_PARTITION_TABLE")) { - devkit_disks_device_set_device_is_partition_table (device, TRUE); - devkit_disks_device_set_partition_table_scheme (device, devkit_device_get_property (device->priv->d, "DKD_PARTITION_TABLE_SCHEME")); + /* Some times we think that vfat on the main block device looks like a Master Boot Record + * partition table (the on-disk formats are extremely similar). So if we already have + * detected a file system on the main block device and don't have any partitions, then + * avoid tagging the device as a partition table. + * + * See e.g. https://bugzilla.redhat.com/show_bug.cgi?id=495876. + */ + if (device->priv->partition_table_count == 0 && + g_strcmp0 (device->priv->id_usage, "filesystem") == 0) { + devkit_disks_device_set_device_is_partition_table (device, FALSE); + } else { + devkit_disks_device_set_device_is_partition_table (device, TRUE); + devkit_disks_device_set_partition_table_scheme (device, devkit_device_get_property (device->priv->d, "DKD_PARTITION_TABLE_SCHEME")); + } } else { devkit_disks_device_set_partition_table_scheme (device, NULL); } -- 2.7.4