hal/tools fstab-sync.c,1.4,1.5
David Zeuthen
david at freedesktop.org
Thu Aug 12 04:29:06 PDT 2004
Update of /cvs/hal/hal/tools
In directory pdx:/tmp/cvs-serv7218/tools
Modified Files:
fstab-sync.c
Log Message:
2004-08-12 David Zeuthen <david at fubar.dk>
* tools/fstab-sync.c (udi_is_volume): Simplify this a bit given
that cap volume always implies cap block
(main): Check the HAL_INFO_PROP_INFO_CAPABILITIES which is set
when invoked from hald to exit if it's not a volume
Index: fstab-sync.c
===================================================================
RCS file: /cvs/hal/hal/tools/fstab-sync.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- fstab-sync.c 12 Aug 2004 10:18:50 -0000 1.4
+++ fstab-sync.c 12 Aug 2004 11:29:04 -0000 1.5
@@ -832,9 +832,6 @@
static boolean
udi_is_volume (const char *udi)
{
- if (!hal_device_query_capability (hal_context, udi, "block"))
- return FALSE;
-
if (!hal_device_query_capability (hal_context, udi, "volume"))
return FALSE;
@@ -842,8 +839,7 @@
!hal_device_get_property_bool (hal_context, udi, "volume.disc.has_data"))
return FALSE;
- return hal_device_property_exists (hal_context, udi, "block.is_volume") &&
- hal_device_get_property_bool (hal_context, udi, "block.is_volume");
+ return TRUE;
}
static char *
@@ -1691,10 +1687,23 @@
*/
left_over_args = poptGetArgs (popt_context);
- hal_device_udi = getenv ("HAL_DEVICE_UDI");
-
- if (hal_device_udi == NULL)
- hal_device_udi = getenv ("UDI");
+ hal_device_udi = getenv ("UDI");
+ if (hal_device_udi != NULL) {
+ char *caps;
+
+ /* when we are invoked by hald, make some early tests using the
+ * exported environment so we don't have to connect to hald */
+
+ caps = getenv ("HAL_PROP_INFO_CAPABILITIES");
+ if (caps != NULL) {
+
+ /* we only handle hal device objects of capability 'volume' */
+ if (strstr (caps, "volume") == NULL) {
+ retval = 0;
+ goto out;
+ }
+ }
+ }
if (left_over_args)
for (i = 0; left_over_args[i] != NULL; i++)
@@ -1735,5 +1744,6 @@
return 1;
}
+out:
return retval;
}
More information about the hal-commit
mailing list