Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > media > main-src > by-pkgid > 26764e702e441b473525f6a16ac25557 > files > 46

hal-0.5.8.1-59.el5.src.rpm

diff -urNp hal-0.5.8.1/hald/linux/blockdev.c hal-0.5.8.1.cciss/hald/linux/blockdev.c
--- hal-0.5.8.1/hald/linux/blockdev.c	2009-07-15 17:37:33.000000000 +0100
+++ hal-0.5.8.1.cciss/hald/linux/blockdev.c	2009-07-22 14:59:17.000000000 +0100
@@ -855,7 +831,13 @@ hotplug_event_begin_add_blockdev (const 
 
 			/* Find device */
 			d_it = hal_device_store_find (hald_get_gdl (), udi_it);
-			g_assert (d_it != NULL);
+			if (d_it == NULL) { 
+				d_it = hal_device_store_find (hald_get_tdl (), udi_it);
+				if (d_it == NULL) {
+					HAL_WARNING (("Could not get device '%s' from gdl or tdl.", udi_it));
+					goto error;
+				}
+			}
 
 			/* Check info.bus */
 			if ((bus = hal_device_property_get_string (d_it, "info.bus")) != NULL) {
@@ -903,6 +885,16 @@ hotplug_event_begin_add_blockdev (const 
 					is_hotpluggable = TRUE;
 					hal_device_property_set_string
 						(d, "storage.bus", "ccw");
+				} else if (strcmp (bus, "pci") == 0) {
+					physdev = d_it;
+					physdev_udi = udi_it;
+					hal_device_property_set_string (d, "storage.bus", "pci");
+				} else if (strcmp (bus, "cciss") == 0) {
+					physdev = d_it;
+					physdev_udi = udi_it;
+					is_hotpluggable = TRUE;
+					hal_device_property_set_string (d, "storage.bus", "cciss");
+					break;
 				}
 			}
 
diff -urNp hal-0.5.8.1/hald/linux/physdev.c hal-0.5.8.1.cciss/hald/linux/physdev.c
--- hal-0.5.8.1/hald/linux/physdev.c	2009-07-15 17:37:33.000000000 +0100
+++ hal-0.5.8.1.cciss/hald/linux/physdev.c	2009-07-22 14:57:40.000000000 +0100
@@ -1457,6 +1457,41 @@ virtual_bus_compute_udi (HalDevice *d)
 	return TRUE;
 }
 
+static HalDevice *
+cciss_add (const gchar *sysfs_path, HalDevice *parent)
+{
+	HalDevice *d;
+
+	d = hal_device_new ();
+	hal_device_property_set_string (d, "linux.sysfs_path", sysfs_path);
+	hal_device_property_set_string (d, "linux.sysfs_path_device", sysfs_path);
+	hal_device_property_set_string (d, "info.bus", "cciss");
+	if (parent != NULL) {
+		hal_device_property_set_string (d, "info.parent", parent->udi);
+	} else {
+		hal_device_property_set_string (d, "info.parent", "/org/freedesktop/Hal/devices/computer");
+	}
+
+	hal_util_set_driver (d, "info.linux.driver", sysfs_path);
+
+	hal_util_set_string_from_file (d, "cciss.unique_id", sysfs_path, "unique_id");
+
+	return d;
+}
+
+static gboolean
+cciss_compute_udi (HalDevice *d)
+{
+	gchar udi[256];
+
+	hal_util_compute_udi (hald_get_gdl (), udi, sizeof (udi),
+			      "/org/freedesktop/Hal/devices/cciss%s",
+			      hal_device_property_get_string (d, "cciss.unique_id"));
+	hal_device_set_udi (d, udi);
+	hal_device_property_set_string (d, "info.udi", udi);
+	return TRUE;
+}
+
 /*--------------------------------------------------------------------------------------------------------------*/
 
 /*--------------------------------------------------------------------------------------------------------------*/
@@ -1605,6 +1640,13 @@ static PhysDevHandler physdev_handler_vi
 	.remove      = physdev_remove
 };
 
+static PhysDevHandler physdev_handler_cciss = { 
+	.subsystem   = "cciss",
+	.add         = cciss_add,
+	.compute_udi = cciss_compute_udi,
+	.remove      = physdev_remove
+};
+
 static PhysDevHandler *phys_handlers[] = {
 	&physdev_handler_pci,
 	&physdev_handler_usb,
@@ -1624,6 +1666,7 @@ static PhysDevHandler *phys_handlers[] =
 	&physdev_handler_vio,
 	&physdev_handler_ibmebus,
 	&physdev_handler_virtual_bus,
+	&physdev_handler_cciss,
 	NULL
 };