summaryrefslogtreecommitdiff
path: root/hald/linux/class_device.c
diff options
context:
space:
mode:
authorDavid Zeuthen <david@fubar.dk>2004-08-16 18:52:39 +0000
committerDavid Zeuthen <david@fubar.dk>2004-08-16 18:52:39 +0000
commit6f0d569cb52a2ec8f090454785e0aab42540513e (patch)
tree639734a42f6e7beed6593ec163db861159e51f22 /hald/linux/class_device.c
parent382d7a95bab8d80d8810e88c2a4bed81b7dce1d2 (diff)
Add the --enable-fstab-op to specify whether we want to use a keywordHAL_0_2_97
(currently kudzu) when adding entries to the fstab. Default is off Only return the HalDevice if the parent exists (detect_media): Print out debug statement when we forcibly probe for media (block_class_pre_process): Detect the ide-cs driver by looking at the sysfs path (!) and set the media_check_enable to FALSE. Only do volume_id and drive_id probing if storage.media_check_enabled is TRUE. Sets the volume.fstype to 'vfat,msdos,auto' in this case. Fixes issues with the ide-cs driver (block_class_in_gdl): Add a comment about how we could defer the check for non-partitioned media via a timeout (deferred_check_for_non_partition_media): The function to check for media; not currently used (mtab_handle_storage): Use detect_media() to add the new child when a non-partition volume we didn't know about was mounted (mtab_handle_volume): Remove non partitioned media on drives that can't be polled when it's unmounted. Only return the HalDevice if the parent exists Only return the HalDevice if the parent exists (class_device_got_parent_device): Print out the sysfs path instead of the HAL UDI New function; currently the same as the super class but useful for testing Don't pickup toplevel ide_host objects cause they're not hotplugged anyway (thus no way to remove them) Also check if the volume.fstype is empty
Diffstat (limited to 'hald/linux/class_device.c')
-rw-r--r--hald/linux/class_device.c55
1 files changed, 33 insertions, 22 deletions
diff --git a/hald/linux/class_device.c b/hald/linux/class_device.c
index 6a78f10b..7c870df9 100644
--- a/hald/linux/class_device.c
+++ b/hald/linux/class_device.c
@@ -103,11 +103,13 @@ class_device_visit (ClassDeviceHandler *self,
const char *path,
struct sysfs_class_device *class_device)
{
+ ClassAsyncData *cad;
HalDevice *d;
char dev_file[SYSFS_PATH_MAX];
char dev_file_prop_name[SYSFS_PATH_MAX];
gboolean merge_or_add;
struct sysfs_device *sysdevice;
+ char *what_to_find;
sysdevice = sysfs_get_classdev_device (class_device);
@@ -181,48 +183,57 @@ class_device_visit (ClassDeviceHandler *self,
}
}
+ cad = g_new0 (ClassAsyncData, 1);
+ cad->device = d;
+ cad->handler = self;
+ cad->merge_or_add = merge_or_add;
+
/* Now find the physical device; this happens asynchronously as it
* might be added later. */
if (merge_or_add) {
- ClassAsyncData *cad = g_new0 (ClassAsyncData, 1);
- cad->device = d;
- cad->handler = self;
- cad->merge_or_add = merge_or_add;
+ what_to_find = sysdevice->path;
/* find the sysdevice */
hal_device_store_match_key_value_string_async (
hald_get_gdl (),
"linux.sysfs_path_device",
- sysdevice->path,
+ what_to_find,
class_device_got_sysdevice, cad,
- HAL_LINUX_HOTPLUG_TIMEOUT);
- } else {
- char *parent_sysfs_path;
- ClassAsyncData *cad = g_new0 (ClassAsyncData, 1);
+ HAL_LINUX_HOTPLUG_TIMEOUT);
+ } else {
if (sysdevice != NULL) {
- parent_sysfs_path =
- get_parent_sysfs_path (sysdevice->path);
+ what_to_find = get_parent_sysfs_path (sysdevice->path);
} else {
- parent_sysfs_path = "(none)";
+ what_to_find = "(none)";
}
- cad->device = d;
- cad->handler = self;
- cad->merge_or_add = merge_or_add;
-
- /* find the parent */
+ /* find the sysdevice */
hal_device_store_match_key_value_string_async (
hald_get_gdl (),
"linux.sysfs_path_device",
- parent_sysfs_path,
+ what_to_find,
class_device_got_parent_device, cad,
HAL_LINUX_HOTPLUG_TIMEOUT);
}
- if (!merge_or_add)
- return d;
- else
+
+ if (!merge_or_add) {
+ /* Now that a) hotplug happens in the right order; and b) the device
+ * from a hotplug event is completely added to the GDL before the
+ * next event is processed; the aysnc call above is actually
+ * synchronous so we can test immediately whether we want to
+ * proceed
+ */
+ if (hal_device_store_match_key_value_string (
+ hald_get_gdl (),
+ "linux.sysfs_path_device",
+ what_to_find) == NULL)
+ return NULL;
+ else
+ return d;
+
+ } else
return NULL;
}
@@ -290,7 +301,7 @@ class_device_got_parent_device (HalDeviceStore *store, HalDevice *parent,
if (parent == NULL) {
HAL_WARNING (("No parent for class device at sysfs path %s",
- d->udi));
+ hal_device_property_get_string (d, "linux.sysfs_path")));
/* get rid of temporary device */
hal_device_store_remove (hald_get_tdl (), d);
return;