From ac1b1940adc038b94fab1e201f8f7d362c711bf2 Mon Sep 17 00:00:00 2001 From: yangsheng Date: Wed, 7 Dec 2011 05:24:59 +0800 Subject: [PATCH] LU-709 build: LC_XATTR_ACL & LC_POSIX_ACL_XATTR_H cleanup 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 Reviewed-on: http://review.whamcloud.com/1916 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Fan Yong Reviewed-by: Oleg Drokin --- lustre/autoconf/lustre-core.m4 | 57 ++++---------------------------- lustre/include/liblustre.h | 46 +++++++++----------------- lustre/include/linux/lustre_acl.h | 38 +++++----------------- lustre/include/linux/lustre_mds.h | 10 +++--- lustre/include/lustre_eacl.h | 10 +++--- lustre/include/lustre_mdc.h | 12 +++---- lustre/ptlrpc/wirehdr.c | 10 +----- lustre/ptlrpc/wiretest.c | 68 ++++++++++++++++++++------------------- lustre/utils/wiretest.c | 58 +++++++++++++++++++-------------- 9 files changed, 112 insertions(+), 197 deletions(-) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index b069946..09a7eac 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -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 - ],[],[ - 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 - #include - ],[],[ - 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 - # endif - # ifdef HAVE_LINUX_POSIX_ACL_XATTR_H - # include - # endif - # endif - - #include + #ifdef CONFIG_FS_POSIX_ACL + # include + #endif #include 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 diff --git a/lustre/include/liblustre.h b/lustre/include/liblustre.h index 1048874..1335d4e 100644 --- a/lustre/include/liblustre.h +++ b/lustre/include/liblustre.h @@ -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 diff --git a/lustre/include/linux/lustre_acl.h b/lustre/include/linux/lustre_acl.h index e47f811..7ffa0c0 100644 --- a/lustre/include/linux/lustre_acl.h +++ b/lustre/include/linux/lustre_acl.h @@ -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. * @@ -50,40 +53,15 @@ # include # include # ifdef CONFIG_FS_POSIX_ACL -# ifdef HAVE_XATTR_ACL -# include -# endif /* HAVE_XATTR_ACL */ -# ifdef HAVE_LINUX_POSIX_ACL_XATTR_H -# include -# endif /* HAVE_LINUX_POSIX_ACL_XATTR_H */ +# include +# define LUSTRE_POSIX_ACL_MAX_SIZE XATTR_ACL_SIZE # endif /* CONFIG_FS_POSIX_ACL */ -#include -/* XATTR_{REPLACE,CREATE} */ -#include +# include +# include /* 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 */ diff --git a/lustre/include/linux/lustre_mds.h b/lustre/include/linux/lustre_mds.h index 100c742..26a5af0 100644 --- a/lustre/include/linux/lustre_mds.h +++ b/lustre/include/linux/lustre_mds.h @@ -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. * @@ -50,12 +53,7 @@ # include # include # ifdef CONFIG_FS_POSIX_ACL -# ifdef HAVE_XATTR_ACL -# include -# endif /* HAVE_XATTR_ACL */ -# ifdef HAVE_LINUX_POSIX_ACL_XATTR_H -# include -# endif /* HAVE_LINUX_POSIX_ACL_XATTR_H */ +# include # endif /* CONFIG_FS_POSIX_ACL */ # include #endif /* __KERNEL__ */ diff --git a/lustre/include/lustre_eacl.h b/lustre/include/lustre_eacl.h index e25eb07..9dfbfd1 100644 --- a/lustre/include/lustre_eacl.h +++ b/lustre/include/lustre_eacl.h @@ -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. * @@ -49,12 +52,7 @@ #ifdef CONFIG_FS_POSIX_ACL -# ifdef HAVE_XATTR_ACL -# include -# endif /* HAVE_XATTR_ACL */ -# ifdef HAVE_LINUX_POSIX_ACL_XATTR_H -# include -# endif /* HAVE_LINUX_POSIX_ACL_XATTR_H */ +#include #include #include diff --git a/lustre/include/lustre_mdc.h b/lustre/include/lustre_mdc.h index e8883b4..9bc6934 100644 --- a/lustre/include/lustre_mdc.h +++ b/lustre/include/lustre_mdc.h @@ -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. * @@ -51,14 +54,9 @@ # include # include # ifdef CONFIG_FS_POSIX_ACL -# ifdef HAVE_XATTR_ACL -# include -# endif /*HAVE_XATTR_ACL */ -# ifdef HAVE_LINUX_POSIX_ACL_XATTR_H -# include -# endif /* HAVE_LINUX_POSIX_ACL_XATTR_H */ +# include # endif /* CONFIG_FS_POSIX_ACL */ -#include +# include #endif /* __KERNEL__ */ #include #include diff --git a/lustre/ptlrpc/wirehdr.c b/lustre/ptlrpc/wirehdr.c index 50acd02..404e6cf 100644 --- a/lustre/ptlrpc/wirehdr.c +++ b/lustre/ptlrpc/wirehdr.c @@ -48,15 +48,7 @@ # endif # ifdef CONFIG_FS_POSIX_ACL # include -# ifdef HAVE_XATTR_ACL -# include -# 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 -# endif +# include # endif #endif diff --git a/lustre/ptlrpc/wiretest.c b/lustre/ptlrpc/wiretest.c index 0e07afe..2b29304 100644 --- a/lustre/ptlrpc/wiretest.c +++ b/lustre/ptlrpc/wiretest.c @@ -48,15 +48,7 @@ # endif # ifdef CONFIG_FS_POSIX_ACL # include -# ifdef HAVE_XATTR_ACL -# include -# 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 -# endif +# include # 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 */ diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index 1de4005..7f138d0 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -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 */ -- 1.8.3.1