lib/replace: Merge remaining xattr test details from lib/util
authorAndrew Bartlett <abartlet@samba.org>
Fri, 1 Jun 2012 05:01:09 +0000 (15:01 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Sat, 2 Jun 2012 00:13:49 +0000 (02:13 +0200)
I prefer the longer XATTR_ADDITIONAL_OPTIONS define and the NULL
rather than 0 values in the getxattr test.

Andrew Bartlett

lib/replace/libreplace.m4
lib/replace/replace.h
lib/replace/system/filesys.h
lib/replace/wscript
lib/replace/xattr.c
lib/util/wscript_configure

index 8176a000b3dfd4bcb36a9a2f454f0859bf0a8013..641d25bb52af6d1403299f9fb509706d50a5378f 100644 (file)
@@ -181,13 +181,13 @@ if test x"$ac_cv_func_getxattr" = x"yes" ; then
                        #include <sys/xattr.h>
                        #endif
                ],[
-                       getxattr(0, 0, 0, 0, 0, 0);
+                       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_ADD_OPT, 1, [xattr functions have additional options])
+               AC_DEFINE(XATTR_ADDITIONAL_OPTIONS, 1, [xattr functions have additional options])
        fi
 fi
 
index fe3ef3dcfdca3e753f05dcdac236ff3d83366c1d..218303f296609a8efc9c0f7076130697e1bdc4de 100644 (file)
@@ -543,42 +543,42 @@ ssize_t rep_pwrite(int __fd, const void *__buf, size_t __nbytes, off_t __offset)
 /* prototype is in "system/network.h" */
 #endif
 
-#if !defined(HAVE_GETXATTR) || defined(XATTR_ADD_OPT)
+#if !defined(HAVE_GETXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
 #define getxattr rep_getxattr
 /* prototype is in "system/filesys.h" */
 #endif
 
-#if !defined(HAVE_FGETXATTR) || defined(XATTR_ADD_OPT)
+#if !defined(HAVE_FGETXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
 #define fgetxattr rep_fgetxattr
 /* prototype is in "system/filesys.h" */
 #endif
 
-#if !defined(HAVE_LISTXATTR) || defined(XATTR_ADD_OPT)
+#if !defined(HAVE_LISTXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
 #define listxattr rep_listxattr
 /* prototype is in "system/filesys.h" */
 #endif
 
-#if !defined(HAVE_FLISTXATTR) || defined(XATTR_ADD_OPT)
+#if !defined(HAVE_FLISTXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
 #define flistxattr rep_flistxattr
 /* prototype is in "system/filesys.h" */
 #endif
 
-#if !defined(HAVE_REMOVEXATTR) || defined(XATTR_ADD_OPT)
+#if !defined(HAVE_REMOVEXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
 #define removexattr rep_removexattr
 /* prototype is in "system/filesys.h" */
 #endif
 
-#if !defined(HAVE_FREMOVEXATTR) || defined(XATTR_ADD_OPT)
+#if !defined(HAVE_FREMOVEXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
 #define fremovexattr rep_fremovexattr
 /* prototype is in "system/filesys.h" */
 #endif
 
-#if !defined(HAVE_SETXATTR) || defined(XATTR_ADD_OPT)
+#if !defined(HAVE_SETXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
 #define setxattr rep_setxattr
 /* prototype is in "system/filesys.h" */
 #endif
 
-#if !defined(HAVE_FSETXATTR) || defined(XATTR_ADD_OPT)
+#if !defined(HAVE_FSETXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
 #define fsetxattr rep_fsetxattr
 /* prototype is in "system/filesys.h" */
 #endif
index cf8b36b53f7f74172548aa66951abd6681caa47b..a72a59a31a9b5e6b4637e258be8b239d67d37416 100644 (file)
 #endif
 
 
-#if !defined(HAVE_GETXATTR) || defined(XATTR_ADD_OPT)
+#if !defined(HAVE_GETXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
 ssize_t rep_getxattr (const char *path, const char *name, void *value, size_t size);
 /* define is in "replace.h" */
 #endif
 
-#if !defined(HAVE_FGETXATTR) || defined(XATTR_ADD_OPT)
+#if !defined(HAVE_FGETXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
 ssize_t rep_fgetxattr (int filedes, const char *name, void *value, size_t size);
 /* define is in "replace.h" */
 #endif
 
