hal: Branch 'master'

Danny Kukawka dkukawka at kemper.freedesktop.org
Sat Aug 8 00:12:54 PDT 2009


 hald/linux/device.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

New commits:
commit 195146f263e193dc80a4094b4750999657734243
Author: Arnout Vandecappelle <arnout at mind.be>
Date:   Fri Aug 7 10:44:48 2009 +0200

    don't remove scsi_host if there are still targets using it
    
    When a scsi device is removed, the host it is connected to is also
    removed by missing_scsi_host().  However, it is possible that other
    targets still exist that are connected to the same host.  In that case,
    the scsi_host should not be removed.  We check if the scsi_host has
    more than one child, and if so it is not removed.
    
    fd.o#20712

diff --git a/hald/linux/device.c b/hald/linux/device.c
index 3bd1383..2eca1ef 100644
--- a/hald/linux/device.c
+++ b/hald/linux/device.c
@@ -3069,6 +3069,22 @@ missing_scsi_host (const gchar *sysfs_path, HotplugEvent *device_event, HotplugA
 	if (action == HOTPLUG_ACTION_REMOVE && d == NULL)
 		goto out;
 
+	/* skip "remove" if more than one child still exists */
+	if (action == HOTPLUG_ACTION_REMOVE && d != NULL)
+	{
+		GSList *siblings;
+
+		siblings = hal_device_store_match_multiple_key_value_string (hald_get_gdl(),
+									     "info.parent",
+									     hal_device_get_udi(d));
+		if (siblings && g_slist_next(siblings) != NULL)
+		{
+			g_slist_free(siblings);
+			goto out;
+		}
+		g_slist_free(siblings);
+	}
+
 	/* fake host event */
 	rc = TRUE;
 	host_event = g_slice_new0 (HotplugEvent);


More information about the hal-commit mailing list