svn commit: samba r16005 - in branches/SAMBA_4_0/source/ntvfs/posix: .

metze at samba.org metze at samba.org
Fri Jun 2 14:22:56 GMT 2006


Author: metze
Date: 2006-06-02 14:22:56 +0000 (Fri, 02 Jun 2006)
New Revision: 16005

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=16005

Log:
add support for XATTR's on MacOS

Thanks to Bjoern Jacke for his help.

metze
Modified:
   branches/SAMBA_4_0/source/ntvfs/posix/config.m4
   branches/SAMBA_4_0/source/ntvfs/posix/xattr_system.c


Changeset:
Modified: branches/SAMBA_4_0/source/ntvfs/posix/config.m4
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/config.m4	2006-06-02 14:06:30 UTC (rev 16004)
+++ branches/SAMBA_4_0/source/ntvfs/posix/config.m4	2006-06-02 14:22:56 UTC (rev 16005)
@@ -29,6 +29,23 @@
 AC_CHECK_FUNC_EXT(flistxattr, $XATTR_LIBS)
 SMB_EXT_LIB(XATTR,[${XATTR_LIBS}],[${XATTR_CFLAGS}],[${XATTR_CPPFLAGS}],[${XATTR_LDFLAGS}])
 if test x"$ac_cv_func_ext_flistxattr" = x"yes"; then
+	AC_CACHE_CHECK([whether xattr interface takes additional options], smb_attr_cv_xattr_add_opt,
+	[old_LIBS=$LIBS
+	 LIBS="$LIBS $XATTRLIBS"
+	 AC_TRY_COMPILE([
+	 	#include <sys/types.h>
+		#if HAVE_ATTR_XATTR_H
+		#include <attr/xattr.h>
+		#elif HAVE_SYS_XATTR_H
+		#include <sys/xattr.h>
+		#endif
+		],[
+		getxattr(NULL, NULL, NULL, 0, 0, 0);
+		],smb_attr_cv_xattr_add_opt=yes,smb_attr_cv_xattr_add_opt=no)
+	  LIBS=$old_LIBS)])
+	if test x"$smb_attr_cv_xattr_add_opt" = x"yes"; then
+		AC_DEFINE(XATTR_ADDITIONAL_OPTIONS, 1, [xattr functions have additional options])
+	fi
 	AC_DEFINE(HAVE_XATTR_SUPPORT,1,[Whether we have xattr support])
 	SMB_ENABLE(XATTR,YES)
 fi

Modified: branches/SAMBA_4_0/source/ntvfs/posix/xattr_system.c
===================================================================
--- branches/SAMBA_4_0/source/ntvfs/posix/xattr_system.c	2006-06-02 14:06:30 UTC (rev 16004)
+++ branches/SAMBA_4_0/source/ntvfs/posix/xattr_system.c	2006-06-02 14:22:56 UTC (rev 16005)
@@ -23,7 +23,38 @@
 #include "includes.h"
 #include "vfs_posix.h"
 
-#if !defined(HAVE_XATTR_SUPPORT)
+#if defined(HAVE_XATTR_SUPPORT) && defined(XATTR_ADDITIONAL_OPTIONS)
+static ssize_t _wrap_fgetxattr(int fd, const char *name, void *value, size_t size)
+{
+	return fgetxattr(fd, name, value, size, 0, 0);
+}
+static ssize_t _wrap_getxattr(const char *path, const char *name, void *value, size_t size)
+{
+	return getxattr(path, name, value, size, 0, 0);
+}
+static ssize_t _wrap_fsetxattr(int fd, const char *name, void *value, size_t size, int flags)
+{
+	return fsetxattr(fd, name, value, size, 0, flags);
+}
+static ssize_t _wrap_setxattr(const char *path, const char *name, void *value, size_t size, int flags)
+{
+	return setxattr(path, name, value, size, 0, flags);
+}
+static ssize_t _wrap_fremovexattr(int fd, const char *name)
+{
+	return fremovexattr(fd, name, 0);
+}
+static ssize_t _wrap_removexattr(const char *path, const char *name)
+{
+	return removexattr(path, name, 0);
+}
+#define fgetxattr	_wrap_fgetxattr
+#define getxattr	_wrap_getxattr
+#define fsetxattr	_wrap_fsetxattr
+#define setxattr	_wrap_setxattr
+#define fremovexattr	_wrap_fremovexattr
+#define removexattr	_wrap_removexattr
+#elif !defined(HAVE_XATTR_SUPPORT)
 static ssize_t _none_fgetxattr(int fd, const char *name, void *value, size_t size)
 {
 	errno = ENOTSUP;



More information about the samba-cvs mailing list