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)
23 SPL_AC_DEBUG_KMEM_TRACKING
25 SPL_AC_ATOMIC_SPINLOCK
26 SPL_AC_SHRINKER_CALLBACK
30 SPL_AC_MUTEX_OWNER_TASK_STRUCT
31 SPL_AC_SET_FS_PWD_WITH_CONST
32 SPL_AC_2ARGS_VFS_UNLINK
33 SPL_AC_4ARGS_VFS_RENAME
35 SPL_AC_2ARGS_VFS_FSYNC
36 SPL_AC_INODE_TRUNCATE_RANGE
37 SPL_AC_FS_STRUCT_SPINLOCK
39 SPL_AC_PUT_TASK_STRUCT
40 SPL_AC_EXPORTED_RWSEM_IS_LOCKED
41 SPL_AC_KERNEL_FALLOCATE
42 SPL_AC_CONFIG_ZLIB_INFLATE
43 SPL_AC_CONFIG_ZLIB_DEFLATE
44 SPL_AC_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE
45 SPL_AC_SHRINK_CONTROL_STRUCT
46 SPL_AC_RWSEM_SPINLOCK_IS_RAW
47 SPL_AC_SCHED_RT_HEADER
48 SPL_AC_2ARGS_VFS_GETATTR
50 SPL_AC_KMEM_CACHE_ALLOCFLAGS
54 AC_DEFUN([SPL_AC_MODULE_SYMVERS], [
55 modpost=$LINUX/scripts/Makefile.modpost
56 AC_MSG_CHECKING([kernel file name for module symbols])
57 if test "x$enable_linux_builtin" != xyes -a -f "$modpost"; then
58 if grep -q Modules.symvers $modpost; then
59 LINUX_SYMBOLS=Modules.symvers
61 LINUX_SYMBOLS=Module.symvers
64 if ! test -f "$LINUX_OBJ/$LINUX_SYMBOLS"; then
66 *** Please make sure the kernel devel package for your distribution
67 *** is installed. If you are building with a custom kernel, make sure the
68 *** kernel is configured, built, and the '--with-linux=PATH' configure
69 *** option refers to the location of the kernel source.])
74 AC_MSG_RESULT($LINUX_SYMBOLS)
75 AC_SUBST(LINUX_SYMBOLS)
78 AC_DEFUN([SPL_AC_KERNEL], [
80 AS_HELP_STRING([--with-linux=PATH],
81 [Path to kernel source]),
82 [kernelsrc="$withval"])
84 AC_ARG_WITH([linux-obj],
85 AS_HELP_STRING([--with-linux-obj=PATH],
86 [Path to kernel build objects]),
87 [kernelbuild="$withval"])
89 AC_MSG_CHECKING([kernel source directory])
90 if test -z "$kernelsrc"; then
91 if test -e "/lib/modules/$(uname -r)/source"; then
92 headersdir="/lib/modules/$(uname -r)/source"
93 sourcelink=$(readlink -f "$headersdir")
94 elif test -e "/lib/modules/$(uname -r)/build"; then
95 headersdir="/lib/modules/$(uname -r)/build"
96 sourcelink=$(readlink -f "$headersdir")
98 sourcelink=$(ls -1d /usr/src/kernels/* \
100 2>/dev/null | grep -v obj | tail -1)
103 if test -n "$sourcelink" && test -e ${sourcelink}; then
104 kernelsrc=`readlink -f ${sourcelink}`
106 kernelsrc="[Not found]"
109 if test "$kernelsrc" = "NONE"; then
114 AC_MSG_RESULT([$kernelsrc])
115 if test ! -d "$kernelsrc"; then
117 *** Please make sure the kernel devel package for your distribution
118 *** is installed and then try again. If that fails, you can specify the
119 *** location of the kernel source with the '--with-linux=PATH' option.])
122 AC_MSG_CHECKING([kernel build directory])
123 if test -z "$kernelbuild"; then
124 if test -e "/lib/modules/$(uname -r)/build"; then
125 kernelbuild=`readlink -f /lib/modules/$(uname -r)/build`
126 elif test -d ${kernelsrc}-obj/${target_cpu}/${target_cpu}; then
127 kernelbuild=${kernelsrc}-obj/${target_cpu}/${target_cpu}
128 elif test -d ${kernelsrc}-obj/${target_cpu}/default; then
129 kernelbuild=${kernelsrc}-obj/${target_cpu}/default
130 elif test -d `dirname ${kernelsrc}`/build-${target_cpu}; then
131 kernelbuild=`dirname ${kernelsrc}`/build-${target_cpu}
133 kernelbuild=${kernelsrc}
136 AC_MSG_RESULT([$kernelbuild])
138 AC_MSG_CHECKING([kernel source version])
139 utsrelease1=$kernelbuild/include/linux/version.h
140 utsrelease2=$kernelbuild/include/linux/utsrelease.h
141 utsrelease3=$kernelbuild/include/generated/utsrelease.h
142 if test -r $utsrelease1 && fgrep -q UTS_RELEASE $utsrelease1; then
143 utsrelease=linux/version.h
144 elif test -r $utsrelease2 && fgrep -q UTS_RELEASE $utsrelease2; then
145 utsrelease=linux/utsrelease.h
146 elif test -r $utsrelease3 && fgrep -q UTS_RELEASE $utsrelease3; then
147 utsrelease=generated/utsrelease.h
150 if test "$utsrelease"; then
151 kernsrcver=`(echo "#include <$utsrelease>";
152 echo "kernsrcver=UTS_RELEASE") |
153 cpp -I $kernelbuild/include |
154 grep "^kernsrcver=" | cut -d \" -f 2`
156 if test -z "$kernsrcver"; then
157 AC_MSG_RESULT([Not found])
158 AC_MSG_ERROR([*** Cannot determine kernel version.])
161 AC_MSG_RESULT([Not found])
162 if test "x$enable_linux_builtin" != xyes; then
163 AC_MSG_ERROR([*** Cannot find UTS_RELEASE definition.])
166 *** Cannot find UTS_RELEASE definition.
167 *** Please run 'make prepare' inside the kernel source tree.])
171 AC_MSG_RESULT([$kernsrcver])
174 LINUX_OBJ=${kernelbuild}
175 LINUX_VERSION=${kernsrcver}
179 AC_SUBST(LINUX_VERSION)
181 SPL_AC_MODULE_SYMVERS
185 dnl # Default SPL user configuration
187 AC_DEFUN([SPL_AC_CONFIG_USER], [])
190 dnl # Check for rpm+rpmbuild to build RPM packages. If these tools
191 dnl # are missing, it is non-fatal, but you will not be able to build
192 dnl # RPM packages and will be warned if you try too.
194 dnl # By default, the generic spec file will be used because it requires
195 dnl # minimal dependencies. Distribution specific spec files can be
196 dnl # placed under the 'rpm/<distribution>' directory and enabled using
197 dnl # the --with-spec=<distribution> configure option.
199 AC_DEFUN([SPL_AC_RPM], [
203 AC_MSG_CHECKING([whether $RPM is available])
204 AS_IF([tmp=$($RPM --version 2>/dev/null)], [
205 RPM_VERSION=$(echo $tmp | $AWK '/RPM/ { print $[3] }')
207 AC_MSG_RESULT([$HAVE_RPM ($RPM_VERSION)])
210 AC_MSG_RESULT([$HAVE_RPM])
213 AC_MSG_CHECKING([whether $RPMBUILD is available])
214 AS_IF([tmp=$($RPMBUILD --version 2>/dev/null)], [
215 RPMBUILD_VERSION=$(echo $tmp | $AWK '/RPM/ { print $[3] }')
217 AC_MSG_RESULT([$HAVE_RPMBUILD ($RPMBUILD_VERSION)])
220 AC_MSG_RESULT([$HAVE_RPMBUILD])
223 RPM_DEFINE_COMMON='--define "$(DEBUG_SPL) 1" --define "$(DEBUG_LOG) 1" --define "$(DEBUG_KMEM) 1" --define "$(DEBUG_KMEM_TRACKING) 1"'
225 RPM_DEFINE_KMOD='--define "kernels $(LINUX_VERSION)"'
228 SRPM_DEFINE_COMMON='--define "build_src_rpm 1"'
233 RPM_SPEC_DIR="rpm/generic"
235 AS_HELP_STRING([--with-spec=SPEC],
236 [Spec files 'generic|fedora']),
237 [RPM_SPEC_DIR="rpm/$withval"])
239 AC_MSG_CHECKING([whether spec files are available])
240 AC_MSG_RESULT([yes ($RPM_SPEC_DIR/*.spec.in)])
244 AC_SUBST(RPM_VERSION)
246 AC_SUBST(HAVE_RPMBUILD)
248 AC_SUBST(RPMBUILD_VERSION)
250 AC_SUBST(RPM_SPEC_DIR)
251 AC_SUBST(RPM_DEFINE_UTIL)
252 AC_SUBST(RPM_DEFINE_KMOD)
253 AC_SUBST(RPM_DEFINE_DKMS)
254 AC_SUBST(RPM_DEFINE_COMMON)
255 AC_SUBST(SRPM_DEFINE_UTIL)
256 AC_SUBST(SRPM_DEFINE_KMOD)
257 AC_SUBST(SRPM_DEFINE_DKMS)
258 AC_SUBST(SRPM_DEFINE_COMMON)
262 dnl # Check for dpkg+dpkg-buildpackage to build DEB packages. If these
263 dnl # tools are missing it is non-fatal but you will not be able to build
264 dnl # DEB packages and will be warned if you try too.
266 AC_DEFUN([SPL_AC_DPKG], [
268 DPKGBUILD=dpkg-buildpackage
270 AC_MSG_CHECKING([whether $DPKG is available])
271 AS_IF([tmp=$($DPKG --version 2>/dev/null)], [
272 DPKG_VERSION=$(echo $tmp | $AWK '/Debian/ { print $[7] }')
274 AC_MSG_RESULT([$HAVE_DPKG ($DPKG_VERSION)])
277 AC_MSG_RESULT([$HAVE_DPKG])
280 AC_MSG_CHECKING([whether $DPKGBUILD is available])
281 AS_IF([tmp=$($DPKGBUILD --version 2>/dev/null)], [
282 DPKGBUILD_VERSION=$(echo $tmp | \
283 $AWK '/Debian/ { print $[4] }' | cut -f-4 -d'.')
285 AC_MSG_RESULT([$HAVE_DPKGBUILD ($DPKGBUILD_VERSION)])
288 AC_MSG_RESULT([$HAVE_DPKGBUILD])
293 AC_SUBST(DPKG_VERSION)
295 AC_SUBST(HAVE_DPKGBUILD)
297 AC_SUBST(DPKGBUILD_VERSION)
301 dnl # Until native packaging for various different packing systems
302 dnl # can be added the least we can do is attempt to use alien to
303 dnl # convert the RPM packages to the needed package type. This is
304 dnl # a hack but so far it has worked reasonable well.
306 AC_DEFUN([SPL_AC_ALIEN], [
309 AC_MSG_CHECKING([whether $ALIEN is available])
310 AS_IF([tmp=$($ALIEN --version 2>/dev/null)], [
311 ALIEN_VERSION=$(echo $tmp | $AWK '{ print $[3] }')
313 AC_MSG_RESULT([$HAVE_ALIEN ($ALIEN_VERSION)])
316 AC_MSG_RESULT([$HAVE_ALIEN])
321 AC_SUBST(ALIEN_VERSION)
325 dnl # Using the VENDOR tag from config.guess set the default
326 dnl # package type for 'make pkg': (rpm | deb | tgz)
328 AC_DEFUN([SPL_AC_DEFAULT_PACKAGE], [
329 AC_MSG_CHECKING([linux distribution])
330 if test -f /etc/toss-release ; then
332 elif test -f /etc/fedora-release ; then
334 elif test -f /etc/redhat-release ; then
336 elif test -f /etc/gentoo-release ; then
338 elif test -f /etc/arch-release ; then
340 elif test -f /etc/SuSE-release ; then
342 elif test -f /etc/slackware-version ; then
344 elif test -f /etc/lunar.release ; then
346 elif test -f /etc/lsb-release ; then
348 elif test -f /etc/debian_version ; then
353 AC_MSG_RESULT([$VENDOR])
356 AC_MSG_CHECKING([default package type])
358 toss) DEFAULT_PACKAGE=rpm ;;
359 redhat) DEFAULT_PACKAGE=rpm ;;
360 fedora) DEFAULT_PACKAGE=rpm ;;
361 gentoo) DEFAULT_PACKAGE=tgz ;;
362 arch) DEFAULT_PACKAGE=tgz ;;
363 sles) DEFAULT_PACKAGE=rpm ;;
364 slackware) DEFAULT_PACKAGE=tgz ;;
365 lunar) DEFAULT_PACKAGE=tgz ;;
366 ubuntu) DEFAULT_PACKAGE=deb ;;
367 debian) DEFAULT_PACKAGE=deb ;;
368 *) DEFAULT_PACKAGE=rpm ;;
371 AC_MSG_RESULT([$DEFAULT_PACKAGE])
372 AC_SUBST(DEFAULT_PACKAGE)
376 dnl # Default SPL user configuration
378 AC_DEFUN([SPL_AC_PACKAGE], [
379 SPL_AC_DEFAULT_PACKAGE
385 AC_DEFUN([SPL_AC_LICENSE], [
386 AC_MSG_CHECKING([spl author])
387 AC_MSG_RESULT([$SPL_META_AUTHOR])
389 AC_MSG_CHECKING([spl license])
390 AC_MSG_RESULT([$SPL_META_LICENSE])
393 AC_DEFUN([SPL_AC_CONFIG], [
395 AC_ARG_WITH([config],
396 AS_HELP_STRING([--with-config=CONFIG],
397 [Config file 'kernel|user|all|srpm']),
398 [SPL_CONFIG="$withval"])
399 AC_ARG_ENABLE([linux-builtin],
400 [AC_HELP_STRING([--enable-linux-builtin],
401 [Configure for builtin in-tree kernel modules @<:@default=no@:>@])],
403 [enable_linux_builtin=no])
405 AC_MSG_CHECKING([spl config])
406 AC_MSG_RESULT([$SPL_CONFIG]);
409 case "$SPL_CONFIG" in
410 kernel) SPL_AC_CONFIG_KERNEL ;;
411 user) SPL_AC_CONFIG_USER ;;
412 all) SPL_AC_CONFIG_KERNEL
413 SPL_AC_CONFIG_USER ;;
416 AC_MSG_RESULT([Error!])
417 AC_MSG_ERROR([Bad value "$SPL_CONFIG" for --with-config,
418 user kernel|user|all|srpm]) ;;
421 AM_CONDITIONAL([CONFIG_USER],
422 [test "$SPL_CONFIG" = user -o "$SPL_CONFIG" = all])
423 AM_CONDITIONAL([CONFIG_KERNEL],
424 [test "$SPL_CONFIG" = kernel -o "$SPL_CONFIG" = all] &&
425 [test "x$enable_linux_builtin" != xyes ])
429 dnl # Enable if the SPL should be compiled with internal debugging enabled.
430 dnl # By default this support is disabled.
432 AC_DEFUN([SPL_AC_DEBUG], [
433 AC_MSG_CHECKING([whether debugging is enabled])
434 AC_ARG_ENABLE([debug],
435 [AS_HELP_STRING([--enable-debug],
436 [Enable generic debug support @<:@default=no@:>@])],
440 AS_IF([test "x$enable_debug" = xyes],
442 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG -Werror"
443 DEBUG_CFLAGS="-DDEBUG -Werror"
444 DEBUG_SPL="_with_debug"
446 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG"
447 DEBUG_CFLAGS="-DNDEBUG"
448 DEBUG_SPL="_without_debug"
451 AC_SUBST(DEBUG_CFLAGS)
453 AC_MSG_RESULT([$enable_debug])
457 dnl # Enabled by default it provides a basic debug log infrastructure.
458 dnl # Each subsystem registers itself with a name and logs messages
459 dnl # using predefined types. If the debug mask it set to allow the
460 dnl # message type it will be written to the internal log. The log
461 dnl # can be dumped to a file by echoing 1 to the 'dump' proc entry,
462 dnl # after dumping the log it must be decoded using the spl utility.
464 dnl # echo 1 >/proc/sys/kernel/spl/debug/dump
465 dnl # spl /tmp/spl-log.xxx.yyy /tmp/spl-log.xxx.yyy.txt
467 AC_DEFUN([SPL_AC_DEBUG_LOG], [
468 AC_ARG_ENABLE([debug-log],
469 [AS_HELP_STRING([--enable-debug-log],
470 [Enable basic debug logging @<:@default=yes@:>@])],
472 [enable_debug_log=yes])
474 AS_IF([test "x$enable_debug_log" = xyes],
476 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_LOG"
477 DEBUG_LOG="_with_debug_log"
478 AC_DEFINE([DEBUG_LOG], [1],
479 [Define to 1 to enable basic debug logging])
481 DEBUG_LOG="_without_debug_log"
485 AC_MSG_CHECKING([whether basic debug logging is enabled])
486 AC_MSG_RESULT([$enable_debug_log])
490 dnl # Enabled by default it provides a minimal level of memory tracking.
491 dnl # A total count of bytes allocated is kept for each alloc and free.
492 dnl # Then at module unload time a report to the console will be printed
493 dnl # if memory was leaked. Additionally, /proc/spl/kmem/slab will exist
494 dnl # and provide an easy way to inspect the kmem based slab.
496 AC_DEFUN([SPL_AC_DEBUG_KMEM], [
497 AC_ARG_ENABLE([debug-kmem],
498 [AS_HELP_STRING([--enable-debug-kmem],
499 [Enable basic kmem accounting @<:@default=yes@:>@])],
501 [enable_debug_kmem=yes])
503 AS_IF([test "x$enable_debug_kmem" = xyes],
505 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM"
506 DEBUG_KMEM="_with_debug_kmem"
507 AC_DEFINE([DEBUG_KMEM], [1],
508 [Define to 1 to enable basic kmem accounting])
510 DEBUG_KMEM="_without_debug_kmem"
514 AC_MSG_CHECKING([whether basic kmem accounting is enabled])
515 AC_MSG_RESULT([$enable_debug_kmem])
519 dnl # Disabled by default it provides detailed memory tracking. This
520 dnl # feature also requires --enable-debug-kmem to be set. When enabled
521 dnl # not only will total bytes be tracked but also the location of every
522 dnl # alloc and free. When the SPL module is unloaded a list of all leaked
523 dnl # addresses and where they were allocated will be dumped to the console.
524 dnl # Enabling this feature has a significant impact on performance but it
525 dnl # makes finding memory leaks pretty straight forward.
527 AC_DEFUN([SPL_AC_DEBUG_KMEM_TRACKING], [
528 AC_ARG_ENABLE([debug-kmem-tracking],
529 [AS_HELP_STRING([--enable-debug-kmem-tracking],
530 [Enable detailed kmem tracking @<:@default=no@:>@])],
532 [enable_debug_kmem_tracking=no])
534 AS_IF([test "x$enable_debug_kmem_tracking" = xyes],
536 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM_TRACKING"
537 DEBUG_KMEM_TRACKING="_with_debug_kmem_tracking"
538 AC_DEFINE([DEBUG_KMEM_TRACKING], [1],
539 [Define to 1 to enable detailed kmem tracking])
541 DEBUG_KMEM_TRACKING="_without_debug_kmem_tracking"
544 AC_SUBST(DEBUG_KMEM_TRACKING)
545 AC_MSG_CHECKING([whether detailed kmem tracking is enabled])
546 AC_MSG_RESULT([$enable_debug_kmem_tracking])
550 dnl # SPL_LINUX_CONFTEST
552 AC_DEFUN([SPL_LINUX_CONFTEST], [
553 cat confdefs.h - <<_ACEOF >conftest.c
559 dnl # SPL_LANG_PROGRAM(C)([PROLOGUE], [BODY])
561 m4_define([SPL_LANG_PROGRAM], [
566 dnl Do *not* indent the following line: there may be CPP directives.
567 dnl Don't move the `;' right after for the same reason.
575 dnl # SPL_LINUX_COMPILE_IFELSE / like AC_COMPILE_IFELSE
577 AC_DEFUN([SPL_LINUX_COMPILE_IFELSE], [
578 m4_ifvaln([$1], [SPL_LINUX_CONFTEST([$1])])
579 rm -Rf build && mkdir -p build && touch build/conftest.mod.c
580 echo "obj-m := conftest.o" >build/Makefile
582 test "x$enable_linux_builtin" = xyes && modpost_flag='modpost=true' # fake modpost stage
584 [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 $modpost_flag) >/dev/null && AC_TRY_COMMAND([$3])],
586 [_AC_MSG_LOG_CONFTEST m4_ifvaln([$5],[$5])]
592 dnl # SPL_LINUX_TRY_COMPILE like AC_TRY_COMPILE
594 AC_DEFUN([SPL_LINUX_TRY_COMPILE],
595 [SPL_LINUX_COMPILE_IFELSE(
596 [AC_LANG_SOURCE([SPL_LANG_PROGRAM([[$1]], [[$2]])])],
598 [test -s build/conftest.o],
603 dnl # SPL_CHECK_SYMBOL_EXPORT
604 dnl # check symbol exported or not
606 AC_DEFUN([SPL_CHECK_SYMBOL_EXPORT], [
607 grep -q -E '[[[:space:]]]$1[[[:space:]]]' \
608 $LINUX_OBJ/Module*.symvers 2>/dev/null
610 if test $rc -ne 0; then
613 grep -q -E "EXPORT_SYMBOL.*($1)" \
614 "$LINUX_OBJ/$file" 2>/dev/null
616 if test $rc -eq 0; then
621 if test $export -eq 0; then :
632 dnl # SPL_LINUX_TRY_COMPILE_SYMBOL
633 dnl # like SPL_LINUX_TRY_COMPILE, except SPL_CHECK_SYMBOL_EXPORT
634 dnl # is called if not compiling for builtin
636 AC_DEFUN([SPL_LINUX_TRY_COMPILE_SYMBOL], [
637 SPL_LINUX_TRY_COMPILE([$1], [$2], [rc=0], [rc=1])
638 if test $rc -ne 0; then :
641 if test "x$enable_linux_builtin" != xyes; then
642 SPL_CHECK_SYMBOL_EXPORT([$3], [$4], [rc=0], [rc=1])
644 if test $rc -ne 0; then :
653 dnl # SPL_CHECK_SYMBOL_HEADER
654 dnl # check if a symbol prototype is defined in listed headers.
656 AC_DEFUN([SPL_CHECK_SYMBOL_HEADER], [
657 AC_MSG_CHECKING([whether symbol $1 exists in header])
660 grep -q "$2" "$LINUX/$file" 2>/dev/null
662 if test $rc -eq 0; then
667 if test $header -eq 0; then
677 dnl # SPL_CHECK_HEADER
678 dnl # check whether header exists and define HAVE_$2_HEADER
680 AC_DEFUN([SPL_CHECK_HEADER],
681 [AC_MSG_CHECKING([whether header $1 exists])
682 SPL_LINUX_TRY_COMPILE([
687 AC_DEFINE(HAVE_$2_HEADER, 1, [$1 exists])
697 dnl # Basic toolchain sanity check. Verify that kernel modules can
698 dnl # be built and which symbols can be used.
700 AC_DEFUN([SPL_AC_TEST_MODULE],
701 [AC_MSG_CHECKING([whether modules can be built])
702 SPL_LINUX_TRY_COMPILE([],[],[
706 if test "x$enable_linux_builtin" != xyes; then
707 AC_MSG_ERROR([*** Unable to build an empty module.])
710 *** Unable to build an empty module.
711 *** Please run 'make scripts' inside the kernel source tree.])
717 #include "$LINUX/include/linux/license.h"
719 return !license_is_gpl_compatible("$SPL_META_LICENSE");
722 AC_DEFINE([SPL_IS_GPL_COMPATIBLE], [1],
723 [Define to 1 if GPL-only symbols can be used])
729 dnl # Use the atomic implemenation based on global spinlocks. This
730 dnl # should only be needed by 32-bit kernels which do not provide
731 dnl # the atomic64_* API. It may be optionally enabled as a fallback
732 dnl # if problems are observed with the direct mapping to the native
733 dnl # Linux atomic operations. You may not disable atomic spinlocks
734 dnl # if you kernel does not an atomic64_* API.
736 AC_DEFUN([SPL_AC_ATOMIC_SPINLOCK], [
737 AC_ARG_ENABLE([atomic-spinlocks],
738 [AS_HELP_STRING([--enable-atomic-spinlocks],
739 [Atomic types use spinlocks @<:@default=check@:>@])],
741 [enable_atomic_spinlocks=check])
743 SPL_LINUX_TRY_COMPILE([
744 #include <linux/fs.h>
746 atomic64_t *ptr __attribute__ ((unused));
749 AC_DEFINE(HAVE_ATOMIC64_T, 1,
750 [kernel defines atomic64_t])
755 AS_IF([test "x$enable_atomic_spinlocks" = xcheck], [
756 AS_IF([test "x$have_atomic64_t" = xyes], [
757 enable_atomic_spinlocks=no
759 enable_atomic_spinlocks=yes
763 AS_IF([test "x$enable_atomic_spinlocks" = xyes], [
764 AC_DEFINE([ATOMIC_SPINLOCK], [1],
765 [Atomic types use spinlocks])
767 AS_IF([test "x$have_atomic64_t" = xno], [
769 [--disable-atomic-spinlocks given but required atomic64 support is unavailable])
773 AC_MSG_CHECKING([whether atomic types use spinlocks])
774 AC_MSG_RESULT([$enable_atomic_spinlocks])
776 AC_MSG_CHECKING([whether kernel defines atomic64_t])
777 AC_MSG_RESULT([$have_atomic64_t])
780 AC_DEFUN([SPL_AC_SHRINKER_CALLBACK],[
781 tmp_flags="$EXTRA_KCFLAGS"
782 EXTRA_KCFLAGS="-Werror"
784 dnl # 2.6.23 to 2.6.34 API change
785 dnl # ->shrink(int nr_to_scan, gfp_t gfp_mask)
787 AC_MSG_CHECKING([whether old 2-argument shrinker exists])
788 SPL_LINUX_TRY_COMPILE([
789 #include <linux/mm.h>
791 int shrinker_cb(int nr_to_scan, gfp_t gfp_mask);
793 struct shrinker cache_shrinker = {
794 .shrink = shrinker_cb,
795 .seeks = DEFAULT_SEEKS,
797 register_shrinker(&cache_shrinker);
800 AC_DEFINE(HAVE_2ARGS_OLD_SHRINKER_CALLBACK, 1,
801 [old shrinker callback wants 2 args])
805 dnl # 2.6.35 - 2.6.39 API change
806 dnl # ->shrink(struct shrinker *,
807 dnl # int nr_to_scan, gfp_t gfp_mask)
809 AC_MSG_CHECKING([whether old 3-argument shrinker exists])
810 SPL_LINUX_TRY_COMPILE([
811 #include <linux/mm.h>
813 int shrinker_cb(struct shrinker *, int nr_to_scan,
816 struct shrinker cache_shrinker = {
817 .shrink = shrinker_cb,
818 .seeks = DEFAULT_SEEKS,
820 register_shrinker(&cache_shrinker);
823 AC_DEFINE(HAVE_3ARGS_SHRINKER_CALLBACK, 1,
824 [old shrinker callback wants 3 args])
828 dnl # 3.0 - 3.11 API change
829 dnl # ->shrink(struct shrinker *,
830 dnl # struct shrink_control *sc)
833 [whether new 2-argument shrinker exists])
834 SPL_LINUX_TRY_COMPILE([
835 #include <linux/mm.h>
837 int shrinker_cb(struct shrinker *,
838 struct shrink_control *sc);
840 struct shrinker cache_shrinker = {
841 .shrink = shrinker_cb,
842 .seeks = DEFAULT_SEEKS,
844 register_shrinker(&cache_shrinker);
847 AC_DEFINE(HAVE_2ARGS_NEW_SHRINKER_CALLBACK, 1,
848 [new shrinker callback wants 2 args])
852 dnl # 3.12 API change,
853 dnl # ->shrink() is logically split in to
854 dnl # ->count_objects() and ->scan_objects()
857 [whether ->count_objects callback exists])
858 SPL_LINUX_TRY_COMPILE([
859 #include <linux/mm.h>
861 unsigned long shrinker_cb(
863 struct shrink_control *sc);
865 struct shrinker cache_shrinker = {
866 .count_objects = shrinker_cb,
867 .scan_objects = shrinker_cb,
868 .seeks = DEFAULT_SEEKS,
870 register_shrinker(&cache_shrinker);
873 AC_DEFINE(HAVE_SPLIT_SHRINKER_CALLBACK,
874 1, [->count_objects exists])
881 EXTRA_KCFLAGS="$tmp_flags"
885 dnl # 2.6.33 API change,
886 dnl # Removed .ctl_name from struct ctl_table.
888 AC_DEFUN([SPL_AC_CTL_NAME], [
889 AC_MSG_CHECKING([whether struct ctl_table has ctl_name])
890 SPL_LINUX_TRY_COMPILE([
891 #include <linux/sysctl.h>
893 struct ctl_table ctl __attribute__ ((unused));
897 AC_DEFINE(HAVE_CTL_NAME, 1, [struct ctl_table has ctl_name])
904 dnl # 2.6.29 API change,
905 dnl # Adaptive mutexs were introduced which track the mutex owner. The
906 dnl # mutex wrappers leverage this functionality to avoid tracking the
907 dnl # owner multipe times.
909 AC_DEFUN([SPL_AC_MUTEX_OWNER], [
910 AC_MSG_CHECKING([whether struct mutex has owner])
911 SPL_LINUX_TRY_COMPILE([
912 #include <linux/mutex.h>
914 struct mutex mtx __attribute__ ((unused));
918 AC_DEFINE(HAVE_MUTEX_OWNER, 1, [struct mutex has owner])
925 dnl # 2.6.39 API change,
926 dnl # Owner type change. A Linux mutex prior to 2.6.39 would store
927 dnl # the owner as a thread_info pointer when CONFIG_DEBUG_MUTEXES
928 dnl # was defined. As of 2.6.39 this was changed to a task_struct
929 dnl # pointer which frankly makes a lot more sense.
931 AC_DEFUN([SPL_AC_MUTEX_OWNER_TASK_STRUCT], [
932 AC_MSG_CHECKING([whether struct mutex owner is a task_struct])
933 tmp_flags="$EXTRA_KCFLAGS"
934 EXTRA_KCFLAGS="-Werror"
935 SPL_LINUX_TRY_COMPILE([
936 #include <linux/mutex.h>
937 #include <linux/sched.h>
939 struct mutex mtx __attribute__ ((unused));
943 AC_DEFINE(HAVE_MUTEX_OWNER_TASK_STRUCT, 1,
944 [struct mutex owner is a task_struct])
948 EXTRA_KCFLAGS="$tmp_flags"
952 dnl # 3.10 API change,
953 dnl # PDE is replaced by PDE_DATA
955 AC_DEFUN([SPL_AC_PDE_DATA], [
956 AC_MSG_CHECKING([whether PDE_DATA() is available])
957 SPL_LINUX_TRY_COMPILE_SYMBOL([
958 #include <linux/proc_fs.h>
963 AC_DEFINE(HAVE_PDE_DATA, 1, [yes])
971 dnl # set_fs_pwd takes const struct path *
973 AC_DEFUN([SPL_AC_SET_FS_PWD_WITH_CONST],
974 tmp_flags="$EXTRA_KCFLAGS"
975 EXTRA_KCFLAGS="-Werror"
976 [AC_MSG_CHECKING([whether set_fs_pwd() requires const struct path *])
977 SPL_LINUX_TRY_COMPILE([
978 #include <linux/spinlock.h>
979 #include <linux/fs_struct.h>
980 #include <linux/path.h>
981 void (*const set_fs_pwd_func)
982 (struct fs_struct *, const struct path *)
988 AC_DEFINE(HAVE_SET_FS_PWD_WITH_CONST, 1,
989 [set_fs_pwd() needs const path *])
991 SPL_LINUX_TRY_COMPILE([
992 #include <linux/spinlock.h>
993 #include <linux/fs_struct.h>
994 #include <linux/path.h>
995 void (*const set_fs_pwd_func)
996 (struct fs_struct *, struct path *)
1003 AC_MSG_ERROR(unknown)
1006 EXTRA_KCFLAGS="$tmp_flags"
1010 dnl # 3.13 API change
1011 dnl # vfs_unlink() updated to take a third delegated_inode argument.
1013 AC_DEFUN([SPL_AC_2ARGS_VFS_UNLINK],
1014 [AC_MSG_CHECKING([whether vfs_unlink() wants 2 args])
1015 SPL_LINUX_TRY_COMPILE([
1016 #include <linux/fs.h>
1018 vfs_unlink((struct inode *) NULL, (struct dentry *) NULL);
1021 AC_DEFINE(HAVE_2ARGS_VFS_UNLINK, 1,
1022 [vfs_unlink() wants 2 args])
1026 dnl # Linux 3.13 API change
1027 dnl # Added delegated inode
1029 AC_MSG_CHECKING([whether vfs_unlink() wants 3 args])
1030 SPL_LINUX_TRY_COMPILE([
1031 #include <linux/fs.h>
1033 vfs_unlink((struct inode *) NULL,
1034 (struct dentry *) NULL,
1035 (struct inode **) NULL);
1038 AC_DEFINE(HAVE_3ARGS_VFS_UNLINK, 1,
1039 [vfs_unlink() wants 3 args])
1048 dnl # 3.13 and 3.15 API changes
1049 dnl # Added delegated inode and flags argument.
1051 AC_DEFUN([SPL_AC_4ARGS_VFS_RENAME],
1052 [AC_MSG_CHECKING([whether vfs_rename() wants 4 args])
1053 SPL_LINUX_TRY_COMPILE([
1054 #include <linux/fs.h>
1056 vfs_rename((struct inode *) NULL, (struct dentry *) NULL,
1057 (struct inode *) NULL, (struct dentry *) NULL);
1060 AC_DEFINE(HAVE_4ARGS_VFS_RENAME, 1,
1061 [vfs_rename() wants 4 args])
1065 dnl # Linux 3.13 API change
1066 dnl # Added delegated inode
1068 AC_MSG_CHECKING([whether vfs_rename() wants 5 args])
1069 SPL_LINUX_TRY_COMPILE([
1070 #include <linux/fs.h>
1072 vfs_rename((struct inode *) NULL,
1073 (struct dentry *) NULL,
1074 (struct inode *) NULL,
1075 (struct dentry *) NULL,
1076 (struct inode **) NULL);
1079 AC_DEFINE(HAVE_5ARGS_VFS_RENAME, 1,
1080 [vfs_rename() wants 5 args])
1084 dnl # Linux 3.15 API change
1087 AC_MSG_CHECKING([whether vfs_rename() wants 6 args])
1088 SPL_LINUX_TRY_COMPILE([
1089 #include <linux/fs.h>
1091 vfs_rename((struct inode *) NULL,
1092 (struct dentry *) NULL,
1093 (struct inode *) NULL,
1094 (struct dentry *) NULL,
1095 (struct inode **) NULL,
1099 AC_DEFINE(HAVE_6ARGS_VFS_RENAME, 1,
1100 [vfs_rename() wants 6 args])
1109 dnl # 2.6.36 API change,
1110 dnl # The 'struct fs_struct->lock' was changed from a rwlock_t to
1111 dnl # a spinlock_t to improve the fastpath performance.
1113 AC_DEFUN([SPL_AC_FS_STRUCT_SPINLOCK], [
1114 AC_MSG_CHECKING([whether struct fs_struct uses spinlock_t])
1115 tmp_flags="$EXTRA_KCFLAGS"
1116 EXTRA_KCFLAGS="-Werror"
1117 SPL_LINUX_TRY_COMPILE([
1118 #include <linux/sched.h>
1119 #include <linux/fs_struct.h>
1121 struct fs_struct fs;
1122 spin_lock_init(&fs.lock);
1125 AC_DEFINE(HAVE_FS_STRUCT_SPINLOCK, 1,
1126 [struct fs_struct uses spinlock_t])
1130 EXTRA_KCFLAGS="$tmp_flags"
1134 dnl # User namespaces, use kuid_t in place of uid_t
1135 dnl # where available. Not strictly a user namespaces thing
1136 dnl # but it should prevent surprises
1138 AC_DEFUN([SPL_AC_KUIDGID_T], [
1139 AC_MSG_CHECKING([whether kuid_t/kgid_t is available])
1140 SPL_LINUX_TRY_COMPILE([
1141 #include <linux/uidgid.h>
1143 kuid_t userid = KUIDT_INIT(0);
1144 kgid_t groupid = KGIDT_INIT(0);
1146 SPL_LINUX_TRY_COMPILE([
1147 #include <linux/uidgid.h>
1152 AC_MSG_RESULT(yes; optional)
1154 AC_MSG_RESULT(yes; mandatory)
1155 AC_DEFINE(HAVE_KUIDGID_T, 1, [kuid_t/kgid_t in use])
1163 dnl # 2.6.39 API change,
1164 dnl # __put_task_struct() was exported by the mainline kernel.
1166 AC_DEFUN([SPL_AC_PUT_TASK_STRUCT],
1167 [AC_MSG_CHECKING([whether __put_task_struct() is available])
1168 SPL_LINUX_TRY_COMPILE_SYMBOL([
1169 #include <linux/sched.h>
1171 __put_task_struct(NULL);
1172 ], [__put_task_struct], [], [
1174 AC_DEFINE(HAVE_PUT_TASK_STRUCT, 1,
1175 [__put_task_struct() is available])
1182 dnl # 2.6.29 API change,
1183 dnl # vfs_fsync() funcation added, prior to this use file_fsync().
1185 AC_DEFUN([SPL_AC_VFS_FSYNC],
1186 [AC_MSG_CHECKING([whether vfs_fsync() is available])
1187 SPL_LINUX_TRY_COMPILE_SYMBOL([
1188 #include <linux/fs.h>
1191 ], [vfs_fsync], [fs/sync.c], [
1193 AC_DEFINE(HAVE_VFS_FSYNC, 1, [vfs_fsync() is available])
1200 dnl # 2.6.35 API change,
1201 dnl # Unused 'struct dentry *' removed from vfs_fsync() prototype.
1203 AC_DEFUN([SPL_AC_2ARGS_VFS_FSYNC], [
1204 AC_MSG_CHECKING([whether vfs_fsync() wants 2 args])
1205 SPL_LINUX_TRY_COMPILE([
1206 #include <linux/fs.h>
1211 AC_DEFINE(HAVE_2ARGS_VFS_FSYNC, 1, [vfs_fsync() wants 2 args])
1218 dnl # 3.5 API change,
1219 dnl # inode_operations.truncate_range removed
1221 AC_DEFUN([SPL_AC_INODE_TRUNCATE_RANGE], [
1222 AC_MSG_CHECKING([whether truncate_range() inode operation is available])
1223 SPL_LINUX_TRY_COMPILE([
1224 #include <linux/fs.h>
1226 struct inode_operations ops;
1227 ops.truncate_range = NULL;
1230 AC_DEFINE(HAVE_INODE_TRUNCATE_RANGE, 1,
1231 [truncate_range() inode operation is available])
1238 dnl # Linux 2.6.38 - 3.x API
1240 AC_DEFUN([SPL_AC_KERNEL_FILE_FALLOCATE], [
1241 AC_MSG_CHECKING([whether fops->fallocate() exists])
1242 SPL_LINUX_TRY_COMPILE([
1243 #include <linux/fs.h>
1245 long (*fallocate) (struct file *, int, loff_t, loff_t) = NULL;
1246 struct file_operations fops __attribute__ ((unused)) = {
1247 .fallocate = fallocate,
1251 AC_DEFINE(HAVE_FILE_FALLOCATE, 1, [fops->fallocate() exists])
1258 dnl # Linux 2.6.x - 2.6.37 API
1260 AC_DEFUN([SPL_AC_KERNEL_INODE_FALLOCATE], [
1261 AC_MSG_CHECKING([whether iops->fallocate() exists])
1262 SPL_LINUX_TRY_COMPILE([
1263 #include <linux/fs.h>
1265 long (*fallocate) (struct inode *, int, loff_t, loff_t) = NULL;
1266 struct inode_operations fops __attribute__ ((unused)) = {
1267 .fallocate = fallocate,
1271 AC_DEFINE(HAVE_INODE_FALLOCATE, 1, [fops->fallocate() exists])
1278 dnl # PaX Linux 2.6.38 - 3.x API
1280 AC_DEFUN([SPL_AC_PAX_KERNEL_FILE_FALLOCATE], [
1281 AC_MSG_CHECKING([whether fops->fallocate() exists])
1282 SPL_LINUX_TRY_COMPILE([
1283 #include <linux/fs.h>
1285 long (*fallocate) (struct file *, int, loff_t, loff_t) = NULL;
1286 struct file_operations_no_const fops __attribute__ ((unused)) = {
1287 .fallocate = fallocate,
1291 AC_DEFINE(HAVE_FILE_FALLOCATE, 1, [fops->fallocate() exists])
1298 dnl # The fallocate callback was moved from the inode_operations
1299 dnl # structure to the file_operations structure.
1301 AC_DEFUN([SPL_AC_KERNEL_FALLOCATE], [
1302 SPL_AC_KERNEL_FILE_FALLOCATE
1303 SPL_AC_KERNEL_INODE_FALLOCATE
1304 SPL_AC_PAX_KERNEL_FILE_FALLOCATE
1308 dnl # 2.6.33 API change. Also backported in RHEL5 as of 2.6.18-190.el5.
1309 dnl # Earlier versions of rwsem_is_locked() were inline and had a race
1310 dnl # condition. The fixed version is exported as a symbol. The race
1311 dnl # condition is fixed by acquiring sem->wait_lock, so we must not
1312 dnl # call that version while holding sem->wait_lock.
1314 AC_DEFUN([SPL_AC_EXPORTED_RWSEM_IS_LOCKED],
1315 [AC_MSG_CHECKING([whether rwsem_is_locked() acquires sem->wait_lock])
1316 SPL_LINUX_TRY_COMPILE_SYMBOL([
1317 #include <linux/rwsem.h>
1318 int rwsem_is_locked(struct rw_semaphore *sem) { return 0; }
1319 ], [], [rwsem_is_locked], [lib/rwsem-spinlock.c], [
1321 AC_DEFINE(RWSEM_IS_LOCKED_TAKES_WAIT_LOCK, 1,
1322 [rwsem_is_locked() acquires sem->wait_lock])
1329 dnl # zlib inflate compat,
1330 dnl # Verify the kernel has CONFIG_ZLIB_INFLATE support enabled.
1332 AC_DEFUN([SPL_AC_CONFIG_ZLIB_INFLATE], [
1333 AC_MSG_CHECKING([whether CONFIG_ZLIB_INFLATE is defined])
1334 SPL_LINUX_TRY_COMPILE([
1335 #if !defined(CONFIG_ZLIB_INFLATE) && \
1336 !defined(CONFIG_ZLIB_INFLATE_MODULE)
1337 #error CONFIG_ZLIB_INFLATE not defined
1340 AC_MSG_RESULT([yes])
1344 *** This kernel does not include the required zlib inflate support.
1345 *** Rebuild the kernel with CONFIG_ZLIB_INFLATE=y|m set.])
1350 dnl # zlib deflate compat,
1351 dnl # Verify the kernel has CONFIG_ZLIB_DEFLATE support enabled.
1353 AC_DEFUN([SPL_AC_CONFIG_ZLIB_DEFLATE], [
1354 AC_MSG_CHECKING([whether CONFIG_ZLIB_DEFLATE is defined])
1355 SPL_LINUX_TRY_COMPILE([
1356 #if !defined(CONFIG_ZLIB_DEFLATE) && \
1357 !defined(CONFIG_ZLIB_DEFLATE_MODULE)
1358 #error CONFIG_ZLIB_DEFLATE not defined
1361 AC_MSG_RESULT([yes])
1365 *** This kernel does not include the required zlib deflate support.
1366 *** Rebuild the kernel with CONFIG_ZLIB_DEFLATE=y|m set.])
1371 dnl # 2.6.39 API compat,
1372 dnl # The function zlib_deflate_workspacesize() now take 2 arguments.
1373 dnl # This was done to avoid always having to allocate the maximum size
1374 dnl # workspace (268K). The caller can now specific the windowBits and
1375 dnl # memLevel compression parameters to get a smaller workspace.
1377 AC_DEFUN([SPL_AC_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE],
1378 [AC_MSG_CHECKING([whether zlib_deflate_workspacesize() wants 2 args])
1379 SPL_LINUX_TRY_COMPILE([
1380 #include <linux/zlib.h>
1382 return zlib_deflate_workspacesize(MAX_WBITS, MAX_MEM_LEVEL);
1385 AC_DEFINE(HAVE_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE, 1,
1386 [zlib_deflate_workspacesize() wants 2 args])
1393 dnl # 2.6.39 API change,
1394 dnl # Shrinker adjust to use common shrink_control structure.
1396 AC_DEFUN([SPL_AC_SHRINK_CONTROL_STRUCT], [
1397 AC_MSG_CHECKING([whether struct shrink_control exists])
1398 SPL_LINUX_TRY_COMPILE([
1399 #include <linux/mm.h>
1401 struct shrink_control sc __attribute__ ((unused));
1404 sc.gfp_mask = GFP_KERNEL;
1407 AC_DEFINE(HAVE_SHRINK_CONTROL_STRUCT, 1,
1408 [struct shrink_control exists])
1415 dnl # 3.1 API Change
1417 dnl # The rw_semaphore.wait_lock member was changed from spinlock_t to
1418 dnl # raw_spinlock_t at commit ddb6c9b58a19edcfac93ac670b066c836ff729f1.
1420 AC_DEFUN([SPL_AC_RWSEM_SPINLOCK_IS_RAW], [
1421 AC_MSG_CHECKING([whether struct rw_semaphore member wait_lock is raw])
1422 tmp_flags="$EXTRA_KCFLAGS"
1423 EXTRA_KCFLAGS="-Werror"
1424 SPL_LINUX_TRY_COMPILE([
1425 #include <linux/rwsem.h>
1427 struct rw_semaphore dummy_semaphore __attribute__ ((unused));
1428 raw_spinlock_t dummy_lock __attribute__ ((unused));
1429 dummy_semaphore.wait_lock = dummy_lock;
1432 AC_DEFINE(RWSEM_SPINLOCK_IS_RAW, 1,
1433 [struct rw_semaphore member wait_lock is raw_spinlock_t])
1437 EXTRA_KCFLAGS="$tmp_flags"
1441 dnl # 3.9 API change,
1442 dnl # Moved things from linux/sched.h to linux/sched/rt.h
1444 AC_DEFUN([SPL_AC_SCHED_RT_HEADER],
1445 [AC_MSG_CHECKING([whether header linux/sched/rt.h exists])
1446 SPL_LINUX_TRY_COMPILE([
1447 #include <linux/sched.h>
1448 #include <linux/sched/rt.h>
1452 AC_DEFINE(HAVE_SCHED_RT_HEADER, 1, [linux/sched/rt.h exists])
1460 dnl # 3.9 API change,
1461 dnl # vfs_getattr() uses 2 args
1462 dnl # It takes struct path * instead of struct vfsmount * and struct dentry *
1464 AC_DEFUN([SPL_AC_2ARGS_VFS_GETATTR], [
1465 AC_MSG_CHECKING([whether vfs_getattr() wants])
1466 SPL_LINUX_TRY_COMPILE([
1467 #include <linux/fs.h>
1469 vfs_getattr((struct path *) NULL,
1470 (struct kstat *)NULL);
1472 AC_MSG_RESULT(2 args)
1473 AC_DEFINE(HAVE_2ARGS_VFS_GETATTR, 1,
1474 [vfs_getattr wants 2 args])
1476 SPL_LINUX_TRY_COMPILE([
1477 #include <linux/fs.h>
1479 vfs_getattr((struct vfsmount *)NULL,
1480 (struct dentry *)NULL,
1481 (struct kstat *)NULL);
1483 AC_MSG_RESULT(3 args)
1485 AC_MSG_ERROR(unknown)
1491 dnl # 2.6.36 API compatibility.
1492 dnl # Added usleep_range timer.
1493 dnl # usleep_range is a finer precision implementation of msleep
1494 dnl # designed to be a drop-in replacement for udelay where a precise
1495 dnl # sleep / busy-wait is unnecessary.
1497 AC_DEFUN([SPL_AC_USLEEP_RANGE], [
1498 AC_MSG_CHECKING([whether usleep_range() is available])
1499 SPL_LINUX_TRY_COMPILE([
1500 #include <linux/delay.h>
1505 AC_DEFINE(HAVE_USLEEP_RANGE, 1,
1506 [usleep_range is available])
1513 dnl # 2.6.35 API change,
1514 dnl # The cachep->gfpflags member was renamed cachep->allocflags. These are
1515 dnl # private allocation flags which are applied when allocating a new slab
1516 dnl # in kmem_getpages(). Unfortunately there is no public API for setting
1517 dnl # non-default flags.
1519 AC_DEFUN([SPL_AC_KMEM_CACHE_ALLOCFLAGS], [
1520 AC_MSG_CHECKING([whether struct kmem_cache has allocflags])
1521 SPL_LINUX_TRY_COMPILE([
1522 #include <linux/slab.h>
1524 struct kmem_cache cachep __attribute__ ((unused));
1525 cachep.allocflags = GFP_KERNEL;
1528 AC_DEFINE(HAVE_KMEM_CACHE_ALLOCFLAGS, 1,
1529 [struct kmem_cache has allocflags])
1533 AC_MSG_CHECKING([whether struct kmem_cache has gfpflags])
1534 SPL_LINUX_TRY_COMPILE([
1535 #include <linux/slab.h>
1537 struct kmem_cache cachep __attribute__ ((unused));
1538 cachep.gfpflags = GFP_KERNEL;
1541 AC_DEFINE(HAVE_KMEM_CACHE_GFPFLAGS, 1,
1542 [struct kmem_cache has gfpflags])
1550 dnl # 3.17 API change,
1551 dnl # wait_on_bit() no longer requires an action argument. The former
1552 dnl # "wait_on_bit" interface required an 'action' function to be provided
1553 dnl # which does the actual waiting. There were over 20 such functions in the
1554 dnl # kernel, many of them identical, though most cases can be satisfied by one
1555 dnl # of just two functions: one which uses io_schedule() and one which just
1556 dnl # uses schedule(). This API change was made to consolidate all of those
1557 dnl # redundant wait functions.
1559 AC_DEFUN([SPL_AC_WAIT_ON_BIT], [
1560 AC_MSG_CHECKING([whether wait_on_bit() takes an action])
1561 SPL_LINUX_TRY_COMPILE([
1562 #include <linux/wait.h>
1564 int (*action)(void *) = NULL;
1565 wait_on_bit(NULL, 0, action, 0);
1568 AC_DEFINE(HAVE_WAIT_ON_BIT_ACTION, 1, [yes])