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
80 SPL_AC_EXPORTED_RWSEM_IS_LOCKED
83 AC_DEFUN([SPL_AC_MODULE_SYMVERS], [
84 modpost=$LINUX/scripts/Makefile.modpost
85 AC_MSG_CHECKING([kernel file name for module symbols])
86 if test -f "$modpost"; then
87 if grep -q Modules.symvers $modpost; then
88 LINUX_SYMBOLS=Modules.symvers
90 LINUX_SYMBOLS=Module.symvers
95 AC_MSG_RESULT($LINUX_SYMBOLS)
96 AC_SUBST(LINUX_SYMBOLS)
99 AC_DEFUN([SPL_AC_KERNEL], [
101 AS_HELP_STRING([--with-linux=PATH],
102 [Path to kernel source]),
103 [kernelsrc="$withval"])
105 AC_ARG_WITH([linux-obj],
106 AS_HELP_STRING([--with-linux-obj=PATH],
107 [Path to kernel build objects]),
108 [kernelbuild="$withval"])
110 AC_MSG_CHECKING([kernel source directory])
111 if test -z "$kernelsrc"; then
112 headersdir="/lib/modules/$(uname -r)/build"
113 if test -e "$headersdir"; then
114 sourcelink=$(readlink -f "$headersdir")
116 sourcelink=$(ls -1d /usr/src/kernels/* \
118 2>/dev/null | grep -v obj | tail -1)
121 if test -n "$sourcelink" && test -e ${sourcelink}; then
122 kernelsrc=`readlink -f ${sourcelink}`
124 AC_MSG_RESULT([Not found])
126 *** Please make sure the kernel devel package for your distribution
127 *** is installed then try again. If that fails you can specify the
128 *** location of the kernel source with the '--with-linux=PATH' option.])
131 if test "$kernelsrc" = "NONE"; then
136 AC_MSG_RESULT([$kernelsrc])
137 AC_MSG_CHECKING([kernel build directory])
138 if test -z "$kernelbuild"; then
139 if test -d ${kernelsrc}-obj/${target_cpu}/${target_cpu}; then
140 kernelbuild=${kernelsrc}-obj/${target_cpu}/${target_cpu}
141 elif test -d ${kernelsrc}-obj/${target_cpu}/default; then
142 kernelbuild=${kernelsrc}-obj/${target_cpu}/default
143 elif test -d `dirname ${kernelsrc}`/build-${target_cpu}; then
144 kernelbuild=`dirname ${kernelsrc}`/build-${target_cpu}
146 kernelbuild=${kernelsrc}
149 AC_MSG_RESULT([$kernelbuild])
151 AC_MSG_CHECKING([kernel source version])
152 utsrelease1=$kernelbuild/include/linux/version.h
153 utsrelease2=$kernelbuild/include/linux/utsrelease.h
154 utsrelease3=$kernelbuild/include/generated/utsrelease.h
155 if test -r $utsrelease1 && fgrep -q UTS_RELEASE $utsrelease1; then
156 utsrelease=linux/version.h
157 elif test -r $utsrelease2 && fgrep -q UTS_RELEASE $utsrelease2; then
158 utsrelease=linux/utsrelease.h
159 elif test -r $utsrelease3 && fgrep -q UTS_RELEASE $utsrelease3; then
160 utsrelease=generated/utsrelease.h
163 if test "$utsrelease"; then
164 kernsrcver=`(echo "#include <$utsrelease>";
165 echo "kernsrcver=UTS_RELEASE") |
166 cpp -I $kernelbuild/include |
167 grep "^kernsrcver=" | cut -d \" -f 2`
169 if test -z "$kernsrcver"; then
170 AC_MSG_RESULT([Not found])
171 AC_MSG_ERROR([*** Cannot determine kernel version.])
174 AC_MSG_RESULT([Not found])
175 AC_MSG_ERROR([*** Cannot find UTS_RELEASE definition.])
178 AC_MSG_RESULT([$kernsrcver])
181 LINUX_OBJ=${kernelbuild}
182 LINUX_VERSION=${kernsrcver}
186 AC_SUBST(LINUX_VERSION)
188 SPL_AC_MODULE_SYMVERS
192 dnl # Explicitly check for gawk, we require it for the the usermode
193 dnl # helper. For some reason the standard awk command does not
194 dnl # behave correctly when invoked from the usermode helper.
196 AC_DEFUN([SPL_AC_GAWK], [
197 AS_IF([test "x$AWK" != xgawk], [
199 *** Required util gawk missing. Please install the required
200 *** gawk package for your distribution and try again.])
205 dnl # Default SPL user configuration
207 AC_DEFUN([SPL_AC_CONFIG_USER], [
212 dnl # Check for rpm+rpmbuild to build RPM packages. If these tools
213 dnl # are missing it is non-fatal but you will not be able to build
214 dnl # RPM packages and will be warned if you try too.
216 AC_DEFUN([SPL_AC_RPM], [
220 AC_MSG_CHECKING([whether $RPM is available])
221 AS_IF([tmp=$($RPM --version 2>/dev/null)], [
222 RPM_VERSION=$(echo $tmp | $AWK '/RPM/ { print $[3] }')
224 AC_MSG_RESULT([$HAVE_RPM ($RPM_VERSION)])
227 AC_MSG_RESULT([$HAVE_RPM])
230 AC_MSG_CHECKING([whether $RPMBUILD is available])
231 AS_IF([tmp=$($RPMBUILD --version 2>/dev/null)], [
232 RPMBUILD_VERSION=$(echo $tmp | $AWK '/RPM/ { print $[3] }')
234 AC_MSG_RESULT([$HAVE_RPMBUILD ($RPMBUILD_VERSION)])
237 AC_MSG_RESULT([$HAVE_RPMBUILD])
242 AC_SUBST(RPM_VERSION)
244 AC_SUBST(HAVE_RPMBUILD)
246 AC_SUBST(RPMBUILD_VERSION)
250 dnl # Check for dpkg+dpkg-buildpackage to build DEB packages. If these
251 dnl # tools are missing it is non-fatal but you will not be able to build
252 dnl # DEB packages and will be warned if you try too.
254 AC_DEFUN([SPL_AC_DPKG], [
256 DPKGBUILD=dpkg-buildpackage
258 AC_MSG_CHECKING([whether $DPKG is available])
259 AS_IF([tmp=$($DPKG --version 2>/dev/null)], [
260 DPKG_VERSION=$(echo $tmp | $AWK '/Debian/ { print $[7] }')
262 AC_MSG_RESULT([$HAVE_DPKG ($DPKG_VERSION)])
265 AC_MSG_RESULT([$HAVE_DPKG])
268 AC_MSG_CHECKING([whether $DPKGBUILD is available])
269 AS_IF([tmp=$($DPKGBUILD --version 2>/dev/null)], [
270 DPKGBUILD_VERSION=$(echo $tmp | \
271 $AWK '/Debian/ { print $[4] }' | cut -f-4 -d'.')
273 AC_MSG_RESULT([$HAVE_DPKGBUILD ($DPKGBUILD_VERSION)])
276 AC_MSG_RESULT([$HAVE_DPKGBUILD])
281 AC_SUBST(DPKG_VERSION)
283 AC_SUBST(HAVE_DPKGBUILD)
285 AC_SUBST(DPKGBUILD_VERSION)
289 dnl # Until native packaging for various different packing systems
290 dnl # can be added the least we can do is attempt to use alien to
291 dnl # convert the RPM packages to the needed package type. This is
292 dnl # a hack but so far it has worked reasonable well.
294 AC_DEFUN([SPL_AC_ALIEN], [
297 AC_MSG_CHECKING([whether $ALIEN is available])
298 AS_IF([tmp=$($ALIEN --version 2>/dev/null)], [
299 ALIEN_VERSION=$(echo $tmp | $AWK '{ print $[3] }')
301 AC_MSG_RESULT([$HAVE_ALIEN ($ALIEN_VERSION)])
304 AC_MSG_RESULT([$HAVE_ALIEN])
309 AC_SUBST(ALIEN_VERSION)
313 dnl # Using the VENDOR tag from config.guess set the default
314 dnl # package type for 'make pkg': (rpm | deb | tgz)
316 AC_DEFUN([SPL_AC_DEFAULT_PACKAGE], [
317 VENDOR=$(echo $ac_build_alias | cut -f2 -d'-')
319 AC_MSG_CHECKING([default package type])
321 fedora) DEFAULT_PACKAGE=rpm ;;
322 redhat) DEFAULT_PACKAGE=rpm ;;
323 sles) DEFAULT_PACKAGE=rpm ;;
324 ubuntu) DEFAULT_PACKAGE=deb ;;
325 debian) DEFAULT_PACKAGE=deb ;;
326 slackware) DEFAULT_PACKAGE=tgz ;;
327 *) DEFAULT_PACKAGE=rpm ;;
330 AC_MSG_RESULT([$DEFAULT_PACKAGE])
331 AC_SUBST(DEFAULT_PACKAGE)
335 dnl # Default SPL user configuration
337 AC_DEFUN([SPL_AC_PACKAGE], [
341 SPL_AC_DEFAULT_PACKAGE
344 AC_DEFUN([SPL_AC_LICENSE], [
345 AC_MSG_CHECKING([spl license])
347 AC_MSG_RESULT([$LICENSE])
348 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DHAVE_GPL_ONLY_SYMBOLS"
352 AC_DEFUN([SPL_AC_CONFIG], [
354 AC_ARG_WITH([config],
355 AS_HELP_STRING([--with-config=CONFIG],
356 [Config file 'kernel|user|all|srpm']),
357 [SPL_CONFIG="$withval"])
359 AC_MSG_CHECKING([spl config])
360 AC_MSG_RESULT([$SPL_CONFIG]);
363 case "$SPL_CONFIG" in
364 kernel) SPL_AC_CONFIG_KERNEL ;;
365 user) SPL_AC_CONFIG_USER ;;
366 all) SPL_AC_CONFIG_KERNEL
367 SPL_AC_CONFIG_USER ;;
370 AC_MSG_RESULT([Error!])
371 AC_MSG_ERROR([Bad value "$SPL_CONFIG" for --with-config,
372 user kernel|user|all|srpm]) ;;
375 AM_CONDITIONAL([CONFIG_USER],
376 [test "$SPL_CONFIG" = user] ||
377 [test "$SPL_CONFIG" = all])
378 AM_CONDITIONAL([CONFIG_KERNEL],
379 [test "$SPL_CONFIG" = kernel] ||
380 [test "$SPL_CONFIG" = all])
384 dnl # Enable if the SPL should be compiled with internal debugging enabled.
385 dnl # By default this support is disabled.
387 AC_DEFUN([SPL_AC_DEBUG], [
388 AC_MSG_CHECKING([whether debugging is enabled])
389 AC_ARG_ENABLE([debug],
390 [AS_HELP_STRING([--enable-debug],
391 [Enable generic debug support @<:@default=no@:>@])],
395 AS_IF([test "x$enable_debug" = xyes],
397 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG -Werror"
398 DEBUG_CFLAGS="-DDEBUG -Werror"
401 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG"
402 DEBUG_CFLAGS="-DNDEBUG"
405 AC_SUBST(DEBUG_CFLAGS)
406 AC_MSG_RESULT([$enable_debug])
410 dnl # Enabled by default it provides a minimal level of memory tracking.
411 dnl # A total count of bytes allocated is kept for each alloc and free.
412 dnl # Then at module unload time a report to the console will be printed
413 dnl # if memory was leaked. Additionally, /proc/spl/kmem/slab will exist
414 dnl # and provide an easy way to inspect the kmem based slab.
416 AC_DEFUN([SPL_AC_DEBUG_KMEM], [
417 AC_ARG_ENABLE([debug-kmem],
418 [AS_HELP_STRING([--enable-debug-kmem],
419 [Enable basic kmem accounting @<:@default=yes@:>@])],
421 [enable_debug_kmem=yes])
423 AS_IF([test "x$enable_debug_kmem" = xyes],
424 [AC_DEFINE([DEBUG_KMEM], [1],
425 [Define to 1 to enable basic kmem accounting])
426 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM"])
428 AC_MSG_CHECKING([whether basic kmem accounting is enabled])
429 AC_MSG_RESULT([$enable_debug_kmem])
433 dnl # Disabled by default it provides detailed memory tracking. This
434 dnl # feature also requires --enable-debug-kmem to be set. When enabled
435 dnl # not only will total bytes be tracked but also the location of every
436 dnl # alloc and free. When the SPL module is unloaded a list of all leaked
437 dnl # addresses and where they were allocated will be dumped to the console.
438 dnl # Enabling this feature has a significant impact on performance but it
439 dnl # makes finding memory leaks pretty straight forward.
441 AC_DEFUN([SPL_AC_DEBUG_KMEM_TRACKING], [
442 AC_ARG_ENABLE([debug-kmem-tracking],
443 [AS_HELP_STRING([--enable-debug-kmem-tracking],
444 [Enable detailed kmem tracking @<:@default=no@:>@])],
446 [enable_debug_kmem_tracking=no])
448 AS_IF([test "x$enable_debug_kmem_tracking" = xyes],
449 [AC_DEFINE([DEBUG_KMEM_TRACKING], [1],
450 [Define to 1 to enable detailed kmem tracking])
451 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM_TRACKING"])
453 AC_MSG_CHECKING([whether detailed kmem tracking is enabled])
454 AC_MSG_RESULT([$enable_debug_kmem_tracking])
458 dnl # SPL_LINUX_CONFTEST
460 AC_DEFUN([SPL_LINUX_CONFTEST], [
461 cat confdefs.h - <<_ACEOF >conftest.c
467 dnl # SPL_LANG_PROGRAM(C)([PROLOGUE], [BODY])
469 m4_define([SPL_LANG_PROGRAM], [
474 dnl Do *not* indent the following line: there may be CPP directives.
475 dnl Don't move the `;' right after for the same reason.
483 dnl # SPL_LINUX_COMPILE_IFELSE / like AC_COMPILE_IFELSE
485 AC_DEFUN([SPL_LINUX_COMPILE_IFELSE], [
486 m4_ifvaln([$1], [SPL_LINUX_CONFTEST([$1])])
487 rm -Rf build && mkdir -p build
488 echo "obj-m := conftest.o" >build/Makefile
490 [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])],
492 [_AC_MSG_LOG_CONFTEST m4_ifvaln([$5],[$5])]
498 dnl # SPL_LINUX_TRY_COMPILE like AC_TRY_COMPILE
500 AC_DEFUN([SPL_LINUX_TRY_COMPILE],
501 [SPL_LINUX_COMPILE_IFELSE(
502 [AC_LANG_SOURCE([SPL_LANG_PROGRAM([[$1]], [[$2]])])],
504 [test -s build/conftest.o],
509 dnl # SPL_LINUX_CONFIG
511 AC_DEFUN([SPL_LINUX_CONFIG],
512 [AC_MSG_CHECKING([whether Linux was built with CONFIG_$1])
513 SPL_LINUX_TRY_COMPILE([
514 #ifndef AUTOCONF_INCLUDED
515 #include <linux/config.h>
519 #error CONFIG_$1 not #defined
531 dnl # SPL_CHECK_SYMBOL_EXPORT
532 dnl # check symbol exported or not
534 AC_DEFUN([SPL_CHECK_SYMBOL_EXPORT],
535 [AC_MSG_CHECKING([whether symbol $1 is exported])
536 grep -q -E '[[[:space:]]]$1[[[:space:]]]' \
537 $LINUX_OBJ/Module*.symvers 2>/dev/null
539 if test $rc -ne 0; then
542 grep -q -E "EXPORT_SYMBOL.*($1)" \
543 "$LINUX_OBJ/$file" 2>/dev/null
545 if test $rc -eq 0; then
550 if test $export -eq 0; then
564 dnl # SPL_CHECK_HEADER
565 dnl # check whether header exists and define HAVE_$2_HEADER
567 AC_DEFUN([SPL_CHECK_HEADER],
568 [AC_MSG_CHECKING([whether header $1 exists])
569 SPL_LINUX_TRY_COMPILE([
574 AC_DEFINE(HAVE_$2_HEADER, 1, [$1 exists])
584 dnl # Use the atomic implemenation based on global spinlocks. This
585 dnl # should only be needed by 32-bit kernels which do not provide
586 dnl # the atomic64_* API. It may be optionally enabled as a fallback
587 dnl # if problems are observed with the direct mapping to the native
588 dnl # Linux atomic operations. You may not disable atomic spinlocks
589 dnl # if you kernel does not an atomic64_* API.
591 AC_DEFUN([SPL_AC_ATOMIC_SPINLOCK], [
592 AC_ARG_ENABLE([atomic-spinlocks],
593 [AS_HELP_STRING([--enable-atomic-spinlocks],
594 [Atomic types use spinlocks @<:@default=check@:>@])],
596 [enable_atomic_spinlocks=check])
598 SPL_LINUX_TRY_COMPILE([
599 #include <asm/atomic.h>
604 AC_DEFINE(HAVE_ATOMIC64_T, 1,
605 [kernel defines atomic64_t])
610 AS_IF([test "x$enable_atomic_spinlocks" = xcheck], [
611 AS_IF([test "x$have_atomic64_t" = xyes], [
612 enable_atomic_spinlocks=no
614 enable_atomic_spinlocks=yes
618 AS_IF([test "x$enable_atomic_spinlocks" = xyes], [
619 AC_DEFINE([ATOMIC_SPINLOCK], [1],
620 [Atomic types use spinlocks])
622 AS_IF([test "x$have_atomic64_t" = xno], [
624 [--disable-atomic-spinlocks given but required atomic64 support is unavailable])
628 AC_MSG_CHECKING([whether atomic types use spinlocks])
629 AC_MSG_RESULT([$enable_atomic_spinlocks])
631 AC_MSG_CHECKING([whether kernel defines atomic64_t])
632 AC_MSG_RESULT([$have_atomic64_t])
636 dnl # 2.6.24 API change,
637 dnl # check if atomic64_cmpxchg is defined
639 AC_DEFUN([SPL_AC_TYPE_ATOMIC64_CMPXCHG],
640 [AC_MSG_CHECKING([whether kernel defines atomic64_cmpxchg])
641 SPL_LINUX_TRY_COMPILE([
642 #include <asm/atomic.h>
643 #include <asm/system.h>
645 atomic64_cmpxchg((atomic64_t *)NULL, 0, 0);
648 AC_DEFINE(HAVE_ATOMIC64_CMPXCHG, 1,
649 [kernel defines atomic64_cmpxchg])
656 dnl # 2.6.24 API change,
657 dnl # check if atomic64_xchg is defined
659 AC_DEFUN([SPL_AC_TYPE_ATOMIC64_XCHG],
660 [AC_MSG_CHECKING([whether kernel defines atomic64_xchg])
661 SPL_LINUX_TRY_COMPILE([
662 #include <asm/atomic.h>
664 atomic64_xchg((atomic64_t *)NULL, 0);
667 AC_DEFINE(HAVE_ATOMIC64_XCHG, 1,
668 [kernel defines atomic64_xchg])
675 dnl # 2.6.24 API change,
676 dnl # check if uintptr_t typedef is defined
678 AC_DEFUN([SPL_AC_TYPE_UINTPTR_T],
679 [AC_MSG_CHECKING([whether kernel defines uintptr_t])
680 SPL_LINUX_TRY_COMPILE([
681 #include <linux/types.h>
686 AC_DEFINE(HAVE_UINTPTR_T, 1,
687 [kernel defines uintptr_t])
694 dnl # 2.6.20 API change,
695 dnl # INIT_WORK use 2 args and not store data inside
697 AC_DEFUN([SPL_AC_3ARGS_INIT_WORK],
698 [AC_MSG_CHECKING([whether INIT_WORK wants 3 args])
699 SPL_LINUX_TRY_COMPILE([
700 #include <linux/workqueue.h>
702 struct work_struct work;
703 INIT_WORK(&work, NULL, NULL);
706 AC_DEFINE(HAVE_3ARGS_INIT_WORK, 1,
707 [INIT_WORK wants 3 args])
714 dnl # 2.6.21 API change,
715 dnl # 'register_sysctl_table' use only one argument instead of two
717 AC_DEFUN([SPL_AC_2ARGS_REGISTER_SYSCTL],
718 [AC_MSG_CHECKING([whether register_sysctl_table() wants 2 args])
719 SPL_LINUX_TRY_COMPILE([
720 #include <linux/sysctl.h>
722 return register_sysctl_table(NULL,0);
725 AC_DEFINE(HAVE_2ARGS_REGISTER_SYSCTL, 1,
726 [register_sysctl_table() wants 2 args])
733 dnl # 2.6.23 API change
734 dnl # Old set_shrinker API replaced with register_shrinker
736 AC_DEFUN([SPL_AC_SET_SHRINKER], [
737 AC_MSG_CHECKING([whether set_shrinker() available])
738 SPL_LINUX_TRY_COMPILE([
739 #include <linux/mm.h>
741 return set_shrinker(DEFAULT_SEEKS, NULL);
744 AC_DEFINE(HAVE_SET_SHRINKER, 1,
745 [set_shrinker() available])
752 dnl # 2.6.25 API change,
753 dnl # struct path entry added to struct nameidata
755 AC_DEFUN([SPL_AC_PATH_IN_NAMEIDATA],
756 [AC_MSG_CHECKING([whether struct path used in struct nameidata])
757 SPL_LINUX_TRY_COMPILE([
758 #include <linux/namei.h>
763 nd.path.dentry = NULL;
766 AC_DEFINE(HAVE_PATH_IN_NAMEIDATA, 1,
767 [struct path used in struct nameidata])
774 dnl # Custom SPL patch may export this system it is not required
776 AC_DEFUN([SPL_AC_TASK_CURR], [
777 SPL_CHECK_SYMBOL_EXPORT([task_curr], [kernel/sched.c],
778 [AC_DEFINE(HAVE_TASK_CURR, 1, [task_curr() exported])],
783 dnl # 2.6.19 API change,
784 dnl # Use CTL_UNNUMBERED when binary sysctl is not required
786 AC_DEFUN([SPL_AC_CTL_UNNUMBERED],
787 [AC_MSG_CHECKING([whether unnumbered sysctl support exists])
788 SPL_LINUX_TRY_COMPILE([
789 #include <linux/sysctl.h>
791 #ifndef CTL_UNNUMBERED
792 #error CTL_UNNUMBERED undefined
796 AC_DEFINE(HAVE_CTL_UNNUMBERED, 1,
797 [unnumbered sysctl support exists])
804 dnl # 2.6.33 API change,
805 dnl # Removed .ctl_name from struct ctl_table.
807 AC_DEFUN([SPL_AC_CTL_NAME], [
808 AC_MSG_CHECKING([whether struct ctl_table has ctl_name])
809 SPL_LINUX_TRY_COMPILE([
810 #include <linux/sysctl.h>
812 struct ctl_table ctl;
816 AC_DEFINE(HAVE_CTL_NAME, 1, [struct ctl_table has ctl_name])
823 dnl # 2.6.16 API change.
824 dnl # Check if 'fls64()' is available
826 AC_DEFUN([SPL_AC_FLS64],
827 [AC_MSG_CHECKING([whether fls64() is available])
828 SPL_LINUX_TRY_COMPILE([
829 #include <linux/bitops.h>
834 AC_DEFINE(HAVE_FLS64, 1, [fls64() is available])
841 dnl # 2.6.18 API change, check whether device_create() is available.
842 dnl # Device_create() was introduced in 2.6.18 and depricated
843 dnl # class_device_create() which was fully removed in 2.6.26.
845 AC_DEFUN([SPL_AC_DEVICE_CREATE], [
846 SPL_CHECK_SYMBOL_EXPORT(
848 [drivers/base/core.c],
849 [AC_DEFINE(HAVE_DEVICE_CREATE, 1,
850 [device_create() is available])],
855 dnl # 2.6.27 API change,
856 dnl # device_create() uses 5 args, new 'drvdata' argument.
858 AC_DEFUN([SPL_AC_5ARGS_DEVICE_CREATE], [
859 AC_MSG_CHECKING([whether device_create() wants 5 args])
860 tmp_flags="$EXTRA_KCFLAGS"
861 EXTRA_KCFLAGS="-Werror"
862 SPL_LINUX_TRY_COMPILE([
863 #include <linux/device.h>
865 device_create(NULL, NULL, 0, NULL, "%d", 1);
868 AC_DEFINE(HAVE_5ARGS_DEVICE_CREATE, 1,
869 [device_create wants 5 args])
873 EXTRA_KCFLAGS="$tmp_flags"
877 dnl # 2.6.13 API change, check whether class_device_create() is available.
878 dnl # Class_device_create() was introduced in 2.6.13 and depricated
879 dnl # class_simple_device_add() which was fully removed in 2.6.13.
881 AC_DEFUN([SPL_AC_CLASS_DEVICE_CREATE], [
882 SPL_CHECK_SYMBOL_EXPORT(
883 [class_device_create],
884 [drivers/base/class.c],
885 [AC_DEFINE(HAVE_CLASS_DEVICE_CREATE, 1,
886 [class_device_create() is available])],
891 dnl # 2.6.26 API change, set_normalized_timespec() is exported.
893 AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_EXPORT], [
894 SPL_CHECK_SYMBOL_EXPORT(
895 [set_normalized_timespec],
897 [AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_EXPORT, 1,
898 [set_normalized_timespec() is available as export])],
903 dnl # 2.6.16 API change, set_normalize_timespec() moved to time.c
904 dnl # previously it was available in time.h as an inline.
906 AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE], [
907 AC_MSG_CHECKING([whether set_normalized_timespec() is an inline])
908 SPL_LINUX_TRY_COMPILE([
909 #include <linux/time.h>
910 void set_normalized_timespec(struct timespec *ts,
911 time_t sec, long nsec) { }
918 AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_INLINE, 1,
919 [set_normalized_timespec() is available as inline])
924 dnl # 2.6.18 API change,
925 dnl # timespec_sub() inline function available in linux/time.h
927 AC_DEFUN([SPL_AC_TIMESPEC_SUB], [
928 AC_MSG_CHECKING([whether timespec_sub() is available])
929 SPL_LINUX_TRY_COMPILE([
930 #include <linux/time.h>
932 struct timespec a, b, c = { 0 };
933 c = timespec_sub(a, b);
936 AC_DEFINE(HAVE_TIMESPEC_SUB, 1, [timespec_sub() is available])
943 dnl # 2.6.19 API change,
944 dnl # check if init_utsname() is available in linux/utsname.h
946 AC_DEFUN([SPL_AC_INIT_UTSNAME], [
947 AC_MSG_CHECKING([whether init_utsname() is available])
948 SPL_LINUX_TRY_COMPILE([
949 #include <linux/utsname.h>
951 struct new_utsname *a = init_utsname();
954 AC_DEFINE(HAVE_INIT_UTSNAME, 1, [init_utsname() is available])
961 dnl # 2.6.26 API change,
962 dnl # definition of struct fdtable relocated to linux/fdtable.h
964 AC_DEFUN([SPL_AC_FDTABLE_HEADER], [
965 SPL_CHECK_HEADER([linux/fdtable.h], [FDTABLE], [], [])
969 dnl # 2.6.14 API change,
970 dnl # check whether 'files_fdtable()' exists
972 AC_DEFUN([SPL_AC_FILES_FDTABLE], [
973 AC_MSG_CHECKING([whether files_fdtable() is available])
974 SPL_LINUX_TRY_COMPILE([
975 #include <linux/sched.h>
976 #include <linux/file.h>
977 #ifdef HAVE_FDTABLE_HEADER
978 #include <linux/fdtable.h>
981 struct files_struct *files = current->files;
982 struct fdtable *fdt = files_fdtable(files);
985 AC_DEFINE(HAVE_FILES_FDTABLE, 1, [files_fdtable() is available])
992 dnl # 2.6.18 API change,
993 dnl # added linux/uaccess.h
995 AC_DEFUN([SPL_AC_UACCESS_HEADER], [
996 SPL_CHECK_HEADER([linux/uaccess.h], [UACCESS], [], [])
1000 dnl # 2.6.12 API change,
1001 dnl # check whether 'kmalloc_node()' is available.
1003 AC_DEFUN([SPL_AC_KMALLOC_NODE], [
1004 AC_MSG_CHECKING([whether kmalloc_node() is available])
1005 SPL_LINUX_TRY_COMPILE([
1006 #include <linux/slab.h>
1008 void *a = kmalloc_node(1, GFP_KERNEL, 0);
1011 AC_DEFINE(HAVE_KMALLOC_NODE, 1, [kmalloc_node() is available])
1018 dnl # 2.6.9 API change,
1019 dnl # check whether 'monotonic_clock()' is available it may
1020 dnl # be available for some archs but not others.
1022 AC_DEFUN([SPL_AC_MONOTONIC_CLOCK], [
1023 SPL_CHECK_SYMBOL_EXPORT(
1026 [AC_DEFINE(HAVE_MONOTONIC_CLOCK, 1,
1027 [monotonic_clock() is available])],
1032 dnl # 2.6.16 API change,
1033 dnl # check whether 'struct inode' has i_mutex
1035 AC_DEFUN([SPL_AC_INODE_I_MUTEX], [
1036 AC_MSG_CHECKING([whether struct inode has i_mutex])
1037 SPL_LINUX_TRY_COMPILE([
1038 #include <linux/fs.h>
1039 #include <linux/mutex.h>
1042 mutex_init(&i.i_mutex);
1045 AC_DEFINE(HAVE_INODE_I_MUTEX, 1, [struct inode has i_mutex])
1052 dnl # 2.6.29 API change,
1053 dnl # Adaptive mutexs introduced.
1055 AC_DEFUN([SPL_AC_MUTEX_OWNER], [
1056 AC_MSG_CHECKING([whether struct mutex has owner])
1057 SPL_LINUX_TRY_COMPILE([
1058 #include <linux/mutex.h>
1064 AC_DEFINE(HAVE_MUTEX_OWNER, 1, [struct mutex has owner])
1071 dnl # 2.6.18 API change,
1072 dnl # First introduced 'mutex_lock_nested()' in include/linux/mutex.h,
1073 dnl # as part of the mutex validator. Fallback to using 'mutex_lock()'
1074 dnl # if the mutex validator is disabled or otherwise unavailable.
1076 AC_DEFUN([SPL_AC_MUTEX_LOCK_NESTED], [
1077 AC_MSG_CHECKING([whether mutex_lock_nested() is available])
1078 SPL_LINUX_TRY_COMPILE([
1079 #include <linux/mutex.h>
1083 mutex_lock_nested(&mutex, 0);
1086 AC_DEFINE(HAVE_MUTEX_LOCK_NESTED, 1,
1087 [mutex_lock_nested() is available])
1094 dnl # 2.6.27 API change,
1095 dnl # on_each_cpu() uses 3 args, no 'retry' argument
1097 AC_DEFUN([SPL_AC_3ARGS_ON_EACH_CPU], [
1098 AC_MSG_CHECKING([whether on_each_cpu() wants 3 args])
1099 SPL_LINUX_TRY_COMPILE([
1100 #include <linux/smp.h>
1102 on_each_cpu(NULL, NULL, 0);
1105 AC_DEFINE(HAVE_3ARGS_ON_EACH_CPU, 1,
1106 [on_each_cpu wants 3 args])
1113 dnl # 2.6.18 API change,
1114 dnl # kallsyms_lookup_name no longer exported
1116 AC_DEFUN([SPL_AC_KALLSYMS_LOOKUP_NAME], [
1117 SPL_CHECK_SYMBOL_EXPORT(
1118 [kallsyms_lookup_name],
1120 [AC_DEFINE(HAVE_KALLSYMS_LOOKUP_NAME, 1,
1121 [kallsyms_lookup_name() is available])],
1126 dnl # Proposed API change,
1127 dnl # This symbol is not available in stock kernels. You may build a
1128 dnl # custom kernel with the *-spl-export-symbols.patch which will export
1129 dnl # these symbols for use. If your already rolling a custom kernel for
1130 dnl # your environment this is recommended.
1132 AC_DEFUN([SPL_AC_GET_VMALLOC_INFO], [
1133 SPL_CHECK_SYMBOL_EXPORT(
1136 [AC_DEFINE(HAVE_GET_VMALLOC_INFO, 1,
1137 [get_vmalloc_info() is available])],
1142 dnl # 2.6.17 API change
1143 dnl # The helper functions first_online_pgdat(), next_online_pgdat(), and
1144 dnl # next_zone() are introduced to simplify for_each_zone(). These symbols
1145 dnl # were exported in 2.6.17 for use by modules which was consistent with
1146 dnl # the previous implementation of for_each_zone(). From 2.6.18 - 2.6.19
1147 dnl # the symbols were exported as 'unused', and by 2.6.20 they exports
1148 dnl # were dropped entirely leaving modules no way to directly iterate over
1149 dnl # the zone list. Because we need access to the zone helpers we check
1150 dnl # if the kernel contains the old or new implementation. Then we check
1151 dnl # to see if the symbols we need for each version are available. If they
1152 dnl # are not, dynamically aquire the addresses with kallsyms_lookup_name().
1154 AC_DEFUN([SPL_AC_PGDAT_HELPERS], [
1155 AC_MSG_CHECKING([whether symbol *_pgdat exist])
1156 grep -q -E 'first_online_pgdat' $LINUX/include/linux/mmzone.h 2>/dev/null
1158 if test $rc -eq 0; then
1159 AC_MSG_RESULT([yes])
1160 AC_DEFINE(HAVE_PGDAT_HELPERS, 1, [pgdat helpers are available])
1167 dnl # Proposed API change,
1168 dnl # This symbol is not available in stock kernels. You may build a
1169 dnl # custom kernel with the *-spl-export-symbols.patch which will export
1170 dnl # these symbols for use. If your already rolling a custom kernel for
1171 dnl # your environment this is recommended.
1173 AC_DEFUN([SPL_AC_FIRST_ONLINE_PGDAT], [
1174 SPL_CHECK_SYMBOL_EXPORT(
1175 [first_online_pgdat],
1177 [AC_DEFINE(HAVE_FIRST_ONLINE_PGDAT, 1,
1178 [first_online_pgdat() is available])],
1183 dnl # Proposed API change,
1184 dnl # This symbol is not available in stock kernels. You may build a
1185 dnl # custom kernel with the *-spl-export-symbols.patch which will export
1186 dnl # these symbols for use. If your already rolling a custom kernel for
1187 dnl # your environment this is recommended.
1189 AC_DEFUN([SPL_AC_NEXT_ONLINE_PGDAT], [
1190 SPL_CHECK_SYMBOL_EXPORT(
1191 [next_online_pgdat],
1193 [AC_DEFINE(HAVE_NEXT_ONLINE_PGDAT, 1,
1194 [next_online_pgdat() is available])],
1199 dnl # Proposed API change,
1200 dnl # This symbol is not available in stock kernels. You may build a
1201 dnl # custom kernel with the *-spl-export-symbols.patch which will export
1202 dnl # these symbols for use. If your already rolling a custom kernel for
1203 dnl # your environment this is recommended.
1205 AC_DEFUN([SPL_AC_NEXT_ZONE], [
1206 SPL_CHECK_SYMBOL_EXPORT(
1209 [AC_DEFINE(HAVE_NEXT_ZONE, 1,
1210 [next_zone() is available])],
1215 dnl # 2.6.17 API change,
1216 dnl # See SPL_AC_PGDAT_HELPERS for details.
1218 AC_DEFUN([SPL_AC_PGDAT_LIST], [
1219 SPL_CHECK_SYMBOL_EXPORT(
1222 [AC_DEFINE(HAVE_PGDAT_LIST, 1,
1223 [pgdat_list is available])],
1228 dnl # 2.6.18 API change,
1229 dnl # First introduced global_page_state() support as an inline.
1231 AC_DEFUN([SPL_AC_GLOBAL_PAGE_STATE], [
1232 AC_MSG_CHECKING([whether global_page_state() is available])
1233 SPL_LINUX_TRY_COMPILE([
1234 #include <linux/mm.h>
1236 unsigned long state;
1237 state = global_page_state(0);
1240 AC_DEFINE(HAVE_GLOBAL_PAGE_STATE, 1,
1241 [global_page_state() is available])
1248 dnl # 2.6.21 API change (plus subsequent naming convention changes),
1249 dnl # Public global zone stats now include a free page count. However
1250 dnl # the enumerated names of the counters have changed since this API
1251 dnl # was introduced. We need to deduce the corrent name to use. This
1252 dnl # replaces the priviate get_zone_counts() interface.
1254 dnl # NR_FREE_PAGES was available from 2.6.21 to current kernels, which
1255 dnl # is 2.6.30 as of when this was written.
1257 AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_FREE], [
1258 AC_MSG_CHECKING([whether page state NR_FREE_PAGES is available])
1259 SPL_LINUX_TRY_COMPILE([
1260 #include <linux/mm.h>
1262 enum zone_stat_item zsi;
1263 zsi = NR_FREE_PAGES;
1266 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_FREE_PAGES, 1,
1267 [Page state NR_FREE_PAGES is available])
1274 dnl # 2.6.21 API change (plus subsequent naming convention changes),
1275 dnl # Public global zone stats now include an inactive page count. However
1276 dnl # the enumerated names of the counters have changed since this API
1277 dnl # was introduced. We need to deduce the corrent name to use. This
1278 dnl # replaces the priviate get_zone_counts() interface.
1280 dnl # NR_INACTIVE was available from 2.6.21 to 2.6.27 and included both
1281 dnl # anonymous and file inactive pages. As of 2.6.28 it was split in
1282 dnl # to NR_INACTIVE_ANON and NR_INACTIVE_FILE.
1284 AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_INACTIVE], [
1285 AC_MSG_CHECKING([whether page state NR_INACTIVE is available])
1286 SPL_LINUX_TRY_COMPILE([
1287 #include <linux/mm.h>
1289 enum zone_stat_item zsi;
1293 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_INACTIVE, 1,
1294 [Page state NR_INACTIVE is available])
1299 AC_MSG_CHECKING([whether page state NR_INACTIVE_ANON is available])
1300 SPL_LINUX_TRY_COMPILE([
1301 #include <linux/mm.h>
1303 enum zone_stat_item zsi;
1304 zsi = NR_INACTIVE_ANON;
1307 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_ANON, 1,
1308 [Page state NR_INACTIVE_ANON is available])
1313 AC_MSG_CHECKING([whether page state NR_INACTIVE_FILE is available])
1314 SPL_LINUX_TRY_COMPILE([
1315 #include <linux/mm.h>
1317 enum zone_stat_item zsi;
1318 zsi = NR_INACTIVE_FILE;
1321 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_FILE, 1,
1322 [Page state NR_INACTIVE_FILE is available])
1329 dnl # 2.6.21 API change (plus subsequent naming convention changes),
1330 dnl # Public global zone stats now include an active page count. However
1331 dnl # the enumerated names of the counters have changed since this API
1332 dnl # was introduced. We need to deduce the corrent name to use. This
1333 dnl # replaces the priviate get_zone_counts() interface.
1335 dnl # NR_ACTIVE was available from 2.6.21 to 2.6.27 and included both
1336 dnl # anonymous and file active pages. As of 2.6.28 it was split in
1337 dnl # to NR_ACTIVE_ANON and NR_ACTIVE_FILE.
1339 AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_ACTIVE], [
1340 AC_MSG_CHECKING([whether page state NR_ACTIVE is available])
1341 SPL_LINUX_TRY_COMPILE([
1342 #include <linux/mm.h>
1344 enum zone_stat_item zsi;
1348 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_ACTIVE, 1,
1349 [Page state NR_ACTIVE is available])
1354 AC_MSG_CHECKING([whether page state NR_ACTIVE_ANON is available])
1355 SPL_LINUX_TRY_COMPILE([
1356 #include <linux/mm.h>
1358 enum zone_stat_item zsi;
1359 zsi = NR_ACTIVE_ANON;
1362 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_ANON, 1,
1363 [Page state NR_ACTIVE_ANON is available])
1368 AC_MSG_CHECKING([whether page state NR_ACTIVE_FILE is available])
1369 SPL_LINUX_TRY_COMPILE([
1370 #include <linux/mm.h>
1372 enum zone_stat_item zsi;
1373 zsi = NR_ACTIVE_FILE;
1376 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_FILE, 1,
1377 [Page state NR_ACTIVE_FILE is available])
1384 dnl # Proposed API change for legacy kernels.
1385 dnl # This symbol is not available in older kernels. For kernels post
1386 dnl # 2.6.21 the global_page_state() API is used to get free/inactive/active
1387 dnl # page state information. This symbol is only used in legacy kernels
1388 dnl # any only as a last resort.
1390 AC_DEFUN([SPL_AC_GET_ZONE_COUNTS], [
1391 AC_MSG_CHECKING([whether symbol get_zone_counts is needed])
1392 SPL_LINUX_TRY_COMPILE([
1394 #if !defined(HAVE_ZONE_STAT_ITEM_NR_FREE_PAGES)
1395 #error "global_page_state needs NR_FREE_PAGES"
1398 #if !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE) && \
1399 !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_ANON) && \
1400 !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_FILE)
1401 #error "global_page_state needs NR_ACTIVE*"
1404 #if !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE) && \
1405 !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_ANON) && \
1406 !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_FILE)
1407 #error "global_page_state needs NR_INACTIVE*"
1413 AC_DEFINE(NEED_GET_ZONE_COUNTS, 1,
1414 [get_zone_counts() is needed])
1416 SPL_CHECK_SYMBOL_EXPORT(
1419 [AC_DEFINE(HAVE_GET_ZONE_COUNTS, 1,
1420 [get_zone_counts() is available])],
1426 dnl # 2.6.27 API change,
1427 dnl # The user_path_dir() replaces __user_walk()
1429 AC_DEFUN([SPL_AC_USER_PATH_DIR], [
1430 SPL_CHECK_SYMBOL_EXPORT(
1433 [AC_DEFINE(HAVE_USER_PATH_DIR, 1,
1434 [user_path_dir() is available])],
1439 dnl # Symbol available in RHEL kernels not in stock kernels.
1441 AC_DEFUN([SPL_AC_SET_FS_PWD], [
1442 SPL_CHECK_SYMBOL_EXPORT(
1445 [AC_DEFINE(HAVE_SET_FS_PWD, 1,
1446 [set_fs_pwd() is available])],
1451 dnl # 2.6.25 API change,
1452 dnl # Simplied API by replacing mnt+dentry args with a single path arg.
1454 AC_DEFUN([SPL_AC_2ARGS_SET_FS_PWD],
1455 [AC_MSG_CHECKING([whether set_fs_pwd() wants 2 args])
1456 SPL_LINUX_TRY_COMPILE([
1457 #include <linux/sched.h>
1458 #include <linux/fs_struct.h>
1460 set_fs_pwd(NULL, NULL);
1463 AC_DEFINE(HAVE_2ARGS_SET_FS_PWD, 1,
1464 [set_fs_pwd() wants 2 args])
1471 dnl # SLES API change, never adopted in mainline,
1472 dnl # Third 'struct vfsmount *' argument removed.
1474 AC_DEFUN([SPL_AC_2ARGS_VFS_UNLINK],
1475 [AC_MSG_CHECKING([whether vfs_unlink() wants 2 args])
1476 SPL_LINUX_TRY_COMPILE([
1477 #include <linux/fs.h>
1479 vfs_unlink(NULL, NULL);
1482 AC_DEFINE(HAVE_2ARGS_VFS_UNLINK, 1,
1483 [vfs_unlink() wants 2 args])
1490 dnl # SLES API change, never adopted in mainline,
1491 dnl # Third and sixth 'struct vfsmount *' argument removed.
1493 AC_DEFUN([SPL_AC_4ARGS_VFS_RENAME],
1494 [AC_MSG_CHECKING([whether vfs_rename() wants 4 args])
1495 SPL_LINUX_TRY_COMPILE([
1496 #include <linux/fs.h>
1498 vfs_rename(NULL, NULL, NULL, NULL);
1501 AC_DEFINE(HAVE_4ARGS_VFS_RENAME, 1,
1502 [vfs_rename() wants 4 args])
1509 dnl # 2.6.29 API change,
1510 dnl # check whether 'struct cred' exists
1512 AC_DEFUN([SPL_AC_CRED_STRUCT], [
1513 AC_MSG_CHECKING([whether struct cred exists])
1514 SPL_LINUX_TRY_COMPILE([
1515 #include <linux/cred.h>
1521 AC_DEFINE(HAVE_CRED_STRUCT, 1, [struct cred exists])
1528 dnl # Custom SPL patch may export this symbol.
1530 AC_DEFUN([SPL_AC_GROUPS_SEARCH], [
1531 SPL_CHECK_SYMBOL_EXPORT(
1534 [AC_DEFINE(HAVE_GROUPS_SEARCH, 1,
1535 [groups_search() is available])],
1540 dnl # 2.6.x API change,
1541 dnl # __put_task_struct() was exported in RHEL5 but unavailable elsewhere.
1543 AC_DEFUN([SPL_AC_PUT_TASK_STRUCT], [
1544 SPL_CHECK_SYMBOL_EXPORT(
1545 [__put_task_struct],
1547 [AC_DEFINE(HAVE_PUT_TASK_STRUCT, 1,
1548 [__put_task_struct() is available])],
1553 dnl # 2.6.32 API change,
1554 dnl # Unused 'struct file *' removed from prototype.
1556 AC_DEFUN([SPL_AC_5ARGS_PROC_HANDLER], [
1557 AC_MSG_CHECKING([whether proc_handler() wants 5 args])
1558 SPL_LINUX_TRY_COMPILE([
1559 #include <linux/sysctl.h>
1561 proc_dostring(NULL, 0, NULL, NULL, NULL);
1564 AC_DEFINE(HAVE_5ARGS_PROC_HANDLER, 1,
1565 [proc_handler() wants 5 args])
1572 dnl # 2.6.x API change,
1573 dnl # kvasprintf() function added.
1575 AC_DEFUN([SPL_AC_KVASPRINTF], [
1576 SPL_CHECK_SYMBOL_EXPORT(
1579 [AC_DEFINE(HAVE_KVASPRINTF, 1,
1580 [kvasprintf() is available])],
1585 dnl # 2.6.35 API change,
1586 dnl # Unused 'struct dentry *' removed from prototype.
1588 AC_DEFUN([SPL_AC_3ARGS_FILE_FSYNC], [
1589 AC_MSG_CHECKING([whether file_fsync() wants 3 args])
1590 SPL_LINUX_TRY_COMPILE([
1591 #include <linux/buffer_head.h>
1593 file_fsync(NULL, NULL, 0);
1596 AC_DEFINE(HAVE_3ARGS_FILE_FSYNC, 1,
1597 [file_fsync() wants 3 args])
1604 dnl # 2.6.33 API change. Also backported in RHEL5 as of 2.6.18-190.el5.
1605 dnl # Earlier versions of rwsem_is_locked() were inline and had a race
1606 dnl # condition. The fixed version is exported as a symbol. The race
1607 dnl # condition is fixed by acquiring sem->wait_lock, so we must not
1608 dnl # call that version while holding sem->wait_lock.
1610 AC_DEFUN([SPL_AC_EXPORTED_RWSEM_IS_LOCKED], [
1611 SPL_CHECK_SYMBOL_EXPORT(
1613 [lib/rwsem-spinlock.c],
1614 [AC_DEFINE(RWSEM_IS_LOCKED_TAKES_WAIT_LOCK, 1,
1615 [rwsem_is_locked() acquires sem->wait_lock])],