Whamcloud - gitweb
LU-709 build: LC_XATTR_ACL & LC_POSIX_ACL_XATTR_H cleanup
authoryangsheng <ys@whamcloud.com>
Tue, 6 Dec 2011 21:24:59 +0000 (05:24 +0800)
committerOleg Drokin <green@whamcloud.com>
Thu, 16 Feb 2012 17:08:48 +0000 (12:08 -0500)
xattr_acl.h removed since 2.6.13 and posix_acl_xattr.h
exist since 2.6.11. So just use posix_acl_xattr.h for now.
And removed relate codes.

Change-Id: Ibefd4db87fa79ec9ee6365d48c83abd0dda0e063
Signed-off-by: yangsheng <ys@whamcloud.com>
Reviewed-on: http://review.whamcloud.com/1916
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Fan Yong <yong.fan@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/autoconf/lustre-core.m4
lustre/include/liblustre.h
lustre/include/linux/lustre_acl.h
lustre/include/linux/lustre_mds.h
lustre/include/lustre_eacl.h
lustre/include/lustre_mdc.h
lustre/ptlrpc/wirehdr.c
lustre/ptlrpc/wiretest.c
lustre/utils/wiretest.c

index b069946..09a7eac 100644 (file)
@@ -433,45 +433,8 @@ AC_DEFUN([LC_BIT_SPINLOCK_H],
 ])
 
 #
-# After 2.6.26 we no longer have xattr_acl.h
+# LC_CONST_ACL_SIZE
 #
