hal: Branch 'master' - 5 commits

Sjoerd Simons sjoerd at kemper.freedesktop.org
Mon Jan 7 09:13:03 PST 2008


 hald/create_cache.c          |   14 +++++++++-----
 hald/dummy/osspec.c          |   21 +++++++++++++++++++++
 hald/mmap_cache.c            |    9 +++------
 tools/hal-system-power-pmu.c |    6 ++++++
 4 files changed, 39 insertions(+), 11 deletions(-)

New commits:
commit 71e114164819eaf0f9259236cc4ee9bae177b931
Author: Sjoerd Simons <sjoerd at luon.net>
Date:   Sat Dec 22 17:16:10 2007 +0100

    add missing functions in the dummy osspec backend
    
    This patch from Samuel Thibault adds the missing osspec_get_file_monitor and
    hal_file_monitor_add_notify functions in the dummy backend

diff --git a/hald/dummy/osspec.c b/hald/dummy/osspec.c
index 36ed07b..40ed1a4 100644
--- a/hald/dummy/osspec.c
+++ b/hald/dummy/osspec.c
@@ -37,6 +37,22 @@
 #include "../util.h"
 #include "../device_info.h"
 
+HalFileMonitor *
+osspec_get_file_monitor (void)
+{
+	return NULL;
+}
+
+guint
+hal_file_monitor_add_notify (HalFileMonitor          *monitor,
+                            const char             *path,
+                            int                     mask,
+                            HalFileMonitorNotifyFunc notify_func,
+                            gpointer                data)
+{
+	return 0;
+}
+
 void
 osspec_privileged_init (void)
 {
commit 75965fdc42620f57bdf9c9138f9d30f0af5b284d
Author: Sjoerd Simons <sjoerd at luon.net>
Date:   Sat Dec 22 15:42:54 2007 +0100

    ensure match rules are always stored before writing the jump_position in the cache
    
    When a match rule is empty the expat end callback is called while the match
    rule isn't saved yet. This patch ensures the match rule is saved _before_
    saving the jump_positions, if this is not done then the jump_position will be
    overwritten with 0.
    
    Fixes hal aborting on Fujitsu laptops because the fujitsu fdi contains an
    empty <match /> rule. Reported in
    http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=456314 and its  dupes

diff --git a/hald/create_cache.c b/hald/create_cache.c
index 37e2d10..882de1b 100644
--- a/hald/create_cache.c
+++ b/hald/create_cache.c
@@ -432,6 +432,11 @@ end (void *data, const char *el){
 
 	if (rtype == RULE_UNKNOWN) return;
 	if (rtype == RULE_MATCH){
+		if (fdi_ctx->rule.rtype == RULE_MATCH) {
+			/* the match rule wasn't stored yet, store it now. So it's stored
+			* _before_ jump_position is written into the cache */
+			store_rule(fdi_ctx);
+		}
 		set_jump_position(fdi_ctx);
 		return;
 	}
commit ba796c6967040ee4f9e9ef3d6c4f3d856b35a30a
Author: Sjoerd Simons <sjoerd at luon.net>
Date:   Sat Dec 22 17:26:48 2007 +0100

    let hal-system-power-pmu return FALSE on hurd
    
    This patch by Samuel Thibault lets hal-system-power-pmu return FALSE on the
    hurd just like other systems not implementing hal-system-power-pmu

diff --git a/tools/hal-system-power-pmu.c b/tools/hal-system-power-pmu.c
index 4ebffa1..0169901 100644
--- a/tools/hal-system-power-pmu.c
+++ b/tools/hal-system-power-pmu.c
@@ -57,6 +57,8 @@ pmac_sleep (void)
 	return FALSE;			/* FIXME implement */
 #elif sun
 	return FALSE;			/* FIXME implement */
+#elif __GNU__
+	return FALSE;			/* FIXME implement */
 #else
 	int ret;
 	int fd;
@@ -92,6 +94,8 @@ pmac_get_lcd_brightness (int *val)
 	return FALSE;			/* FIXME implement */
 #elif sun
 	return FALSE;			/* FIXME implement */
+#elif __GNU__
+	return FALSE;			/* FIXME implement */
 #else
 	int ret;
 	int fd;
@@ -127,6 +131,8 @@ pmac_set_lcd_brightness (int val)
 	return FALSE;			/* FIXME implement */
 #elif sun
 	return FALSE;			/* FIXME implement */
+#elif __GNU__
+	return FALSE;			/* FIXME implement */
 #else
 	int ret;
 	int fd;
commit 18fadda330dcbd81ee3a2e09e503863a12d87c64
Author: Sjoerd Simons <sjoerd at luon.net>
Date:   Sat Dec 8 21:41:17 2007 +0100

    get rid of PATH_MAX users to allow compilation on the Hurd
    
    This patch gets rid of all uses of PATH_MAX to allow compilation on the Hurd.
    Based on a patch by Samuel Thibault in Debian bug #444574

diff --git a/hald/create_cache.c b/hald/create_cache.c
index c78c03f..37e2d10 100644
--- a/hald/create_cache.c
+++ b/hald/create_cache.c
@@ -608,7 +608,7 @@ di_rules_init (void)
 	char * cachename;
 	int fd = -1;
 	struct cache_header header;
-	char cachename_temp [PATH_MAX+1];
+	gchar *cachename_temp;
 	char *hal_fdi_source_preprobe = getenv ("HAL_FDI_SOURCE_PREPROBE");
 	char *hal_fdi_source_information = getenv ("HAL_FDI_SOURCE_INFORMATION");
 	char *hal_fdi_source_policy = getenv ("HAL_FDI_SOURCE_POLICY");
@@ -623,8 +623,7 @@ di_rules_init (void)
 	if (haldc_verbose)
 		HAL_INFO (("Loading rules"));
 
-	strncpy(cachename_temp, cachename, PATH_MAX);
-	strncat(cachename_temp, "~", PATH_MAX);
+	cachename_temp = g_strconcat (cachename, "~", NULL);
 
 	fd = open(cachename_temp, O_CREAT|O_RDWR|O_TRUNC, 0644);
 	if(fd < 0) {
@@ -681,9 +680,8 @@ di_rules_init (void)
 	pad32_write(fd, 0, &header, sizeof(struct cache_header));
 	close(fd);
 	if (rename (cachename_temp, cachename) != 0) {
-		unlink (cachename_temp);
 		HAL_ERROR (("Cannot rename '%s' to '%s': %s", cachename_temp, cachename, strerror (errno)));
-		return -1;
+		goto error;
 	}
 
 	if (haldc_verbose){
@@ -703,6 +701,7 @@ error:
 		close (fd);
 
 	unlink (cachename_temp);
+	g_free (cachename_temp);
 	return -1;
 }
 
diff --git a/hald/mmap_cache.c b/hald/mmap_cache.c
index be31429..db660a0 100644
--- a/hald/mmap_cache.c
+++ b/hald/mmap_cache.c
@@ -179,7 +179,6 @@ dir_mtime (const char *path, time_t *mt, gboolean setup_watches)
 	struct dirent **namelist;
 	struct stat st;
 	int n;
-	char cpath[PATH_MAX];
 
         if (setup_watches) {
                 HalFileMonitor *file_monitor;
@@ -206,15 +205,13 @@ dir_mtime (const char *path, time_t *mt, gboolean setup_watches)
 				return;
 			else {
 				while(n--) {
-#ifdef HAVE_SNPRINTF
-					snprintf(cpath, PATH_MAX, "%s/%s", path, namelist[n]->d_name);
-#else
-					sprintf(cpath, "%s/%s", path, namelist[n]->d_name);
-#endif
+					gchar *cpath;
+					cpath = g_build_filename(path, namelist[n]->d_name, NULL);
 					if(namelist[n]->d_name[0] != '.')
 						dir_mtime(cpath, mt, setup_watches);
 					
 					free(namelist[n]);
+					g_free(cpath);
 				}
 				free(namelist);
 			}
commit cb204ce0b7c7bd83b0b185b404a00f33800282c5
Author: Sjoerd Simons <sjoerd at luon.net>
Date:   Sat Dec 8 21:38:36 2007 +0100

    implement osspec_privileged_init in the dummy backend
    
    This added a noop osspec_privileged_init implementation for the dummy backend.
    Patch by Samuel Thibault in Debian bug #444574

diff --git a/hald/dummy/osspec.c b/hald/dummy/osspec.c
index c4bc3c9..36ed07b 100644
--- a/hald/dummy/osspec.c
+++ b/hald/dummy/osspec.c
@@ -38,6 +38,11 @@
 #include "../device_info.h"
 
 void
+osspec_privileged_init (void)
+{
+}
+
+void
 osspec_init (void)
 {
 }


More information about the hal-commit mailing list