Whamcloud - gitweb
Branch HEAD
authorbwzhou <bwzhou>
Thu, 6 Dec 2007 11:53:22 +0000 (11:53 +0000)
committerbwzhou <bwzhou>
Thu, 6 Dec 2007 11:53:22 +0000 (11:53 +0000)
b=13317
r=shadow, johann

enable liblustre to connect to mds with acl

lustre/autoconf/lustre-core.m4
lustre/include/liblustre.h
lustre/liblustre/llite_lib.c
lustre/liblustre/super.c
lustre/utils/wirecheck.c
lustre/utils/wiretest.c

index 75758bc..5f789c1 100644 (file)
@@ -1494,6 +1494,19 @@ if test x$enable_liblustre != xyes ; then
 fi
 AC_MSG_RESULT([$enable_liblustre_tests])
 
+AC_MSG_CHECKING([whether to enable liblustre acl])
+AC_ARG_ENABLE([liblustre-acl],
+       AC_HELP_STRING([--disable-liblustre-acl],
+                       [disable ACL support for liblustre]),
+       [],[enable_liblustre_acl=yes])
+if test x$enable_liblustre != xyes ; then
+   enable_liblustre_acl='no'
+fi
+AC_MSG_RESULT([$enable_liblustre_acl])
+if test x$enable_liblustre_acl != xno ; then
+  AC_DEFINE(LIBLUSTRE_POSIX_ACL, 1, Liblustre Support ACL-enabled MDS)
+fi
+
 AC_MSG_CHECKING([whether to build mpitests])
 AC_ARG_ENABLE([mpitests],
        AC_HELP_STRING([--enable-mpitests],
index 3e773b9..feff186 100644 (file)
@@ -950,6 +950,21 @@ 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
+#endif
+
 #ifndef ENOTSUPP
 #define ENOTSUPP ENOTSUP
 #endif
index 0d67368..486f874 100644 (file)
@@ -158,6 +158,9 @@ int liblustre_process_log(struct config_llog_instance *cfg,
                 GOTO(out_cleanup, rc = -ENOMEM);
 
         ocd->ocd_connect_flags = OBD_CONNECT_VERSION;
+#ifdef LIBLUSTRE_POSIX_ACL
+        ocd->ocd_connect_flags |= OBD_CONNECT_ACL;
+#endif
         ocd->ocd_version = LUSTRE_VERSION_CODE;
 
         rc = obd_connect(NULL, &mgc_conn, obd, &mgc_uuid, ocd);
index 3dc931b..cefd4a0 100644 (file)
@@ -2075,6 +2075,9 @@ llu_fsswop_mount(const char *source,
                            sizeof(async), &async, NULL);
 
         ocd.ocd_connect_flags = OBD_CONNECT_IBITS | OBD_CONNECT_VERSION;
+#ifdef LIBLUSTRE_POSIX_ACL
+        ocd.ocd_connect_flags |= OBD_CONNECT_ACL;
+#endif
         ocd.ocd_ibits_known = MDS_INODELOCK_FULL;
         ocd.ocd_version = LUSTRE_VERSION_CODE;
 
index 08b7050..5cd12e3 100644 (file)
@@ -54,23 +54,44 @@ do {                                                            \
         CHECK_VALUE((int)offsetof(struct s, m));                \
 } while(0)
 
+#define CHECK_MEMBER_OFFSET_TYPEDEF(s,m)                        \
+do {                                                            \
+        CHECK_VALUE((int)offsetof(s, m));                       \
+} while(0)
+
 #define CHECK_MEMBER_SIZEOF(s,m)                                \
 do {                                                            \
         CHECK_VALUE((int)sizeof(((struct s *)0)->m));           \
 } while(0)
 
+#define CHECK_MEMBER_SIZEOF_TYPEDEF(s,m)                        \
+do {                                                            \
+        CHECK_VALUE((int)sizeof(((s *)0)->m));                  \
+} while(0)
+
 #define CHECK_MEMBER(s,m)                                       \
 do {                                                            \
         CHECK_MEMBER_OFFSET(s, m);                              \
         CHECK_MEMBER_SIZEOF(s, m);                              \
 } while(0)
 
+#define CHECK_MEMBER_TYPEDEF(s,m)                               \
+do {                                                            \
+        CHECK_MEMBER_OFFSET_TYPEDEF(s, m);                      \
+        CHECK_MEMBER_SIZEOF_TYPEDEF(s, m);                      \
+} while(0)
+
 #define CHECK_STRUCT(s)                                         \
 do {                                                            \
         COMMENT("Checks for struct "#s);                        \
                 CHECK_VALUE((int)sizeof(struct s));             \
 } while(0)
 
+#define CHECK_STRUCT_TYPEDEF(s)                                 \
+do {                                                            \
+        COMMENT("Checks for type "#s);                          \
+                CHECK_VALUE((int)sizeof(s));                    \
+} while(0)
 
 static void
 check_lustre_handle(void)
@@ -1003,6 +1024,27 @@ check_lustre_disk_data(void)
         CHECK_MEMBER(lustre_disk_data, ldd_params);
 }
 
+#ifdef LIBLUSTRE_POSIX_ACL
+static void
+check_posix_acl_xattr_entry(void)
+{
+        BLANK_LINE();
+        CHECK_STRUCT_TYPEDEF(posix_acl_xattr_entry);
+        CHECK_MEMBER_TYPEDEF(posix_acl_xattr_entry, e_tag);
+        CHECK_MEMBER_TYPEDEF(posix_acl_xattr_entry, e_perm);
+        CHECK_MEMBER_TYPEDEF(posix_acl_xattr_entry, e_id);
+}
+
+static void
+check_posix_acl_xattr_header(void)
+{
+        BLANK_LINE();
+        CHECK_STRUCT_TYPEDEF(posix_acl_xattr_header);
+        CHECK_MEMBER_TYPEDEF(posix_acl_xattr_header, a_version);
+        CHECK_MEMBER_TYPEDEF(posix_acl_xattr_header, a_entries);
+}
+#endif
+
 static void
 system_string (char *cmdline, char *str, int len)
 {
@@ -1251,6 +1293,10 @@ main(int argc, char **argv)
         check_qunit_data_old();
         check_mgs_target_info();
         check_lustre_disk_data();
+#ifdef LIBLUSTRE_POSIX_ACL
+        check_posix_acl_xattr_entry();
+        check_posix_acl_xattr_header();
+#endif
 
 
         printf("}\n\n");
index 04b561d..85257f0 100644 (file)
@@ -2140,5 +2140,36 @@ void lustre_assert_wire_constants(void)
                  (long long)(int)offsetof(struct lustre_disk_data, ldd_params));
         LASSERTF((int)sizeof(((struct lustre_disk_data *)0)->ldd_params) == 4096, " found %lld\n",
                  (long long)(int)sizeof(((struct lustre_disk_data *)0)->ldd_params));
+
+#ifdef LIBLUSTRE_POSIX_ACL
+        /* Checks for type posix_acl_xattr_entry */
+        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(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
+
 }