1 ###############################################################################
2 # Copyright (C) 2007-2010 Lawrence Livermore National Security, LLC.
3 # Copyright (C) 2007 The Regents of the University of California.
4 # Written by Brian Behlendorf <behlendorf1@llnl.gov>.
5 ###############################################################################
6 # SPL_AC_CONFIG_KERNEL: Default SPL kernel configuration.
7 ###############################################################################
9 AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
12 if test "${LINUX_OBJ}" != "${LINUX}"; then
13 KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ"
15 AC_SUBST(KERNELMAKE_PARAMS)
17 KERNELCPPFLAGS="$KERNELCPPFLAGS -Wstrict-prototypes"
18 AC_SUBST(KERNELCPPFLAGS)
22 SPL_AC_DEBUG_KMEM_TRACKING
23 SPL_AC_ATOMIC_SPINLOCK
24 SPL_AC_TYPE_ATOMIC64_CMPXCHG
25 SPL_AC_TYPE_ATOMIC64_XCHG
27 SPL_AC_3ARGS_INIT_WORK
28 SPL_AC_2ARGS_REGISTER_SYSCTL
30 SPL_AC_3ARGS_SHRINKER_CALLBACK
31 SPL_AC_PATH_IN_NAMEIDATA
37 SPL_AC_5ARGS_DEVICE_CREATE
38 SPL_AC_CLASS_DEVICE_CREATE
39 SPL_AC_SET_NORMALIZED_TIMESPEC_EXPORT
40 SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE
47 SPL_AC_MONOTONIC_CLOCK
50 SPL_AC_MUTEX_LOCK_NESTED
51 SPL_AC_3ARGS_ON_EACH_CPU
52 SPL_AC_KALLSYMS_LOOKUP_NAME
53 SPL_AC_GET_VMALLOC_INFO
55 SPL_AC_FIRST_ONLINE_PGDAT
56 SPL_AC_NEXT_ONLINE_PGDAT
59 SPL_AC_GLOBAL_PAGE_STATE
60 SPL_AC_ZONE_STAT_ITEM_FREE
61 SPL_AC_ZONE_STAT_ITEM_INACTIVE
62 SPL_AC_ZONE_STAT_ITEM_ACTIVE
63 SPL_AC_GET_ZONE_COUNTS
66 SPL_AC_2ARGS_SET_FS_PWD
67 SPL_AC_2ARGS_VFS_UNLINK
68 SPL_AC_4ARGS_VFS_RENAME
69 SPL_AC_FS_STRUCT_SPINLOCK
72 SPL_AC_PUT_TASK_STRUCT
73 SPL_AC_5ARGS_PROC_HANDLER
75 SPL_AC_3ARGS_FILE_FSYNC
76 SPL_AC_EXPORTED_RWSEM_IS_LOCKED
79 AC_DEFUN([SPL_AC_MODULE_SYMVERS], [
80 modpost=$LINUX/scripts/Makefile.modpost
81 AC_MSG_CHECKING([kernel file name for module symbols])
82 if test -f "$modpost"; then
83 if grep -q Modules.symvers $modpost; then
84 LINUX_SYMBOLS=Modules.symvers
86 LINUX_SYMBOLS=Module.symvers
91 AC_MSG_RESULT($LINUX_SYMBOLS)
92 AC_SUBST(LINUX_SYMBOLS)
95 AC_DEFUN([SPL_AC_KERNEL], [
97 AS_HELP_STRING([--with-linux=PATH],
98 [Path to kernel source]),
99 [kernelsrc="$withval"])
101 AC_ARG_WITH([linux-obj],
102 AS_HELP_STRING([--with-linux-obj=PATH],
103 [Path to kernel build objects]),
104 [kernelbuild="$withval"])
106 AC_MSG_CHECKING([kernel source directory])
107 if test -z "$kernelsrc"; then
108 if test -e "/lib/modules/$(uname -r)/source"; then
109 headersdir="/lib/modules/$(uname -r)/source"
110 sourcelink=$(readlink -f "$headersdir")
111 elif test -e "/lib/modules/$(uname -r)/build"; then
112 headersdir="/lib/modules/$(uname -r)/build"
113 sourcelink=$(readlink -f "$headersdir")
115 sourcelink=$(ls -1d /usr/src/kernels/* \
117 2>/dev/null | grep -v obj | tail -1)
120 if test -n "$sourcelink" && test -e ${sourcelink}; then
121 kernelsrc=`readlink -f ${sourcelink}`
123 AC_MSG_RESULT([Not found])
125 *** Please make sure the kernel devel package for your distribution
126 *** is installed then try again. If that fails you can specify the
127 *** location of the kernel source with the '--with-linux=PATH' option.])
130 if test "$kernelsrc" = "NONE"; then
135 AC_MSG_RESULT([$kernelsrc])
136 AC_MSG_CHECKING([kernel build directory])
137 if test -z "$kernelbuild"; then
138 if test -e "/lib/modules/$(uname -r)/build"; then
139 kernelbuild=`readlink -f /lib/modules/$(uname -r)/build`
140 elif test -d ${kernelsrc}-obj/${target_cpu}/${target_cpu}; then
141 kernelbuild=${kernelsrc}-obj/${target_cpu}/${target_cpu}
142 elif test -d ${kernelsrc}-obj/${target_cpu}/default; then
143 kernelbuild=${kernelsrc}-obj/${target_cpu}/default
144 elif test -d `dirname ${kernelsrc}`/build-${target_cpu}; then
145 kernelbuild=`dirname ${kernelsrc}`/build-${target_cpu}
147 kernelbuild=${kernelsrc}
150 AC_MSG_RESULT([$kernelbuild])
152 AC_MSG_CHECKING([kernel source version])
153 utsrelease1=$kernelbuild/include/linux/version.h
154 utsrelease2=$kernelbuild/include/linux/utsrelease.h
155 utsrelease3=$kernelbuild/include/generated/utsrelease.h
156 if test -r $utsrelease1 && fgrep -q UTS_RELEASE $utsrelease1; then
157 utsrelease=linux/version.h
158 elif test -r $utsrelease2 && fgrep -q UTS_RELEASE $utsrelease2; then
159 utsrelease=linux/utsrelease.h
160 elif test -r $utsrelease3 && fgrep -q UTS_RELEASE $utsrelease3; then
161 utsrelease=generated/utsrelease.h
164 if test "$utsrelease"; then
165 kernsrcver=`(echo "#include <$utsrelease>";
166 echo "kernsrcver=UTS_RELEASE") |
167 cpp -I $kernelbuild/include |
168 grep "^kernsrcver=" | cut -d \" -f 2`
170 if test -z "$kernsrcver"; then
171 AC_MSG_RESULT([Not found])
172 AC_MSG_ERROR([*** Cannot determine kernel version.])
175 AC_MSG_RESULT([Not found])
176 AC_MSG_ERROR([*** Cannot find UTS_RELEASE definition.])
179 AC_MSG_RESULT([$kernsrcver])
182 LINUX_OBJ=${kernelbuild}
183 LINUX_VERSION=${kernsrcver}
187 AC_SUBST(LINUX_VERSION)
189 SPL_AC_MODULE_SYMVERS
193 dnl # Explicitly check for gawk, we require it for the the usermode
194 dnl # helper. For some reason the standard awk command does not
195 dnl # behave correctly when invoked from the usermode helper.
197 AC_DEFUN([SPL_AC_GAWK], [
198 AS_IF([test "x$AWK" != xgawk], [
200 *** Required util gawk missing. Please install the required
201 *** gawk package for your distribution and try again.])
206 dnl # Default SPL user configuration
208 AC_DEFUN([SPL_AC_CONFIG_USER], [
213 dnl # Check for rpm+rpmbuild to build RPM packages. If these tools
214 dnl # are missing it is non-fatal but you will not be able to build
215 dnl # RPM packages and will be warned if you try too.
217 AC_DEFUN([SPL_AC_RPM], [
221 AC_MSG_CHECKING([whether $RPM is available])
222 AS_IF([tmp=$($RPM --version 2>/dev/null)], [
223 RPM_VERSION=$(echo $tmp | $AWK '/RPM/ { print $[3] }')
225 AC_MSG_RESULT([$HAVE_RPM ($RPM_VERSION)])
228 AC_MSG_RESULT([$HAVE_RPM])
231 AC_MSG_CHECKING([whether $RPMBUILD is available])
232 AS_IF([tmp=$($RPMBUILD --version 2>/dev/null)], [
233 RPMBUILD_VERSION=$(echo $tmp | $AWK '/RPM/ { print $[3] }')
235 AC_MSG_RESULT([$HAVE_RPMBUILD ($RPMBUILD_VERSION)])
238 AC_MSG_RESULT([$HAVE_RPMBUILD])
243 AC_SUBST(RPM_VERSION)
245 AC_SUBST(HAVE_RPMBUILD)
247 AC_SUBST(RPMBUILD_VERSION)
251 dnl # Check for dpkg+dpkg-buildpackage to build DEB packages. If these
252 dnl # tools are missing it is non-fatal but you will not be able to build
253 dnl # DEB packages and will be warned if you try too.
255 AC_DEFUN([SPL_AC_DPKG], [
257 DPKGBUILD=dpkg-buildpackage
259 AC_MSG_CHECKING([whether $DPKG is available])
260 AS_IF([tmp=$($DPKG --version 2>/dev/null)], [
261 DPKG_VERSION=$(echo $tmp | $AWK '/Debian/ { print $[7] }')
263 AC_MSG_RESULT([$HAVE_DPKG ($DPKG_VERSION)])
266 AC_MSG_RESULT([$HAVE_DPKG])
269 AC_MSG_CHECKING([whether $DPKGBUILD is available])
270 AS_IF([tmp=$($DPKGBUILD --version 2>/dev/null)], [
271 DPKGBUILD_VERSION=$(echo $tmp | \
272 $AWK '/Debian/ { print $[4] }' | cut -f-4 -d'.')
274 AC_MSG_RESULT([$HAVE_DPKGBUILD ($DPKGBUILD_VERSION)])
277 AC_MSG_RESULT([$HAVE_DPKGBUILD])
282 AC_SUBST(DPKG_VERSION)
284 AC_SUBST(HAVE_DPKGBUILD)
286 AC_SUBST(DPKGBUILD_VERSION)
290 dnl # Until native packaging for various different packing systems
291 dnl # can be added the least we can do is attempt to use alien to
292 dnl # convert the RPM packages to the needed package type. This is
293 dnl # a hack but so far it has worked reasonable well.
295 AC_DEFUN([SPL_AC_ALIEN], [
298 AC_MSG_CHECKING([whether $ALIEN is available])
299 AS_IF([tmp=$($ALIEN --version 2>/dev/null)], [
300 ALIEN_VERSION=$(echo $tmp | $AWK '{ print $[3] }')
302 AC_MSG_RESULT([$HAVE_ALIEN ($ALIEN_VERSION)])
305 AC_MSG_RESULT([$HAVE_ALIEN])
310 AC_SUBST(ALIEN_VERSION)
314 dnl # Using the VENDOR tag from config.guess set the default
315 dnl # package type for 'make pkg': (rpm | deb | tgz)
317 AC_DEFUN([SPL_AC_DEFAULT_PACKAGE], [
318 AC_MSG_CHECKING([linux distribution])
319 if test -f /etc/redhat-release ; then
321 elif test -f /etc/fedora-release ; then
323 elif test -f /etc/lsb-release ; then
325 elif test -f /etc/debian_version ; then
327 elif test -f /etc/SuSE-release ; then
329 elif test -f /etc/slackware-version ; then
331 elif test -f /etc/gentoo-release ; then
336 AC_MSG_RESULT([$VENDOR])
339 AC_MSG_CHECKING([default package type])
341 fedora) DEFAULT_PACKAGE=rpm ;;
342 redhat) DEFAULT_PACKAGE=rpm ;;
343 sles) DEFAULT_PACKAGE=rpm ;;
344 ubuntu) DEFAULT_PACKAGE=deb ;;
345 debian) DEFAULT_PACKAGE=deb ;;
346 slackware) DEFAULT_PACKAGE=tgz ;;
347 *) DEFAULT_PACKAGE=rpm ;;
350 AC_MSG_RESULT([$DEFAULT_PACKAGE])
351 AC_SUBST(DEFAULT_PACKAGE)
355 dnl # Default SPL user configuration
357 AC_DEFUN([SPL_AC_PACKAGE], [
361 SPL_AC_DEFAULT_PACKAGE
364 AC_DEFUN([SPL_AC_LICENSE], [
365 AC_MSG_CHECKING([spl license])
367 AC_MSG_RESULT([$LICENSE])
368 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DHAVE_GPL_ONLY_SYMBOLS"
372 AC_DEFUN([SPL_AC_CONFIG], [
374 AC_ARG_WITH([config],
375 AS_HELP_STRING([--with-config=CONFIG],
376 [Config file 'kernel|user|all|srpm']),
377 [SPL_CONFIG="$withval"])
379 AC_MSG_CHECKING([spl config])
380 AC_MSG_RESULT([$SPL_CONFIG]);
383 case "$SPL_CONFIG" in
384 kernel) SPL_AC_CONFIG_KERNEL ;;
385 user) SPL_AC_CONFIG_USER ;;
386 all) SPL_AC_CONFIG_KERNEL
387 SPL_AC_CONFIG_USER ;;
390 AC_MSG_RESULT([Error!])
391 AC_MSG_ERROR([Bad value "$SPL_CONFIG" for --with-config,
392 user kernel|user|all|srpm]) ;;
395 AM_CONDITIONAL([CONFIG_USER],
396 [test "$SPL_CONFIG" = user] ||
397 [test "$SPL_CONFIG" = all])
398 AM_CONDITIONAL([CONFIG_KERNEL],
399 [test "$SPL_CONFIG" = kernel] ||
400 [test "$SPL_CONFIG" = all])
404 dnl # Enable if the SPL should be compiled with internal debugging enabled.
405 dnl # By default this support is disabled.
407 AC_DEFUN([SPL_AC_DEBUG], [
408 AC_MSG_CHECKING([whether debugging is enabled])
409 AC_ARG_ENABLE([debug],
410 [AS_HELP_STRING([--enable-debug],
411 [Enable generic debug support @<:@default=no@:>@])],
415 AS_IF([test "x$enable_debug" = xyes],
417 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG -Werror"
418 DEBUG_CFLAGS="-DDEBUG -Werror"
421 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG"
422 DEBUG_CFLAGS="-DNDEBUG"
425 AC_SUBST(DEBUG_CFLAGS)
426 AC_MSG_RESULT([$enable_debug])
430 dnl # Enabled by default it provides a minimal level of memory tracking.
431 dnl # A total count of bytes allocated is kept for each alloc and free.
432 dnl # Then at module unload time a report to the console will be printed
433 dnl # if memory was leaked. Additionally, /proc/spl/kmem/slab will exist
434 dnl # and provide an easy way to inspect the kmem based slab.
436 AC_DEFUN([SPL_AC_DEBUG_KMEM], [
437 AC_ARG_ENABLE([debug-kmem],
438 [AS_HELP_STRING([--enable-debug-kmem],
439 [Enable basic kmem accounting @<:@default=yes@:>@])],
441 [enable_debug_kmem=yes])
443 AS_IF([test "x$enable_debug_kmem" = xyes],
444 [AC_DEFINE([DEBUG_KMEM], [1],
445 [Define to 1 to enable basic kmem accounting])
446 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM"])
448 AC_MSG_CHECKING([whether basic kmem accounting is enabled])
449 AC_MSG_RESULT([$enable_debug_kmem])
453 dnl # Disabled by default it provides detailed memory tracking. This
454 dnl # feature also requires --enable-debug-kmem to be set. When enabled
455 dnl # not only will total bytes be tracked but also the location of every
456 dnl # alloc and free. When the SPL module is unloaded a list of all leaked
457 dnl # addresses and where they were allocated will be dumped to the console.
458 dnl # Enabling this feature has a significant impact on performance but it
459 dnl # makes finding memory leaks pretty straight forward.
461 AC_DEFUN([SPL_AC_DEBUG_KMEM_TRACKING], [
462 AC_ARG_ENABLE([debug-kmem-tracking],
463 [AS_HELP_STRING([--enable-debug-kmem-tracking],
464 [Enable detailed kmem tracking @<:@default=no@:>@])],
466 [enable_debug_kmem_tracking=no])
468 AS_IF([test "x$enable_debug_kmem_tracking" = xyes],
469 [AC_DEFINE([DEBUG_KMEM_TRACKING], [1],
470 [Define to 1 to enable detailed kmem tracking])
471 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM_TRACKING"])
473 AC_MSG_CHECKING([whether detailed kmem tracking is enabled])
474 AC_MSG_RESULT([$enable_debug_kmem_tracking])
478 dnl # SPL_LINUX_CONFTEST
480 AC_DEFUN([SPL_LINUX_CONFTEST], [
481 cat confdefs.h - <<_ACEOF >conftest.c
487 dnl # SPL_LANG_PROGRAM(C)([PROLOGUE], [BODY])
489 m4_define([SPL_LANG_PROGRAM], [
494 dnl Do *not* indent the following line: there may be CPP directives.
495 dnl Don't move the `;' right after for the same reason.
503 dnl # SPL_LINUX_COMPILE_IFELSE / like AC_COMPILE_IFELSE
505 AC_DEFUN([SPL_LINUX_COMPILE_IFELSE], [
506 m4_ifvaln([$1], [SPL_LINUX_CONFTEST([$1])])
507 rm -Rf build && mkdir -p build
508 echo "obj-m := conftest.o" >build/Makefile
510 [AC_TRY_COMMAND(cp conftest.c build && make [$2] -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build) >/dev/null && AC_TRY_COMMAND([$3])],
512 [_AC_MSG_LOG_CONFTEST m4_ifvaln([$5],[$5])]
518 dnl # SPL_LINUX_TRY_COMPILE like AC_TRY_COMPILE
520 AC_DEFUN([SPL_LINUX_TRY_COMPILE],
521 [SPL_LINUX_COMPILE_IFELSE(
522 [AC_LANG_SOURCE([SPL_LANG_PROGRAM([[$1]], [[$2]])])],
524 [test -s build/conftest.o],
529 dnl # SPL_LINUX_CONFIG
531 AC_DEFUN([SPL_LINUX_CONFIG],
532 [AC_MSG_CHECKING([whether Linux was built with CONFIG_$1])
533 SPL_LINUX_TRY_COMPILE([
534 #ifndef AUTOCONF_INCLUDED
535 #include <linux/config.h>
539 #error CONFIG_$1 not #defined
551 dnl # SPL_CHECK_SYMBOL_EXPORT
552 dnl # check symbol exported or not
554 AC_DEFUN([SPL_CHECK_SYMBOL_EXPORT],
555 [AC_MSG_CHECKING([whether symbol $1 is exported])
556 grep -q -E '[[[:space:]]]$1[[[:space:]]]' \
557 $LINUX_OBJ/Module*.symvers 2>/dev/null
559 if test $rc -ne 0; then
562 grep -q -E "EXPORT_SYMBOL.*($1)" \
563 "$LINUX_OBJ/$file" 2>/dev/null
565 if test $rc -eq 0; then
570 if test $export -eq 0; then
584 dnl # SPL_CHECK_HEADER
585 dnl # check whether header exists and define HAVE_$2_HEADER
587 AC_DEFUN([SPL_CHECK_HEADER],
588 [AC_MSG_CHECKING([whether header $1 exists])
589 SPL_LINUX_TRY_COMPILE([
594 AC_DEFINE(HAVE_$2_HEADER, 1, [$1 exists])
604 dnl # Use the atomic implemenation based on global spinlocks. This
605 dnl # should only be needed by 32-bit kernels which do not provide
606 dnl # the atomic64_* API. It may be optionally enabled as a fallback
607 dnl # if problems are observed with the direct mapping to the native
608 dnl # Linux atomic operations. You may not disable atomic spinlocks
609 dnl # if you kernel does not an atomic64_* API.
611 AC_DEFUN([SPL_AC_ATOMIC_SPINLOCK], [
612 AC_ARG_ENABLE([atomic-spinlocks],
613 [AS_HELP_STRING([--enable-atomic-spinlocks],
614 [Atomic types use spinlocks @<:@default=check@:>@])],
616 [enable_atomic_spinlocks=check])
618 SPL_LINUX_TRY_COMPILE([
619 #include <asm/atomic.h>
624 AC_DEFINE(HAVE_ATOMIC64_T, 1,
625 [kernel defines atomic64_t])
630 AS_IF([test "x$enable_atomic_spinlocks" = xcheck], [
631 AS_IF([test "x$have_atomic64_t" = xyes], [
632 enable_atomic_spinlocks=no
634 enable_atomic_spinlocks=yes
638 AS_IF([test "x$enable_atomic_spinlocks" = xyes], [
639 AC_DEFINE([ATOMIC_SPINLOCK], [1],
640 [Atomic types use spinlocks])
642 AS_IF([test "x$have_atomic64_t" = xno], [
644 [--disable-atomic-spinlocks given but required atomic64 support is unavailable])
648 AC_MSG_CHECKING([whether atomic types use spinlocks])
649 AC_MSG_RESULT([$enable_atomic_spinlocks])
651 AC_MSG_CHECKING([whether kernel defines atomic64_t])
652 AC_MSG_RESULT([$have_atomic64_t])
656 dnl # 2.6.24 API change,
657 dnl # check if atomic64_cmpxchg is defined
659 AC_DEFUN([SPL_AC_TYPE_ATOMIC64_CMPXCHG],
660 [AC_MSG_CHECKING([whether kernel defines atomic64_cmpxchg])
661 SPL_LINUX_TRY_COMPILE([
662 #include <asm/atomic.h>
663 #include <asm/system.h>
665 atomic64_cmpxchg((atomic64_t *)NULL, 0, 0);
668 AC_DEFINE(HAVE_ATOMIC64_CMPXCHG, 1,
669 [kernel defines atomic64_cmpxchg])
676 dnl # 2.6.24 API change,
677 dnl # check if atomic64_xchg is defined
679 AC_DEFUN([SPL_AC_TYPE_ATOMIC64_XCHG],
680 [AC_MSG_CHECKING([whether kernel defines atomic64_xchg])
681 SPL_LINUX_TRY_COMPILE([
682 #include <asm/atomic.h>
684 atomic64_xchg((atomic64_t *)NULL, 0);
687 AC_DEFINE(HAVE_ATOMIC64_XCHG, 1,
688 [kernel defines atomic64_xchg])
695 dnl # 2.6.24 API change,
696 dnl # check if uintptr_t typedef is defined
698 AC_DEFUN([SPL_AC_TYPE_UINTPTR_T],
699 [AC_MSG_CHECKING([whether kernel defines uintptr_t])
700 SPL_LINUX_TRY_COMPILE([
701 #include <linux/types.h>
706 AC_DEFINE(HAVE_UINTPTR_T, 1,
707 [kernel defines uintptr_t])
714 dnl # 2.6.20 API change,
715 dnl # INIT_WORK use 2 args and not store data inside
717 AC_DEFUN([SPL_AC_3ARGS_INIT_WORK],
718 [AC_MSG_CHECKING([whether INIT_WORK wants 3 args])
719 SPL_LINUX_TRY_COMPILE([
720 #include <linux/workqueue.h>
722 struct work_struct work;
723 INIT_WORK(&work, NULL, NULL);
726 AC_DEFINE(HAVE_3ARGS_INIT_WORK, 1,
727 [INIT_WORK wants 3 args])
734 dnl # 2.6.21 API change,
735 dnl # 'register_sysctl_table' use only one argument instead of two
737 AC_DEFUN([SPL_AC_2ARGS_REGISTER_SYSCTL],
738 [AC_MSG_CHECKING([whether register_sysctl_table() wants 2 args])
739 SPL_LINUX_TRY_COMPILE([
740 #include <linux/sysctl.h>
742 return register_sysctl_table(NULL,0);
745 AC_DEFINE(HAVE_2ARGS_REGISTER_SYSCTL, 1,
746 [register_sysctl_table() wants 2 args])
753 dnl # 2.6.23 API change
754 dnl # Old set_shrinker API replaced with register_shrinker
756 AC_DEFUN([SPL_AC_SET_SHRINKER], [
757 AC_MSG_CHECKING([whether set_shrinker() available])
758 SPL_LINUX_TRY_COMPILE([
759 #include <linux/mm.h>
761 return set_shrinker(DEFAULT_SEEKS, NULL);
764 AC_DEFINE(HAVE_SET_SHRINKER, 1,
765 [set_shrinker() available])
772 dnl # 2.6.35 API change,
773 dnl # Add context to shrinker callback
775 AC_DEFUN([SPL_AC_3ARGS_SHRINKER_CALLBACK],
776 [AC_MSG_CHECKING([whether shrinker callback wants 3 args])
777 tmp_flags="$EXTRA_KCFLAGS"
778 EXTRA_KCFLAGS="-Werror"
779 SPL_LINUX_TRY_COMPILE([
780 #include <linux/mm.h>
782 int shrinker_cb(struct shrinker *, int, unsigned int);
784 struct shrinker cache_shrinker = {
785 .shrink = shrinker_cb,
786 .seeks = DEFAULT_SEEKS,
788 register_shrinker(&cache_shrinker);
791 AC_DEFINE(HAVE_3ARGS_SHRINKER_CALLBACK, 1,
792 [shrinker callback wants 3 args])
796 EXTRA_KCFLAGS="$tmp_flags"
800 dnl # 2.6.25 API change,
801 dnl # struct path entry added to struct nameidata
803 AC_DEFUN([SPL_AC_PATH_IN_NAMEIDATA],
804 [AC_MSG_CHECKING([whether struct path used in struct nameidata])
805 SPL_LINUX_TRY_COMPILE([
806 #include <linux/namei.h>
811 nd.path.dentry = NULL;
814 AC_DEFINE(HAVE_PATH_IN_NAMEIDATA, 1,
815 [struct path used in struct nameidata])
822 dnl # Custom SPL patch may export this system it is not required
824 AC_DEFUN([SPL_AC_TASK_CURR], [
825 SPL_CHECK_SYMBOL_EXPORT([task_curr], [kernel/sched.c],
826 [AC_DEFINE(HAVE_TASK_CURR, 1, [task_curr() exported])],
831 dnl # 2.6.19 API change,
832 dnl # Use CTL_UNNUMBERED when binary sysctl is not required
834 AC_DEFUN([SPL_AC_CTL_UNNUMBERED],
835 [AC_MSG_CHECKING([whether unnumbered sysctl support exists])
836 SPL_LINUX_TRY_COMPILE([
837 #include <linux/sysctl.h>
839 #ifndef CTL_UNNUMBERED
840 #error CTL_UNNUMBERED undefined
844 AC_DEFINE(HAVE_CTL_UNNUMBERED, 1,
845 [unnumbered sysctl support exists])
852 dnl # 2.6.33 API change,
853 dnl # Removed .ctl_name from struct ctl_table.
855 AC_DEFUN([SPL_AC_CTL_NAME], [
856 AC_MSG_CHECKING([whether struct ctl_table has ctl_name])
857 SPL_LINUX_TRY_COMPILE([
858 #include <linux/sysctl.h>
860 struct ctl_table ctl;
864 AC_DEFINE(HAVE_CTL_NAME, 1, [struct ctl_table has ctl_name])
871 dnl # 2.6.16 API change.
872 dnl # Check if 'fls64()' is available
874 AC_DEFUN([SPL_AC_FLS64],
875 [AC_MSG_CHECKING([whether fls64() is available])
876 SPL_LINUX_TRY_COMPILE([
877 #include <linux/bitops.h>
882 AC_DEFINE(HAVE_FLS64, 1, [fls64() is available])
889 dnl # 2.6.18 API change, check whether device_create() is available.
890 dnl # Device_create() was introduced in 2.6.18 and depricated
891 dnl # class_device_create() which was fully removed in 2.6.26.
893 AC_DEFUN([SPL_AC_DEVICE_CREATE], [
894 SPL_CHECK_SYMBOL_EXPORT(
896 [drivers/base/core.c],
897 [AC_DEFINE(HAVE_DEVICE_CREATE, 1,
898 [device_create() is available])],
903 dnl # 2.6.27 API change,
904 dnl # device_create() uses 5 args, new 'drvdata' argument.
906 AC_DEFUN([SPL_AC_5ARGS_DEVICE_CREATE], [
907 AC_MSG_CHECKING([whether device_create() wants 5 args])
908 tmp_flags="$EXTRA_KCFLAGS"
909 EXTRA_KCFLAGS="-Werror"
910 SPL_LINUX_TRY_COMPILE([
911 #include <linux/device.h>
913 device_create(NULL, NULL, 0, NULL, "%d", 1);
916 AC_DEFINE(HAVE_5ARGS_DEVICE_CREATE, 1,
917 [device_create wants 5 args])
921 EXTRA_KCFLAGS="$tmp_flags"
925 dnl # 2.6.13 API change, check whether class_device_create() is available.
926 dnl # Class_device_create() was introduced in 2.6.13 and depricated
927 dnl # class_simple_device_add() which was fully removed in 2.6.13.
929 AC_DEFUN([SPL_AC_CLASS_DEVICE_CREATE], [
930 SPL_CHECK_SYMBOL_EXPORT(
931 [class_device_create],
932 [drivers/base/class.c],
933 [AC_DEFINE(HAVE_CLASS_DEVICE_CREATE, 1,
934 [class_device_create() is available])],
939 dnl # 2.6.26 API change, set_normalized_timespec() is exported.
941 AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_EXPORT], [
942 SPL_CHECK_SYMBOL_EXPORT(
943 [set_normalized_timespec],
945 [AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_EXPORT, 1,
946 [set_normalized_timespec() is available as export])],
951 dnl # 2.6.16 API change, set_normalize_timespec() moved to time.c
952 dnl # previously it was available in time.h as an inline.
954 AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE], [
955 AC_MSG_CHECKING([whether set_normalized_timespec() is an inline])
956 SPL_LINUX_TRY_COMPILE([
957 #include <linux/time.h>
958 void set_normalized_timespec(struct timespec *ts,
959 time_t sec, long nsec) { }
966 AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_INLINE, 1,
967 [set_normalized_timespec() is available as inline])
972 dnl # 2.6.18 API change,
973 dnl # timespec_sub() inline function available in linux/time.h
975 AC_DEFUN([SPL_AC_TIMESPEC_SUB], [
976 AC_MSG_CHECKING([whether timespec_sub() is available])
977 SPL_LINUX_TRY_COMPILE([
978 #include <linux/time.h>
980 struct timespec a, b, c = { 0 };
981 c = timespec_sub(a, b);
984 AC_DEFINE(HAVE_TIMESPEC_SUB, 1, [timespec_sub() is available])
991 dnl # 2.6.19 API change,
992 dnl # check if init_utsname() is available in linux/utsname.h
994 AC_DEFUN([SPL_AC_INIT_UTSNAME], [
995 AC_MSG_CHECKING([whether init_utsname() is available])
996 SPL_LINUX_TRY_COMPILE([
997 #include <linux/utsname.h>
999 struct new_utsname *a = init_utsname();
1002 AC_DEFINE(HAVE_INIT_UTSNAME, 1, [init_utsname() is available])
1009 dnl # 2.6.26 API change,
1010 dnl # definition of struct fdtable relocated to linux/fdtable.h
1012 AC_DEFUN([SPL_AC_FDTABLE_HEADER], [
1013 SPL_CHECK_HEADER([linux/fdtable.h], [FDTABLE], [], [])
1017 dnl # 2.6.14 API change,
1018 dnl # check whether 'files_fdtable()' exists
1020 AC_DEFUN([SPL_AC_FILES_FDTABLE], [
1021 AC_MSG_CHECKING([whether files_fdtable() is available])
1022 SPL_LINUX_TRY_COMPILE([
1023 #include <linux/sched.h>
1024 #include <linux/file.h>
1025 #ifdef HAVE_FDTABLE_HEADER
1026 #include <linux/fdtable.h>
1029 struct files_struct *files = current->files;
1030 struct fdtable *fdt = files_fdtable(files);
1033 AC_DEFINE(HAVE_FILES_FDTABLE, 1, [files_fdtable() is available])
1040 dnl # 2.6.18 API change,
1041 dnl # added linux/uaccess.h
1043 AC_DEFUN([SPL_AC_UACCESS_HEADER], [
1044 SPL_CHECK_HEADER([linux/uaccess.h], [UACCESS], [], [])
1048 dnl # 2.6.12 API change,
1049 dnl # check whether 'kmalloc_node()' is available.
1051 AC_DEFUN([SPL_AC_KMALLOC_NODE], [
1052 AC_MSG_CHECKING([whether kmalloc_node() is available])
1053 SPL_LINUX_TRY_COMPILE([
1054 #include <linux/slab.h>
1056 void *a = kmalloc_node(1, GFP_KERNEL, 0);
1059 AC_DEFINE(HAVE_KMALLOC_NODE, 1, [kmalloc_node() is available])
1066 dnl # 2.6.9 API change,
1067 dnl # check whether 'monotonic_clock()' is available it may
1068 dnl # be available for some archs but not others.
1070 AC_DEFUN([SPL_AC_MONOTONIC_CLOCK], [
1071 SPL_CHECK_SYMBOL_EXPORT(
1074 [AC_DEFINE(HAVE_MONOTONIC_CLOCK, 1,
1075 [monotonic_clock() is available])],
1080 dnl # 2.6.16 API change,
1081 dnl # check whether 'struct inode' has i_mutex
1083 AC_DEFUN([SPL_AC_INODE_I_MUTEX], [
1084 AC_MSG_CHECKING([whether struct inode has i_mutex])
1085 SPL_LINUX_TRY_COMPILE([
1086 #include <linux/fs.h>
1087 #include <linux/mutex.h>
1090 mutex_init(&i.i_mutex);
1093 AC_DEFINE(HAVE_INODE_I_MUTEX, 1, [struct inode has i_mutex])
1100 dnl # 2.6.29 API change,
1101 dnl # Adaptive mutexs introduced.
1103 AC_DEFUN([SPL_AC_MUTEX_OWNER], [
1104 AC_MSG_CHECKING([whether struct mutex has owner])
1105 SPL_LINUX_TRY_COMPILE([
1106 #include <linux/mutex.h>
1112 AC_DEFINE(HAVE_MUTEX_OWNER, 1, [struct mutex has owner])
1119 dnl # 2.6.18 API change,
1120 dnl # First introduced 'mutex_lock_nested()' in include/linux/mutex.h,
1121 dnl # as part of the mutex validator. Fallback to using 'mutex_lock()'
1122 dnl # if the mutex validator is disabled or otherwise unavailable.
1124 AC_DEFUN([SPL_AC_MUTEX_LOCK_NESTED], [
1125 AC_MSG_CHECKING([whether mutex_lock_nested() is available])
1126 SPL_LINUX_TRY_COMPILE([
1127 #include <linux/mutex.h>
1131 mutex_lock_nested(&mutex, 0);
1134 AC_DEFINE(HAVE_MUTEX_LOCK_NESTED, 1,
1135 [mutex_lock_nested() is available])
1142 dnl # 2.6.27 API change,
1143 dnl # on_each_cpu() uses 3 args, no 'retry' argument
1145 AC_DEFUN([SPL_AC_3ARGS_ON_EACH_CPU], [
1146 AC_MSG_CHECKING([whether on_each_cpu() wants 3 args])
1147 SPL_LINUX_TRY_COMPILE([
1148 #include <linux/smp.h>
1150 on_each_cpu(NULL, NULL, 0);
1153 AC_DEFINE(HAVE_3ARGS_ON_EACH_CPU, 1,
1154 [on_each_cpu wants 3 args])
1161 dnl # 2.6.18 API change,
1162 dnl # kallsyms_lookup_name no longer exported
1164 AC_DEFUN([SPL_AC_KALLSYMS_LOOKUP_NAME], [
1165 SPL_CHECK_SYMBOL_EXPORT(
1166 [kallsyms_lookup_name],
1168 [AC_DEFINE(HAVE_KALLSYMS_LOOKUP_NAME, 1,
1169 [kallsyms_lookup_name() is available])],
1174 dnl # Proposed API change,
1175 dnl # This symbol is not available in stock kernels. You may build a
1176 dnl # custom kernel with the *-spl-export-symbols.patch which will export
1177 dnl # these symbols for use. If your already rolling a custom kernel for
1178 dnl # your environment this is recommended.
1180 AC_DEFUN([SPL_AC_GET_VMALLOC_INFO], [
1181 SPL_CHECK_SYMBOL_EXPORT(
1184 [AC_DEFINE(HAVE_GET_VMALLOC_INFO, 1,
1185 [get_vmalloc_info() is available])],
1190 dnl # 2.6.17 API change
1191 dnl # The helper functions first_online_pgdat(), next_online_pgdat(), and
1192 dnl # next_zone() are introduced to simplify for_each_zone(). These symbols
1193 dnl # were exported in 2.6.17 for use by modules which was consistent with
1194 dnl # the previous implementation of for_each_zone(). From 2.6.18 - 2.6.19
1195 dnl # the symbols were exported as 'unused', and by 2.6.20 they exports
1196 dnl # were dropped entirely leaving modules no way to directly iterate over
1197 dnl # the zone list. Because we need access to the zone helpers we check
1198 dnl # if the kernel contains the old or new implementation. Then we check
1199 dnl # to see if the symbols we need for each version are available. If they
1200 dnl # are not, dynamically aquire the addresses with kallsyms_lookup_name().
1202 AC_DEFUN([SPL_AC_PGDAT_HELPERS], [
1203 AC_MSG_CHECKING([whether symbol *_pgdat exist])
1204 grep -q -E 'first_online_pgdat' $LINUX/include/linux/mmzone.h 2>/dev/null
1206 if test $rc -eq 0; then
1207 AC_MSG_RESULT([yes])
1208 AC_DEFINE(HAVE_PGDAT_HELPERS, 1, [pgdat helpers are available])
1215 dnl # Proposed API change,
1216 dnl # This symbol is not available in stock kernels. You may build a
1217 dnl # custom kernel with the *-spl-export-symbols.patch which will export
1218 dnl # these symbols for use. If your already rolling a custom kernel for
1219 dnl # your environment this is recommended.
1221 AC_DEFUN([SPL_AC_FIRST_ONLINE_PGDAT], [
1222 SPL_CHECK_SYMBOL_EXPORT(
1223 [first_online_pgdat],
1225 [AC_DEFINE(HAVE_FIRST_ONLINE_PGDAT, 1,
1226 [first_online_pgdat() is available])],
1231 dnl # Proposed API change,
1232 dnl # This symbol is not available in stock kernels. You may build a
1233 dnl # custom kernel with the *-spl-export-symbols.patch which will export
1234 dnl # these symbols for use. If your already rolling a custom kernel for
1235 dnl # your environment this is recommended.
1237 AC_DEFUN([SPL_AC_NEXT_ONLINE_PGDAT], [
1238 SPL_CHECK_SYMBOL_EXPORT(
1239 [next_online_pgdat],
1241 [AC_DEFINE(HAVE_NEXT_ONLINE_PGDAT, 1,
1242 [next_online_pgdat() is available])],
1247 dnl # Proposed API change,
1248 dnl # This symbol is not available in stock kernels. You may build a
1249 dnl # custom kernel with the *-spl-export-symbols.patch which will export
1250 dnl # these symbols for use. If your already rolling a custom kernel for
1251 dnl # your environment this is recommended.
1253 AC_DEFUN([SPL_AC_NEXT_ZONE], [
1254 SPL_CHECK_SYMBOL_EXPORT(
1257 [AC_DEFINE(HAVE_NEXT_ZONE, 1,
1258 [next_zone() is available])],
1263 dnl # 2.6.17 API change,
1264 dnl # See SPL_AC_PGDAT_HELPERS for details.
1266 AC_DEFUN([SPL_AC_PGDAT_LIST], [
1267 SPL_CHECK_SYMBOL_EXPORT(
1270 [AC_DEFINE(HAVE_PGDAT_LIST, 1,
1271 [pgdat_list is available])],
1276 dnl # 2.6.18 API change,
1277 dnl # First introduced global_page_state() support as an inline.
1279 AC_DEFUN([SPL_AC_GLOBAL_PAGE_STATE], [
1280 AC_MSG_CHECKING([whether global_page_state() is available])
1281 SPL_LINUX_TRY_COMPILE([
1282 #include <linux/mm.h>
1284 unsigned long state;
1285 state = global_page_state(0);
1288 AC_DEFINE(HAVE_GLOBAL_PAGE_STATE, 1,
1289 [global_page_state() is available])
1296 dnl # 2.6.21 API change (plus subsequent naming convention changes),
1297 dnl # Public global zone stats now include a free page count. However
1298 dnl # the enumerated names of the counters have changed since this API
1299 dnl # was introduced. We need to deduce the corrent name to use. This
1300 dnl # replaces the priviate get_zone_counts() interface.
1302 dnl # NR_FREE_PAGES was available from 2.6.21 to current kernels, which
1303 dnl # is 2.6.30 as of when this was written.
1305 AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_FREE], [
1306 AC_MSG_CHECKING([whether page state NR_FREE_PAGES is available])
1307 SPL_LINUX_TRY_COMPILE([
1308 #include <linux/mm.h>
1310 enum zone_stat_item zsi;
1311 zsi = NR_FREE_PAGES;
1314 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_FREE_PAGES, 1,
1315 [Page state NR_FREE_PAGES is available])
1322 dnl # 2.6.21 API change (plus subsequent naming convention changes),
1323 dnl # Public global zone stats now include an inactive page count. However
1324 dnl # the enumerated names of the counters have changed since this API
1325 dnl # was introduced. We need to deduce the corrent name to use. This
1326 dnl # replaces the priviate get_zone_counts() interface.
1328 dnl # NR_INACTIVE was available from 2.6.21 to 2.6.27 and included both
1329 dnl # anonymous and file inactive pages. As of 2.6.28 it was split in
1330 dnl # to NR_INACTIVE_ANON and NR_INACTIVE_FILE.
1332 AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_INACTIVE], [
1333 AC_MSG_CHECKING([whether page state NR_INACTIVE is available])
1334 SPL_LINUX_TRY_COMPILE([
1335 #include <linux/mm.h>
1337 enum zone_stat_item zsi;
1341 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_INACTIVE, 1,
1342 [Page state NR_INACTIVE is available])
1347 AC_MSG_CHECKING([whether page state NR_INACTIVE_ANON is available])
1348 SPL_LINUX_TRY_COMPILE([
1349 #include <linux/mm.h>
1351 enum zone_stat_item zsi;
1352 zsi = NR_INACTIVE_ANON;
1355 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_ANON, 1,
1356 [Page state NR_INACTIVE_ANON is available])
1361 AC_MSG_CHECKING([whether page state NR_INACTIVE_FILE is available])
1362 SPL_LINUX_TRY_COMPILE([
1363 #include <linux/mm.h>
1365 enum zone_stat_item zsi;
1366 zsi = NR_INACTIVE_FILE;
1369 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_FILE, 1,
1370 [Page state NR_INACTIVE_FILE is available])
1377 dnl # 2.6.21 API change (plus subsequent naming convention changes),
1378 dnl # Public global zone stats now include an active page count. However
1379 dnl # the enumerated names of the counters have changed since this API
1380 dnl # was introduced. We need to deduce the corrent name to use. This
1381 dnl # replaces the priviate get_zone_counts() interface.
1383 dnl # NR_ACTIVE was available from 2.6.21 to 2.6.27 and included both
1384 dnl # anonymous and file active pages. As of 2.6.28 it was split in
1385 dnl # to NR_ACTIVE_ANON and NR_ACTIVE_FILE.
1387 AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_ACTIVE], [
1388 AC_MSG_CHECKING([whether page state NR_ACTIVE is available])
1389 SPL_LINUX_TRY_COMPILE([
1390 #include <linux/mm.h>
1392 enum zone_stat_item zsi;
1396 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_ACTIVE, 1,
1397 [Page state NR_ACTIVE is available])
1402 AC_MSG_CHECKING([whether page state NR_ACTIVE_ANON is available])
1403 SPL_LINUX_TRY_COMPILE([
1404 #include <linux/mm.h>
1406 enum zone_stat_item zsi;
1407 zsi = NR_ACTIVE_ANON;
1410 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_ANON, 1,
1411 [Page state NR_ACTIVE_ANON is available])
1416 AC_MSG_CHECKING([whether page state NR_ACTIVE_FILE is available])
1417 SPL_LINUX_TRY_COMPILE([
1418 #include <linux/mm.h>
1420 enum zone_stat_item zsi;
1421 zsi = NR_ACTIVE_FILE;
1424 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_FILE, 1,
1425 [Page state NR_ACTIVE_FILE is available])
1432 dnl # Proposed API change for legacy kernels.
1433 dnl # This symbol is not available in older kernels. For kernels post
1434 dnl # 2.6.21 the global_page_state() API is used to get free/inactive/active
1435 dnl # page state information. This symbol is only used in legacy kernels
1436 dnl # any only as a last resort.
1438 AC_DEFUN([SPL_AC_GET_ZONE_COUNTS], [
1439 AC_MSG_CHECKING([whether symbol get_zone_counts is needed])
1440 SPL_LINUX_TRY_COMPILE([
1442 #if !defined(HAVE_ZONE_STAT_ITEM_NR_FREE_PAGES)
1443 #error "global_page_state needs NR_FREE_PAGES"
1446 #if !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE) && \
1447 !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_ANON) && \
1448 !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_FILE)
1449 #error "global_page_state needs NR_ACTIVE*"
1452 #if !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE) && \
1453 !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_ANON) && \
1454 !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_FILE)
1455 #error "global_page_state needs NR_INACTIVE*"
1461 AC_DEFINE(NEED_GET_ZONE_COUNTS, 1,
1462 [get_zone_counts() is needed])
1464 SPL_CHECK_SYMBOL_EXPORT(
1467 [AC_DEFINE(HAVE_GET_ZONE_COUNTS, 1,
1468 [get_zone_counts() is available])],
1474 dnl # 2.6.27 API change,
1475 dnl # The user_path_dir() replaces __user_walk()
1477 AC_DEFUN([SPL_AC_USER_PATH_DIR], [
1478 SPL_CHECK_SYMBOL_EXPORT(
1481 [AC_DEFINE(HAVE_USER_PATH_DIR, 1,
1482 [user_path_dir() is available])],
1487 dnl # Symbol available in RHEL kernels not in stock kernels.
1489 AC_DEFUN([SPL_AC_SET_FS_PWD], [
1490 SPL_CHECK_SYMBOL_EXPORT(
1493 [AC_DEFINE(HAVE_SET_FS_PWD, 1,
1494 [set_fs_pwd() is available])],
1499 dnl # 2.6.25 API change,
1500 dnl # Simplied API by replacing mnt+dentry args with a single path arg.
1502 AC_DEFUN([SPL_AC_2ARGS_SET_FS_PWD],
1503 [AC_MSG_CHECKING([whether set_fs_pwd() wants 2 args])
1504 SPL_LINUX_TRY_COMPILE([
1505 #include <linux/sched.h>
1506 #include <linux/fs_struct.h>
1508 set_fs_pwd(NULL, NULL);
1511 AC_DEFINE(HAVE_2ARGS_SET_FS_PWD, 1,
1512 [set_fs_pwd() wants 2 args])
1519 dnl # SLES API change, never adopted in mainline,
1520 dnl # Third 'struct vfsmount *' argument removed.
1522 AC_DEFUN([SPL_AC_2ARGS_VFS_UNLINK],
1523 [AC_MSG_CHECKING([whether vfs_unlink() wants 2 args])
1524 SPL_LINUX_TRY_COMPILE([
1525 #include <linux/fs.h>
1527 vfs_unlink(NULL, NULL);
1530 AC_DEFINE(HAVE_2ARGS_VFS_UNLINK, 1,
1531 [vfs_unlink() wants 2 args])
1538 dnl # SLES API change, never adopted in mainline,
1539 dnl # Third and sixth 'struct vfsmount *' argument removed.
1541 AC_DEFUN([SPL_AC_4ARGS_VFS_RENAME],
1542 [AC_MSG_CHECKING([whether vfs_rename() wants 4 args])
1543 SPL_LINUX_TRY_COMPILE([
1544 #include <linux/fs.h>
1546 vfs_rename(NULL, NULL, NULL, NULL);
1549 AC_DEFINE(HAVE_4ARGS_VFS_RENAME, 1,
1550 [vfs_rename() wants 4 args])
1557 dnl # 2.6.36 API change,
1558 dnl # The 'struct fs_struct->lock' was changed from a rwlock_t to
1559 dnl # a spinlock_t to improve the fastpath performance.
1561 AC_DEFUN([SPL_AC_FS_STRUCT_SPINLOCK], [
1562 AC_MSG_CHECKING([whether struct fs_struct uses spinlock_t])
1563 SPL_LINUX_TRY_COMPILE([
1564 #include <linux/sched.h>
1565 #include <linux/fs_struct.h>
1567 struct fs_struct fs;
1568 spin_lock_init(&fs.lock);
1571 AC_DEFINE(HAVE_FS_STRUCT_SPINLOCK, 1,
1572 [struct fs_struct uses spinlock_t])
1579 dnl # 2.6.29 API change,
1580 dnl # check whether 'struct cred' exists
1582 AC_DEFUN([SPL_AC_CRED_STRUCT], [
1583 AC_MSG_CHECKING([whether struct cred exists])
1584 SPL_LINUX_TRY_COMPILE([
1585 #include <linux/cred.h>
1591 AC_DEFINE(HAVE_CRED_STRUCT, 1, [struct cred exists])
1598 dnl # Custom SPL patch may export this symbol.
1600 AC_DEFUN([SPL_AC_GROUPS_SEARCH], [
1601 SPL_CHECK_SYMBOL_EXPORT(
1604 [AC_DEFINE(HAVE_GROUPS_SEARCH, 1,
1605 [groups_search() is available])],
1610 dnl # 2.6.x API change,
1611 dnl # __put_task_struct() was exported in RHEL5 but unavailable elsewhere.
1613 AC_DEFUN([SPL_AC_PUT_TASK_STRUCT], [
1614 SPL_CHECK_SYMBOL_EXPORT(
1615 [__put_task_struct],
1617 [AC_DEFINE(HAVE_PUT_TASK_STRUCT, 1,
1618 [__put_task_struct() is available])],
1623 dnl # 2.6.32 API change,
1624 dnl # Unused 'struct file *' removed from prototype.
1626 AC_DEFUN([SPL_AC_5ARGS_PROC_HANDLER], [
1627 AC_MSG_CHECKING([whether proc_handler() wants 5 args])
1628 SPL_LINUX_TRY_COMPILE([
1629 #include <linux/sysctl.h>
1631 proc_dostring(NULL, 0, NULL, NULL, NULL);
1634 AC_DEFINE(HAVE_5ARGS_PROC_HANDLER, 1,
1635 [proc_handler() wants 5 args])
1642 dnl # 2.6.x API change,
1643 dnl # kvasprintf() function added.
1645 AC_DEFUN([SPL_AC_KVASPRINTF], [
1646 SPL_CHECK_SYMBOL_EXPORT(
1649 [AC_DEFINE(HAVE_KVASPRINTF, 1,
1650 [kvasprintf() is available])],
1655 dnl # 2.6.35 API change,
1656 dnl # Unused 'struct dentry *' removed from prototype.
1658 AC_DEFUN([SPL_AC_3ARGS_FILE_FSYNC], [
1659 AC_MSG_CHECKING([whether file_fsync() wants 3 args])
1660 SPL_LINUX_TRY_COMPILE([
1661 #include <linux/buffer_head.h>
1663 file_fsync(NULL, NULL, 0);
1666 AC_DEFINE(HAVE_3ARGS_FILE_FSYNC, 1,
1667 [file_fsync() wants 3 args])
1674 dnl # 2.6.33 API change. Also backported in RHEL5 as of 2.6.18-190.el5.
1675 dnl # Earlier versions of rwsem_is_locked() were inline and had a race
1676 dnl # condition. The fixed version is exported as a symbol. The race
1677 dnl # condition is fixed by acquiring sem->wait_lock, so we must not
1678 dnl # call that version while holding sem->wait_lock.
1680 AC_DEFUN([SPL_AC_EXPORTED_RWSEM_IS_LOCKED], [
1681 SPL_CHECK_SYMBOL_EXPORT(
1683 [lib/rwsem-spinlock.c],
1684 [AC_DEFINE(RWSEM_IS_LOCKED_TAKES_WAIT_LOCK, 1,
1685 [rwsem_is_locked() acquires sem->wait_lock])],