Whamcloud - gitweb
Branch b1_8
authoryangsheng <yangsheng>
Fri, 25 Sep 2009 03:55:54 +0000 (03:55 +0000)
committeryangsheng <yangsheng>
Fri, 25 Sep 2009 03:55:54 +0000 (03:55 +0000)
b=18668

i=johann, panda

Config check for cred.h to avoid current_* redefined.

lnet/autoconf/lustre-lnet.m4
lnet/include/libcfs/linux/libcfs.h

index fd624a8..3459a22 100644 (file)
@@ -1440,6 +1440,16 @@ LB_LINUX_TRY_COMPILE([
 ])
 ])
 
+# since 2.6.27 have linux/cred.h defined current_* macro
+AC_DEFUN([LN_HAVE_LINUX_CRED_H],
+[LB_CHECK_FILE([$LINUX/include/linux/cred.h],[
+        AC_DEFINE(HAVE_LINUX_CRED_H, 1,
+                [kernel has include/linux/cred.h])
+],[
+        AC_MSG_RESULT([no])
+])
+])
+
 #
 #
 # LN_CONFIG_USERSPACE
@@ -1546,6 +1556,7 @@ LN_SEM_COUNT
 # 2.6.27
 LN_SOCK_MAP_FD_2ARG
 LN_FUNC_DUMP_TRACE
+LN_HAVE_LINUX_CRED_H
 #2.6.29
 LN_STRUCT_CRED_IN_TASK
 # 2.6.30
index ea4b79c..a5f0191 100644 (file)
@@ -211,6 +211,8 @@ struct cfs_stack_trace {
         current->xxx;                     \
 })
 
+#ifndef HAVE_LINUX_CRED_H
+
 #define current_uid()           (current_cred_xxx(uid))
 #define current_gid()           (current_cred_xxx(gid))
 #define current_euid()          (current_cred_xxx(euid))
@@ -220,6 +222,9 @@ struct cfs_stack_trace {
 #define current_fsuid()         (current_cred_xxx(fsuid))
 #define current_fsgid()         (current_cred_xxx(fsgid))
 #define current_cap()           (current_cred_xxx(cap_effective))
+
+#endif /* HAVE_LINUX_CRED_H */
+
 #define current_user()          (current_cred_xxx(user))
 #define current_user_ns()       (current_cred_xxx(user)->user_ns)
 #define current_security()      (current_cred_xxx(security))
@@ -228,7 +233,8 @@ struct cfs_stack_trace {
 
 #define prepare_creds() (current)
 #define commit_creds(a)
-#endif
+
+#endif /* HAVE_STRUCT_CRED */
 
 #endif