Whamcloud - gitweb
b=21951 2.6.32-fc13 patchless client support for HEAD
[fs/lustre-release.git] / libcfs / autoconf / lustre-libcfs.m4
index 467874c..49c5a21 100644 (file)
@@ -213,56 +213,6 @@ LB_LINUX_TRY_COMPILE([
 EXTRA_KCFLAGS="$tmp_flags"
 ])
 
-# check userland size_t type
-AC_DEFUN([LIBCFS_SIZE_T_LONG],
-[AC_MSG_CHECKING([size_t is unsigned long type])
-tmp_flags="$CFLAGS"
-CFLAGS="$CFLAGS -Werror"
-AC_COMPILE_IFELSE([
-       #include <linux/types.h>
-       #include <linux/stddef.h>
-       int main(void) {
-               unsigned long *data1;
-               size_t *data2 = NULL;
-
-               data1 = data2;
-               return 0;
-       }
-],[
-       AC_MSG_RESULT([yes])
-        AC_DEFINE(HAVE_SIZE_T_LONG, 1,
-                  [size_t is long type])
-],[
-       AC_MSG_RESULT([no])
-])
-CFLAGS="$tmp_flags"
-])
-
-AC_DEFUN([LIBCFS_SSIZE_T_LONG],
-[AC_MSG_CHECKING([ssize_t is signed long type])
-tmp_flags="$CFLAGS"
-CFLAGS="$CFLAGS -Werror"
-AC_COMPILE_IFELSE([
-       #include <linux/types.h>
-       #include <linux/stddef.h>
-       int main(void) {
-               long *data1;
-               ssize_t *data2 = NULL;
-
-               data1 = data2;
-               return 0;
-       }
-],[
-       AC_MSG_RESULT([yes])
-        AC_DEFINE(HAVE_SSIZE_T_LONG, 1,
-                  [ssize_t is long type])
-],[
-       AC_MSG_RESULT([no])
-])
-CFLAGS="$tmp_flags"
-])
-
-
 # check if task_struct with rcu memeber
 AC_DEFUN([LIBCFS_TASK_RCU],
 [AC_MSG_CHECKING([if task_struct has a rcu field])
@@ -502,13 +452,29 @@ LB_LINUX_TRY_COMPILE([
 ])
 ])
 
+# from 2.6.24 please use sg_init_table
+AC_DEFUN([LIBCFS_SCATTERLIST_INITTABLE],
+[AC_MSG_CHECKING([if sg_init_table is defined])
+LB_LINUX_TRY_COMPILE([
+        #include <linux/scatterlist.h>
+],[
+       sg_init_table(NULL,0);
+],[
+        AC_MSG_RESULT(yes)
+        AC_DEFINE(HAVE_SCATTERLIST_INITTABLE, 1,
+                  [sg_init_table is defined])
+],[
+        AC_MSG_RESULT(NO)
+])
+])
+
 # 2.6.24 
 AC_DEFUN([LIBCFS_NETWORK_NAMESPACE],
 [AC_MSG_CHECKING([for network stack has namespaces])
 LB_LINUX_TRY_COMPILE([
         #include <net/net_namespace.h>
 ],[
-        struct net *net = &init_ns;
+        struct net *net = &init_net;
 ],[
         AC_MSG_RESULT(yes)
         AC_DEFINE(HAVE_INIT_NET, 1,
@@ -644,6 +610,70 @@ LB_LINUX_TRY_COMPILE([
 ])
 ])
 
+# LIBCFS_CRED_WRAPPERS
+#
+# wrappers for task's credentials are in sles11
+#
+AC_DEFUN([LIBCFS_CRED_WRAPPERS],
+[AC_MSG_CHECKING([if kernel has wrappers for task's credentials])
+LB_LINUX_TRY_COMPILE([
+       #include <linux/sched.h>
+],[
+       uid_t uid;
+
+       uid = current_uid();
+],[
+       AC_MSG_RESULT([yes])
+       AC_DEFINE(HAVE_CRED_WRAPPERS, 1, [task's cred wrappers found])
+],[
+       AC_MSG_RESULT([no])
+])
+])
+
+#
+# LN_STRUCT_CRED_IN_TASK
+#
+# struct cred was introduced in 2.6.29 to streamline credentials in task struct
+#
+AC_DEFUN([LIBCFS_STRUCT_CRED_IN_TASK],
+[AC_MSG_CHECKING([if kernel has struct cred])
+LB_LINUX_TRY_COMPILE([
+       #include <linux/sched.h>
+],[
+       struct task_struct *tsk = NULL;
+       tsk->real_cred = NULL;
+],[
+       AC_MSG_RESULT([yes])
+       AC_DEFINE(HAVE_STRUCT_CRED, 1, [struct cred found])
+],[
+       AC_MSG_RESULT([no])
+])
+])
+
+#
+# LIBCFS_FUNC_UNSHARE_FS_STRUCT
+#
+# unshare_fs_struct was introduced in 2.6.30 to prevent others to directly
+# mess with copy_fs_struct
+#
+AC_DEFUN([LIBCFS_FUNC_UNSHARE_FS_STRUCT],
+[AC_MSG_CHECKING([if kernel defines unshare_fs_struct()])
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_LINUX_TRY_COMPILE([
+       #include <linux/sched.h>
+       #include <linux/fs_struct.h>
+],[
+       unshare_fs_struct();
+],[
+       AC_MSG_RESULT([yes])
+       AC_DEFINE(HAVE_UNSHARE_FS_STRUCT, 1, [unshare_fs_struct found])
+],[
+       AC_MSG_RESULT([no])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+])
+
 #
 # LIBCFS_PROG_LINUX
 #
@@ -660,8 +690,6 @@ LIBCFS_STRUCT_PAGE_LIST
 LIBCFS_STRUCT_SIGHAND
 LIBCFS_FUNC_SHOW_TASK
 LIBCFS_U64_LONG_LONG
-LIBCFS_SSIZE_T_LONG
-LIBCFS_SIZE_T_LONG
 LIBCFS_TASK_RCU
 # 2.6.18
 LIBCFS_TASKLIST_LOCK
@@ -681,12 +709,19 @@ LIBCFS_NETLINK_CBMUTEX
 # 2.6.24
 LIBCFS_SYSCTL_UNNUMBERED
 LIBCFS_SCATTERLIST_SETPAGE
+LIBCFS_SCATTERLIST_INITTABLE
 LIBCFS_NL_BROADCAST_GFP
 LIBCFS_NETWORK_NAMESPACE
 LIBCFS_NETLINK_NETNS
 LIBCFS_FUNC_DUMP_TRACE
 # 2.6.26
 LIBCFS_SEM_COUNT
+# 2.6.27
+LIBCFS_CRED_WRAPPERS
+# 2.6.29
+LIBCFS_STRUCT_CRED_IN_TASK
+# 2.6.30
+LIBCFS_FUNC_UNSHARE_FS_STRUCT
 LIBCFS_SOCK_MAP_FD_2ARG
 ])
 
@@ -847,16 +882,9 @@ libcfs/include/libcfs/util/Makefile
 libcfs/libcfs/Makefile
 libcfs/libcfs/autoMakefile
 libcfs/libcfs/linux/Makefile
-libcfs/libcfs/ulinux/Makefile
 libcfs/libcfs/posix/Makefile
 libcfs/libcfs/util/Makefile
-])
-case $lb_target_os in
-       darwin)
-               AC_CONFIG_FILES([
 libcfs/include/libcfs/darwin/Makefile
 libcfs/libcfs/darwin/Makefile
 ])
-               ;;
-esac
 ])