])
])
+# since 2.6.19 nlmsg_multicast() needs 5 argument.
+AC_DEFUN([LIBCFS_NLMSG_MULTICAST],
+[AC_MSG_CHECKING([nlmsg_multicast needs 5 argument])
+LB_LINUX_TRY_COMPILE([
+ #include <net/netlink.h>
+],[
+ nlmsg_multicast(NULL, NULL, 0, 0, 0);
+],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_NLMSG_MULTICAST_5ARGS, 1,
+ [nlmsg_multicast needs 5 argument])
+],[
+ AC_MSG_RESULT(NO)
+])
+])
+
+#
+# LIBCFS_NETLINK
+#
+# If we have netlink.h, and nlmsg_new takes 2 args (2.6.19)
+#
+AC_DEFUN([LIBCFS_NETLINK],
+[AC_MSG_CHECKING([if netlink.h can be compiled])
+LB_LINUX_TRY_COMPILE([
+ #include <net/netlink.h>
+],[],[
+ AC_MSG_RESULT([yes])
+ AC_DEFINE(HAVE_NETLINK, 1, [net/netlink.h found])
+
+ AC_MSG_CHECKING([if nlmsg_new takes a 2nd argument])
+ LB_LINUX_TRY_COMPILE([
+ #include <net/netlink.h>
+ ],[
+ nlmsg_new(100, GFP_KERNEL);
+ ],[
+ AC_MSG_RESULT([yes])
+ AC_DEFINE(HAVE_NETLINK_NL2, 1, [nlmsg_new takes 2 args])
+ ],[
+ AC_MSG_RESULT([no])
+ ])
+],[
+ AC_MSG_RESULT([no])
+])
+])
+
# 2.6.20 API change INIT_WORK use 2 args and not
# store data inside
AC_DEFUN([LIBCFS_3ARGS_INIT_WORK],
])
EXTRA_KCFLAGS="$tmp_flags"
])
+
# 2.6.23 lost dtor argument
AC_DEFUN([LIBCFS_KMEM_CACHE_CREATE_DTOR],
[AC_MSG_CHECKING([check kmem_cache_create has dtor argument])
])
])
+# 2.6.24
+AC_DEFUN([LIBCFS_NETLINK_CBMUTEX],
+[AC_MSG_CHECKING([for mutex in netlink_kernel_create])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/netlink.h>
+],[
+ struct mutex *lock = NULL;
+
+ netlink_kernel_create(0, 0, NULL, lock, NULL);
+],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_NETLINK_CBMUTEX, 1,
+ [netlink_kernel_create want mutex for callback])
+],[
+ AC_MSG_RESULT(NO)
+])
+])
+
# 2.6.24 request not use real numbers for ctl_name
-AC_DEFUN([LN_SYSCTL_UNNUMBERED],
+AC_DEFUN([LIBCFS_SYSCTL_UNNUMBERED],
[AC_MSG_CHECKING([for CTL_UNNUMBERED])
LB_LINUX_TRY_COMPILE([
#include <linux/sysctl.h>
])
# 2.6.24 lost scatterlist->page
-AC_DEFUN([LN_SCATTERLIST_SETPAGE],
+AC_DEFUN([LIBCFS_SCATTERLIST_SETPAGE],
[AC_MSG_CHECKING([for exist sg_set_page])
LB_LINUX_TRY_COMPILE([
#include <linux/scatterlist.h>
])
])
+# 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;
+],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_INIT_NET, 1,
+ [kernel is support network namespaces ])
+],[
+ AC_MSG_RESULT(NO)
+])
+])
+
+
+# 2.6.24
+AC_DEFUN([LIBCFS_NETLINK_NETNS],
+[AC_MSG_CHECKING([for netlink support net ns])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/netlink.h>
+],[
+ struct net *net = NULL;
+ struct mutex *lock = NULL;
+
+ netlink_kernel_create(net, 0, 0, NULL,
+ lock,
+ NULL);
+],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_NETLINK_NS, 1,
+ [netlink is support network namespace])
+# XXX
+# for now - if kernel have netlink ns - he uses cbmutex
+ AC_DEFINE(HAVE_NETLINK_CBMUTEX, 1,
+ [netlink_kernel_create want mutex for callback])
+
+],[
+ AC_MSG_RESULT(NO)
+])
+])
+
+# ~2.6.24
+AC_DEFUN([LIBCFS_NL_BROADCAST_GFP],
+[AC_MSG_CHECKING([for netlink_broadcast is want to have gfp parameter])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/netlink.h>
+],[
+ gfp_t gfp = GFP_KERNEL;
+
+ netlink_broadcast(NULL, NULL, 0, 0, gfp);
+],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_NL_BROADCAST_GFP, 1,
+ [netlink brouacast is want to have gfp paramter])
+],[
+ AC_MSG_RESULT(NO)
+])
+])
+
+#
+# LIBCFS_FUNC_DUMP_TRACE
+#
+# 2.6.23 exports dump_trace() so we can dump_stack() on any task
+# 2.6.24 has stacktrace_ops.address with "reliable" parameter
+#
+AC_DEFUN([LIBCFS_FUNC_DUMP_TRACE],
+[LB_CHECK_SYMBOL_EXPORT([dump_trace],
+[kernel/ksyms.c arch/${LINUX_ARCH%_64}/kernel/traps_64.c],[
+ tmp_flags="$EXTRA_KCFLAGS"
+ EXTRA_KCFLAGS="-Werror"
+ AC_MSG_CHECKING([whether we can really use dump_stack])
+ LB_LINUX_TRY_COMPILE([
+ struct task_struct;
+ struct pt_regs;
+ #include <asm/stacktrace.h>
+ ],[
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_DUMP_TRACE, 1, [dump_trace is exported])
+ ],[
+ AC_MSG_RESULT(no)
+ ],[
+ ])
+ AC_MSG_CHECKING([whether print_trace_address has reliable argument])
+ LB_LINUX_TRY_COMPILE([
+ struct task_struct;
+ struct pt_regs;
+ void print_addr(void *data, unsigned long addr, int reliable);
+ #include <asm/stacktrace.h>
+ ],[
+ struct stacktrace_ops ops;
+
+ ops.address = print_addr;
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_TRACE_ADDRESS_RELIABLE, 1,
+ [print_trace_address has reliable argument])
+ ],[
+ AC_MSG_RESULT(no)
+ ],[
+ ])
+EXTRA_KCFLAGS="$tmp_flags"
+])
+])
+
+
# 2.6.26 use int instead of atomic for sem.count
-AC_DEFUN([LN_SEM_COUNT],
+AC_DEFUN([LIBCFS_SEM_COUNT],
[AC_MSG_CHECKING([atomic sem.count])
LB_LINUX_TRY_COMPILE([
#include <asm/semaphore.h>
])
])
+# 2.6.27 have second argument to sock_map_fd
+AC_DEFUN([LIBCFS_SOCK_MAP_FD_2ARG],
+[AC_MSG_CHECKING([sock_map_fd have second argument])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/net.h>
+],[
+ sock_map_fd(NULL, 0);
+],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_SOCK_MAP_FD_2ARG, 1,
+ [sock_map_fd have second argument])
+],[
+ AC_MSG_RESULT(NO)
+])
+])
+
#
# LIBCFS_PROG_LINUX
#
# 2.6.18
LIBCFS_TASKLIST_LOCK
# 2.6.19
+LIBCFS_NETLINK
+LIBCFS_NLMSG_MULTICAST
LIBCFS_KMEM_CACHE_DESTROY_INT
LIBCFS_ATOMIC_PANIC_NOTIFIER
# 2.6.20
LIBCFS_KMEM_CACHE
# 2.6.23
LIBCFS_KMEM_CACHE_CREATE_DTOR
+LIBCFS_NETLINK_CBMUTEX
# 2.6.24
-LN_SYSCTL_UNNUMBERED
-LN_SCATTERLIST_SETPAGE
+LIBCFS_SYSCTL_UNNUMBERED
+LIBCFS_SCATTERLIST_SETPAGE
+LIBCFS_NL_BROADCAST_GFP
+LIBCFS_NETWORK_NAMESPACE
+LIBCFS_NETLINK_NETNS
+LIBCFS_FUNC_DUMP_TRACE
# 2.6.26
-LN_SEM_COUNT
+LIBCFS_SEM_COUNT
+LIBCFS_SOCK_MAP_FD_2ARG
])
#