hal/hald/linux block_class_device.c,1.38,1.39

David Zeuthen david at pdx.freedesktop.org
Thu Jul 8 10:12:07 PDT 2004


Update of /cvs/hal/hal/hald/linux
In directory pdx:/tmp/cvs-serv17786/hald/linux

Modified Files:
	block_class_device.c 
Log Message:
2004-07-08  David Zeuthen  <david at fubar.dk>

	Some more fixes caught by extensive testing

	* hald/linux/block_class_device.c (mtab_handle_storage): Consolidate
	three if statements into one. Also search TDL for child. Don't remove
	child if called second time.
	(mtab_handle_volume): Don't check volumes added by mtab_handle_storage
	e.g. volumes we detect on mount only



Index: block_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/block_class_device.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- block_class_device.c	6 Jul 2004 23:18:08 -0000	1.38
+++ block_class_device.c	8 Jul 2004 17:12:05 -0000	1.39
@@ -1667,18 +1667,11 @@
 	struct mount_point_s *mp = NULL;
 	int i;
 	
-	if (!hal_device_property_get_bool (d, "block.no_partitions"))
-		return TRUE;
-
-	if (!hal_device_has_property (d, "storage.media_check_enabled"))
-		return TRUE;
-
-	if (hal_device_property_get_bool (d, "storage.media_check_enabled"))
+	if (!hal_device_property_get_bool (d, "block.no_partitions") ||
+	    !hal_device_has_property (d, "storage.media_check_enabled") ||
+	    hal_device_property_get_bool (d, "storage.media_check_enabled"))
 		return TRUE;
 
-	HAL_INFO (("FOOO Checking for %s", 
-		   hal_device_property_get_string (d, "block.device")));
-
 	/* Only handle storage devices where block.no_parition==TRUE and
 	 * where we can't check for media. Typically this is only legacy
 	 * floppy drives on x86 boxes.
@@ -1694,6 +1687,13 @@
 		hald_get_gdl (), "info.parent",
 		hal_device_get_udi (d));
 
+	if (child == NULL) {
+		child = hal_device_store_match_key_value_string (
+			hald_get_tdl (), "info.parent",
+			hal_device_get_udi (d));
+
+	}
+
 	/* Search all mount points */
 	found_mount_point = FALSE;
 	for (i = 0; i < num_mount_points; i++) {
@@ -1802,6 +1802,12 @@
 				/* GDL was modified */
 				return TRUE;
 
+			} else {
+				/* Is mounted and we did have a child,
+				 * just bail
+				 */
+				found_mount_point = TRUE;
+				return FALSE;
 			}
 		}
 	}
@@ -1838,11 +1844,21 @@
 	int major, minor;
 	dbus_bool_t found_mount_point;
 	struct mount_point_s *mp;
+	const char *storudi;
+	HalDevice *stor;
 	int i;
 
 	major = hal_device_property_get_int (d, "block.major");
 	minor = hal_device_property_get_int (d, "block.minor");
 
+	/* these are handled in mtab_handle_storage */
+	storudi = hal_device_property_get_string (d, "block.storage_device");
+	stor = hal_device_store_find (hald_get_gdl (), storudi);
+	if (hal_device_property_get_bool (stor, "block.no_partitions") &&
+	    hal_device_has_property (d, "storage.media_check_enabled") &&
+	    !hal_device_property_get_bool (d, "storage.media_check_enabled"))
+		return TRUE;
+
 	/* Search all mount points */
 	found_mount_point = FALSE;
 	for (i = 0; i < num_mount_points; i++) {





More information about the hal-commit mailing list