hal: Branch 'master'

Danny Kukawka dkukawka at kemper.freedesktop.org
Wed Aug 20 11:04:28 PDT 2008


 hald/device_info.c |   19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

New commits:
commit 56263658664de8c2b151764d647f3a84a09452c3
Author: Arjan van de Ven <arjan at infradead.org>
Date:   Wed Aug 20 20:03:56 2008 +0200

    make hal start a lot faster
    
    Hal is a significant part of the boot time of (optimized) systems,
    so optimizing hal to start faster is certainly worthwhile.
    
    The patch below cuts the start time of hal by about one third,
    by reducing the number of calls to hal_device_get_udi() from
    well over 700.000 to below 100.000.

diff --git a/hald/device_info.c b/hald/device_info.c
index 2381612..e378a2e 100644
--- a/hald/device_info.c
+++ b/hald/device_info.c
@@ -273,22 +273,27 @@ handle_match (struct rule *rule, HalDevice *d)
 	char prop_to_check[HAL_PATH_MAX];
 	const char *key = rule->key;
 	const char *value = (char *)RULES_PTR(rule->value_offset);
+	const char *d_udi;
+	
+	d_udi = hal_device_get_udi (d);
 
 	/* Resolve key paths like 'someudi/foo/bar/baz:prop.name' '@prop.here.is.an.udi:with.prop.name' */
 	if (!resolve_udiprop_path (key,
-				   hal_device_get_udi (d),
+				   d_udi,
 				   udi_to_check, sizeof (udi_to_check),
 				   prop_to_check, sizeof (prop_to_check))) {
 		/*HAL_ERROR (("Could not resolve keypath '%s' on udi '%s'", key, value));*/
 		return FALSE;
 	}
 
-	d = hal_device_store_find (hald_get_gdl (), udi_to_check);
-	if (d == NULL)
-		d = hal_device_store_find (hald_get_tdl (), udi_to_check);
-	if (d == NULL) {
-		HAL_ERROR (("Could not find device with udi '%s'", udi_to_check));
-		return FALSE;
+	if (strcmp(udi_to_check, d_udi)) {
+		d = hal_device_store_find (hald_get_gdl (), udi_to_check);
+		if (d == NULL)
+			d = hal_device_store_find (hald_get_tdl (), udi_to_check);
+		if (d == NULL) {
+			HAL_ERROR (("Could not find device with udi '%s'", udi_to_check));
+			return FALSE;
+		}
 	}
 
 	switch (rule->type_match) {


More information about the hal-commit mailing list