-#if !defined(HAVE_LISTXATTR) || defined(XATTR_ADD_OPT)
+#if !defined(HAVE_LISTXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
 ssize_t rep_listxattr (const char *path, char *list, size_t size);
 /* define is in "replace.h" */
 #endif
 
-#if !defined(HAVE_FLISTXATTR) || defined(XATTR_ADD_OPT)
+#if !defined(HAVE_FLISTXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
 ssize_t rep_flistxattr (int filedes, char *list, size_t size);
 /* define is in "replace.h" */
 #endif
 
-#if !defined(HAVE_REMOVEXATTR) || defined(XATTR_ADD_OPT)
+#if !defined(HAVE_REMOVEXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
 int rep_removexattr (const char *path, const char *name);
 /* define is in "replace.h" */
 #endif
 
-#if !defined(HAVE_FREMOVEXATTR) || defined(XATTR_ADD_OPT)
+#if !defined(HAVE_FREMOVEXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
 int rep_fremovexattr (int filedes, const char *name);
 /* define is in "replace.h" */
 #endif
 
-#if !defined(HAVE_SETXATTR) || defined(XATTR_ADD_OPT)
+#if !defined(HAVE_SETXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
 int rep_setxattr (const char *path, const char *name, const void *value, size_t size, int flags);
 /* define is in "replace.h" */
 #endif
 
-#if !defined(HAVE_FSETXATTR) || defined(XATTR_ADD_OPT)
+#if !defined(HAVE_FSETXATTR) || defined(XATTR_ADDITIONAL_OPTIONS)
 int rep_fsetxattr (int filedes, const char *name, const void *value, size_t size, int flags);
 /* define is in "replace.h" */
 #endif
index 1d1480caec4a58634fcaa673686ea9b45d3951b0..6331b884eda49863e2e676a19508d06f4d12ab64 100644 (file)
@@ -213,11 +213,13 @@ def configure(conf):
 
     conf.SET_TARGET_TYPE('attr', 'EMPTY')
 
