hal/hald/linux block_class_device.c, 1.50, 1.51 common.c, 1.11, 1.12 common.h, 1.5, 1.6 platform_bus_device.c, 1.4, 1.5

David Zeuthen david at freedesktop.org
Wed Aug 11 11:53:53 PDT 2004


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

Modified Files:
	block_class_device.c common.c common.h platform_bus_device.c 
Log Message:
2004-08-11  David Zeuthen  <david at fubar.dk>

	* doc/spec/hal-spec.xml.in: Add docs for block.have_scanned,
	volume.is_filesystem, Device Conditions on volume device
	objects (now with new names), 'unknown' value for
	volume.disc.type, 'platform' value for storage.bus, rename
	storage.automount_enabled to storage.automount_enabled_hint. Add
	property storage.no_partitions_hint

	* hald/hald.conf:
	* hald/hald_conf.[ch]:
	Rename storage.automount_enabled to storage.automount_enabled_hint
	and remove storage.cdrom_eject_check_enabled.

	* hald/linux/common.[ch]:

	* hald/linux/platform_bus_device.c: (platform_device_pre_process):

	* hald/property.c (hal_property_get_bool): Return FALSE instead of
	-1 if property not found.

	* hald/linux/block_class_device.c: (set_volume_id_values),
	(get_child_device_gdl), (get_child_device_tdl),
	(block_class_visit), (cdrom_get_properties), (force_unmount),
	(force_unmount_of_all_childs), (get_first_valid_partition),
	(detect_disc), (detect_media), (block_class_pre_process),
	(mtab_handle_storage), (mtab_handle_volume):
	Unified codepaths for handling optical discs and other removable
	storage. Handle media with no partition table much nicer
	
	* hald/linux/volume_id/volume_id.c: (set_label_string),
	(set_label_unicode16), (set_uuid), (get_buffer),
	(probe_msdos_part_table), (probe_ext), (probe_reiser), (probe_xfs),
	(probe_jfs), (probe_vfat), (probe_msdos), (probe_udf),
	(probe_iso9660), (probe_ufs), (probe_mac_partition_map),
	(probe_hfs_hfsplus), (probe_ntfs), (probe_swap), (volume_id_probe),
	(volume_id_close):
	* hald/linux/volume_id/volume_id.h:
	Add support for parsing partition tables from Kay Sievers 
	<kay.sievers at vrfy.org>. Change 'reiser' to 'reiserfs' because
	the that's the name on Linux.



Index: block_class_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/block_class_device.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- block_class_device.c	9 Aug 2004 18:33:29 -0000	1.50
+++ block_class_device.c	11 Aug 2004 18:53:50 -0000	1.51
@@ -72,7 +72,53 @@
 
 static void etc_mtab_process_all_block_devices (dbus_bool_t force);
 
-static void detect_fs (HalDevice *d);
+static char *block_class_compute_udi (HalDevice * d, int append_num);
+
+
+static void
+set_volume_id_values(HalDevice *d, struct volume_id *vid)
+{
+	char *product;
[...1607 lines suppressed...]
 		}
+
+		g_free (device_mount_point);
 		
 	}
 
@@ -2135,9 +1953,10 @@
 }
 
 
-/** Load /etc/mtab and process all HAL block devices and set properties
- *  according to mount status. Also, optionally, sets up a watcher to do
- *  this whenever /etc/mtab changes
+/** Load /etc/mtab and process all HAL storage and volume devices
+ *  (that in turn each will process every entry) and set properties
+ *  according to mount status. Also, optionally, sets up a watcher to
+ *  do this whenever /etc/mtab changes
  *
  *  @param  force               Force reading of mtab
  */

Index: common.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/common.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- common.c	21 Jul 2004 22:32:17 -0000	1.11
+++ common.c	11 Aug 2004 18:53:50 -0000	1.12
@@ -603,51 +603,6 @@
 	return parent_path;
 }
 
