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 dnl # -Wall -fno-strict-aliasing -Wstrict-prototypes and other
13 dnl # compiler options are added by the kernel build system.
14 abs_srcdir=`readlink -f ${srcdir}`
15 KERNELCPPFLAGS="$KERNELCPPFLAGS -Wstrict-prototypes"
16 KERNELCPPFLAGS="$KERNELCPPFLAGS -I${abs_srcdir}/include"
17 KERNELCPPFLAGS="$KERNELCPPFLAGS -include ${abs_srcdir}/spl_config.h"
19 if test "${LINUX_OBJ}" != "${LINUX}"; then
20 KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ"
23 AC_SUBST(KERNELMAKE_PARAMS)
24 AC_SUBST(KERNELCPPFLAGS)
28 SPL_AC_DEBUG_KMEM_TRACKING
29 SPL_AC_ATOMIC_SPINLOCK
30 SPL_AC_TYPE_ATOMIC64_CMPXCHG
31 SPL_AC_TYPE_ATOMIC64_XCHG
33 SPL_AC_3ARGS_INIT_WORK
34 SPL_AC_2ARGS_REGISTER_SYSCTL
36 SPL_AC_PATH_IN_NAMEIDATA
42 SPL_AC_5ARGS_DEVICE_CREATE
43 SPL_AC_CLASS_DEVICE_CREATE
44 SPL_AC_SET_NORMALIZED_TIMESPEC_EXPORT
45 SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE
52 SPL_AC_MONOTONIC_CLOCK
55 SPL_AC_MUTEX_LOCK_NESTED
56 SPL_AC_3ARGS_ON_EACH_CPU
57 SPL_AC_KALLSYMS_LOOKUP_NAME
58 SPL_AC_GET_VMALLOC_INFO
60 SPL_AC_FIRST_ONLINE_PGDAT
61 SPL_AC_NEXT_ONLINE_PGDAT
64 SPL_AC_GLOBAL_PAGE_STATE
65 SPL_AC_ZONE_STAT_ITEM_FREE
66 SPL_AC_ZONE_STAT_ITEM_INACTIVE
67 SPL_AC_ZONE_STAT_ITEM_ACTIVE
68 SPL_AC_GET_ZONE_COUNTS
71 SPL_AC_2ARGS_SET_FS_PWD
72 SPL_AC_2ARGS_VFS_UNLINK
73 SPL_AC_4ARGS_VFS_RENAME
76 SPL_AC_PUT_TASK_STRUCT
77 SPL_AC_5ARGS_PROC_HANDLER
79 SPL_AC_3ARGS_FILE_FSYNC
82 AC_DEFUN([SPL_AC_MODULE_SYMVERS], [
83 modpost=$LINUX/scripts/Makefile.modpost
84 AC_MSG_CHECKING([kernel file name for module symbols])
85 if test -f "$modpost"; then
86 if grep -q Modules.symvers $modpost; then
87 LINUX_SYMBOLS=Modules.symvers
89 LINUX_SYMBOLS=Module.symvers
94 AC_MSG_RESULT($LINUX_SYMBOLS)
95 AC_SUBST(LINUX_SYMBOLS)
98 AC_DEFUN([SPL_AC_KERNEL], [
100 AS_HELP_STRING([--with-linux=PATH],
101 [Path to kernel source]),
102 [kernelsrc="$withval"])
104 AC_ARG_WITH([linux-obj],
105 AS_HELP_STRING([--with-linux-obj=PATH],
106 [Path to kernel build objects]),
107 [kernelbuild="$withval"])
109 AC_MSG_CHECKING([kernel source directory])
110 if test -z "$kernelsrc"; then
111 headersdir="/lib/modules/$(uname -r)/build"
112 if test -e "$headersdir"; then
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 -d ${kernelsrc}-obj/${target_cpu}/${target_cpu}; then
139 kernelbuild=${kernelsrc}-obj/${target_cpu}/${target_cpu}
140 elif test -d ${kernelsrc}-obj/${target_cpu}/default; then
141 kernelbuild=${kernelsrc}-obj/${target_cpu}/default
142 elif test -d `dirname ${kernelsrc}`/build-${target_cpu}; then
143 kernelbuild=`dirname ${kernelsrc}`/build-${target_cpu}
145 kernelbuild=${kernelsrc}
148 AC_MSG_RESULT([$kernelbuild])
150 AC_MSG_CHECKING([kernel source version])
151 utsrelease1=$kernelbuild/include/linux/version.h
152 utsrelease2=$kernelbuild/include/linux/utsrelease.h
153 utsrelease3=$kernelbuild/include/generated/utsrelease.h
154 if test -r $utsrelease1 && fgrep -q UTS_RELEASE $utsrelease1; then
155 utsrelease=linux/version.h
156 elif test -r $utsrelease2 && fgrep -q UTS_RELEASE $utsrelease2; then
157 utsrelease=linux/utsrelease.h
158 elif test -r $utsrelease3 && fgrep -q UTS_RELEASE $utsrelease3; then
159 utsrelease=generated/utsrelease.h
162 if test "$utsrelease"; then
163 kernsrcver=`(echo "#include <$utsrelease>";
164 echo "kernsrcver=UTS_RELEASE") |
165 cpp -I $kernelbuild/include |
166 grep "^kernsrcver=" | cut -d \" -f 2`
168 if test -z "$kernsrcver"; then
169 AC_MSG_RESULT([Not found])
170 AC_MSG_ERROR([*** Cannot determine kernel version.])
173 AC_MSG_RESULT([Not found])
174 AC_MSG_ERROR([*** Cannot find UTS_RELEASE definition.])
177 AC_MSG_RESULT([$kernsrcver])
180 LINUX_OBJ=${kernelbuild}
181 LINUX_VERSION=${kernsrcver}
185 AC_SUBST(LINUX_VERSION)
187 SPL_AC_MODULE_SYMVERS
191 dnl # Explicitly check for gawk, we require it for the the usermode
192 dnl # helper. For some reason the standard awk command does not
193 dnl # behave correctly when invoked from the usermode helper.
195 AC_DEFUN([SPL_AC_GAWK], [
196 AS_IF([test "x$AWK" != xgawk], [
198 *** Required util gawk missing. Please install the required
199 *** gawk package for your distribution and try again.])
204 dnl # Default SPL user configuration
206 AC_DEFUN([SPL_AC_CONFIG_USER], [
211 dnl # Check for rpm+rpmbuild to build RPM packages. If these tools
212 dnl # are missing it is non-fatal but you will not be able to build
213 dnl # RPM packages and will be warned if you try too.
215 AC_DEFUN([SPL_AC_RPM], [
219 AC_MSG_CHECKING([whether $RPM is available])
220 AS_IF([tmp=$($RPM --version 2>/dev/null)], [
221 RPM_VERSION=$(echo $tmp | $AWK '/RPM/ { print $[3] }')
223 AC_MSG_RESULT([$HAVE_RPM ($RPM_VERSION)])
226 AC_MSG_RESULT([$HAVE_RPM])
229 AC_MSG_CHECKING([whether $RPMBUILD is available])
230 AS_IF([tmp=$($RPMBUILD --version 2>/dev/null)], [
231 RPMBUILD_VERSION=$(echo $tmp | $AWK '/RPM/ { print $[3] }')
233 AC_MSG_RESULT([$HAVE_RPMBUILD ($RPMBUILD_VERSION)])
236 AC_MSG_RESULT([$HAVE_RPMBUILD])
241 AC_SUBST(RPM_VERSION)
243 AC_SUBST(HAVE_RPMBUILD)
245 AC_SUBST(RPMBUILD_VERSION)
249 dnl # Check for dpkg+dpkg-buildpackage to build DEB packages. If these
250 dnl # tools are missing it is non-fatal but you will not be able to build
251 dnl # DEB packages and will be warned if you try too.
253 AC_DEFUN([SPL_AC_DPKG], [
255 DPKGBUILD=dpkg-buildpackage
257 AC_MSG_CHECKING([whether $DPKG is available])
258 AS_IF([tmp=$($DPKG --version 2>/dev/null)], [
259 DPKG_VERSION=$(echo $tmp | $AWK '/Debian/ { print $[7] }')
261 AC_MSG_RESULT([$HAVE_DPKG ($DPKG_VERSION)])
264 AC_MSG_RESULT([$HAVE_DPKG])
267 AC_MSG_CHECKING([whether $DPKGBUILD is available])
268 AS_IF([tmp=$($DPKGBUILD --version 2>/dev/null)], [
269 DPKGBUILD_VERSION=$(echo $tmp | \
270 $AWK '/Debian/ { print $[4] }' | cut -f-4 -d'.')
272 AC_MSG_RESULT([$HAVE_DPKGBUILD ($DPKGBUILD_VERSION)])
275 AC_MSG_RESULT([$HAVE_DPKGBUILD])
280 AC_SUBST(DPKG_VERSION)
282 AC_SUBST(HAVE_DPKGBUILD)
284 AC_SUBST(DPKGBUILD_VERSION)
288 dnl # Until native packaging for various different packing systems
289 dnl # can be added the least we can do is attempt to use alien to
290 dnl # convert the RPM packages to the needed package type. This is
291 dnl # a hack but so far it has worked reasonable well.
293 AC_DEFUN([SPL_AC_ALIEN], [
296 AC_MSG_CHECKING([whether $ALIEN is available])
297 AS_IF([tmp=$($ALIEN --version 2>/dev/null)], [
298 ALIEN_VERSION=$(echo $tmp | $AWK '{ print $[3] }')
300 AC_MSG_RESULT([$HAVE_ALIEN ($ALIEN_VERSION)])
303 AC_MSG_RESULT([$HAVE_ALIEN])
308 AC_SUBST(ALIEN_VERSION)
312 dnl # Using the VENDOR tag from config.guess set the default
313 dnl # package type for 'make pkg': (rpm | deb | tgz)
315 AC_DEFUN([SPL_AC_DEFAULT_PACKAGE], [
316 VENDOR=$(echo $ac_build_alias | cut -f2 -d'-')
318 AC_MSG_CHECKING([default package type])
320 fedora) DEFAULT_PACKAGE=rpm ;;
321 redhat) DEFAULT_PACKAGE=rpm ;;
322 sles) DEFAULT_PACKAGE=rpm ;;
323 ubuntu) DEFAULT_PACKAGE=deb ;;
324 debian) DEFAULT_PACKAGE=deb ;;
325 slackware) DEFAULT_PACKAGE=tgz ;;
326 *) DEFAULT_PACKAGE=rpm ;;
329 AC_MSG_RESULT([$DEFAULT_PACKAGE])
330 AC_SUBST(DEFAULT_PACKAGE)
334 dnl # Default SPL user configuration
336 AC_DEFUN([SPL_AC_PACKAGE], [
340 SPL_AC_DEFAULT_PACKAGE
343 AC_DEFUN([SPL_AC_LICENSE], [
344 AC_MSG_CHECKING([spl license])
346 AC_MSG_RESULT([$LICENSE])
347 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DHAVE_GPL_ONLY_SYMBOLS"
351 AC_DEFUN([SPL_AC_CONFIG], [
353 AC_ARG_WITH([config],
354 AS_HELP_STRING([--with-config=CONFIG],
355 [Config file 'kernel|user|all|srpm']),
356 [SPL_CONFIG="$withval"])
358 AC_MSG_CHECKING([spl config])
359 AC_MSG_RESULT([$SPL_CONFIG]);
362 case "$SPL_CONFIG" in
363 kernel) SPL_AC_CONFIG_KERNEL ;;
364 user) SPL_AC_CONFIG_USER ;;
365 all) SPL_AC_CONFIG_KERNEL
366 SPL_AC_CONFIG_USER ;;
369 AC_MSG_RESULT([Error!])
370 AC_MSG_ERROR([Bad value "$SPL_CONFIG" for --with-config,
371 user kernel|user|all|srpm]) ;;
374 AM_CONDITIONAL([CONFIG_USER],
375 [test "$SPL_CONFIG" = user] ||
376 [test "$SPL_CONFIG" = all])
377 AM_CONDITIONAL([CONFIG_KERNEL],
378 [test "$SPL_CONFIG" = kernel] ||
379 [test "$SPL_CONFIG" = all])
383 dnl # Enable if the SPL should be compiled with internal debugging enabled.
384 dnl # By default this support is disabled.
386 AC_DEFUN([SPL_AC_DEBUG], [
387 AC_MSG_CHECKING([whether debugging is enabled])
388 AC_ARG_ENABLE([debug],
389 [AS_HELP_STRING([--enable-debug],
390 [Enable generic debug support @<:@default=no@:>@])],
394 AS_IF([test "x$enable_debug" = xyes],
396 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG -Werror"
397 DEBUG_CFLAGS="-DDEBUG -Werror"
400 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG"
401 DEBUG_CFLAGS="-DNDEBUG"
404 AC_SUBST(DEBUG_CFLAGS)
405 AC_MSG_RESULT([$enable_debug])
409 dnl # Enabled by default it provides a minimal level of memory tracking.
410 dnl # A total count of bytes allocated is kept for each alloc and free.
411 dnl # Then at module unload time a report to the console will be printed
412 dnl # if memory was leaked. Additionally, /proc/spl/kmem/slab will exist
413 dnl # and provide an easy way to inspect the kmem based slab.
415 AC_DEFUN([SPL_AC_DEBUG_KMEM], [
416 AC_ARG_ENABLE([debug-kmem],
417 [AS_HELP_STRING([--enable-debug-kmem],
418 [Enable basic kmem accounting @<:@default=yes@:>@])],
420 [enable_debug_kmem=yes])
422 AS_IF([test "x$enable_debug_kmem" = xyes],
423 [AC_DEFINE([DEBUG_KMEM], [1],
424 [Define to 1 to enable basic kmem accounting])
425 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM"])
427 AC_MSG_CHECKING([whether basic kmem accounting is enabled])
428 AC_MSG_RESULT([$enable_debug_kmem])
432 dnl # Disabled by default it provides detailed memory tracking. This
433 dnl # feature also requires --enable-debug-kmem to be set. When enabled
434 dnl # not only will total bytes be tracked but also the location of every
435 dnl # alloc and free. When the SPL module is unloaded a list of all leaked
436 dnl # addresses and where they were allocated will be dumped to the console.
437 dnl # Enabling this feature has a significant impact on performance but it
438 dnl # makes finding memory leaks pretty straight forward.
440 AC_DEFUN([SPL_AC_DEBUG_KMEM_TRACKING], [
441 AC_ARG_ENABLE([debug-kmem-tracking],
442 [AS_HELP_STRING([--enable-debug-kmem-tracking],
443 [Enable detailed kmem tracking @<:@default=no@:>@])],
445 [enable_debug_kmem_tracking=no])
447 AS_IF([test "x$enable_debug_kmem_tracking" = xyes],
448 [AC_DEFINE([DEBUG_KMEM_TRACKING], [1],
449 [Define to 1 to enable detailed kmem tracking])
450 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM_TRACKING"])
452 AC_MSG_CHECKING([whether detailed kmem tracking is enabled])
453 AC_MSG_RESULT([$enable_debug_kmem_tracking])
457 dnl # SPL_LINUX_CONFTEST
459 AC_DEFUN([SPL_LINUX_CONFTEST], [
460 cat confdefs.h - <<_ACEOF >conftest.c
466 dnl # SPL_LANG_PROGRAM(C)([PROLOGUE], [BODY])
468 m4_define([SPL_LANG_PROGRAM], [
473 dnl Do *not* indent the following line: there may be CPP directives.
474 dnl Don't move the `;' right after for the same reason.
482 dnl # SPL_LINUX_COMPILE_IFELSE / like AC_COMPILE_IFELSE
484 AC_DEFUN([SPL_LINUX_COMPILE_IFELSE], [
485 m4_ifvaln([$1], [SPL_LINUX_CONFTEST([$1])])
486 rm -Rf build && mkdir -p build
487 echo "obj-m := conftest.o" >build/Makefile
489 [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])],
491 [_AC_MSG_LOG_CONFTEST m4_ifvaln([$5],[$5])]
497 dnl # SPL_LINUX_TRY_COMPILE like AC_TRY_COMPILE
499 AC_DEFUN([SPL_LINUX_TRY_COMPILE],
500 [SPL_LINUX_COMPILE_IFELSE(
501 [AC_LANG_SOURCE([SPL_LANG_PROGRAM([[$1]], [[$2]])])],
503 [test -s build/conftest.o],
508 dnl # SPL_LINUX_CONFIG
510 AC_DEFUN([SPL_LINUX_CONFIG],
511 [AC_MSG_CHECKING([whether Linux was built with CONFIG_$1])
512 SPL_LINUX_TRY_COMPILE([
513 #ifndef AUTOCONF_INCLUDED
514 #include <linux/config.h>
518 #error CONFIG_$1 not #defined
530 dnl # SPL_CHECK_SYMBOL_EXPORT
531 dnl # check symbol exported or not
533 AC_DEFUN([SPL_CHECK_SYMBOL_EXPORT],
534 [AC_MSG_CHECKING([whether symbol $1 is exported])
535 grep -q -E '[[[:space:]]]$1[[[:space:]]]' \
536 $LINUX_OBJ/Module*.symvers 2>/dev/null
538 if test $rc -ne 0; then
541 grep -q -E "EXPORT_SYMBOL.*($1)" \
542 "$LINUX_OBJ/$file" 2>/dev/null
544 if test $rc -eq 0; then
549 if test $export -eq 0; then
563 dnl # SPL_CHECK_HEADER
564 dnl # check whether header exists and define HAVE_$2_HEADER
566 AC_DEFUN([SPL_CHECK_HEADER],
567 [AC_MSG_CHECKING([whether header $1 exists])
568 SPL_LINUX_TRY_COMPILE([
573 AC_DEFINE(HAVE_$2_HEADER, 1, [$1 exists])
583 dnl # Use the atomic implemenation based on global spinlocks. This
584 dnl # should only be needed by 32-bit kernels which do not provide
585 dnl # the atomic64_* API. It may be optionally enabled as a fallback
586 dnl # if problems are observed with the direct mapping to the native
587 dnl # Linux atomic operations. You may not disable atomic spinlocks
588 dnl # if you kernel does not an atomic64_* API.
590 AC_DEFUN([SPL_AC_ATOMIC_SPINLOCK], [
591 AC_ARG_ENABLE([atomic-spinlocks],
592 [AS_HELP_STRING([--enable-atomic-spinlocks],
593 [Atomic types use spinlocks @<:@default=check@:>@])],
595 [enable_atomic_spinlocks=check])
597 SPL_LINUX_TRY_COMPILE([
598 #include <asm/atomic.h>
603 AC_DEFINE(HAVE_ATOMIC64_T, 1,
604 [kernel defines atomic64_t])
609 AS_IF([test "x$enable_atomic_spinlocks" = xcheck], [
610 AS_IF([test "x$have_atomic64_t" = xyes], [
611 enable_atomic_spinlocks=no
613 enable_atomic_spinlocks=yes
617 AS_IF([test "x$enable_atomic_spinlocks" = xyes], [
618 AC_DEFINE([ATOMIC_SPINLOCK], [1],
619 [Atomic types use spinlocks])
621 AS_IF([test "x$have_atomic64_t" = xno], [
623 [--disable-atomic-spinlocks given but required atomic64 support is unavailable])
627 AC_MSG_CHECKING([whether atomic types use spinlocks])
628 AC_MSG_RESULT([$enable_atomic_spinlocks])
630 AC_MSG_CHECKING([whether kernel defines atomic64_t])
631 AC_MSG_RESULT([$have_atomic64_t])
635 dnl # 2.6.24 API change,
636 dnl # check if atomic64_cmpxchg is defined
638 AC_DEFUN([SPL_AC_TYPE_ATOMIC64_CMPXCHG],
639 [AC_MSG_CHECKING([whether kernel defines atomic64_cmpxchg])
640 SPL_LINUX_TRY_COMPILE([
641 #include <asm/atomic.h>
642 #include <asm/system.h>
644 atomic64_cmpxchg((atomic64_t *)NULL, 0, 0);
647 AC_DEFINE(HAVE_ATOMIC64_CMPXCHG, 1,
648 [kernel defines atomic64_cmpxchg])
655 dnl # 2.6.24 API change,
656 dnl # check if atomic64_xchg is defined
658 AC_DEFUN([SPL_AC_TYPE_ATOMIC64_XCHG],
659 [AC_MSG_CHECKING([whether kernel defines atomic64_xchg])
660 SPL_LINUX_TRY_COMPILE([
661 #include <asm/atomic.h>
663 atomic64_xchg((atomic64_t *)NULL, 0);
666 AC_DEFINE(HAVE_ATOMIC64_XCHG, 1,
667 [kernel defines atomic64_xchg])
674 dnl # 2.6.24 API change,
675 dnl # check if uintptr_t typedef is defined
677 AC_DEFUN([SPL_AC_TYPE_UINTPTR_T],
678 [AC_MSG_CHECKING([whether kernel defines uintptr_t])
679 SPL_LINUX_TRY_COMPILE([
680 #include <linux/types.h>
685 AC_DEFINE(HAVE_UINTPTR_T, 1,
686 [kernel defines uintptr_t])
693 dnl # 2.6.20 API change,
694 dnl # INIT_WORK use 2 args and not store data inside
696 AC_DEFUN([SPL_AC_3ARGS_INIT_WORK],
697 [AC_MSG_CHECKING([whether INIT_WORK wants 3 args])
698 SPL_LINUX_TRY_COMPILE([
699 #include <linux/workqueue.h>
701 struct work_struct work;
702 INIT_WORK(&work, NULL, NULL);
705 AC_DEFINE(HAVE_3ARGS_INIT_WORK, 1,
706 [INIT_WORK wants 3 args])
713 dnl # 2.6.21 API change,
714 dnl # 'register_sysctl_table' use only one argument instead of two
716 AC_DEFUN([SPL_AC_2ARGS_REGISTER_SYSCTL],
717 [AC_MSG_CHECKING([whether register_sysctl_table() wants 2 args])
718 SPL_LINUX_TRY_COMPILE([
719 #include <linux/sysctl.h>
721 return register_sysctl_table(NULL,0);
724 AC_DEFINE(HAVE_2ARGS_REGISTER_SYSCTL, 1,
725 [register_sysctl_table() wants 2 args])
732 dnl # 2.6.23 API change
733 dnl # Old set_shrinker API replaced with register_shrinker
735 AC_DEFUN([SPL_AC_SET_SHRINKER], [
736 AC_MSG_CHECKING([whether set_shrinker() available])
737 SPL_LINUX_TRY_COMPILE([
738 #include <linux/mm.h>
740 return set_shrinker(DEFAULT_SEEKS, NULL);
743 AC_DEFINE(HAVE_SET_SHRINKER, 1,
744 [set_shrinker() available])
751 dnl # 2.6.25 API change,
752 dnl # struct path entry added to struct nameidata
754 AC_DEFUN([SPL_AC_PATH_IN_NAMEIDATA],
755 [AC_MSG_CHECKING([whether struct path used in struct nameidata])
756 SPL_LINUX_TRY_COMPILE([
757 #include <linux/namei.h>
762 nd.path.dentry = NULL;
765 AC_DEFINE(HAVE_PATH_IN_NAMEIDATA, 1,
766 [struct path used in struct nameidata])
773 dnl # Custom SPL patch may export this system it is not required
775 AC_DEFUN([SPL_AC_TASK_CURR], [
776 SPL_CHECK_SYMBOL_EXPORT([task_curr], [kernel/sched.c],
777 [AC_DEFINE(HAVE_TASK_CURR, 1, [task_curr() exported])],
782 dnl # 2.6.19 API change,
783 dnl # Use CTL_UNNUMBERED when binary sysctl is not required
785 AC_DEFUN([SPL_AC_CTL_UNNUMBERED],
786 [AC_MSG_CHECKING([whether unnumbered sysctl support exists])
787 SPL_LINUX_TRY_COMPILE([
788 #include <linux/sysctl.h>
790 #ifndef CTL_UNNUMBERED
791 #error CTL_UNNUMBERED undefined
795 AC_DEFINE(HAVE_CTL_UNNUMBERED, 1,
796 [unnumbered sysctl support exists])
803 dnl # 2.6.33 API change,
804 dnl # Removed .ctl_name from struct ctl_table.
806 AC_DEFUN([SPL_AC_CTL_NAME], [
807 AC_MSG_CHECKING([whether struct ctl_table has ctl_name])
808 SPL_LINUX_TRY_COMPILE([
809 #include <linux/sysctl.h>
811 struct ctl_table ctl;
815 AC_DEFINE(HAVE_CTL_NAME, 1, [struct ctl_table has ctl_name])
822 dnl # 2.6.16 API change.
823 dnl # Check if 'fls64()' is available
825 AC_DEFUN([SPL_AC_FLS64],
826 [AC_MSG_CHECKING([whether fls64() is available])
827 SPL_LINUX_TRY_COMPILE([
828 #include <linux/bitops.h>
833 AC_DEFINE(HAVE_FLS64, 1, [fls64() is available])
840 dnl # 2.6.18 API change, check whether device_create() is available.
841 dnl # Device_create() was introduced in 2.6.18 and depricated
842 dnl # class_device_create() which was fully removed in 2.6.26.
844 AC_DEFUN([SPL_AC_DEVICE_CREATE], [
845 SPL_CHECK_SYMBOL_EXPORT(
847 [drivers/base/core.c],
848 [AC_DEFINE(HAVE_DEVICE_CREATE, 1,
849 [device_create() is available])],
854 dnl # 2.6.27 API change,
855 dnl # device_create() uses 5 args, new 'drvdata' argument.
857 AC_DEFUN([SPL_AC_5ARGS_DEVICE_CREATE], [
858 AC_MSG_CHECKING([whether device_create() wants 5 args])
859 tmp_flags="$EXTRA_KCFLAGS"
860 EXTRA_KCFLAGS="-Werror"
861 SPL_LINUX_TRY_COMPILE([
862 #include <linux/device.h>
864 device_create(NULL, NULL, 0, NULL, "%d", 1);
867 AC_DEFINE(HAVE_5ARGS_DEVICE_CREATE, 1,
868 [device_create wants 5 args])
872 EXTRA_KCFLAGS="$tmp_flags"
876 dnl # 2.6.13 API change, check whether class_device_create() is available.
877 dnl # Class_device_create() was introduced in 2.6.13 and depricated
878 dnl # class_simple_device_add() which was fully removed in 2.6.13.
880 AC_DEFUN([SPL_AC_CLASS_DEVICE_CREATE], [
881 SPL_CHECK_SYMBOL_EXPORT(
882 [class_device_create],
883 [drivers/base/class.c],
884 [AC_DEFINE(HAVE_CLASS_DEVICE_CREATE, 1,
885 [class_device_create() is available])],
890 dnl # 2.6.26 API change, set_normalized_timespec() is exported.
892 AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_EXPORT], [
893 SPL_CHECK_SYMBOL_EXPORT(
894 [set_normalized_timespec],
896 [AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_EXPORT, 1,
897 [set_normalized_timespec() is available as export])],
902 dnl # 2.6.16 API change, set_normalize_timespec() moved to time.c
903 dnl # previously it was available in time.h as an inline.
905 AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE], [
906 AC_MSG_CHECKING([whether set_normalized_timespec() is an inline])
907 SPL_LINUX_TRY_COMPILE([
908 #include <linux/time.h>
909 void set_normalized_timespec(struct timespec *ts,
910 time_t sec, long nsec) { }
917 AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_INLINE, 1,
918 [set_normalized_timespec() is available as inline])
923 dnl # 2.6.18 API change,
924 dnl # timespec_sub() inline function available in linux/time.h
926 AC_DEFUN([SPL_AC_TIMESPEC_SUB], [
927 AC_MSG_CHECKING([whether timespec_sub() is available])
928 SPL_LINUX_TRY_COMPILE([
929 #include <linux/time.h>
931 struct timespec a, b, c = { 0 };
932 c = timespec_sub(a, b);
935 AC_DEFINE(HAVE_TIMESPEC_SUB, 1, [timespec_sub() is available])
942 dnl # 2.6.19 API change,
943 dnl # check if init_utsname() is available in linux/utsname.h
945 AC_DEFUN([SPL_AC_INIT_UTSNAME], [
946 AC_MSG_CHECKING([whether init_utsname() is available])
947 SPL_LINUX_TRY_COMPILE([
948 #include <linux/utsname.h>
950 struct new_utsname *a = init_utsname();
953 AC_DEFINE(HAVE_INIT_UTSNAME, 1, [init_utsname() is available])
960 dnl # 2.6.26 API change,
961 dnl # definition of struct fdtable relocated to linux/fdtable.h
963 AC_DEFUN([SPL_AC_FDTABLE_HEADER], [
964 SPL_CHECK_HEADER([linux/fdtable.h], [FDTABLE], [], [])
968 dnl # 2.6.14 API change,
969 dnl # check whether 'files_fdtable()' exists
971 AC_DEFUN([SPL_AC_FILES_FDTABLE], [
972 AC_MSG_CHECKING([whether files_fdtable() is available])
973 SPL_LINUX_TRY_COMPILE([
974 #include <linux/sched.h>
975 #include <linux/file.h>
976 #ifdef HAVE_FDTABLE_HEADER
977 #include <linux/fdtable.h>
980 struct files_struct *files = current->files;
981 struct fdtable *fdt = files_fdtable(files);
984 AC_DEFINE(HAVE_FILES_FDTABLE, 1, [files_fdtable() is available])
991 dnl # 2.6.18 API change,
992 dnl # added linux/uaccess.h
994 AC_DEFUN([SPL_AC_UACCESS_HEADER], [
995 SPL_CHECK_HEADER([linux/uaccess.h], [UACCESS], [], [])
999 dnl # 2.6.12 API change,
1000 dnl # check whether 'kmalloc_node()' is available.
1002 AC_DEFUN([SPL_AC_KMALLOC_NODE], [
1003 AC_MSG_CHECKING([whether kmalloc_node() is available])
1004 SPL_LINUX_TRY_COMPILE([
1005 #include <linux/slab.h>
1007 void *a = kmalloc_node(1, GFP_KERNEL, 0);
1010 AC_DEFINE(HAVE_KMALLOC_NODE, 1, [kmalloc_node() is available])
1017 dnl # 2.6.9 API change,
1018 dnl # check whether 'monotonic_clock()' is available it may
1019 dnl # be available for some archs but not others.
1021 AC_DEFUN([SPL_AC_MONOTONIC_CLOCK], [
1022 SPL_CHECK_SYMBOL_EXPORT(
1025 [AC_DEFINE(HAVE_MONOTONIC_CLOCK, 1,
1026 [monotonic_clock() is available])],
1031 dnl # 2.6.16 API change,
1032 dnl # check whether 'struct inode' has i_mutex
1034 AC_DEFUN([SPL_AC_INODE_I_MUTEX], [
1035 AC_MSG_CHECKING([whether struct inode has i_mutex])
1036 SPL_LINUX_TRY_COMPILE([
1037 #include <linux/fs.h>
1038 #include <linux/mutex.h>
1041 mutex_init(&i.i_mutex);
1044 AC_DEFINE(HAVE_INODE_I_MUTEX, 1, [struct inode has i_mutex])
1051 dnl # 2.6.29 API change,
1052 dnl # Adaptive mutexs introduced.
1054 AC_DEFUN([SPL_AC_MUTEX_OWNER], [
1055 AC_MSG_CHECKING([whether struct mutex has owner])
1056 SPL_LINUX_TRY_COMPILE([
1057 #include <linux/mutex.h>
1063 AC_DEFINE(HAVE_MUTEX_OWNER, 1, [struct mutex has owner])
1070 dnl # 2.6.18 API change,
1071 dnl # First introduced 'mutex_lock_nested()' in include/linux/mutex.h,
1072 dnl # as part of the mutex validator. Fallback to using 'mutex_lock()'
1073 dnl # if the mutex validator is disabled or otherwise unavailable.
1075 AC_DEFUN([SPL_AC_MUTEX_LOCK_NESTED], [
1076 AC_MSG_CHECKING([whether mutex_lock_nested() is available])
1077 SPL_LINUX_TRY_COMPILE([
1078 #include <linux/mutex.h>
1082 mutex_lock_nested(&mutex, 0);
1085 AC_DEFINE(HAVE_MUTEX_LOCK_NESTED, 1,
1086 [mutex_lock_nested() is available])
1093 dnl # 2.6.27 API change,
1094 dnl # on_each_cpu() uses 3 args, no 'retry' argument
1096 AC_DEFUN([SPL_AC_3ARGS_ON_EACH_CPU], [
1097 AC_MSG_CHECKING([whether on_each_cpu() wants 3 args])
1098 SPL_LINUX_TRY_COMPILE([
1099 #include <linux/smp.h>
1101 on_each_cpu(NULL, NULL, 0);
1104 AC_DEFINE(HAVE_3ARGS_ON_EACH_CPU, 1,
1105 [on_each_cpu wants 3 args])
1112 dnl # 2.6.18 API change,
1113 dnl # kallsyms_lookup_name no longer exported
1115 AC_DEFUN([SPL_AC_KALLSYMS_LOOKUP_NAME], [
1116 SPL_CHECK_SYMBOL_EXPORT(
1117 [kallsyms_lookup_name],
1119 [AC_DEFINE(HAVE_KALLSYMS_LOOKUP_NAME, 1,
1120 [kallsyms_lookup_name() is available])],
1125 dnl # Proposed API change,
1126 dnl # This symbol is not available in stock kernels. You may build a
1127 dnl # custom kernel with the *-spl-export-symbols.patch which will export
1128 dnl # these symbols for use. If your already rolling a custom kernel for
1129 dnl # your environment this is recommended.
1131 AC_DEFUN([SPL_AC_GET_VMALLOC_INFO], [
1132 SPL_CHECK_SYMBOL_EXPORT(
1135 [AC_DEFINE(HAVE_GET_VMALLOC_INFO, 1,
1136 [get_vmalloc_info() is available])],
1141 dnl # 2.6.17 API change
1142 dnl # The helper functions first_online_pgdat(), next_online_pgdat(), and
1143 dnl # next_zone() are introduced to simplify for_each_zone(). These symbols
1144 dnl # were exported in 2.6.17 for use by modules which was consistent with
1145 dnl # the previous implementation of for_each_zone(). From 2.6.18 - 2.6.19
1146 dnl # the symbols were exported as 'unused', and by 2.6.20 they exports
1147 dnl # were dropped entirely leaving modules no way to directly iterate over
1148 dnl # the zone list. Because we need access to the zone helpers we check
1149 dnl # if the kernel contains the old or new implementation. Then we check
1150 dnl # to see if the symbols we need for each version are available. If they
1151 dnl # are not, dynamically aquire the addresses with kallsyms_lookup_name().
1153 AC_DEFUN([SPL_AC_PGDAT_HELPERS], [
1154 AC_MSG_CHECKING([whether symbol *_pgdat exist])
1155 grep -q -E 'first_online_pgdat' $LINUX/include/linux/mmzone.h 2>/dev/null
1157 if test $rc -eq 0; then
1158 AC_MSG_RESULT([yes])
1159 AC_DEFINE(HAVE_PGDAT_HELPERS, 1, [pgdat helpers are available])
1166 dnl # Proposed API change,
1167 dnl # This symbol is not available in stock kernels. You may build a
1168 dnl # custom kernel with the *-spl-export-symbols.patch which will export
1169 dnl # these symbols for use. If your already rolling a custom kernel for
1170 dnl # your environment this is recommended.
1172 AC_DEFUN([SPL_AC_FIRST_ONLINE_PGDAT], [
1173 SPL_CHECK_SYMBOL_EXPORT(
1174 [first_online_pgdat],
1176 [AC_DEFINE(HAVE_FIRST_ONLINE_PGDAT, 1,
1177 [first_online_pgdat() is available])],
1182 dnl # Proposed API change,
1183 dnl # This symbol is not available in stock kernels. You may build a
1184 dnl # custom kernel with the *-spl-export-symbols.patch which will export
1185 dnl # these symbols for use. If your already rolling a custom kernel for
1186 dnl # your environment this is recommended.
1188 AC_DEFUN([SPL_AC_NEXT_ONLINE_PGDAT], [
1189 SPL_CHECK_SYMBOL_EXPORT(
1190 [next_online_pgdat],
1192 [AC_DEFINE(HAVE_NEXT_ONLINE_PGDAT, 1,
1193 [next_online_pgdat() is available])],
1198 dnl # Proposed API change,
1199 dnl # This symbol is not available in stock kernels. You may build a
1200 dnl # custom kernel with the *-spl-export-symbols.patch which will export
1201 dnl # these symbols for use. If your already rolling a custom kernel for
1202 dnl # your environment this is recommended.
1204 AC_DEFUN([SPL_AC_NEXT_ZONE], [
1205 SPL_CHECK_SYMBOL_EXPORT(
1208 [AC_DEFINE(HAVE_NEXT_ZONE, 1,
1209 [next_zone() is available])],
1214 dnl # 2.6.17 API change,
1215 dnl # See SPL_AC_PGDAT_HELPERS for details.
1217 AC_DEFUN([SPL_AC_PGDAT_LIST], [
1218 SPL_CHECK_SYMBOL_EXPORT(
1221 [AC_DEFINE(HAVE_PGDAT_LIST, 1,
1222 [pgdat_list is available])],
1227 dnl # 2.6.18 API change,
1228 dnl # First introduced global_page_state() support as an inline.
1230 AC_DEFUN([SPL_AC_GLOBAL_PAGE_STATE], [
1231 AC_MSG_CHECKING([whether global_page_state() is available])
1232 SPL_LINUX_TRY_COMPILE([
1233 #include <linux/mm.h>
1235 unsigned long state;
1236 state = global_page_state(0);
1239 AC_DEFINE(HAVE_GLOBAL_PAGE_STATE, 1,
1240 [global_page_state() is available])
1247 dnl # 2.6.21 API change (plus subsequent naming convention changes),
1248 dnl # Public global zone stats now include a free page count. However
1249 dnl # the enumerated names of the counters have changed since this API
1250 dnl # was introduced. We need to deduce the corrent name to use. This
1251 dnl # replaces the priviate get_zone_counts() interface.
1253 dnl # NR_FREE_PAGES was available from 2.6.21 to current kernels, which
1254 dnl # is 2.6.30 as of when this was written.
1256 AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_FREE], [
1257 AC_MSG_CHECKING([whether page state NR_FREE_PAGES is available])
1258 SPL_LINUX_TRY_COMPILE([
1259 #include <linux/mm.h>
1261 enum zone_stat_item zsi;
1262 zsi = NR_FREE_PAGES;
1265 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_FREE_PAGES, 1,
1266 [Page state NR_FREE_PAGES is available])
1273 dnl # 2.6.21 API change (plus subsequent naming convention changes),
1274 dnl # Public global zone stats now include an inactive page count. However
1275 dnl # the enumerated names of the counters have changed since this API
1276 dnl # was introduced. We need to deduce the corrent name to use. This
1277 dnl # replaces the priviate get_zone_counts() interface.
1279 dnl # NR_INACTIVE was available from 2.6.21 to 2.6.27 and included both
1280 dnl # anonymous and file inactive pages. As of 2.6.28 it was split in
1281 dnl # to NR_INACTIVE_ANON and NR_INACTIVE_FILE.
1283 AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_INACTIVE], [
1284 AC_MSG_CHECKING([whether page state NR_INACTIVE is available])
1285 SPL_LINUX_TRY_COMPILE([
1286 #include <linux/mm.h>
1288 enum zone_stat_item zsi;
1292 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_INACTIVE, 1,
1293 [Page state NR_INACTIVE is available])
1298 AC_MSG_CHECKING([whether page state NR_INACTIVE_ANON is available])
1299 SPL_LINUX_TRY_COMPILE([
1300 #include <linux/mm.h>
1302 enum zone_stat_item zsi;
1303 zsi = NR_INACTIVE_ANON;
1306 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_ANON, 1,
1307 [Page state NR_INACTIVE_ANON is available])
1312 AC_MSG_CHECKING([whether page state NR_INACTIVE_FILE is available])
1313 SPL_LINUX_TRY_COMPILE([
1314 #include <linux/mm.h>
1316 enum zone_stat_item zsi;
1317 zsi = NR_INACTIVE_FILE;
1320 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_FILE, 1,
1321 [Page state NR_INACTIVE_FILE is available])
1328 dnl # 2.6.21 API change (plus subsequent naming convention changes),
1329 dnl # Public global zone stats now include an active page count. However
1330 dnl # the enumerated names of the counters have changed since this API
1331 dnl # was introduced. We need to deduce the corrent name to use. This
1332 dnl # replaces the priviate get_zone_counts() interface.
1334 dnl # NR_ACTIVE was available from 2.6.21 to 2.6.27 and included both
1335 dnl # anonymous and file active pages. As of 2.6.28 it was split in
1336 dnl # to NR_ACTIVE_ANON and NR_ACTIVE_FILE.
1338 AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_ACTIVE], [
1339 AC_MSG_CHECKING([whether page state NR_ACTIVE is available])
1340 SPL_LINUX_TRY_COMPILE([
1341 #include <linux/mm.h>
1343 enum zone_stat_item zsi;
1347 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_ACTIVE, 1,
1348 [Page state NR_ACTIVE is available])
1353 AC_MSG_CHECKING([whether page state NR_ACTIVE_ANON is available])
1354 SPL_LINUX_TRY_COMPILE([
1355 #include <linux/mm.h>
1357 enum zone_stat_item zsi;
1358 zsi = NR_ACTIVE_ANON;
1361 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_ANON, 1,
1362 [Page state NR_ACTIVE_ANON is available])
1367 AC_MSG_CHECKING([whether page state NR_ACTIVE_FILE is available])
1368 SPL_LINUX_TRY_COMPILE([
1369 #include <linux/mm.h>
1371 enum zone_stat_item zsi;
1372 zsi = NR_ACTIVE_FILE;
1375 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_FILE, 1,
1376 [Page state NR_ACTIVE_FILE is available])
1383 dnl # Proposed API change for legacy kernels.
1384 dnl # This symbol is not available in older kernels. For kernels post
1385 dnl # 2.6.21 the global_page_state() API is used to get free/inactive/active
1386 dnl # page state information. This symbol is only used in legacy kernels
1387 dnl # any only as a last resort.
1389 AC_DEFUN([SPL_AC_GET_ZONE_COUNTS], [
1390 AC_MSG_CHECKING([whether symbol get_zone_counts is needed])
1391 SPL_LINUX_TRY_COMPILE([
1393 #if !defined(HAVE_ZONE_STAT_ITEM_NR_FREE_PAGES)
1394 #error "global_page_state needs NR_FREE_PAGES"
1397 #if !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE) && \
1398 !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_ANON) && \
1399 !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_FILE)
1400 #error "global_page_state needs NR_ACTIVE*"
1403 #if !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE) && \
1404 !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_ANON) && \
1405 !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_FILE)
1406 #error "global_page_state needs NR_INACTIVE*"
1412 AC_DEFINE(NEED_GET_ZONE_COUNTS, 1,
1413 [get_zone_counts() is needed])
1415 SPL_CHECK_SYMBOL_EXPORT(
1418 [AC_DEFINE(HAVE_GET_ZONE_COUNTS, 1,
1419 [get_zone_counts() is available])],
1425 dnl # 2.6.27 API change,
1426 dnl # The user_path_dir() replaces __user_walk()
1428 AC_DEFUN([SPL_AC_USER_PATH_DIR], [
1429 SPL_CHECK_SYMBOL_EXPORT(
1432 [AC_DEFINE(HAVE_USER_PATH_DIR, 1,
1433 [user_path_dir() is available])],
1438 dnl # Symbol available in RHEL kernels not in stock kernels.
1440 AC_DEFUN([SPL_AC_SET_FS_PWD], [
1441 SPL_CHECK_SYMBOL_EXPORT(
1444 [AC_DEFINE(HAVE_SET_FS_PWD, 1,
1445 [set_fs_pwd() is available])],
1450 dnl # 2.6.25 API change,
1451 dnl # Simplied API by replacing mnt+dentry args with a single path arg.
1453 AC_DEFUN([SPL_AC_2ARGS_SET_FS_PWD],
1454 [AC_MSG_CHECKING([whether set_fs_pwd() wants 2 args])
1455 SPL_LINUX_TRY_COMPILE([
1456 #include <linux/sched.h>
1457 #include <linux/fs_struct.h>
1459 set_fs_pwd(NULL, NULL);
1462 AC_DEFINE(HAVE_2ARGS_SET_FS_PWD, 1,
1463 [set_fs_pwd() wants 2 args])
1470 dnl # SLES API change, never adopted in mainline,
1471 dnl # Third 'struct vfsmount *' argument removed.
1473 AC_DEFUN([SPL_AC_2ARGS_VFS_UNLINK],
1474 [AC_MSG_CHECKING([whether vfs_unlink() wants 2 args])
1475 SPL_LINUX_TRY_COMPILE([
1476 #include <linux/fs.h>
1478 vfs_unlink(NULL, NULL);
1481 AC_DEFINE(HAVE_2ARGS_VFS_UNLINK, 1,
1482 [vfs_unlink() wants 2 args])
1489 dnl # SLES API change, never adopted in mainline,
1490 dnl # Third and sixth 'struct vfsmount *' argument removed.
1492 AC_DEFUN([SPL_AC_4ARGS_VFS_RENAME],
1493 [AC_MSG_CHECKING([whether vfs_rename() wants 4 args])
1494 SPL_LINUX_TRY_COMPILE([
1495 #include <linux/fs.h>
1497 vfs_rename(NULL, NULL, NULL, NULL);
1500 AC_DEFINE(HAVE_4ARGS_VFS_RENAME, 1,
1501 [vfs_rename() wants 4 args])
1508 dnl # 2.6.29 API change,
1509 dnl # check whether 'struct cred' exists
1511 AC_DEFUN([SPL_AC_CRED_STRUCT], [
1512 AC_MSG_CHECKING([whether struct cred exists])
1513 SPL_LINUX_TRY_COMPILE([
1514 #include <linux/cred.h>
1520 AC_DEFINE(HAVE_CRED_STRUCT, 1, [struct cred exists])
1527 dnl # Custom SPL patch may export this symbol.
1529 AC_DEFUN([SPL_AC_GROUPS_SEARCH], [
1530 SPL_CHECK_SYMBOL_EXPORT(
1533 [AC_DEFINE(HAVE_GROUPS_SEARCH, 1,
1534 [groups_search() is available])],
1539 dnl # 2.6.x API change,
1540 dnl # __put_task_struct() was exported in RHEL5 but unavailable elsewhere.
1542 AC_DEFUN([SPL_AC_PUT_TASK_STRUCT], [
1543 SPL_CHECK_SYMBOL_EXPORT(
1544 [__put_task_struct],
1546 [AC_DEFINE(HAVE_PUT_TASK_STRUCT, 1,
1547 [__put_task_struct() is available])],
1552 dnl # 2.6.32 API change,
1553 dnl # Unused 'struct file *' removed from prototype.
1555 AC_DEFUN([SPL_AC_5ARGS_PROC_HANDLER], [
1556 AC_MSG_CHECKING([whether proc_handler() wants 5 args])
1557 SPL_LINUX_TRY_COMPILE([
1558 #include <linux/sysctl.h>
1560 proc_dostring(NULL, 0, NULL, NULL, NULL);
1563 AC_DEFINE(HAVE_5ARGS_PROC_HANDLER, 1,
1564 [proc_handler() wants 5 args])
1571 dnl # 2.6.x API change,
1572 dnl # kvasprintf() function added.
1574 AC_DEFUN([SPL_AC_KVASPRINTF], [
1575 SPL_CHECK_SYMBOL_EXPORT(
1578 [AC_DEFINE(HAVE_KVASPRINTF, 1,
1579 [kvasprintf() is available])],
1584 dnl # 2.6.35 API change,
1585 dnl # Unused 'struct dentry *' removed from prototype.
1587 AC_DEFUN([SPL_AC_3ARGS_FILE_FSYNC], [
1588 AC_MSG_CHECKING([whether file_fsync() wants 3 args])
1589 SPL_LINUX_TRY_COMPILE([
1590 #include <linux/buffer_head.h>
1592 file_fsync(NULL, NULL, 0);
1595 AC_DEFINE(HAVE_3ARGS_FILE_FSYNC, 1,
1596 [file_fsync() wants 3 args])