[gamin] [Patch 0.0.10] Cleanup ENABLE_DNOTIFY and HAVE_LINUX and fix build error [u]



On Tue, 2004-09-21 at 08:40 -0400, Daniel Veillard wrote:

Hi

>   I just pushed an update which fixed a few bugs and added support for
> a per user configuration:
>      Downloads at the usual places:
>      http://www.gnome.org/~veillard/gamin/downloads.html
>      News log:
>      http://www.gnome.org/~veillard/gamin/news.html
>      Doc for the configuration file:
>      http://www.gnome.org/~veillard/gamin/config.html
> 
>  I don't know if people are using both dnotify and inotify at the same time.
> In that case code and configuration might need to be extended for a finer
> grain selection.
> 

Hmm, I do not think (certainly do not look that way) you can
use both dnotify and inotify at the same time (or at least in
the same instance of a gam_server) ?

Also, this will currently just work for dnotify, as the inotify
backend do not make use of poll currently?  Or more specific,
adding 'poll /foo' to .gaminrc will not do anything currently
if inotify is in use.  Further, it looks like for both inotify
and dnotify 'notify /foo' will have no use, as they do not
use gam_exclude_check yet ... ?

---

Then, attached is a patch that does the following:
-  Use ENABLE_DNOTIFY (instead of #ifdef linux) in gam_server.c
  to include gam_dnotify.h and init the dnotify backend, else
  we get link errors if we build with inotify support, as
  gam_dnotify.o was not build
  (./configure --enable-inotify --disable-kernel).
-  Use '#ifdef HAVE_LINUX' instead of '#ifdef linux', as this
  is what is defined in config.h if we are building for linux.
  I might be wrong here, but I think 'linux' gets defined by
  gcc ...
-  Actually build dnotify backend again if --enable-inotify was
   passed, but not --disable-kernel.

Comments appreciated.


Regards,
-- 
Martin Schlemmer
Gentoo Linux Developer, Desktop/System Team Developer
Cape Town, South Africa

--- gamin-0.0.10/configure.in	2004-09-21 21:16:53.608085112 +0200
+++ gamin-0.0.10.az/configure.in	2004-09-21 21:49:59.739147296 +0200
@@ -169,11 +169,19 @@ AM_CONDITIONAL(HAVE_LINUX, test x$os = x
 
 if test x$os = xlinux-gnu; then
 	AC_DEFINE([HAVE_LINUX],[],[Whether we are using linux or not])
+	
+	# We enable dnotify no matter what.  If the user enables
+	# inotify, he will still have dnotify to fall back on ...
+	AC_DEFINE(ENABLE_DNOTIFY,1,[Use dnotify as backend])
 	backend="dnotify"
 else
 	backend="polling"
 fi
 
+# We do not care about inotify for now - if the user enables
+# it, we still want to build dnotify support ...
+AM_CONDITIONAL(ENABLE_DNOTIFY, test x$backend = xdnotify)
+
 AC_ARG_ENABLE(inotify,
 [  --enable-inotify Uses inotify as backend],
 [case "${enableval}" in
@@ -184,17 +192,14 @@ esac])
 
 if test x$backend = xinotify; then
     AC_DEFINE(ENABLE_INOTIFY,1,[Use inotify as backend])
-else 
-    if test x$backend = xdnotify; then
-        AC_DEFINE(ENABLE_DNOTIFY,1,[Use dnotify as backend])
-        else if test x$backend = xpolling; then
-            AC_DEFINE(ENABLE_POLLING,1,[Use polling as backend])
-        fi
+else
+    # If all else fails, use polling
+    if test x$backend = xpolling; then
+        AC_DEFINE(ENABLE_POLLING,1,[Use polling as backend])
     fi
 fi
 
 AM_CONDITIONAL(ENABLE_INOTIFY, test x$backend = xinotify)
-AM_CONDITIONAL(ENABLE_DNOTIFY, test x$backend = xdnotify)
 
 dnl check for flavours of varargs macros (test from GLib)
 AC_MSG_CHECKING(for ISO C99 varargs macros in C)
--- gamin-0.0.10/server/gam_excludes.c	2004-09-21 21:44:04.466157000 +0200
+++ gamin-0.0.10.az/server/gam_excludes.c	2004-09-21 21:48:36.589787920 +0200
@@ -19,7 +19,7 @@ struct _gam_exclude {
 static int initialized = 0;
 static GList *excludes = NULL;
 static char *static_excludes[] = {
-#ifdef linux
+#ifdef HAVE_LINUX
     "/media/*",
     "/mnt/*",
 #endif
--- gamin-0.0.10/server/gam_server.c	2004-09-21 21:19:34.375644728 +0200
+++ gamin-0.0.10.az/server/gam_server.c	2004-09-21 21:31:33.929255952 +0200
@@ -36,7 +36,7 @@
 #ifdef ENABLE_INOTIFY
 #include "gam_inotify.h"
 #endif
-#ifdef linux
+#ifdef ENABLE_DNOTIFY
 #include "gam_dnotify.h"
 #endif
 #include "gam_excludes.h"
@@ -72,7 +72,7 @@ gam_init_subscriptions(void)
 	return(TRUE);
     }
 #endif
-#ifdef linux
+#ifdef ENABLE_DNOTIFY
     if (gam_dnotify_init()) {
 	gam_debug(DEBUG_INFO, "Using DNotify as backend\n");
 	return(TRUE);

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]