-/** Set the physical device for a device.
- *
- *  This function visits all parent devices and sets the property
- *  info.physical_device to the first parent device that doesn't have the
- *  info.physical_device property set.
- *
- *  @param  device              HalDevice to process
- */
-void
-find_and_set_physical_device (HalDevice * device)
-{
-	HalDevice *d;
-	HalDevice *parent;
-	const char *parent_udi;
-
-	d = device;
-	do {
-		parent_udi = hal_device_property_get_string (d,
-							      "info.parent");
-		if (parent_udi == NULL) {
-			HAL_ERROR (("Error finding parent for %s\n",
-				    d->udi));
-			return;
-		}
-
-		parent = hal_device_store_find (hald_get_gdl (), parent_udi);
-		if (parent == NULL) {
-			HAL_ERROR (("Error resolving UDI %s\n",
-				    parent_udi));
-			return;
-		}
-
-		if (!hal_device_has_property (parent,
-					       "info.physical_device")) {
-			hal_device_property_set_string (device,
-							 "info.physical_device",
-							 parent_udi);
-			return;
-		}
-
-		d = parent;
-	}
-	while (TRUE);
-}
-
 /** Utility function to retrieve major and minor number for a class device.
  *
  *  The class device must have a dev file in the #sysfs_path directory and

Index: common.h
===================================================================
RCS file: /cvs/hal/hal/hald/linux/common.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- common.h	21 Jul 2004 22:32:17 -0000	1.5
+++ common.h	11 Aug 2004 18:53:50 -0000	1.6
@@ -69,8 +69,6 @@
 
 char *get_parent_sysfs_path (const char *path);
 
-void find_and_set_physical_device (HalDevice * device);
-
 dbus_bool_t class_device_get_major_minor (const char *sysfs_path, int *major, int *minor);
 
 dbus_bool_t class_device_get_device_file (const char *sysfs_path, char *dev_file, int dev_file_length);

Index: platform_bus_device.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/platform_bus_device.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- platform_bus_device.c	21 Jul 2004 22:32:17 -0000	1.4
+++ platform_bus_device.c	11 Aug 2004 18:53:50 -0000	1.5
@@ -93,13 +93,10 @@
 	char fd_sysfs_path[256];
 
 	sscanf (device->bus_id, "floppy%d", &number);
-	hal_device_property_set_int (d, "storage.legacy_floppy.number", 
-				     number);
+	hal_device_property_set_int (d, "storage.legacy_floppy.number", number);
 
-	hal_device_property_set_string (d, "info.product",
-					"Legacy Floppy Drive");
-	hal_device_property_set_string (d, "info.vendor",
-					"");
+	hal_device_property_set_string (d, "info.product", "Legacy Floppy Drive");
+	hal_device_property_set_string (d, "info.vendor", "");
 
 	/* All the following is a little but of cheating, but hey, what
 	 * can you do when the kernel doesn't properly export legacy
@@ -126,28 +123,30 @@
 	hal_device_property_set_int (d, "block.major", major);
 	hal_device_property_set_int (d, "block.minor", minor);
 	hal_device_property_set_bool (d, "block.no_partitions", TRUE);
+	hal_device_property_set_bool (d, "block.have_scanned", FALSE);
 
 	hal_device_property_set_string (d, "storage.bus", "platform");
 	hal_device_property_set_string (d, "storage.drive_type", "floppy");
 	hal_device_property_set_bool (d, "storage.hotpluggable", FALSE);
 	hal_device_property_set_bool (d, "storage.removable", TRUE);
 	hal_device_property_set_bool (d, "storage.media_check_enabled", FALSE);
-	hal_device_property_set_bool (d, "storage.automount_enabled", FALSE);
+	hal_device_property_set_bool (d, "storage.automount_enabled_hint", FALSE);
+	hal_device_property_set_bool (d, "storage.no_partitions_hint", TRUE);
+	hal_device_property_set_string (d, "storage.physical_device", "");
 	
 	hal_device_property_set_string (d, "storage.vendor", "");
 	hal_device_property_set_string (d, "storage.model", "Floppy Drive");
 
-	hal_device_property_set_string (
-		d, "storage.physical_device", 
-		"/org/freedesktop/Hal/devices/computer");
+	hal_device_property_set_string (d, "storage.physical_device", 
+					"/org/freedesktop/Hal/devices/computer");
 
-	hal_device_property_set_string (
-		d, "info.parent", 
-		"/org/freedesktop/Hal/devices/computer");
+	hal_device_property_set_string (d, "info.parent", 
+					"/org/freedesktop/Hal/devices/computer");
 
 	hal_device_add_capability (d, "block");
 	hal_device_add_capability (d, "storage");
-	hal_device_add_capability (d, "storage.floppy");
+	hal_device_property_set_string (d, "info.category", 
+					"storage");
 }
 
 




More information about the hal-commit mailing list