rpms/DeviceKit-disks/devel devkit-disks-dm-is-system-internal.patch, NONE, 1.1 DeviceKit-disks.spec, 1.9, 1.10

David Zeuthen davidz at fedoraproject.org
Thu Mar 19 20:24:41 UTC 2009


Author: davidz

Update of /cvs/pkgs/rpms/DeviceKit-disks/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv1150

Modified Files:
	DeviceKit-disks.spec 
Added Files:
	devkit-disks-dm-is-system-internal.patch 
Log Message:
* Thu Mar 19 2009 David Zeuthen <davidz at redhat.com> - 003-7%{?dist}
- Make sure dm devices are marked as system-internal (#489397)



devkit-disks-dm-is-system-internal.patch:

--- NEW FILE devkit-disks-dm-is-system-internal.patch ---
fix up how device-is-system-internal is computed

This should fix

 https://bugzilla.redhat.com/show_bug.cgi?id=489397

where we marked device-mapper devices as system internal.

diff --git a/src/devkit-disks-device.c b/src/devkit-disks-device.c
index 5b4b844..e0c711f 100644
--- a/src/devkit-disks-device.c
+++ b/src/devkit-disks-device.c
@@ -2573,29 +2573,45 @@ update_info_is_system_internal (DevkitDisksDevice *device)
         /* TODO: make it possible to override this property from a udev property.
          */
 
-        is_system_internal = FALSE;
+        /* start out by assuming the device is system internal, then adjust depending on what kind of
+         * device we are dealing with
+         */
+        is_system_internal = TRUE;
 
+        /* A Linux MD device is system internal if, and only if
+         *
+         * - a single component is system internal
+         * - there are no components
+         */
         if (device->priv->device_is_linux_md) {
-                guint n;
+                is_system_internal = FALSE;
 
-                /* A Linux MD device is system internal IFF a single component is system internal */
-                for (n = 0; n < device->priv->slaves_objpath->len; n++) {
-                        const gchar *slave_objpath;
-                        DevkitDisksDevice *slave;
+                if (device->priv->slaves_objpath->len == 0) {
+                        is_system_internal = TRUE;
+                } else {
+                        guint n;
 
-                        slave_objpath = device->priv->slaves_objpath->pdata[n];
-                        slave = devkit_disks_daemon_local_find_by_object_path (device->priv->daemon, slave_objpath);
-                        if (slave == NULL)
-                                continue;
+                        for (n = 0; n < device->priv->slaves_objpath->len; n++) {
+                                const gchar *slave_objpath;
+                                DevkitDisksDevice *slave;
 
-                        if (slave->priv->device_is_system_internal) {
-                                is_system_internal = TRUE;
-                                break;
+                                slave_objpath = device->priv->slaves_objpath->pdata[n];
+                                slave = devkit_disks_daemon_local_find_by_object_path (device->priv->daemon, slave_objpath);
+                                if (slave == NULL)
+                                        continue;
+
+                                if (slave->priv->device_is_system_internal) {
+                                        is_system_internal = TRUE;
+                                        break;
+                                }
                         }
                 }
+
+                goto determined;
         }
 
-        else  if (device->priv->device_is_partition) {
+        /* a partition is system internal only if the drive it belongs to is system internal */
+        if (device->priv->device_is_partition) {
                 DevkitDisksDevice *enclosing_device;
 
                 enclosing_device = devkit_disks_daemon_local_find_by_object_path (device->priv->daemon, device->priv->partition_slave);
@@ -2605,9 +2621,14 @@ update_info_is_system_internal (DevkitDisksDevice *device)
                         is_system_internal = TRUE;
                 }
 
-        } else if (device->priv->device_is_luks_cleartext) {
-                DevkitDisksDevice *enclosing_device;
+                goto determined;
+        }
 
+        /* a LUKS cleartext device is system internal only if the underlying crypto-text
+         * device is system internal
+         */
+        if (device->priv->device_is_luks_cleartext) {
+                DevkitDisksDevice *enclosing_device;
                 enclosing_device = devkit_disks_daemon_local_find_by_object_path (device->priv->daemon, device->priv->luks_cleartext_slave);
                 if (enclosing_device != NULL) {
                         is_system_internal = enclosing_device->priv->device_is_system_internal;
@@ -2615,11 +2636,17 @@ update_info_is_system_internal (DevkitDisksDevice *device)
                         is_system_internal = TRUE;
                 }
 
-        } else if (device->priv->device_is_removable) {
+                goto determined;
+        }
 
+        /* devices with removable media are never system internal */
+        if (device->priv->device_is_removable) {
                 is_system_internal = FALSE;
+                goto determined;
+        }
 
-        } else if (device->priv->device_is_drive && device->priv->drive_connection_interface != NULL) {
+        /* devices on certain buses are never system internal */
+        if (device->priv->device_is_drive && device->priv->drive_connection_interface != NULL) {
 
                 if (strcmp (device->priv->drive_connection_interface, "ata_serial_esata") == 0 ||
                     strcmp (device->priv->drive_connection_interface, "sdio") == 0 ||
@@ -2629,8 +2656,10 @@ update_info_is_system_internal (DevkitDisksDevice *device)
                 } else {
                         is_system_internal = TRUE;
                 }
+                goto determined;
         }
 
+ determined:
         devkit_disks_device_set_device_is_system_internal (device, is_system_internal);
 
         return TRUE;



Index: DeviceKit-disks.spec
===================================================================
RCS file: /cvs/pkgs/rpms/DeviceKit-disks/devel/DeviceKit-disks.spec,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- DeviceKit-disks.spec	10 Mar 2009 18:49:28 -0000	1.9
+++ DeviceKit-disks.spec	19 Mar 2009 20:24:11 -0000	1.10
@@ -11,7 +11,7 @@
 Summary: Disk Management Service
 Name: DeviceKit-disks
 Version: 003
-Release: 6%{?dist}
+Release: 7%{?dist}
 License: GPLv2+
 Group: System Environment/Libraries
 URL: http://gitweb.freedesktop.org/?p=users/david/DeviceKit-disks.git;a=summary
@@ -42,6 +42,8 @@
 Patch2: devkit-disks-fstab-unmount.patch
 # https://bugzilla.redhat.com/show_bug.cgi?id=488850
 Patch3: devkit-disks-dashdash.patch
+# https://bugzilla.redhat.com/show_bug.cgi?id=489397
+Patch4: devkit-disks-dm-is-system-internal.patch
 
 %description
 DeviceKit-disks provides a daemon, D-Bus API and command line tools
@@ -64,6 +66,7 @@
 %patch1 -p1 -b .fstab-unmount
 %patch2 -p1 -b .dump-option
 %patch3 -p1 -b .dashdash
+%patch4 -p1 -b .dm-is-system-internal
 
 %build
 %configure
@@ -117,11 +120,16 @@
 %dir %{_datadir}/gtk-doc/html/devkit-disks
 %{_datadir}/gtk-doc/html/devkit-disks/*
 
+# Note: please don't forget the %{?dist} in the changelog. Thanks
+#
 %changelog
-* Tue Mar 10 2009 Matthias Clasen <mclasen at redhat.com> - 003-6
+* Thu Mar 19 2009 David Zeuthen <davidz at redhat.com> - 003-7%{?dist}
+- Make sure dm devices are marked as system-internal (#489397)
+
+* Tue Mar 10 2009 Matthias Clasen <mclasen at redhat.com> - 003-6%{?dist}
 - Fix the previous patch
 
-* Fri Mar  6 2009 Matthias Clasen <mclasen at redhat.com> - 003-5
+* Fri Mar  6 2009 Matthias Clasen <mclasen at redhat.com> - 003-5%{?dist}
 - Handle -- correctly in devkit-disks
 
 * Wed Mar 04 2009 David Zeuthen <davidz at redhat.com> - 003-3%{?dist}




More information about the fedora-extras-commits mailing list