hal/hald/linux osspec.c,1.46,1.47

David Zeuthen david at freedesktop.org
Tue Oct 12 13:17:10 PDT 2004


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

Modified Files:
	osspec.c 
Log Message:
2004-10-12  David Zeuthen  <davidz at redhat.com>

	First part of big patch to use .fdi files for policy properties.

	* configure.in: Add a bunch of new configure.in variables

	* doc/Makefile.am: Add conf directory

	* doc/conf/Makefile.am: New file

	* doc/conf/storage-policy-examples.fdi: New file

	* fdi/30osvendor/Makefile.am: New file

	* fdi/40oem/Makefile.am: New file

	* fdi/50user/Makefile.am: New file

	* fdi/90defaultpolicy/Makefile.am: New File

	* fdi/90defaultpolicy/storage-policy.fdi: New file

	* fdi/95userpolicy/Makefile.am: New file

	* fdi/Makefile.am: Added new subdirs

	* hald/Makefile.am: Link with libselinux if selinux is enabled

	* hald/device.c: 
	(hal_device_property_get_as_string): New function
	(hal_device_copy_property): New function

	* hald/device.h: Add prototypes for two new functions

	* hald/device_info.c:
	(resolve_udiprop_path): New function 
	(match_compare_property): New function
	(handle_match): Allow property names to contain UDI dirct and indirect
	references. Add support for 'exists', 'empty', 'is_absolute_path', 
	'compare_lt', 'compare_le', 'compare_gt', 'compare_ge'
	(handle_merge): Add support for 'copy_property'
	(handle_append): New function
	(start): Support new 'append' operation (like merge)
	(end): Also support MERGE_TYPE_COPY_PROPERTY. Fixup compare bug in 
	match_depth_first_fail that made several matches on the same level
	impossible.
	(process_fdi_file): Init match_depth_first_fail to -1

	* hald/linux/osspec.c (osspec_probe): Add selinux support to
	root computer device object.



Index: osspec.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux/osspec.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- osspec.c	7 Oct 2004 14:53:08 -0000	1.46
+++ osspec.c	12 Oct 2004 20:17:08 -0000	1.47
@@ -50,6 +50,8 @@
 #include "../logger.h"
 #include "../hald.h"
 #include "../callout.h"
+#include "../device_info.h"
+#include "../hald_conf.h"
 
 #include "common.h"
 #include "hald_helper.h"
@@ -801,6 +803,9 @@
 	process_coldplug_list ();
 }
 
+#ifdef HAVE_SELINUX
+#include <selinux/selinux.h>
+#endif /* HAVE_SELINUX */
 
 /* This function is documented in ../osspec.h */
 void
@@ -827,15 +832,26 @@
 	hal_device_set_udi (root, "/org/freedesktop/Hal/devices/computer");
 	
 	if (uname (&un) >= 0) {
-		hal_device_property_set_string (root, "kernel.name",
-						un.sysname);
-		hal_device_property_set_string (root, "kernel.version",
-						un.release);
-		hal_device_property_set_string (root, "kernel.machine",
-						un.machine);
+		hal_device_property_set_string (root, "kernel.name", un.sysname);
+		hal_device_property_set_string (root, "kernel.version", un.release);
+		hal_device_property_set_string (root, "kernel.machine", un.machine);
 	}
+
+#ifdef HAVE_SELINUX
+	hal_device_property_set_bool (root, "linux.is_selinux_enabled", is_selinux_enabled());
+#endif /* HAVE_SELINUX */
+
 	hal_device_store_add (hald_get_tdl (), root);
 
+	/* Search for device information file and attempt merge */
+	if (di_search_and_merge (root)) {
+		HAL_INFO (("Found a .fdi file for %s", root->udi));
+	}
+	
+	/* add possible saved properties for this udi from disk*/
+	if (hald_get_conf ()->persistent_device_list)
+		hal_pstore_load_device (hald_get_pstore_sys (), root);
+
 	/* begin processing the coldplug_list when computer is added */
 	g_signal_connect (root,
 			  "callouts_finished",




More information about the hal-commit mailing list