Re: some gvfs code



Am Freitag, den 06.10.2006, 08:48 +0200 schrieb Alexander Larsson:
> I spent some time working on out the gvfs API, and I'd like to talk to
> people about it on the summit. I've set up a public git repository at
> http://www.gnome.org/~alexl/git/gvfs.git so that people can take a look
> at it themselves.
> 
> Note, this is in no way finished, but the core APIs that most apps
> (except nautilus and the filemanager) use are mostly there. The "simple"
> backend that only accesses local files is somewhat fleshed out (it
> lackes some things like mime detection), but please ignore the "unix"
> backend and the daemon, since that is mainly a shell with no
> implementation yet.

You rock so much Alex! :)

Attached is a patch that allows to disable xattr support at build-time,
changes the xattr include to <sys/xattr.h>, and adds deps on the
generated marshalling files for the gvfs sources.

-- 
Christian Neumair <chris gnome-de org>
diff --git a/INSTALL b/INSTALL
diff --git a/README b/README
diff --git a/configure.ac b/configure.ac
index 028e7cd..b935dd7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -60,6 +60,23 @@ if test "x$enable_selinux" != "xno"; the
 fi
 AC_SUBST(SELINUX_LIBS)
 
+dnl ***********************
+dnl *** Check for xattr ***
+dnl ***********************
+AC_ARG_ENABLE(xattr, [  --disable-xattr           build without xattr support])
+msg_xattr=no
+XATTR_LIBS=
+if test "x$enable_xattr" != "xno"; then
+
+ AC_CHECK_LIB(c, getxattr,
+   [AC_CHECK_HEADERS(sys/xattr.h,
+     [AC_DEFINE(HAVE_XATTR, 1, [Define to 1 if xattr is available])
+      XATTR_LIBS="-lxattr"
+      msg_xattr=yes])
+   ])
+fi
+AC_SUBST(XATTR_LIBS)
+
 dnl ==========================================================================
 	
 dnl Globally define_GNU_SOURCE and therefore enable the GNU extensions
diff --git a/gvfs/Makefile.am b/gvfs/Makefile.am
index b504fd4..5975187 100644
--- a/gvfs/Makefile.am
+++ b/gvfs/Makefile.am
@@ -63,10 +63,13 @@ libgvfs_la_SOURCES = 	\
 	$(marshal_sources) \
 	$(NULL)
 
+$(libgvfs_la_OBJECTS): $(marshal_sources)
+
 libgvfs_la_LIBADD = \
 	$(SELINUX_LIBS) \
 	$(DBUS_LIBS) \
-	$(GLIB_LIBS)
+	$(GLIB_LIBS) \
+	$(XATTR_LIBS)
 
 gvfsincludedir=$(includedir)/gvfs/
 gvfsinclude_HEADERS = \
diff --git a/gvfs/gfileinfosimple.c b/gvfs/gfileinfosimple.c
index 31c0f05..98f1a91 100644
--- a/gvfs/gfileinfosimple.c
+++ b/gvfs/gfileinfosimple.c
@@ -8,7 +8,9 @@ #include <selinux/selinux.h>
 #endif
 
 #include <sys/types.h>
-#include <attr/xattr.h>
+#ifdef HAVE_XATTR
+#include <sys/xattr.h>
+#endif
 
 #include <glib/gstdio.h>
 #include <glib/gi18n-lib.h>
@@ -75,6 +77,8 @@ #ifdef HAVE_SELINUX
 #endif
 }
 
+#ifdef HAVE_XATTR
+
 static gboolean
 valid_char (char c)
 {
@@ -183,12 +187,15 @@ get_one_xattr (const char *path,
     g_free (value_p);
 }
 
+#endif /* defined HAVE_XATTR */
+
 static void
 get_xattrs (const char *path,
 	    GFileInfo *info,
 	    GFileAttributeMatcher *matcher,
 	    gboolean follow_symlinks)
 {
+#ifdef HAVE_XATTR
   gboolean all;
   gsize list_size;
   ssize_t list_res_size;
@@ -245,8 +252,10 @@ get_xattrs (const char *path,
       while ((attr = g_file_attribute_matcher_enumerate_next (matcher)) != NULL)
 	get_one_xattr (path, info, attr, follow_symlinks);
     }
+#endif /* defined HAVE_XATTR */
 }
 
+#ifdef HAVE_XATTR
 static void
 get_one_xattr_from_fd (int fd,
 		       GFileInfo *info,
@@ -289,12 +298,14 @@ get_one_xattr_from_fd (int fd,
   if (value_p != value)
     g_free (value_p);
 }
+#endif /* defined HAVE_XATTR */
 
 static void
 get_xattrs_from_fd (int fd,
 		    GFileInfo *info,
 		    GFileAttributeMatcher *matcher)
 {
+#ifdef HAVE_XATTR
   gboolean all;
   gsize list_size;
   ssize_t list_res_size;
@@ -345,6 +356,7 @@ get_xattrs_from_fd (int fd,
       while ((attr = g_file_attribute_matcher_enumerate_next (matcher)) != NULL)
 	get_one_xattr_from_fd (fd, info, attr);
     }
+#endif /* defined HAVE_XATTR */
 }
 
 static GFileAccessRights


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