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_PATH_IN_NAMEIDATA
36 SPL_AC_5ARGS_DEVICE_CREATE
37 SPL_AC_CLASS_DEVICE_CREATE
38 SPL_AC_SET_NORMALIZED_TIMESPEC_EXPORT
39 SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE
46 SPL_AC_MONOTONIC_CLOCK
49 SPL_AC_MUTEX_LOCK_NESTED
50 SPL_AC_3ARGS_ON_EACH_CPU
51 SPL_AC_KALLSYMS_LOOKUP_NAME
52 SPL_AC_GET_VMALLOC_INFO
54 SPL_AC_FIRST_ONLINE_PGDAT
55 SPL_AC_NEXT_ONLINE_PGDAT
58 SPL_AC_GLOBAL_PAGE_STATE
59 SPL_AC_ZONE_STAT_ITEM_FREE
60 SPL_AC_ZONE_STAT_ITEM_INACTIVE
61 SPL_AC_ZONE_STAT_ITEM_ACTIVE
62 SPL_AC_GET_ZONE_COUNTS
65 SPL_AC_2ARGS_SET_FS_PWD
66 SPL_AC_2ARGS_VFS_UNLINK
67 SPL_AC_4ARGS_VFS_RENAME
70 SPL_AC_PUT_TASK_STRUCT
71 SPL_AC_5ARGS_PROC_HANDLER
73 SPL_AC_3ARGS_FILE_FSYNC
74 SPL_AC_EXPORTED_RWSEM_IS_LOCKED
77 AC_DEFUN([SPL_AC_MODULE_SYMVERS], [
78 modpost=$LINUX/scripts/Makefile.modpost
79 AC_MSG_CHECKING([kernel file name for module symbols])
80 if test -f "$modpost"; then
81 if grep -q Modules.symvers $modpost; then
82 LINUX_SYMBOLS=Modules.symvers
84 LINUX_SYMBOLS=Module.symvers
89 AC_MSG_RESULT($LINUX_SYMBOLS)
90 AC_SUBST(LINUX_SYMBOLS)
93 AC_DEFUN([SPL_AC_KERNEL], [
95 AS_HELP_STRING([--with-linux=PATH],
96 [Path to kernel source]),
97 [kernelsrc="$withval"])
99 AC_ARG_WITH([linux-obj],
100 AS_HELP_STRING([--with-linux-obj=PATH],
101 [Path to kernel build objects]),
102 [kernelbuild="$withval"])
104 AC_MSG_CHECKING([kernel source directory])
105 if test -z "$kernelsrc"; then
106 headersdir="/lib/modules/$(uname -r)/build"
107 if test -e "$headersdir"; then
108 sourcelink=$(readlink -f "$headersdir")
110 sourcelink=$(ls -1d /usr/src/kernels/* \
112 2>/dev/null | grep -v obj | tail -1)
115 if test -n "$sourcelink" && test -e ${sourcelink}; then
116 kernelsrc=`readlink -f ${sourcelink}`
118 AC_MSG_RESULT([Not found])
120 *** Please make sure the kernel devel package for your distribution
121 *** is installed then try again. If that fails you can specify the
122 *** location of the kernel source with the '--with-linux=PATH' option.])
125 if test "$kernelsrc" = "NONE"; then
130 AC_MSG_RESULT([$kernelsrc])
131 AC_MSG_CHECKING([kernel build directory])
132 if test -z "$kernelbuild"; then
133 if test -d ${kernelsrc}-obj/${target_cpu}/${target_cpu}; then
134 kernelbuild=${kernelsrc}-obj/${target_cpu}/${target_cpu}
135 elif test -d ${kernelsrc}-obj/${target_cpu}/default; then
136 kernelbuild=${kernelsrc}-obj/${target_cpu}/default
137 elif test -d `dirname ${kernelsrc}`/build-${target_cpu}; then
138 kernelbuild=`dirname ${kernelsrc}`/build-${target_cpu}
140 kernelbuild=${kernelsrc}
143 AC_MSG_RESULT([$kernelbuild])
145 AC_MSG_CHECKING([kernel source version])
146 utsrelease1=$kernelbuild/include/linux/version.h
147 utsrelease2=$kernelbuild/include/linux/utsrelease.h
148 utsrelease3=$kernelbuild/include/generated/utsrelease.h
149 if test -r $utsrelease1 && fgrep -q UTS_RELEASE $utsrelease1; then
150 utsrelease=linux/version.h
151 elif test -r $utsrelease2 && fgrep -q UTS_RELEASE $utsrelease2; then
152 utsrelease=linux/utsrelease.h
153 elif test -r $utsrelease3 && fgrep -q UTS_RELEASE $utsrelease3; then
154 utsrelease=generated/utsrelease.h
157 if test "$utsrelease"; then
158 kernsrcver=`(echo "#include <$utsrelease>";
159 echo "kernsrcver=UTS_RELEASE") |
160 cpp -I $kernelbuild/include |
161 grep "^kernsrcver=" | cut -d \" -f 2`
163 if test -z "$kernsrcver"; then
164 AC_MSG_RESULT([Not found])
165 AC_MSG_ERROR([*** Cannot determine kernel version.])
168 AC_MSG_RESULT([Not found])
169 AC_MSG_ERROR([*** Cannot find UTS_RELEASE definition.])
172 AC_MSG_RESULT([$kernsrcver])
175 LINUX_OBJ=${kernelbuild}
176 LINUX_VERSION=${kernsrcver}
180 AC_SUBST(LINUX_VERSION)
182 SPL_AC_MODULE_SYMVERS
186 dnl # Explicitly check for gawk, we require it for the the usermode
187 dnl # helper. For some reason the standard awk command does not
188 dnl # behave correctly when invoked from the usermode helper.
190 AC_DEFUN([SPL_AC_GAWK], [
191 AS_IF([test "x$AWK" != xgawk], [
193 *** Required util gawk missing. Please install the required
194 *** gawk package for your distribution and try again.])
199 dnl # Default SPL user configuration
201 AC_DEFUN([SPL_AC_CONFIG_USER], [
206 dnl # Check for rpm+rpmbuild to build RPM packages. If these tools
207 dnl # are missing it is non-fatal but you will not be able to build
208 dnl # RPM packages and will be warned if you try too.
210 AC_DEFUN([SPL_AC_RPM], [
214 AC_MSG_CHECKING([whether $RPM is available])
215 AS_IF([tmp=$($RPM --version 2>/dev/null)], [
216 RPM_VERSION=$(echo $tmp | $AWK '/RPM/ { print $[3] }')
218 AC_MSG_RESULT([$HAVE_RPM ($RPM_VERSION)])
221 AC_MSG_RESULT([$HAVE_RPM])
224 AC_MSG_CHECKING([whether $RPMBUILD is available])
225 AS_IF([tmp=$($RPMBUILD --version 2>/dev/null)], [
226 RPMBUILD_VERSION=$(echo $tmp | $AWK '/RPM/ { print $[3] }')
228 AC_MSG_RESULT([$HAVE_RPMBUILD ($RPMBUILD_VERSION)])
231 AC_MSG_RESULT([$HAVE_RPMBUILD])
236 AC_SUBST(RPM_VERSION)
238 AC_SUBST(HAVE_RPMBUILD)
240 AC_SUBST(RPMBUILD_VERSION)
244 dnl # Check for dpkg+dpkg-buildpackage to build DEB packages. If these
245 dnl # tools are missing it is non-fatal but you will not be able to build
246 dnl # DEB packages and will be warned if you try too.
248 AC_DEFUN([SPL_AC_DPKG], [
250 DPKGBUILD=dpkg-buildpackage
252 AC_MSG_CHECKING([whether $DPKG is available])
253 AS_IF([tmp=$($DPKG --version 2>/dev/null)], [
254 DPKG_VERSION=$(echo $tmp | $AWK '/Debian/ { print $[7] }')
256 AC_MSG_RESULT([$HAVE_DPKG ($DPKG_VERSION)])
259 AC_MSG_RESULT([$HAVE_DPKG])
262 AC_MSG_CHECKING([whether $DPKGBUILD is available])
263 AS_IF([tmp=$($DPKGBUILD --version 2>/dev/null)], [
264 DPKGBUILD_VERSION=$(echo $tmp | \
265 $AWK '/Debian/ { print $[4] }' | cut -f-4 -d'.')
267 AC_MSG_RESULT([$HAVE_DPKGBUILD ($DPKGBUILD_VERSION)])
270 AC_MSG_RESULT([$HAVE_DPKGBUILD])
275 AC_SUBST(DPKG_VERSION)
277 AC_SUBST(HAVE_DPKGBUILD)
279 AC_SUBST(DPKGBUILD_VERSION)
283 dnl # Until native packaging for various different packing systems
284 dnl # can be added the least we can do is attempt to use alien to
285 dnl # convert the RPM packages to the needed package type. This is
286 dnl # a hack but so far it has worked reasonable well.
288 AC_DEFUN([SPL_AC_ALIEN], [
291 AC_MSG_CHECKING([whether $ALIEN is available])
292 AS_IF([tmp=$($ALIEN --version 2>/dev/null)], [
293 ALIEN_VERSION=$(echo $tmp | $AWK '{ print $[3] }')
295 AC_MSG_RESULT([$HAVE_ALIEN ($ALIEN_VERSION)])
298 AC_MSG_RESULT([$HAVE_ALIEN])
303 AC_SUBST(ALIEN_VERSION)
307 dnl # Using the VENDOR tag from config.guess set the default
308 dnl # package type for 'make pkg': (rpm | deb | tgz)
310 AC_DEFUN([SPL_AC_DEFAULT_PACKAGE], [
311 AC_MSG_CHECKING([linux distribution])
312 if test -f /etc/redhat-release ; then
314 elif test -f /etc/fedora-release ; then
316 elif test -f /etc/lsb-release ; then
318 elif test -f /etc/debian_version ; then
320 elif test -f /etc/SuSE-release ; then
322 elif test -f /etc/slackware-version ; then
324 elif test -f /etc/gentoo-release ; then
329 AC_MSG_RESULT([$VENDOR])
332 AC_MSG_CHECKING([default package type])
334 fedora) DEFAULT_PACKAGE=rpm ;;
335 redhat) DEFAULT_PACKAGE=rpm ;;
336 sles) DEFAULT_PACKAGE=rpm ;;
337 ubuntu) DEFAULT_PACKAGE=deb ;;
338 debian) DEFAULT_PACKAGE=deb ;;
339 slackware) DEFAULT_PACKAGE=tgz ;;
340 *) DEFAULT_PACKAGE=rpm ;;
343 AC_MSG_RESULT([$DEFAULT_PACKAGE])
344 AC_SUBST(DEFAULT_PACKAGE)
348 dnl # Default SPL user configuration
350 AC_DEFUN([SPL_AC_PACKAGE], [
354 SPL_AC_DEFAULT_PACKAGE
357 AC_DEFUN([SPL_AC_LICENSE], [
358 AC_MSG_CHECKING([spl license])
360 AC_MSG_RESULT([$LICENSE])
361 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DHAVE_GPL_ONLY_SYMBOLS"
365 AC_DEFUN([SPL_AC_CONFIG], [
367 AC_ARG_WITH([config],
368 AS_HELP_STRING([--with-config=CONFIG],
369 [Config file 'kernel|user|all|srpm']),
370 [SPL_CONFIG="$withval"])
372 AC_MSG_CHECKING([spl config])
373 AC_MSG_RESULT([$SPL_CONFIG]);
376 case "$SPL_CONFIG" in
377 kernel) SPL_AC_CONFIG_KERNEL ;;
378 user) SPL_AC_CONFIG_USER ;;
379 all) SPL_AC_CONFIG_KERNEL
380 SPL_AC_CONFIG_USER ;;
383 AC_MSG_RESULT([Error!])
384 AC_MSG_ERROR([Bad value "$SPL_CONFIG" for --with-config,
385 user kernel|user|all|srpm]) ;;
388 AM_CONDITIONAL([CONFIG_USER],
389 [test "$SPL_CONFIG" = user] ||
390 [test "$SPL_CONFIG" = all])
391 AM_CONDITIONAL([CONFIG_KERNEL],
392 [test "$SPL_CONFIG" = kernel] ||
393 [test "$SPL_CONFIG" = all])
397 dnl # Enable if the SPL should be compiled with internal debugging enabled.
398 dnl # By default this support is disabled.
400 AC_DEFUN([SPL_AC_DEBUG], [
401 AC_MSG_CHECKING([whether debugging is enabled])
402 AC_ARG_ENABLE([debug],
403 [AS_HELP_STRING([--enable-debug],
404 [Enable generic debug support @<:@default=no@:>@])],
408 AS_IF([test "x$enable_debug" = xyes],
410 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG -Werror"
411 DEBUG_CFLAGS="-DDEBUG -Werror"
414 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG"
415 DEBUG_CFLAGS="-DNDEBUG"
418 AC_SUBST(DEBUG_CFLAGS)
419 AC_MSG_RESULT([$enable_debug])
423 dnl # Enabled by default it provides a minimal level of memory tracking.
424 dnl # A total count of bytes allocated is kept for each alloc and free.
425 dnl # Then at module unload time a report to the console will be printed
426 dnl # if memory was leaked. Additionally, /proc/spl/kmem/slab will exist
427 dnl # and provide an easy way to inspect the kmem based slab.
429 AC_DEFUN([SPL_AC_DEBUG_KMEM], [
430 AC_ARG_ENABLE([debug-kmem],
431 [AS_HELP_STRING([--enable-debug-kmem],
432 [Enable basic kmem accounting @<:@default=yes@:>@])],
434 [enable_debug_kmem=yes])
436 AS_IF([test "x$enable_debug_kmem" = xyes],
437 [AC_DEFINE([DEBUG_KMEM], [1],
438 [Define to 1 to enable basic kmem accounting])
439 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM"])
441 AC_MSG_CHECKING([whether basic kmem accounting is enabled])
442 AC_MSG_RESULT([$enable_debug_kmem])
446 dnl # Disabled by default it provides detailed memory tracking. This
447 dnl # feature also requires --enable-debug-kmem to be set. When enabled
448 dnl # not only will total bytes be tracked but also the location of every
449 dnl # alloc and free. When the SPL module is unloaded a list of all leaked
450 dnl # addresses and where they were allocated will be dumped to the console.
451 dnl # Enabling this feature has a significant impact on performance but it
452 dnl # makes finding memory leaks pretty straight forward.
454 AC_DEFUN([SPL_AC_DEBUG_KMEM_TRACKING], [
455 AC_ARG_ENABLE([debug-kmem-tracking],
456 [AS_HELP_STRING([--enable-debug-kmem-tracking],
457 [Enable detailed kmem tracking @<:@default=no@:>@])],
459 [enable_debug_kmem_tracking=no])
461 AS_IF([test "x$enable_debug_kmem_tracking" = xyes],
462 [AC_DEFINE([DEBUG_KMEM_TRACKING], [1],
463 [Define to 1 to enable detailed kmem tracking])
464 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM_TRACKING"])
466 AC_MSG_CHECKING([whether detailed kmem tracking is enabled])
467 AC_MSG_RESULT([$enable_debug_kmem_tracking])
471 dnl # SPL_LINUX_CONFTEST
473 AC_DEFUN([SPL_LINUX_CONFTEST], [
474 cat confdefs.h - <<_ACEOF >conftest.c
480 dnl # SPL_LANG_PROGRAM(C)([PROLOGUE], [BODY])
482 m4_define([SPL_LANG_PROGRAM], [
487 dnl Do *not* indent the following line: there may be CPP directives.
488 dnl Don't move the `;' right after for the same reason.
496 dnl # SPL_LINUX_COMPILE_IFELSE / like AC_COMPILE_IFELSE
498 AC_DEFUN([SPL_LINUX_COMPILE_IFELSE], [
499 m4_ifvaln([$1], [SPL_LINUX_CONFTEST([$1])])
500 rm -Rf build && mkdir -p build
501 echo "obj-m := conftest.o" >build/Makefile
503 [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])],
505 [_AC_MSG_LOG_CONFTEST m4_ifvaln([$5],[$5])]
511 dnl # SPL_LINUX_TRY_COMPILE like AC_TRY_COMPILE
513 AC_DEFUN([SPL_LINUX_TRY_COMPILE],
514 [SPL_LINUX_COMPILE_IFELSE(
515 [AC_LANG_SOURCE([SPL_LANG_PROGRAM([[$1]], [[$2]])])],
517 [test -s build/conftest.o],
522 dnl # SPL_LINUX_CONFIG
524 AC_DEFUN([SPL_LINUX_CONFIG],
525 [AC_MSG_CHECKING([whether Linux was built with CONFIG_$1])
526 SPL_LINUX_TRY_COMPILE([
527 #ifndef AUTOCONF_INCLUDED
528 #include <linux/config.h>
532 #error CONFIG_$1 not #defined
544 dnl # SPL_CHECK_SYMBOL_EXPORT
545 dnl # check symbol exported or not
547 AC_DEFUN([SPL_CHECK_SYMBOL_EXPORT],
548 [AC_MSG_CHECKING([whether symbol $1 is exported])
549 grep -q -E '[[[:space:]]]$1[[[:space:]]]' \
550 $LINUX_OBJ/Module*.symvers 2>/dev/null
552 if test $rc -ne 0; then
555 grep -q -E "EXPORT_SYMBOL.*($1)" \
556 "$LINUX_OBJ/$file" 2>/dev/null
558 if test $rc -eq 0; then
563 if test $export -eq 0; then
577 dnl # SPL_CHECK_HEADER
578 dnl # check whether header exists and define HAVE_$2_HEADER
580 AC_DEFUN([SPL_CHECK_HEADER],
581 [AC_MSG_CHECKING([whether header $1 exists])
582 SPL_LINUX_TRY_COMPILE([
587 AC_DEFINE(HAVE_$2_HEADER, 1, [$1 exists])
597 dnl # Use the atomic implemenation based on global spinlocks. This
598 dnl # should only be needed by 32-bit kernels which do not provide
599 dnl # the atomic64_* API. It may be optionally enabled as a fallback
600 dnl # if problems are observed with the direct mapping to the native
601 dnl # Linux atomic operations. You may not disable atomic spinlocks
602 dnl # if you kernel does not an atomic64_* API.
604 AC_DEFUN([SPL_AC_ATOMIC_SPINLOCK], [
605 AC_ARG_ENABLE([atomic-spinlocks],
606 [AS_HELP_STRING([--enable-atomic-spinlocks],
607 [Atomic types use spinlocks @<:@default=check@:>@])],
609 [enable_atomic_spinlocks=check])
611 SPL_LINUX_TRY_COMPILE([
612 #include <asm/atomic.h>
617 AC_DEFINE(HAVE_ATOMIC64_T, 1,
618 [kernel defines atomic64_t])
623 AS_IF([test "x$enable_atomic_spinlocks" = xcheck], [
624 AS_IF([test "x$have_atomic64_t" = xyes], [
625 enable_atomic_spinlocks=no
627 enable_atomic_spinlocks=yes
631 AS_IF([test "x$enable_atomic_spinlocks" = xyes], [
632 AC_DEFINE([ATOMIC_SPINLOCK], [1],
633 [Atomic types use spinlocks])
635 AS_IF([test "x$have_atomic64_t" = xno], [
637 [--disable-atomic-spinlocks given but required atomic64 support is unavailable])
641 AC_MSG_CHECKING([whether atomic types use spinlocks])
642 AC_MSG_RESULT([$enable_atomic_spinlocks])
644 AC_MSG_CHECKING([whether kernel defines atomic64_t])
645 AC_MSG_RESULT([$have_atomic64_t])
649 dnl # 2.6.24 API change,
650 dnl # check if atomic64_cmpxchg is defined
652 AC_DEFUN([SPL_AC_TYPE_ATOMIC64_CMPXCHG],
653 [AC_MSG_CHECKING([whether kernel defines atomic64_cmpxchg])
654 SPL_LINUX_TRY_COMPILE([
655 #include <asm/atomic.h>
656 #include <asm/system.h>
658 atomic64_cmpxchg((atomic64_t *)NULL, 0, 0);
661 AC_DEFINE(HAVE_ATOMIC64_CMPXCHG, 1,
662 [kernel defines atomic64_cmpxchg])
669 dnl # 2.6.24 API change,
670 dnl # check if atomic64_xchg is defined
672 AC_DEFUN([SPL_AC_TYPE_ATOMIC64_XCHG],
673 [AC_MSG_CHECKING([whether kernel defines atomic64_xchg])
674 SPL_LINUX_TRY_COMPILE([
675 #include <asm/atomic.h>
677 atomic64_xchg((atomic64_t *)NULL, 0);
680 AC_DEFINE(HAVE_ATOMIC64_XCHG, 1,
681 [kernel defines atomic64_xchg])
688 dnl # 2.6.24 API change,
689 dnl # check if uintptr_t typedef is defined
691 AC_DEFUN([SPL_AC_TYPE_UINTPTR_T],
692 [AC_MSG_CHECKING([whether kernel defines uintptr_t])
693 SPL_LINUX_TRY_COMPILE([
694 #include <linux/types.h>
699 AC_DEFINE(HAVE_UINTPTR_T, 1,
700 [kernel defines uintptr_t])
707 dnl # 2.6.20 API change,
708 dnl # INIT_WORK use 2 args and not store data inside
710 AC_DEFUN([SPL_AC_3ARGS_INIT_WORK],
711 [AC_MSG_CHECKING([whether INIT_WORK wants 3 args])
712 SPL_LINUX_TRY_COMPILE([
713 #include <linux/workqueue.h>
715 struct work_struct work;
716 INIT_WORK(&work, NULL, NULL);
719 AC_DEFINE(HAVE_3ARGS_INIT_WORK, 1,
720 [INIT_WORK wants 3 args])
727 dnl # 2.6.21 API change,
728 dnl # 'register_sysctl_table' use only one argument instead of two
730 AC_DEFUN([SPL_AC_2ARGS_REGISTER_SYSCTL],
731 [AC_MSG_CHECKING([whether register_sysctl_table() wants 2 args])
732 SPL_LINUX_TRY_COMPILE([
733 #include <linux/sysctl.h>
735 return register_sysctl_table(NULL,0);
738 AC_DEFINE(HAVE_2ARGS_REGISTER_SYSCTL, 1,
739 [register_sysctl_table() wants 2 args])
746 dnl # 2.6.23 API change
747 dnl # Old set_shrinker API replaced with register_shrinker
749 AC_DEFUN([SPL_AC_SET_SHRINKER], [
750 AC_MSG_CHECKING([whether set_shrinker() available])
751 SPL_LINUX_TRY_COMPILE([
752 #include <linux/mm.h>
754 return set_shrinker(DEFAULT_SEEKS, NULL);
757 AC_DEFINE(HAVE_SET_SHRINKER, 1,
758 [set_shrinker() available])
765 dnl # 2.6.25 API change,
766 dnl # struct path entry added to struct nameidata
768 AC_DEFUN([SPL_AC_PATH_IN_NAMEIDATA],
769 [AC_MSG_CHECKING([whether struct path used in struct nameidata])
770 SPL_LINUX_TRY_COMPILE([
771 #include <linux/namei.h>
776 nd.path.dentry = NULL;
779 AC_DEFINE(HAVE_PATH_IN_NAMEIDATA, 1,
780 [struct path used in struct nameidata])
787 dnl # Custom SPL patch may export this system it is not required
789 AC_DEFUN([SPL_AC_TASK_CURR], [
790 SPL_CHECK_SYMBOL_EXPORT([task_curr], [kernel/sched.c],
791 [AC_DEFINE(HAVE_TASK_CURR, 1, [task_curr() exported])],
796 dnl # 2.6.19 API change,
797 dnl # Use CTL_UNNUMBERED when binary sysctl is not required
799 AC_DEFUN([SPL_AC_CTL_UNNUMBERED],
800 [AC_MSG_CHECKING([whether unnumbered sysctl support exists])
801 SPL_LINUX_TRY_COMPILE([
802 #include <linux/sysctl.h>
804 #ifndef CTL_UNNUMBERED
805 #error CTL_UNNUMBERED undefined
809 AC_DEFINE(HAVE_CTL_UNNUMBERED, 1,
810 [unnumbered sysctl support exists])
817 dnl # 2.6.33 API change,
818 dnl # Removed .ctl_name from struct ctl_table.
820 AC_DEFUN([SPL_AC_CTL_NAME], [
821 AC_MSG_CHECKING([whether struct ctl_table has ctl_name])
822 SPL_LINUX_TRY_COMPILE([
823 #include <linux/sysctl.h>
825 struct ctl_table ctl;
829 AC_DEFINE(HAVE_CTL_NAME, 1, [struct ctl_table has ctl_name])
836 dnl # 2.6.16 API change.
837 dnl # Check if 'fls64()' is available
839 AC_DEFUN([SPL_AC_FLS64],
840 [AC_MSG_CHECKING([whether fls64() is available])
841 SPL_LINUX_TRY_COMPILE([
842 #include <linux/bitops.h>
847 AC_DEFINE(HAVE_FLS64, 1, [fls64() is available])
854 dnl # 2.6.18 API change, check whether device_create() is available.
855 dnl # Device_create() was introduced in 2.6.18 and depricated
856 dnl # class_device_create() which was fully removed in 2.6.26.
858 AC_DEFUN([SPL_AC_DEVICE_CREATE], [
859 SPL_CHECK_SYMBOL_EXPORT(
861 [drivers/base/core.c],
862 [AC_DEFINE(HAVE_DEVICE_CREATE, 1,
863 [device_create() is available])],
868 dnl # 2.6.27 API change,
869 dnl # device_create() uses 5 args, new 'drvdata' argument.
871 AC_DEFUN([SPL_AC_5ARGS_DEVICE_CREATE], [
872 AC_MSG_CHECKING([whether device_create() wants 5 args])
873 tmp_flags="$EXTRA_KCFLAGS"
874 EXTRA_KCFLAGS="-Werror"
875 SPL_LINUX_TRY_COMPILE([
876 #include <linux/device.h>
878 device_create(NULL, NULL, 0, NULL, "%d", 1);
881 AC_DEFINE(HAVE_5ARGS_DEVICE_CREATE, 1,
882 [device_create wants 5 args])
886 EXTRA_KCFLAGS="$tmp_flags"
890 dnl # 2.6.13 API change, check whether class_device_create() is available.
891 dnl # Class_device_create() was introduced in 2.6.13 and depricated
892 dnl # class_simple_device_add() which was fully removed in 2.6.13.
894 AC_DEFUN([SPL_AC_CLASS_DEVICE_CREATE], [
895 SPL_CHECK_SYMBOL_EXPORT(
896 [class_device_create],
897 [drivers/base/class.c],
898 [AC_DEFINE(HAVE_CLASS_DEVICE_CREATE, 1,
899 [class_device_create() is available])],
904 dnl # 2.6.26 API change, set_normalized_timespec() is exported.
906 AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_EXPORT], [
907 SPL_CHECK_SYMBOL_EXPORT(
908 [set_normalized_timespec],
910 [AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_EXPORT, 1,
911 [set_normalized_timespec() is available as export])],
916 dnl # 2.6.16 API change, set_normalize_timespec() moved to time.c
917 dnl # previously it was available in time.h as an inline.
919 AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE], [
920 AC_MSG_CHECKING([whether set_normalized_timespec() is an inline])
921 SPL_LINUX_TRY_COMPILE([
922 #include <linux/time.h>
923 void set_normalized_timespec(struct timespec *ts,
924 time_t sec, long nsec) { }
931 AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_INLINE, 1,
932 [set_normalized_timespec() is available as inline])
937 dnl # 2.6.18 API change,
938 dnl # timespec_sub() inline function available in linux/time.h
940 AC_DEFUN([SPL_AC_TIMESPEC_SUB], [
941 AC_MSG_CHECKING([whether timespec_sub() is available])
942 SPL_LINUX_TRY_COMPILE([
943 #include <linux/time.h>
945 struct timespec a, b, c = { 0 };
946 c = timespec_sub(a, b);
949 AC_DEFINE(HAVE_TIMESPEC_SUB, 1, [timespec_sub() is available])
956 dnl # 2.6.19 API change,
957 dnl # check if init_utsname() is available in linux/utsname.h
959 AC_DEFUN([SPL_AC_INIT_UTSNAME], [
960 AC_MSG_CHECKING([whether init_utsname() is available])
961 SPL_LINUX_TRY_COMPILE([
962 #include <linux/utsname.h>
964 struct new_utsname *a = init_utsname();
967 AC_DEFINE(HAVE_INIT_UTSNAME, 1, [init_utsname() is available])
974 dnl # 2.6.26 API change,
975 dnl # definition of struct fdtable relocated to linux/fdtable.h
977 AC_DEFUN([SPL_AC_FDTABLE_HEADER], [
978 SPL_CHECK_HEADER([linux/fdtable.h], [FDTABLE], [], [])
982 dnl # 2.6.14 API change,
983 dnl # check whether 'files_fdtable()' exists
985 AC_DEFUN([SPL_AC_FILES_FDTABLE], [
986 AC_MSG_CHECKING([whether files_fdtable() is available])
987 SPL_LINUX_TRY_COMPILE([
988 #include <linux/sched.h>
989 #include <linux/file.h>
990 #ifdef HAVE_FDTABLE_HEADER
991 #include <linux/fdtable.h>
994 struct files_struct *files = current->files;
995 struct fdtable *fdt = files_fdtable(files);
998 AC_DEFINE(HAVE_FILES_FDTABLE, 1, [files_fdtable() is available])
1005 dnl # 2.6.18 API change,
1006 dnl # added linux/uaccess.h
1008 AC_DEFUN([SPL_AC_UACCESS_HEADER], [
1009 SPL_CHECK_HEADER([linux/uaccess.h], [UACCESS], [], [])
1013 dnl # 2.6.12 API change,
1014 dnl # check whether 'kmalloc_node()' is available.
1016 AC_DEFUN([SPL_AC_KMALLOC_NODE], [
1017 AC_MSG_CHECKING([whether kmalloc_node() is available])
1018 SPL_LINUX_TRY_COMPILE([
1019 #include <linux/slab.h>
1021 void *a = kmalloc_node(1, GFP_KERNEL, 0);
1024 AC_DEFINE(HAVE_KMALLOC_NODE, 1, [kmalloc_node() is available])
1031 dnl # 2.6.9 API change,
1032 dnl # check whether 'monotonic_clock()' is available it may
1033 dnl # be available for some archs but not others.
1035 AC_DEFUN([SPL_AC_MONOTONIC_CLOCK], [
1036 SPL_CHECK_SYMBOL_EXPORT(
1039 [AC_DEFINE(HAVE_MONOTONIC_CLOCK, 1,
1040 [monotonic_clock() is available])],
1045 dnl # 2.6.16 API change,
1046 dnl # check whether 'struct inode' has i_mutex
1048 AC_DEFUN([SPL_AC_INODE_I_MUTEX], [
1049 AC_MSG_CHECKING([whether struct inode has i_mutex])
1050 SPL_LINUX_TRY_COMPILE([
1051 #include <linux/fs.h>
1052 #include <linux/mutex.h>
1055 mutex_init(&i.i_mutex);
1058 AC_DEFINE(HAVE_INODE_I_MUTEX, 1, [struct inode has i_mutex])
1065 dnl # 2.6.29 API change,
1066 dnl # Adaptive mutexs introduced.
1068 AC_DEFUN([SPL_AC_MUTEX_OWNER], [
1069 AC_MSG_CHECKING([whether struct mutex has owner])
1070 SPL_LINUX_TRY_COMPILE([
1071 #include <linux/mutex.h>
1077 AC_DEFINE(HAVE_MUTEX_OWNER, 1, [struct mutex has owner])
1084 dnl # 2.6.18 API change,
1085 dnl # First introduced 'mutex_lock_nested()' in include/linux/mutex.h,
1086 dnl # as part of the mutex validator. Fallback to using 'mutex_lock()'
1087 dnl # if the mutex validator is disabled or otherwise unavailable.
1089 AC_DEFUN([SPL_AC_MUTEX_LOCK_NESTED], [
1090 AC_MSG_CHECKING([whether mutex_lock_nested() is available])
1091 SPL_LINUX_TRY_COMPILE([
1092 #include <linux/mutex.h>
1096 mutex_lock_nested(&mutex, 0);
1099 AC_DEFINE(HAVE_MUTEX_LOCK_NESTED, 1,
1100 [mutex_lock_nested() is available])
1107 dnl # 2.6.27 API change,
1108 dnl # on_each_cpu() uses 3 args, no 'retry' argument
1110 AC_DEFUN([SPL_AC_3ARGS_ON_EACH_CPU], [
1111 AC_MSG_CHECKING([whether on_each_cpu() wants 3 args])
1112 SPL_LINUX_TRY_COMPILE([
1113 #include <linux/smp.h>
1115 on_each_cpu(NULL, NULL, 0);
1118 AC_DEFINE(HAVE_3ARGS_ON_EACH_CPU, 1,
1119 [on_each_cpu wants 3 args])
1126 dnl # 2.6.18 API change,
1127 dnl # kallsyms_lookup_name no longer exported
1129 AC_DEFUN([SPL_AC_KALLSYMS_LOOKUP_NAME], [
1130 SPL_CHECK_SYMBOL_EXPORT(
1131 [kallsyms_lookup_name],
1133 [AC_DEFINE(HAVE_KALLSYMS_LOOKUP_NAME, 1,
1134 [kallsyms_lookup_name() is available])],
1139 dnl # Proposed API change,
1140 dnl # This symbol is not available in stock kernels. You may build a
1141 dnl # custom kernel with the *-spl-export-symbols.patch which will export
1142 dnl # these symbols for use. If your already rolling a custom kernel for
1143 dnl # your environment this is recommended.
1145 AC_DEFUN([SPL_AC_GET_VMALLOC_INFO], [
1146 SPL_CHECK_SYMBOL_EXPORT(
1149 [AC_DEFINE(HAVE_GET_VMALLOC_INFO, 1,
1150 [get_vmalloc_info() is available])],
1155 dnl # 2.6.17 API change
1156 dnl # The helper functions first_online_pgdat(), next_online_pgdat(), and
1157 dnl # next_zone() are introduced to simplify for_each_zone(). These symbols
1158 dnl # were exported in 2.6.17 for use by modules which was consistent with
1159 dnl # the previous implementation of for_each_zone(). From 2.6.18 - 2.6.19
1160 dnl # the symbols were exported as 'unused', and by 2.6.20 they exports
1161 dnl # were dropped entirely leaving modules no way to directly iterate over
1162 dnl # the zone list. Because we need access to the zone helpers we check
1163 dnl # if the kernel contains the old or new implementation. Then we check
1164 dnl # to see if the symbols we need for each version are available. If they
1165 dnl # are not, dynamically aquire the addresses with kallsyms_lookup_name().
1167 AC_DEFUN([SPL_AC_PGDAT_HELPERS], [
1168 AC_MSG_CHECKING([whether symbol *_pgdat exist])
1169 grep -q -E 'first_online_pgdat' $LINUX/include/linux/mmzone.h 2>/dev/null
1171 if test $rc -eq 0; then
1172 AC_MSG_RESULT([yes])
1173 AC_DEFINE(HAVE_PGDAT_HELPERS, 1, [pgdat helpers are available])
1180 dnl # Proposed API change,
1181 dnl # This symbol is not available in stock kernels. You may build a
1182 dnl # custom kernel with the *-spl-export-symbols.patch which will export
1183 dnl # these symbols for use. If your already rolling a custom kernel for
1184 dnl # your environment this is recommended.
1186 AC_DEFUN([SPL_AC_FIRST_ONLINE_PGDAT], [
1187 SPL_CHECK_SYMBOL_EXPORT(
1188 [first_online_pgdat],
1190 [AC_DEFINE(HAVE_FIRST_ONLINE_PGDAT, 1,
1191 [first_online_pgdat() is available])],
1196 dnl # Proposed API change,
1197 dnl # This symbol is not available in stock kernels. You may build a
1198 dnl # custom kernel with the *-spl-export-symbols.patch which will export
1199 dnl # these symbols for use. If your already rolling a custom kernel for
1200 dnl # your environment this is recommended.
1202 AC_DEFUN([SPL_AC_NEXT_ONLINE_PGDAT], [
1203 SPL_CHECK_SYMBOL_EXPORT(
1204 [next_online_pgdat],
1206 [AC_DEFINE(HAVE_NEXT_ONLINE_PGDAT, 1,
1207 [next_online_pgdat() is available])],
1212 dnl # Proposed API change,
1213 dnl # This symbol is not available in stock kernels. You may build a
1214 dnl # custom kernel with the *-spl-export-symbols.patch which will export
1215 dnl # these symbols for use. If your already rolling a custom kernel for
1216 dnl # your environment this is recommended.
1218 AC_DEFUN([SPL_AC_NEXT_ZONE], [
1219 SPL_CHECK_SYMBOL_EXPORT(
1222 [AC_DEFINE(HAVE_NEXT_ZONE, 1,
1223 [next_zone() is available])],
1228 dnl # 2.6.17 API change,
1229 dnl # See SPL_AC_PGDAT_HELPERS for details.
1231 AC_DEFUN([SPL_AC_PGDAT_LIST], [
1232 SPL_CHECK_SYMBOL_EXPORT(
1235 [AC_DEFINE(HAVE_PGDAT_LIST, 1,
1236 [pgdat_list is available])],
1241 dnl # 2.6.18 API change,
1242 dnl # First introduced global_page_state() support as an inline.
1244 AC_DEFUN([SPL_AC_GLOBAL_PAGE_STATE], [
1245 AC_MSG_CHECKING([whether global_page_state() is available])
1246 SPL_LINUX_TRY_COMPILE([
1247 #include <linux/mm.h>
1249 unsigned long state;
1250 state = global_page_state(0);
1253 AC_DEFINE(HAVE_GLOBAL_PAGE_STATE, 1,
1254 [global_page_state() is available])
1261 dnl # 2.6.21 API change (plus subsequent naming convention changes),
1262 dnl # Public global zone stats now include a free page count. However
1263 dnl # the enumerated names of the counters have changed since this API
1264 dnl # was introduced. We need to deduce the corrent name to use. This
1265 dnl # replaces the priviate get_zone_counts() interface.
1267 dnl # NR_FREE_PAGES was available from 2.6.21 to current kernels, which
1268 dnl # is 2.6.30 as of when this was written.
1270 AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_FREE], [
1271 AC_MSG_CHECKING([whether page state NR_FREE_PAGES is available])
1272 SPL_LINUX_TRY_COMPILE([
1273 #include <linux/mm.h>
1275 enum zone_stat_item zsi;
1276 zsi = NR_FREE_PAGES;
1279 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_FREE_PAGES, 1,
1280 [Page state NR_FREE_PAGES is available])
1287 dnl # 2.6.21 API change (plus subsequent naming convention changes),
1288 dnl # Public global zone stats now include an inactive page count. However
1289 dnl # the enumerated names of the counters have changed since this API
1290 dnl # was introduced. We need to deduce the corrent name to use. This
1291 dnl # replaces the priviate get_zone_counts() interface.
1293 dnl # NR_INACTIVE was available from 2.6.21 to 2.6.27 and included both
1294 dnl # anonymous and file inactive pages. As of 2.6.28 it was split in
1295 dnl # to NR_INACTIVE_ANON and NR_INACTIVE_FILE.
1297 AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_INACTIVE], [
1298 AC_MSG_CHECKING([whether page state NR_INACTIVE is available])
1299 SPL_LINUX_TRY_COMPILE([
1300 #include <linux/mm.h>
1302 enum zone_stat_item zsi;
1306 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_INACTIVE, 1,
1307 [Page state NR_INACTIVE is available])
1312 AC_MSG_CHECKING([whether page state NR_INACTIVE_ANON is available])
1313 SPL_LINUX_TRY_COMPILE([
1314 #include <linux/mm.h>
1316 enum zone_stat_item zsi;
1317 zsi = NR_INACTIVE_ANON;
1320 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_ANON, 1,
1321 [Page state NR_INACTIVE_ANON is available])
1326 AC_MSG_CHECKING([whether page state NR_INACTIVE_FILE is available])
1327 SPL_LINUX_TRY_COMPILE([
1328 #include <linux/mm.h>
1330 enum zone_stat_item zsi;
1331 zsi = NR_INACTIVE_FILE;
1334 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_FILE, 1,
1335 [Page state NR_INACTIVE_FILE is available])
1342 dnl # 2.6.21 API change (plus subsequent naming convention changes),
1343 dnl # Public global zone stats now include an active page count. However
1344 dnl # the enumerated names of the counters have changed since this API
1345 dnl # was introduced. We need to deduce the corrent name to use. This
1346 dnl # replaces the priviate get_zone_counts() interface.
1348 dnl # NR_ACTIVE was available from 2.6.21 to 2.6.27 and included both
1349 dnl # anonymous and file active pages. As of 2.6.28 it was split in
1350 dnl # to NR_ACTIVE_ANON and NR_ACTIVE_FILE.
1352 AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_ACTIVE], [
1353 AC_MSG_CHECKING([whether page state NR_ACTIVE is available])
1354 SPL_LINUX_TRY_COMPILE([
1355 #include <linux/mm.h>
1357 enum zone_stat_item zsi;
1361 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_ACTIVE, 1,
1362 [Page state NR_ACTIVE is available])
1367 AC_MSG_CHECKING([whether page state NR_ACTIVE_ANON is available])
1368 SPL_LINUX_TRY_COMPILE([
1369 #include <linux/mm.h>
1371 enum zone_stat_item zsi;
1372 zsi = NR_ACTIVE_ANON;
1375 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_ANON, 1,
1376 [Page state NR_ACTIVE_ANON is available])
1381 AC_MSG_CHECKING([whether page state NR_ACTIVE_FILE is available])
1382 SPL_LINUX_TRY_COMPILE([
1383 #include <linux/mm.h>
1385 enum zone_stat_item zsi;
1386 zsi = NR_ACTIVE_FILE;
1389 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_FILE, 1,
1390 [Page state NR_ACTIVE_FILE is available])
1397 dnl # Proposed API change for legacy kernels.
1398 dnl # This symbol is not available in older kernels. For kernels post
1399 dnl # 2.6.21 the global_page_state() API is used to get free/inactive/active
1400 dnl # page state information. This symbol is only used in legacy kernels
1401 dnl # any only as a last resort.
1403 AC_DEFUN([SPL_AC_GET_ZONE_COUNTS], [
1404 AC_MSG_CHECKING([whether symbol get_zone_counts is needed])
1405 SPL_LINUX_TRY_COMPILE([
1407 #if !defined(HAVE_ZONE_STAT_ITEM_NR_FREE_PAGES)
1408 #error "global_page_state needs NR_FREE_PAGES"
1411 #if !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE) && \
1412 !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_ANON) && \
1413 !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_FILE)
1414 #error "global_page_state needs NR_ACTIVE*"
1417 #if !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE) && \
1418 !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_ANON) && \
1419 !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_FILE)
1420 #error "global_page_state needs NR_INACTIVE*"
1426 AC_DEFINE(NEED_GET_ZONE_COUNTS, 1,
1427 [get_zone_counts() is needed])
1429 SPL_CHECK_SYMBOL_EXPORT(
1432 [AC_DEFINE(HAVE_GET_ZONE_COUNTS, 1,
1433 [get_zone_counts() is available])],
1439 dnl # 2.6.27 API change,
1440 dnl # The user_path_dir() replaces __user_walk()
1442 AC_DEFUN([SPL_AC_USER_PATH_DIR], [
1443 SPL_CHECK_SYMBOL_EXPORT(
1446 [AC_DEFINE(HAVE_USER_PATH_DIR, 1,
1447 [user_path_dir() is available])],
1452 dnl # Symbol available in RHEL kernels not in stock kernels.
1454 AC_DEFUN([SPL_AC_SET_FS_PWD], [
1455 SPL_CHECK_SYMBOL_EXPORT(
1458 [AC_DEFINE(HAVE_SET_FS_PWD, 1,
1459 [set_fs_pwd() is available])],
1464 dnl # 2.6.25 API change,
1465 dnl # Simplied API by replacing mnt+dentry args with a single path arg.
1467 AC_DEFUN([SPL_AC_2ARGS_SET_FS_PWD],
1468 [AC_MSG_CHECKING([whether set_fs_pwd() wants 2 args])
1469 SPL_LINUX_TRY_COMPILE([
1470 #include <linux/sched.h>
1471 #include <linux/fs_struct.h>
1473 set_fs_pwd(NULL, NULL);
1476 AC_DEFINE(HAVE_2ARGS_SET_FS_PWD, 1,
1477 [set_fs_pwd() wants 2 args])
1484 dnl # SLES API change, never adopted in mainline,
1485 dnl # Third 'struct vfsmount *' argument removed.
1487 AC_DEFUN([SPL_AC_2ARGS_VFS_UNLINK],
1488 [AC_MSG_CHECKING([whether vfs_unlink() wants 2 args])
1489 SPL_LINUX_TRY_COMPILE([
1490 #include <linux/fs.h>
1492 vfs_unlink(NULL, NULL);
1495 AC_DEFINE(HAVE_2ARGS_VFS_UNLINK, 1,
1496 [vfs_unlink() wants 2 args])
1503 dnl # SLES API change, never adopted in mainline,
1504 dnl # Third and sixth 'struct vfsmount *' argument removed.
1506 AC_DEFUN([SPL_AC_4ARGS_VFS_RENAME],
1507 [AC_MSG_CHECKING([whether vfs_rename() wants 4 args])
1508 SPL_LINUX_TRY_COMPILE([
1509 #include <linux/fs.h>
1511 vfs_rename(NULL, NULL, NULL, NULL);
1514 AC_DEFINE(HAVE_4ARGS_VFS_RENAME, 1,
1515 [vfs_rename() wants 4 args])
1522 dnl # 2.6.29 API change,
1523 dnl # check whether 'struct cred' exists
1525 AC_DEFUN([SPL_AC_CRED_STRUCT], [
1526 AC_MSG_CHECKING([whether struct cred exists])
1527 SPL_LINUX_TRY_COMPILE([
1528 #include <linux/cred.h>
1534 AC_DEFINE(HAVE_CRED_STRUCT, 1, [struct cred exists])
1541 dnl # Custom SPL patch may export this symbol.
1543 AC_DEFUN([SPL_AC_GROUPS_SEARCH], [
1544 SPL_CHECK_SYMBOL_EXPORT(
1547 [AC_DEFINE(HAVE_GROUPS_SEARCH, 1,
1548 [groups_search() is available])],
1553 dnl # 2.6.x API change,
1554 dnl # __put_task_struct() was exported in RHEL5 but unavailable elsewhere.
1556 AC_DEFUN([SPL_AC_PUT_TASK_STRUCT], [
1557 SPL_CHECK_SYMBOL_EXPORT(
1558 [__put_task_struct],
1560 [AC_DEFINE(HAVE_PUT_TASK_STRUCT, 1,
1561 [__put_task_struct() is available])],
1566 dnl # 2.6.32 API change,
1567 dnl # Unused 'struct file *' removed from prototype.
1569 AC_DEFUN([SPL_AC_5ARGS_PROC_HANDLER], [
1570 AC_MSG_CHECKING([whether proc_handler() wants 5 args])
1571 SPL_LINUX_TRY_COMPILE([
1572 #include <linux/sysctl.h>
1574 proc_dostring(NULL, 0, NULL, NULL, NULL);
1577 AC_DEFINE(HAVE_5ARGS_PROC_HANDLER, 1,
1578 [proc_handler() wants 5 args])
1585 dnl # 2.6.x API change,
1586 dnl # kvasprintf() function added.
1588 AC_DEFUN([SPL_AC_KVASPRINTF], [
1589 SPL_CHECK_SYMBOL_EXPORT(
1592 [AC_DEFINE(HAVE_KVASPRINTF, 1,
1593 [kvasprintf() is available])],
1598 dnl # 2.6.35 API change,
1599 dnl # Unused 'struct dentry *' removed from prototype.
1601 AC_DEFUN([SPL_AC_3ARGS_FILE_FSYNC], [
1602 AC_MSG_CHECKING([whether file_fsync() wants 3 args])
1603 SPL_LINUX_TRY_COMPILE([
1604 #include <linux/buffer_head.h>
1606 file_fsync(NULL, NULL, 0);
1609 AC_DEFINE(HAVE_3ARGS_FILE_FSYNC, 1,
1610 [file_fsync() wants 3 args])
1617 dnl # 2.6.33 API change. Also backported in RHEL5 as of 2.6.18-190.el5.
1618 dnl # Earlier versions of rwsem_is_locked() were inline and had a race
1619 dnl # condition. The fixed version is exported as a symbol. The race
1620 dnl # condition is fixed by acquiring sem->wait_lock, so we must not
1621 dnl # call that version while holding sem->wait_lock.
1623 AC_DEFUN([SPL_AC_EXPORTED_RWSEM_IS_LOCKED], [
1624 SPL_CHECK_SYMBOL_EXPORT(
1626 [lib/rwsem-spinlock.c],
1627 [AC_DEFINE(RWSEM_IS_LOCKED_TAKES_WAIT_LOCK, 1,
1628 [rwsem_is_locked() acquires sem->wait_lock])],