hal/hald/linux block_class_device.c, 1.86.2.8, 1.86.2.9 osspec.c, 1.52.2.5, 1.52.2.6

David Zeuthen david at freedesktop.org
Mon Mar 28 11:15:21 PST 2005


Update of /cvs/hal/hal/hald/linux
In directory gabe:/tmp/cvs-serv26753/hald/linux

Modified Files:
      Tag: hal-0_4-stable-branch
	block_class_device.c osspec.c 
Log Message:
2005-03-28  David Zeuthen  <david at fubar.dk>

	* hald/linux/osspec.c: Patch from Kay Sievers <kay.sievers at vrfy.org>
	While playing around with hotplug event replay from initramfs, it
	happens, that events are generated for devices HAL already knows
	from its coldplug run. This leads to a lot of funny double entries
	in the device store. :) We should prevent the device addition by
	hotplug events if we already have one with the same sysfs-devpath.

	* hald/device_info.c: Backport a memory leak fix from the new
	development branch: Fix up error handling; remember to free the
	XML_Parser context which fixes a 4.5MB memory leak on my system.
	Verified by Timo Hoenig <thoenig at suse.de> to work.



Index: block_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/Attic/block_class_device.c,v
retrieving revision 1.86.2.8
retrieving revision 1.86.2.9
diff -u -d -r1.86.2.8 -r1.86.2.9
--- block_class_device.c	21 Jan 2005 15:46:55 -0000	1.86.2.8
+++ block_class_device.c	28 Mar 2005 19:15:19 -0000	1.86.2.9
@@ -407,6 +407,12 @@
 
 	umount_argv[2] = device_file;
 
+	HAL_INFO (("dumping device - device_mount_point=%s", device_mount_point));
+	HAL_INFO (("++++++++++++++++++++++++++++++++++++++++"));
+	hal_device_print (d);
+	HAL_INFO (("++++++++++++++++++++++++++++++++++++++++"));
+
+
 	if (hal_device_has_property (d, "block.is_volume") &&
 	    hal_device_property_get_bool (d, "block.is_volume") &&
 	    hal_device_property_get_bool (d, "volume.is_mounted") &&
@@ -464,6 +470,8 @@
 			device_property_atomic_update_end ();
 */
 		}
+	} else {
+		HAL_INFO (("didn't want to unmount"));
 	}
 }
 
@@ -1975,6 +1983,8 @@
 
 	num_mount_points = 0;
 
+	HAL_INFO (("Reading mtab"));
+
 	fd = open ("/etc/mtab", O_RDONLY);
 
 	if (fd == -1) {
@@ -2008,7 +2018,7 @@
 	while (!feof (f)) {
 		if (fgets (buf, 256, f) == NULL)
 			break;
-		/*printf("got line: '%s'\n", buf); */
+		HAL_INFO (("mtab line: '%s'", buf));
 		etc_mtab_process_line (buf);
 	}
 
@@ -2129,6 +2139,8 @@
 			hal_device_property_set_string (d, "volume.fstype", mp->fs_type);
 			hal_device_property_set_bool (d, "volume.is_mounted", TRUE);
 
+			HAL_INFO (("----- is_mounted = TRUE; mount_point=%s, device_file=%s", mp->mount_point, mp->device));
+
 			/* only overwrite block.device if it's not set */
 			if (existing_block_device == NULL || (existing_block_device != NULL &&
 			     strcmp (existing_block_device, "") == 0)) {
@@ -2177,6 +2189,8 @@
 		hal_device_property_set_string (d, "volume.mount_point",
 						"");
 
+		HAL_INFO (("----- is_mounted = FALSE; was_mounted=%s device_file=%s", was_mounted ? "TRUE" : "FALSE", mp->device));
+
 		device_property_atomic_update_end ();
 
 		if (was_mounted) {
@@ -2268,6 +2282,7 @@
 		/*HAL_INFO (("processing /etc/mtab"));*/
 	}
 
+	HAL_INFO (("Checking mtab"));
 	hal_device_store_foreach (hald_get_gdl (), mtab_foreach_device, NULL);
 }
 

Index: osspec.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/Attic/osspec.c,v
retrieving revision 1.52.2.5
retrieving revision 1.52.2.6
diff -u -d -r1.52.2.5 -r1.52.2.6
--- osspec.c	21 Jan 2005 15:46:55 -0000	1.52.2.5
+++ osspec.c	28 Mar 2005 19:15:19 -0000	1.52.2.6
@@ -1010,6 +1010,11 @@
 
 	strncpy (sysfs_path, given_sysfs_path, SYSFS_PATH_MAX);
 
+	if (hal_device_store_match_key_value_string (hald_get_gdl (), "linux.sysfs_path", sysfs_path)) {
+		HAL_WARNING (("devpath %s already present in the store, don't add device", sysfs_path));
+		return NULL;
+	}
+
 	len1 = snprintf (buf1, SYSFS_PATH_MAX, "%s/block", sysfs_mount_path);
 	len2 = snprintf (buf2, SYSFS_PATH_MAX, "%s/class", sysfs_mount_path);
 	if (strncmp (sysfs_path, buf1, len1) == 0 || strncmp (sysfs_path, buf2, len2) == 0) {




More information about the hal-commit mailing list