-AC_DEFUN([LC_XATTR_ACL],
-[LB_CHECK_FILE([$LINUX/include/linux/xattr_acl.h],[
-       AC_MSG_CHECKING([if xattr_acl.h can be compiled])
-       LB_LINUX_TRY_COMPILE([
-               #include <linux/xattr_acl.h>
-       ],[],[
-               AC_MSG_RESULT([yes])
-               AC_DEFINE(HAVE_XATTR_ACL, 1, [Kernel has xattr_acl])
-       ],[
-               AC_MSG_RESULT([no])
-       ])
-],
-[])
-])
-
-#
-# After 2.6.16 the xattr_acl API is removed, and posix_acl is used instead
-#
-AC_DEFUN([LC_POSIX_ACL_XATTR_H],
-[LB_CHECK_FILE([$LINUX/include/linux/posix_acl_xattr.h],[
-        AC_MSG_CHECKING([if linux/posix_acl_xattr.h can be compiled])
-        LB_LINUX_TRY_COMPILE([
-                #include <linux/fs.h>
-                #include <linux/posix_acl_xattr.h>
-        ],[],[
-                AC_MSG_RESULT([yes])
-                AC_DEFINE(HAVE_LINUX_POSIX_ACL_XATTR_H, 1, [linux/posix_acl_xattr.h found])
-
-        ],[
-                AC_MSG_RESULT([no])
-        ])
-$1
-],[
-        AC_MSG_RESULT([no])
-])
-])
-
 AC_DEFUN([LC_CONST_ACL_SIZE],
 [AC_MSG_CHECKING([calc acl size])
 tmp_flags="$CFLAGS"
@@ -483,22 +446,16 @@ AC_TRY_RUN([
         // block include
         #define __LINUX_POSIX_ACL_H
 
-        # ifdef CONFIG_FS_POSIX_ACL
-        #  ifdef HAVE_XATTR_ACL
-        #   include <linux/xattr_acl.h>
-        #  endif
-        #  ifdef HAVE_LINUX_POSIX_ACL_XATTR_H
-        #   include <linux/posix_acl_xattr.h>
-        #  endif
-        # endif
-
-        #include <lustre_acl.h>
+        #ifdef CONFIG_FS_POSIX_ACL
+        # include <linux/posix_acl_xattr.h>
+        #endif
 
         #include <stdio.h>
 
         int main(void)
         {
-            int size = mds_xattr_acl_size(LUSTRE_POSIX_ACL_MAX_ENTRIES);
+                /* LUSTRE_POSIX_ACL_MAX_ENTRIES  = 32 */
+            int size = posix_acl_xattr_size(32);
             FILE *f = fopen("acl.size","w+");
             fprintf(f,"%d", size);
             fclose(f);
@@ -2288,8 +2245,6 @@ AC_DEFUN([LC_PROG_LINUX],
          LC_D_ADD_UNIQUE
          LC_BIT_SPINLOCK_H
 
-         LC_XATTR_ACL
-         LC_POSIX_ACL_XATTR_H
          LC_CONST_ACL_SIZE
 
          LC_STRUCT_INTENT_FILE
index 1048874..1335d4e 100644 (file)
@@ -437,32 +437,27 @@ typedef struct file_lock {
 #define NO_QUOTA 1
 
 /* ACL */
-struct posix_acl_entry {
-        short                   e_tag;
-        unsigned short          e_perm;
-        unsigned int            e_id;
-};
-
-struct posix_acl {
-        cfs_atomic_t            a_refcount;
-        unsigned int            a_count;
-        struct posix_acl_entry  a_entries[0];
-};
-
 typedef struct {
         __u16           e_tag;
         __u16           e_perm;
         __u32           e_id;
-} xattr_acl_entry;
+} posix_acl_xattr_entry;
+
+struct posix_acl {
+        cfs_atomic_t           a_refcount;
+        unsigned int           a_count;
+        posix_acl_xattr_entry  a_entries[0];
+};
 
 typedef struct {
-        __u32           a_version;
-        xattr_acl_entry a_entries[0];
-} xattr_acl_header;
+        __u32                 a_version;
+        posix_acl_xattr_entry a_entries[0];
+} posix_acl_xattr_header;
 
-static inline size_t xattr_acl_size(int count)
+static inline size_t posix_acl_xattr_size(int count)
 {
-        return sizeof(xattr_acl_header) + count * sizeof(xattr_acl_entry);
+        return sizeof(posix_acl_xattr_header) + count *
+               sizeof(posix_acl_xattr_entry);
 }
 
 static inline
@@ -482,19 +477,8 @@ void posix_acl_release(struct posix_acl *acl)
 {
 }
 
-#ifdef LIBLUSTRE_POSIX_ACL
-# ifndef posix_acl_xattr_entry
-#  define posix_acl_xattr_entry xattr_acl_entry
-# endif
-# ifndef posix_acl_xattr_header
-#  define posix_acl_xattr_header xattr_acl_header
-# endif
-# ifndef posix_acl_xattr_size
-#  define posix_acl_xattr_size(entry) xattr_acl_size(entry)
-# endif
-# ifndef CONFIG_FS_POSIX_ACL
-#  define CONFIG_FS_POSIX_ACL 1
-# endif
+#if defined(LIBLUSTRE_POSIX_ACL) && !defined(CONFIG_FS_POSIX_ACL)
+# define CONFIG_FS_POSIX_ACL 1
 #endif
 
 #ifndef ENOTSUPP
index e47f811..7ffa0c0 100644 (file)
@@ -30,6 +30,9 @@
  * Use is subject to license terms.
  */
 /*
+ * Copyright (c) 2012 Whamcloud, Inc.
+ */
+/*
  * This file is part of Lustre, http://www.lustre.org/
  * Lustre is a trademark of Sun Microsystems, Inc.
  *
 # include <linux/fs.h>
 # include <linux/dcache.h>
 # ifdef CONFIG_FS_POSIX_ACL
-#  ifdef HAVE_XATTR_ACL
-#   include <linux/xattr_acl.h>
-#  endif /* HAVE_XATTR_ACL */
-#  ifdef HAVE_LINUX_POSIX_ACL_XATTR_H
-#   include <linux/posix_acl_xattr.h>
-#  endif /* HAVE_LINUX_POSIX_ACL_XATTR_H */
+#  include <linux/posix_acl_xattr.h>
+#  define LUSTRE_POSIX_ACL_MAX_SIZE   XATTR_ACL_SIZE
 # endif /* CONFIG_FS_POSIX_ACL */
-#include <linux/lustre_intent.h>
-/* XATTR_{REPLACE,CREATE} */
-#include <linux/xattr.h>
+# include <linux/lustre_intent.h>
+# include <linux/xattr.h> /* XATTR_{REPLACE,CREATE} */
 #endif /* __KERNEL__ */
 
-/* ACL */
-#ifdef CONFIG_FS_POSIX_ACL
-# ifdef HAVE_XATTR_ACL
-#  define MDS_XATTR_NAME_ACL_ACCESS XATTR_NAME_ACL_ACCESS
-#  define mds_xattr_acl_size(entry) xattr_acl_size(entry)
-# else /* HAVE_XATTR_ACL */
-#  ifdef HAVE_LINUX_POSIX_ACL_XATTR_H
-#   define MDS_XATTR_NAME_ACL_ACCESS POSIX_ACL_XATTR_ACCESS
-#   define mds_xattr_acl_size(entry) posix_acl_xattr_size(entry)
-#  endif /* HAVE_LINUX_POSIX_ACL_XATTR_H */
-# endif /* HAVE_XATTR_ACL */
-
-# define LUSTRE_POSIX_ACL_MAX_ENTRIES   (32)
-
-#ifdef __KERNEL__
-# define LUSTRE_POSIX_ACL_MAX_SIZE   XATTR_ACL_SIZE
-#else
+#ifndef LUSTRE_POSIX_ACL_MAX_SIZE
 # define LUSTRE_POSIX_ACL_MAX_SIZE   0
 #endif
 
-# else /* CONFIG_FS_POSIX_ACL */
-# define LUSTRE_POSIX_ACL_MAX_SIZE      0
-# endif /* CONFIG_FS_POSIX_ACL */
-
 #endif /* _LUSTRE_LINUX_ACL_H */
index 100c742..26a5af0 100644 (file)
@@ -30,6 +30,9 @@
  * Use is subject to license terms.
  */
 /*
+ * Copyright (c) 2012 Whamcloud, Inc.
+ */
+/*
  * This file is part of Lustre, http://www.lustre.org/
  * Lustre is a trademark of Sun Microsystems, Inc.
  *
 # include <linux/fs.h>
 # include <linux/dcache.h>
 # ifdef CONFIG_FS_POSIX_ACL
-#  ifdef HAVE_XATTR_ACL
-#   include <linux/xattr_acl.h>
-#  endif /* HAVE_XATTR_ACL */ 
-#  ifdef HAVE_LINUX_POSIX_ACL_XATTR_H
-#   include <linux/posix_acl_xattr.h>
-#  endif /* HAVE_LINUX_POSIX_ACL_XATTR_H */
+#  include <linux/posix_acl_xattr.h>
 # endif /* CONFIG_FS_POSIX_ACL */
 # include <linux/lustre_intent.h>
 #endif /* __KERNEL__ */
index e25eb07..9dfbfd1 100644 (file)
@@ -30,6 +30,9 @@
  * Use is subject to license terms.
  */
 /*
+ * Copyright (c) 2012 Whamcloud, Inc.
+ */
+/*
  * This file is part of Lustre, http://www.lustre.org/
  * Lustre is a trademark of Sun Microsystems, Inc.
  *
 
 #ifdef CONFIG_FS_POSIX_ACL
 
-# ifdef HAVE_XATTR_ACL
-#  include <linux/xattr_acl.h>
-# endif /* HAVE_XATTR_ACL */
-# ifdef HAVE_LINUX_POSIX_ACL_XATTR_H
-#  include <linux/posix_acl_xattr.h>
-# endif /* HAVE_LINUX_POSIX_ACL_XATTR_H */
+#include <linux/posix_acl_xattr.h>
 
 #include <lustre_idmap.h>
 #include <md_object.h>
index e8883b4..9bc6934 100644 (file)
@@ -30,6 +30,9 @@
  * Use is subject to license terms.
  */
 /*
+ * Copyright (c) 2012 Whamcloud, Inc.
+ */
+/*
  * This file is part of Lustre, http://www.lustre.org/
  * Lustre is a trademark of Sun Microsystems, Inc.
  *
 # include <linux/fs.h>
 # include <linux/dcache.h>
 # ifdef CONFIG_FS_POSIX_ACL
-#  ifdef HAVE_XATTR_ACL
-#   include <linux/xattr_acl.h>
-#  endif /*HAVE_XATTR_ACL */
-#  ifdef HAVE_LINUX_POSIX_ACL_XATTR_H
-#   include <linux/posix_acl_xattr.h>
-#  endif /* HAVE_LINUX_POSIX_ACL_XATTR_H */
+#  include <linux/posix_acl_xattr.h>
 # endif /* CONFIG_FS_POSIX_ACL */
-#include <linux/lustre_intent.h>
+# include <linux/lustre_intent.h>
 #endif /* __KERNEL__ */
 #include <lustre_handles.h>
 #include <libcfs/libcfs.h>
index 50acd02..404e6cf 100644 (file)
 # endif
 # ifdef CONFIG_FS_POSIX_ACL
 #  include <linux/fs.h>
-#  ifdef HAVE_XATTR_ACL
-#   include <linux/xattr_acl.h>
-#  else
-#   define xattr_acl_entry  posix_acl_xattr_entry
-#   define xattr_acl_header posix_acl_xattr_header
-#  endif
-#  ifdef HAVE_LINUX_POSIX_ACL_XATTR_H
-#   include <linux/posix_acl_xattr.h>
-#  endif
+#  include <linux/posix_acl_xattr.h>
 # endif
 #endif
 
index 0e07afe..2b29304 100644 (file)
 # endif
 # ifdef CONFIG_FS_POSIX_ACL
 #  include <linux/fs.h>
-#  ifdef HAVE_XATTR_ACL
-#   include <linux/xattr_acl.h>
-#  else
-#   define xattr_acl_entry  posix_acl_xattr_entry
-#   define xattr_acl_header posix_acl_xattr_header
-#  endif
-#  ifdef HAVE_LINUX_POSIX_ACL_XATTR_H
-#   include <linux/posix_acl_xattr.h>
-#  endif
+#  include <linux/posix_acl_xattr.h>
 # endif
 #endif
 
@@ -3745,32 +3737,42 @@ void lustre_assert_wire_constants(void)
 #ifdef LIBLUSTRE_POSIX_ACL
 
         /* Checks for type posix_acl_xattr_entry */
-        LASSERTF((int)sizeof(xattr_acl_entry) == 8, "found %lld\n",
-                 (long long)(int)sizeof(xattr_acl_entry));
-        LASSERTF((int)offsetof(xattr_acl_entry, e_tag) == 0, "found %lld\n",
-                 (long long)(int)offsetof(xattr_acl_entry, e_tag));
-        LASSERTF((int)sizeof(((xattr_acl_entry *)0)->e_tag) == 2, "found %lld\n",
-                 (long long)(int)sizeof(((xattr_acl_entry *)0)->e_tag));
-        LASSERTF((int)offsetof(xattr_acl_entry, e_perm) == 2, "found %lld\n",
-                 (long long)(int)offsetof(xattr_acl_entry, e_perm));
-        LASSERTF((int)sizeof(((xattr_acl_entry *)0)->e_perm) == 2, "found %lld\n",
-                 (long long)(int)sizeof(((xattr_acl_entry *)0)->e_perm));
-        LASSERTF((int)offsetof(xattr_acl_entry, e_id) == 4, "found %lld\n",
-                 (long long)(int)offsetof(xattr_acl_entry, e_id));
-        LASSERTF((int)sizeof(((xattr_acl_entry *)0)->e_id) == 4, "found %lld\n",
-                 (long long)(int)sizeof(((xattr_acl_entry *)0)->e_id));
+        LASSERTF((int)sizeof(posix_acl_xattr_entry) == 8, "found %lld\n",
+                 (long long)(int)sizeof(posix_acl_xattr_entry));
+        LASSERTF((int)offsetof(posix_acl_xattr_entry, e_tag) == 0,
+                 "found %lld\n",
+                 (long long)(int)offsetof(posix_acl_xattr_entry, e_tag));
+        LASSERTF((int)sizeof(((posix_acl_xattr_entry *)0)->e_tag) == 2,
+                 "found %lld\n",
+                 (long long)(int)sizeof(((posix_acl_xattr_entry *)0)->e_tag));
+        LASSERTF((int)offsetof(posix_acl_xattr_entry, e_perm) == 2,
+                 "found %lld\n",
+                 (long long)(int)offsetof(posix_acl_xattr_entry, e_perm));
+        LASSERTF((int)sizeof(((posix_acl_xattr_entry *)0)->e_perm) == 2,
+                 "found %lld\n",
+                 (long long)(int)sizeof(((posix_acl_xattr_entry *)0)->e_perm));
+        LASSERTF((int)offsetof(posix_acl_xattr_entry, e_id) == 4,
+                 "found %lld\n",
+                 (long long)(int)offsetof(posix_acl_xattr_entry, e_id));
+        LASSERTF((int)sizeof(((posix_acl_xattr_entry *)0)->e_id) == 4,
+                 "found %lld\n",
+                 (long long)(int)sizeof(((posix_acl_xattr_entry *)0)->e_id));
 
         /* Checks for type posix_acl_xattr_header */
-        LASSERTF((int)sizeof(xattr_acl_header) == 4, "found %lld\n",
-                 (long long)(int)sizeof(xattr_acl_header));
-        LASSERTF((int)offsetof(xattr_acl_header, a_version) == 0, "found %lld\n",
-                 (long long)(int)offsetof(xattr_acl_header, a_version));
-        LASSERTF((int)sizeof(((xattr_acl_header *)0)->a_version) == 4, "found %lld\n",
-                 (long long)(int)sizeof(((xattr_acl_header *)0)->a_version));
-        LASSERTF((int)offsetof(xattr_acl_header, a_entries) == 4, "found %lld\n",
-                 (long long)(int)offsetof(xattr_acl_header, a_entries));
-        LASSERTF((int)sizeof(((xattr_acl_header *)0)->a_entries) == 0, "found %lld\n",
-                 (long long)(int)sizeof(((xattr_acl_header *)0)->a_entries));
+        LASSERTF((int)sizeof(posix_acl_xattr_header) == 4, "found %lld\n",
+                 (long long)(int)sizeof(posix_acl_xattr_header));
+        LASSERTF((int)offsetof(posix_acl_xattr_header, a_version) == 0,
+                 "found %lld\n",
+                 (long long)(int)offsetof(posix_acl_xattr_header, a_version));
+        LASSERTF((int)sizeof(((posix_acl_xattr_header *)0)->a_version) == 4,
+                 "found %lld\n",
+                 (long long)(int)sizeof(((posix_acl_xattr_header *)0)->a_version));
+        LASSERTF((int)offsetof(posix_acl_xattr_header, a_entries) == 4,
+                 "found %lld\n",
+                 (long long)(int)offsetof(posix_acl_xattr_header, a_entries));
+        LASSERTF((int)sizeof(((posix_acl_xattr_header *)0)->a_entries) == 0,
+                 "found %lld\n",
+                 (long long)(int)sizeof(((posix_acl_xattr_header *)0)->a_entries));
 #endif
 
         /* Checks for struct link_ea_header */
index 1de4005..7f138d0 100644 (file)
@@ -3743,32 +3743,42 @@ void lustre_assert_wire_constants(void)
 #ifdef LIBLUSTRE_POSIX_ACL
 
         /* Checks for type posix_acl_xattr_entry */
-        LASSERTF((int)sizeof(xattr_acl_entry) == 8, "found %lld\n",
-                 (long long)(int)sizeof(xattr_acl_entry));
-        LASSERTF((int)offsetof(xattr_acl_entry, e_tag) == 0, "found %lld\n",
-                 (long long)(int)offsetof(xattr_acl_entry, e_tag));
-        LASSERTF((int)sizeof(((xattr_acl_entry *)0)->e_tag) == 2, "found %lld\n",
-                 (long long)(int)sizeof(((xattr_acl_entry *)0)->e_tag));
-        LASSERTF((int)offsetof(xattr_acl_entry, e_perm) == 2, "found %lld\n",
-                 (long long)(int)offsetof(xattr_acl_entry, e_perm));
-        LASSERTF((int)sizeof(((xattr_acl_entry *)0)->e_perm) == 2, "found %lld\n",
-                 (long long)(int)sizeof(((xattr_acl_entry *)0)->e_perm));
-        LASSERTF((int)offsetof(xattr_acl_entry, e_id) == 4, "found %lld\n",
-                 (long long)(int)offsetof(xattr_acl_entry, e_id));
-        LASSERTF((int)sizeof(((xattr_acl_entry *)0)->e_id) == 4, "found %lld\n",
-                 (long long)(int)sizeof(((xattr_acl_entry *)0)->e_id));
+        LASSERTF((int)sizeof(posix_acl_xattr_entry) == 8, "found %lld\n",
+                 (long long)(int)sizeof(posix_acl_xattr_entry));
+        LASSERTF((int)offsetof(posix_acl_xattr_entry, e_tag) == 0,
+                 "found %lld\n",
+                 (long long)(int)offsetof(posix_acl_xattr_entry, e_tag));
+        LASSERTF((int)sizeof(((posix_acl_xattr_entry *)0)->e_tag) == 2,
+                 "found %lld\n",
+                 (long long)(int)sizeof(((posix_acl_xattr_entry *)0)->e_tag));
+        LASSERTF((int)offsetof(posix_acl_xattr_entry, e_perm) == 2,
+                 "found %lld\n",
+                 (long long)(int)offsetof(posix_acl_xattr_entry, e_perm));
+        LASSERTF((int)sizeof(((posix_acl_xattr_entry *)0)->e_perm) == 2,
+                 "found %lld\n",
+                 (long long)(int)sizeof(((posix_acl_xattr_entry *)0)->e_perm));
+        LASSERTF((int)offsetof(posix_acl_xattr_entry, e_id) == 4,
+                 "found %lld\n",
+                 (long long)(int)offsetof(posix_acl_xattr_entry, e_id));
+        LASSERTF((int)sizeof(((posix_acl_xattr_entry *)0)->e_id) == 4,
+                 "found %lld\n",
+                 (long long)(int)sizeof(((posix_acl_xattr_entry *)0)->e_id));
 
         /* Checks for type posix_acl_xattr_header */
-        LASSERTF((int)sizeof(xattr_acl_header) == 4, "found %lld\n",
-                 (long long)(int)sizeof(xattr_acl_header));
-        LASSERTF((int)offsetof(xattr_acl_header, a_version) == 0, "found %lld\n",
-                 (long long)(int)offsetof(xattr_acl_header, a_version));
-        LASSERTF((int)sizeof(((xattr_acl_header *)0)->a_version) == 4, "found %lld\n",
-                 (long long)(int)sizeof(((xattr_acl_header *)0)->a_version));
-        LASSERTF((int)offsetof(xattr_acl_header, a_entries) == 4, "found %lld\n",
-                 (long long)(int)offsetof(xattr_acl_header, a_entries));
-        LASSERTF((int)sizeof(((xattr_acl_header *)0)->a_entries) == 0, "found %lld\n",
-                 (long long)(int)sizeof(((xattr_acl_header *)0)->a_entries));
+        LASSERTF((int)sizeof(posix_acl_xattr_header) == 4, "found %lld\n",
+                 (long long)(int)sizeof(posix_acl_xattr_header));
+        LASSERTF((int)offsetof(posix_acl_xattr_header, a_version) == 0,
+                 "found %lld\n",
+                 (long long)(int)offsetof(posix_acl_xattr_header, a_version));
+        LASSERTF((int)sizeof(((posix_acl_xattr_header *)0)->a_version) == 4,
+                 "found %lld\n",
+                 (long long)(int)sizeof(((posix_acl_xattr_header *)0)->a_version));
+        LASSERTF((int)offsetof(posix_acl_xattr_header, a_entries) == 4,
+                 "found %lld\n",
+                 (long long)(int)offsetof(posix_acl_xattr_header, a_entries));
+        LASSERTF((int)sizeof(((posix_acl_xattr_header *)0)->a_entries) == 0,
+                 "found %lld\n",
+                 (long long)(int)sizeof(((posix_acl_xattr_header *)0)->a_entries));
 #endif
 
         /* Checks for struct link_ea_header */