+    xattr_headers='sys/attributes.h attr/xattr.h sys/xattr.h'
+
     conf.CHECK_FUNCS_IN('''
 fgetxattr flistea flistxattr
 fremovexattr fsetxattr getxattr
 listxattr removexattr setxattr
-''', 'attr', checklibc=True)
+''', 'attr', checklibc=True, headers=xattr_headers)
 
     # We need to check for linux xattrs first, as we do not wish to link to -lattr
     # (the XFS compat API) on Linux systems with the native xattr API
@@ -229,7 +231,7 @@ extattr_get_fd extattr_get_file extattr_list_fd extattr_list_file
 extattr_set_fd extattr_set_file fgetea flistea
 fremoveea fsetea getea listea
 removeea setea
-''', 'attr', checklibc=True)
+''', 'attr', checklibc=True, headers=xattr_headers)
 
     if (conf.CONFIG_SET('HAVE_ATTR_LISTF') or
         conf.CONFIG_SET('HAVE_EXTATTR_LIST_FD') or
@@ -238,10 +240,10 @@ removeea setea
             conf.DEFINE('HAVE_XATTR_SUPPORT', 1)
 
     # Darwin has extra options to xattr-family functions
-    conf.CHECK_CODE('getxattr(0, 0, 0, 0, 0, 0);',
-                    'XATTR_ADD_OPT',
-                    msg="Checking whether xattr interface takes additional options",
-                    headers='sys/types.h attr/xattr.h sys/xattr.h')
+    conf.CHECK_CODE('getxattr(NULL, NULL, NULL, 0, 0, 0)',
+                    headers=xattr_headers, local_include=False,
+                    define='XATTR_ADDITIONAL_OPTIONS',
+                    msg="Checking whether xattr interface takes additional options")
 
     conf.CHECK_FUNCS_IN('dlopen dlsym dlerror dlclose', 'dl',
                         checklibc=True, headers='dlfcn.h dl.h')
index 192784f344daf38d7e4021d89ae1339b8fa69abd..39f55c66b219ec874146fd0cec13806358ab0fa3 100644 (file)
@@ -42,7 +42,7 @@ static int solaris_openat(int fildes, const char *path, int oflag, mode_t mode);
 ssize_t rep_getxattr (const char *path, const char *name, void *value, size_t size)
 {
 #if defined(HAVE_GETXATTR)
-#ifndef XATTR_ADD_OPT
+#ifndef XATTR_ADDITIONAL_OPTIONS
        return getxattr(path, name, value, size);
 #else
        int options = 0;
@@ -98,7 +98,7 @@ ssize_t rep_getxattr (const char *path, const char *name, void *value, size_t si
 ssize_t rep_fgetxattr (int filedes, const char *name, void *value, size_t size)
 {
 #if defined(HAVE_FGETXATTR)
-#ifndef XATTR_ADD_OPT
+#ifndef XATTR_ADDITIONAL_OPTIONS
        return fgetxattr(filedes, name, value, size);
 #else
        int options = 0;
@@ -311,7 +311,7 @@ static ssize_t irix_attr_list(const char *path, int filedes, char *list, size_t
 ssize_t rep_listxattr (const char *path, char *list, size_t size)
 {
 #if defined(HAVE_LISTXATTR)
-#ifndef XATTR_ADD_OPT
+#ifndef XATTR_ADDITIONAL_OPTIONS
        return listxattr(path, list, size);
 #else
        int options = 0;
@@ -342,7 +342,7 @@ ssize_t rep_listxattr (const char *path, char *list, size_t size)
 ssize_t rep_flistxattr (int filedes, char *list, size_t size)
 {
 #if defined(HAVE_FLISTXATTR)
-#ifndef XATTR_ADD_OPT
+#ifndef XATTR_ADDITIONAL_OPTIONS
        return flistxattr(filedes, list, size);
 #else
        int options = 0;
@@ -373,7 +373,7 @@ ssize_t rep_flistxattr (int filedes, char *list, size_t size)
 int rep_removexattr (const char *path, const char *name)
 {
 #if defined(HAVE_REMOVEXATTR)
-#ifndef XATTR_ADD_OPT
+#ifndef XATTR_ADDITIONAL_OPTIONS
        return removexattr(path, name);
 #else
        int options = 0;
@@ -412,7 +412,7 @@ int rep_removexattr (const char *path, const char *name)
 int rep_fremovexattr (int filedes, const char *name)
 {
 #if defined(HAVE_FREMOVEXATTR)
-#ifndef XATTR_ADD_OPT
+#ifndef XATTR_ADDITIONAL_OPTIONS
        return fremovexattr(filedes, name);
 #else
        int options = 0;
@@ -451,7 +451,7 @@ int rep_fremovexattr (int filedes, const char *name)
 int rep_setxattr (const char *path, const char *name, const void *value, size_t size, int flags)
 {
 #if defined(HAVE_SETXATTR)
-#ifndef XATTR_ADD_OPT
+#ifndef XATTR_ADDITIONAL_OPTIONS
        return setxattr(path, name, value, size, flags);
 #else
        int options = 0;
@@ -516,7 +516,7 @@ int rep_setxattr (const char *path, const char *name, const void *value, size_t
 int rep_fsetxattr (int filedes, const char *name, const void *value, size_t size, int flags)
 {
 #if defined(HAVE_FSETXATTR)
-#ifndef XATTR_ADD_OPT
+#ifndef XATTR_ADDITIONAL_OPTIONS
        return fsetxattr(filedes, name, value, size, flags);
 #else
        int options = 0;
index d5c9f743d0a8519e3451bb270e154b78b31faa92..f0514fd0b804c22ff28ad6d3c9cddaa6f17e5fa9 100644 (file)
@@ -9,14 +9,6 @@ conf.CHECK_FUNCS_IN('backtrace backtrace_symbols', 'execinfo', checklibc=True, h
 
 conf.CHECK_FUNCS('sigprocmask sigblock sigaction')
 
-xattr_headers='sys/attributes.h attr/xattr.h sys/xattr.h'
-
-conf.CHECK_CODE('getxattr(NULL, NULL, NULL, 0, 0, 0)',
-                headers=xattr_headers, local_include=False,
-                define='XATTR_ADDITIONAL_OPTIONS',
-                msg='Checking for darwin xattr api')
-
-
 conf.CHECK_STRUCTURE_MEMBER('struct statvfs', 'f_frsize', define='HAVE_FRSIZE', headers='sys/statvfs.h')
 
 # all the different ways of doing statfs