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_TYPE_ATOMIC64_CMPXCHG
27 SPL_AC_TYPE_ATOMIC64_XCHG
29 SPL_AC_2ARGS_REGISTER_SYSCTL
31 SPL_AC_3ARGS_SHRINKER_CALLBACK
32 SPL_AC_PATH_IN_NAMEIDATA
38 SPL_AC_5ARGS_DEVICE_CREATE
39 SPL_AC_CLASS_DEVICE_CREATE
40 SPL_AC_SET_NORMALIZED_TIMESPEC_EXPORT
41 SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE
46 SPL_AC_MONOTONIC_CLOCK
49 SPL_AC_MUTEX_OWNER_TASK_STRUCT
50 SPL_AC_MUTEX_LOCK_NESTED
51 SPL_AC_3ARGS_ON_EACH_CPU
52 SPL_AC_KALLSYMS_LOOKUP_NAME
53 SPL_AC_GET_VMALLOC_INFO
55 SPL_AC_FIRST_ONLINE_PGDAT
56 SPL_AC_NEXT_ONLINE_PGDAT
59 SPL_AC_GLOBAL_PAGE_STATE
60 SPL_AC_ZONE_STAT_ITEM_FREE
61 SPL_AC_ZONE_STAT_ITEM_INACTIVE
62 SPL_AC_ZONE_STAT_ITEM_ACTIVE
63 SPL_AC_GET_ZONE_COUNTS
66 SPL_AC_2ARGS_SET_FS_PWD
67 SPL_AC_2ARGS_VFS_UNLINK
68 SPL_AC_4ARGS_VFS_RENAME
70 SPL_AC_2ARGS_VFS_FSYNC
71 SPL_AC_INODE_TRUNCATE_RANGE
72 SPL_AC_FS_STRUCT_SPINLOCK
75 SPL_AC_PUT_TASK_STRUCT
76 SPL_AC_5ARGS_PROC_HANDLER
78 SPL_AC_EXPORTED_RWSEM_IS_LOCKED
79 SPL_AC_KERNEL_FALLOCATE
80 SPL_AC_SHRINK_DCACHE_MEMORY
81 SPL_AC_SHRINK_ICACHE_MEMORY
82 SPL_AC_KERN_PATH_PARENT_HEADER
83 SPL_AC_KERN_PATH_PARENT_SYMBOL
84 SPL_AC_KERN_PATH_LOCKED
85 SPL_AC_CONFIG_KALLSYMS
86 SPL_AC_CONFIG_ZLIB_INFLATE
87 SPL_AC_CONFIG_ZLIB_DEFLATE
88 SPL_AC_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE
89 SPL_AC_SHRINK_CONTROL_STRUCT
90 SPL_AC_RWSEM_SPINLOCK_IS_RAW
91 SPL_AC_SCHED_RT_HEADER
94 AC_DEFUN([SPL_AC_MODULE_SYMVERS], [
95 modpost=$LINUX/scripts/Makefile.modpost
96 AC_MSG_CHECKING([kernel file name for module symbols])
97 if test "x$enable_linux_builtin" != xyes -a -f "$modpost"; then
98 if grep -q Modules.symvers $modpost; then
99 LINUX_SYMBOLS=Modules.symvers
101 LINUX_SYMBOLS=Module.symvers
104 if ! test -f "$LINUX_OBJ/$LINUX_SYMBOLS"; then
106 *** Please make sure the kernel devel package for your distribution
107 *** is installed. If your building with a custom kernel make sure the
108 *** kernel is configured, built, and the '--with-linux=PATH' configure
109 *** option refers to the location of the kernel source.])
114 AC_MSG_RESULT($LINUX_SYMBOLS)
115 AC_SUBST(LINUX_SYMBOLS)
118 AC_DEFUN([SPL_AC_KERNEL], [
120 AS_HELP_STRING([--with-linux=PATH],
121 [Path to kernel source]),
122 [kernelsrc="$withval"])
124 AC_ARG_WITH([linux-obj],
125 AS_HELP_STRING([--with-linux-obj=PATH],
126 [Path to kernel build objects]),
127 [kernelbuild="$withval"])
129 AC_MSG_CHECKING([kernel source directory])
130 if test -z "$kernelsrc"; then
131 if test -e "/lib/modules/$(uname -r)/source"; then
132 headersdir="/lib/modules/$(uname -r)/source"
133 sourcelink=$(readlink -f "$headersdir")
134 elif test -e "/lib/modules/$(uname -r)/build"; then
135 headersdir="/lib/modules/$(uname -r)/build"
136 sourcelink=$(readlink -f "$headersdir")
138 sourcelink=$(ls -1d /usr/src/kernels/* \
140 2>/dev/null | grep -v obj | tail -1)
143 if test -n "$sourcelink" && test -e ${sourcelink}; then
144 kernelsrc=`readlink -f ${sourcelink}`
146 kernelsrc="[Not found]"
149 if test "$kernelsrc" = "NONE"; then
154 AC_MSG_RESULT([$kernelsrc])
155 if test ! -d "$kernelsrc"; then
157 *** Please make sure the kernel devel package for your distribution
158 *** is installed then try again. If that fails you can specify the
159 *** location of the kernel source with the '--with-linux=PATH' option.])
162 AC_MSG_CHECKING([kernel build directory])
163 if test -z "$kernelbuild"; then
164 if test -e "/lib/modules/$(uname -r)/build"; then
165 kernelbuild=`readlink -f /lib/modules/$(uname -r)/build`
166 elif test -d ${kernelsrc}-obj/${target_cpu}/${target_cpu}; then
167 kernelbuild=${kernelsrc}-obj/${target_cpu}/${target_cpu}
168 elif test -d ${kernelsrc}-obj/${target_cpu}/default; then
169 kernelbuild=${kernelsrc}-obj/${target_cpu}/default
170 elif test -d `dirname ${kernelsrc}`/build-${target_cpu}; then
171 kernelbuild=`dirname ${kernelsrc}`/build-${target_cpu}
173 kernelbuild=${kernelsrc}
176 AC_MSG_RESULT([$kernelbuild])
178 AC_MSG_CHECKING([kernel source version])
179 utsrelease1=$kernelbuild/include/linux/version.h
180 utsrelease2=$kernelbuild/include/linux/utsrelease.h
181 utsrelease3=$kernelbuild/include/generated/utsrelease.h
182 if test -r $utsrelease1 && fgrep -q UTS_RELEASE $utsrelease1; then
183 utsrelease=linux/version.h
184 elif test -r $utsrelease2 && fgrep -q UTS_RELEASE $utsrelease2; then
185 utsrelease=linux/utsrelease.h
186 elif test -r $utsrelease3 && fgrep -q UTS_RELEASE $utsrelease3; then
187 utsrelease=generated/utsrelease.h
190 if test "$utsrelease"; then
191 kernsrcver=`(echo "#include <$utsrelease>";
192 echo "kernsrcver=UTS_RELEASE") |
193 cpp -I $kernelbuild/include |
194 grep "^kernsrcver=" | cut -d \" -f 2`
196 if test -z "$kernsrcver"; then
197 AC_MSG_RESULT([Not found])
198 AC_MSG_ERROR([*** Cannot determine kernel version.])
201 AC_MSG_RESULT([Not found])
202 if test "x$enable_linux_builtin" != xyes; then
203 AC_MSG_ERROR([*** Cannot find UTS_RELEASE definition.])
206 *** Cannot find UTS_RELEASE definition.
207 *** Please run 'make prepare' inside the kernel source tree.])
211 AC_MSG_RESULT([$kernsrcver])
214 LINUX_OBJ=${kernelbuild}
215 LINUX_VERSION=${kernsrcver}
219 AC_SUBST(LINUX_VERSION)
221 SPL_AC_MODULE_SYMVERS
225 dnl # Default SPL user configuration
227 AC_DEFUN([SPL_AC_CONFIG_USER], [])
230 dnl # Check for rpm+rpmbuild to build RPM packages. If these tools
231 dnl # are missing it is non-fatal but you will not be able to build
232 dnl # RPM packages and will be warned if you try too.
234 AC_DEFUN([SPL_AC_RPM], [
238 AC_MSG_CHECKING([whether $RPM is available])
239 AS_IF([tmp=$($RPM --version 2>/dev/null)], [
240 RPM_VERSION=$(echo $tmp | $AWK '/RPM/ { print $[3] }')
242 AC_MSG_RESULT([$HAVE_RPM ($RPM_VERSION)])
245 AC_MSG_RESULT([$HAVE_RPM])
248 AC_MSG_CHECKING([whether $RPMBUILD is available])
249 AS_IF([tmp=$($RPMBUILD --version 2>/dev/null)], [
250 RPMBUILD_VERSION=$(echo $tmp | $AWK '/RPM/ { print $[3] }')
252 AC_MSG_RESULT([$HAVE_RPMBUILD ($RPMBUILD_VERSION)])
255 AC_MSG_RESULT([$HAVE_RPMBUILD])
260 AC_SUBST(RPM_VERSION)
262 AC_SUBST(HAVE_RPMBUILD)
264 AC_SUBST(RPMBUILD_VERSION)
268 dnl # Check for dpkg+dpkg-buildpackage to build DEB packages. If these
269 dnl # tools are missing it is non-fatal but you will not be able to build
270 dnl # DEB packages and will be warned if you try too.
272 AC_DEFUN([SPL_AC_DPKG], [
274 DPKGBUILD=dpkg-buildpackage
276 AC_MSG_CHECKING([whether $DPKG is available])
277 AS_IF([tmp=$($DPKG --version 2>/dev/null)], [
278 DPKG_VERSION=$(echo $tmp | $AWK '/Debian/ { print $[7] }')
280 AC_MSG_RESULT([$HAVE_DPKG ($DPKG_VERSION)])
283 AC_MSG_RESULT([$HAVE_DPKG])
286 AC_MSG_CHECKING([whether $DPKGBUILD is available])
287 AS_IF([tmp=$($DPKGBUILD --version 2>/dev/null)], [
288 DPKGBUILD_VERSION=$(echo $tmp | \
289 $AWK '/Debian/ { print $[4] }' | cut -f-4 -d'.')
291 AC_MSG_RESULT([$HAVE_DPKGBUILD ($DPKGBUILD_VERSION)])
294 AC_MSG_RESULT([$HAVE_DPKGBUILD])
299 AC_SUBST(DPKG_VERSION)
301 AC_SUBST(HAVE_DPKGBUILD)
303 AC_SUBST(DPKGBUILD_VERSION)
307 dnl # Until native packaging for various different packing systems
308 dnl # can be added the least we can do is attempt to use alien to
309 dnl # convert the RPM packages to the needed package type. This is
310 dnl # a hack but so far it has worked reasonable well.
312 AC_DEFUN([SPL_AC_ALIEN], [
315 AC_MSG_CHECKING([whether $ALIEN is available])
316 AS_IF([tmp=$($ALIEN --version 2>/dev/null)], [
317 ALIEN_VERSION=$(echo $tmp | $AWK '{ print $[3] }')
319 AC_MSG_RESULT([$HAVE_ALIEN ($ALIEN_VERSION)])
322 AC_MSG_RESULT([$HAVE_ALIEN])
327 AC_SUBST(ALIEN_VERSION)
331 dnl # Using the VENDOR tag from config.guess set the default
332 dnl # package type for 'make pkg': (rpm | deb | tgz)
334 AC_DEFUN([SPL_AC_DEFAULT_PACKAGE], [
335 AC_MSG_CHECKING([linux distribution])
336 if test -f /etc/toss-release ; then
338 elif test -f /etc/fedora-release ; then
340 elif test -f /etc/redhat-release ; then
342 elif test -f /etc/gentoo-release ; then
344 elif test -f /etc/arch-release ; then
346 elif test -f /etc/SuSE-release ; then
348 elif test -f /etc/slackware-version ; then
350 elif test -f /etc/lunar.release ; then
352 elif test -f /etc/lsb-release ; then
354 elif test -f /etc/debian_version ; then
359 AC_MSG_RESULT([$VENDOR])
362 AC_MSG_CHECKING([default package type])
364 toss) DEFAULT_PACKAGE=rpm ;;
365 redhat) DEFAULT_PACKAGE=rpm ;;
366 fedora) DEFAULT_PACKAGE=rpm ;;
367 gentoo) DEFAULT_PACKAGE=tgz ;;
368 arch) DEFAULT_PACKAGE=tgz ;;
369 sles) DEFAULT_PACKAGE=rpm ;;
370 slackware) DEFAULT_PACKAGE=tgz ;;
371 lunar) DEFAULT_PACKAGE=tgz ;;
372 ubuntu) DEFAULT_PACKAGE=deb ;;
373 debian) DEFAULT_PACKAGE=deb ;;
374 *) DEFAULT_PACKAGE=rpm ;;
377 AC_MSG_RESULT([$DEFAULT_PACKAGE])
378 AC_SUBST(DEFAULT_PACKAGE)
382 dnl # Default SPL user configuration
384 AC_DEFUN([SPL_AC_PACKAGE], [
385 SPL_AC_DEFAULT_PACKAGE
391 AC_DEFUN([SPL_AC_LICENSE], [
392 AC_MSG_CHECKING([spl license])
394 AC_MSG_RESULT([$LICENSE])
395 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DHAVE_GPL_ONLY_SYMBOLS"
399 AC_DEFUN([SPL_AC_CONFIG], [
401 AC_ARG_WITH([config],
402 AS_HELP_STRING([--with-config=CONFIG],
403 [Config file 'kernel|user|all|srpm']),
404 [SPL_CONFIG="$withval"])
405 AC_ARG_ENABLE([linux-builtin],
406 [AC_HELP_STRING([--enable-linux-builtin],
407 [Configure for builtin in-tree kernel modules @<:@default=no@:>@])],
409 [enable_linux_builtin=no])
411 AC_MSG_CHECKING([spl config])
412 AC_MSG_RESULT([$SPL_CONFIG]);
415 case "$SPL_CONFIG" in
416 kernel) SPL_AC_CONFIG_KERNEL ;;
417 user) SPL_AC_CONFIG_USER ;;
418 all) SPL_AC_CONFIG_KERNEL
419 SPL_AC_CONFIG_USER ;;
422 AC_MSG_RESULT([Error!])
423 AC_MSG_ERROR([Bad value "$SPL_CONFIG" for --with-config,
424 user kernel|user|all|srpm]) ;;
427 AM_CONDITIONAL([CONFIG_USER],
428 [test "$SPL_CONFIG" = user -o "$SPL_CONFIG" = all])
429 AM_CONDITIONAL([CONFIG_KERNEL],
430 [test "$SPL_CONFIG" = kernel -o "$SPL_CONFIG" = all] &&
431 [test "x$enable_linux_builtin" != xyes ])
435 dnl # Enable if the SPL should be compiled with internal debugging enabled.
436 dnl # By default this support is disabled.
438 AC_DEFUN([SPL_AC_DEBUG], [
439 AC_MSG_CHECKING([whether debugging is enabled])
440 AC_ARG_ENABLE([debug],
441 [AS_HELP_STRING([--enable-debug],
442 [Enable generic debug support @<:@default=no@:>@])],
446 AS_IF([test "x$enable_debug" = xyes],
448 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG -Werror"
449 DEBUG_CFLAGS="-DDEBUG -Werror"
450 DEBUG_SPL="_with_debug"
452 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG"
453 DEBUG_CFLAGS="-DNDEBUG"
454 DEBUG_SPL="_without_debug"
457 AC_SUBST(DEBUG_CFLAGS)
459 AC_MSG_RESULT([$enable_debug])
463 dnl # Enabled by default it provides a basic debug log infrastructure.
464 dnl # Each subsystem registers itself with a name and logs messages
465 dnl # using predefined types. If the debug mask it set to allow the
466 dnl # message type it will be written to the internal log. The log
467 dnl # can be dumped to a file by echoing 1 to the 'dump' proc entry,
468 dnl # after dumping the log it must be decoded using the spl utility.
470 dnl # echo 1 >/proc/sys/kernel/spl/debug/dump
471 dnl # spl /tmp/spl-log.xxx.yyy /tmp/spl-log.xxx.yyy.txt
473 AC_DEFUN([SPL_AC_DEBUG_LOG], [
474 AC_ARG_ENABLE([debug-log],
475 [AS_HELP_STRING([--enable-debug-log],
476 [Enable basic debug logging @<:@default=yes@:>@])],
478 [enable_debug_log=yes])
480 AS_IF([test "x$enable_debug_log" = xyes],
482 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_LOG"
483 DEBUG_LOG="_with_debug_log"
484 AC_DEFINE([DEBUG_LOG], [1],
485 [Define to 1 to enable basic debug logging])
487 DEBUG_LOG="_without_debug_log"
491 AC_MSG_CHECKING([whether basic debug logging is enabled])
492 AC_MSG_RESULT([$enable_debug_log])
496 dnl # Enabled by default it provides a minimal level of memory tracking.
497 dnl # A total count of bytes allocated is kept for each alloc and free.
498 dnl # Then at module unload time a report to the console will be printed
499 dnl # if memory was leaked. Additionally, /proc/spl/kmem/slab will exist
500 dnl # and provide an easy way to inspect the kmem based slab.
502 AC_DEFUN([SPL_AC_DEBUG_KMEM], [
503 AC_ARG_ENABLE([debug-kmem],
504 [AS_HELP_STRING([--enable-debug-kmem],
505 [Enable basic kmem accounting @<:@default=yes@:>@])],
507 [enable_debug_kmem=yes])
509 AS_IF([test "x$enable_debug_kmem" = xyes],
511 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM"
512 DEBUG_KMEM="_with_debug_kmem"
513 AC_DEFINE([DEBUG_KMEM], [1],
514 [Define to 1 to enable basic kmem accounting])
516 DEBUG_KMEM="_without_debug_kmem"
520 AC_MSG_CHECKING([whether basic kmem accounting is enabled])
521 AC_MSG_RESULT([$enable_debug_kmem])
525 dnl # Disabled by default it provides detailed memory tracking. This
526 dnl # feature also requires --enable-debug-kmem to be set. When enabled
527 dnl # not only will total bytes be tracked but also the location of every
528 dnl # alloc and free. When the SPL module is unloaded a list of all leaked
529 dnl # addresses and where they were allocated will be dumped to the console.
530 dnl # Enabling this feature has a significant impact on performance but it
531 dnl # makes finding memory leaks pretty straight forward.
533 AC_DEFUN([SPL_AC_DEBUG_KMEM_TRACKING], [
534 AC_ARG_ENABLE([debug-kmem-tracking],
535 [AS_HELP_STRING([--enable-debug-kmem-tracking],
536 [Enable detailed kmem tracking @<:@default=no@:>@])],
538 [enable_debug_kmem_tracking=no])
540 AS_IF([test "x$enable_debug_kmem_tracking" = xyes],
542 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM_TRACKING"
543 DEBUG_KMEM_TRACKING="_with_debug_kmem_tracking"
544 AC_DEFINE([DEBUG_KMEM_TRACKING], [1],
545 [Define to 1 to enable detailed kmem tracking])
547 DEBUG_KMEM_TRACKING="_without_debug_kmem_tracking"
550 AC_SUBST(DEBUG_KMEM_TRACKING)
551 AC_MSG_CHECKING([whether detailed kmem tracking is enabled])
552 AC_MSG_RESULT([$enable_debug_kmem_tracking])
556 dnl # SPL_LINUX_CONFTEST
558 AC_DEFUN([SPL_LINUX_CONFTEST], [
559 cat confdefs.h - <<_ACEOF >conftest.c
565 dnl # SPL_LANG_PROGRAM(C)([PROLOGUE], [BODY])
567 m4_define([SPL_LANG_PROGRAM], [
572 dnl Do *not* indent the following line: there may be CPP directives.
573 dnl Don't move the `;' right after for the same reason.
581 dnl # SPL_LINUX_COMPILE_IFELSE / like AC_COMPILE_IFELSE
583 AC_DEFUN([SPL_LINUX_COMPILE_IFELSE], [
584 m4_ifvaln([$1], [SPL_LINUX_CONFTEST([$1])])
585 rm -Rf build && mkdir -p build && touch build/conftest.mod.c
586 echo "obj-m := conftest.o" >build/Makefile
588 test "x$enable_linux_builtin" = xyes && modpost_flag='modpost=true' # fake modpost stage
590 [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])],
592 [_AC_MSG_LOG_CONFTEST m4_ifvaln([$5],[$5])]
598 dnl # SPL_LINUX_TRY_COMPILE like AC_TRY_COMPILE
600 AC_DEFUN([SPL_LINUX_TRY_COMPILE],
601 [SPL_LINUX_COMPILE_IFELSE(
602 [AC_LANG_SOURCE([SPL_LANG_PROGRAM([[$1]], [[$2]])])],
604 [test -s build/conftest.o],
609 dnl # SPL_CHECK_SYMBOL_EXPORT
610 dnl # check symbol exported or not
612 AC_DEFUN([SPL_CHECK_SYMBOL_EXPORT], [
613 grep -q -E '[[[:space:]]]$1[[[:space:]]]' \
614 $LINUX_OBJ/Module*.symvers 2>/dev/null
616 if test $rc -ne 0; then
619 grep -q -E "EXPORT_SYMBOL.*($1)" \
620 "$LINUX_OBJ/$file" 2>/dev/null
622 if test $rc -eq 0; then
627 if test $export -eq 0; then :
638 dnl # SPL_LINUX_TRY_COMPILE_SYMBOL
639 dnl # like SPL_LINUX_TRY_COMPILE, except SPL_CHECK_SYMBOL_EXPORT
640 dnl # is called if not compiling for builtin
642 AC_DEFUN([SPL_LINUX_TRY_COMPILE_SYMBOL], [
643 SPL_LINUX_TRY_COMPILE([$1], [$2], [rc=0], [rc=1])
644 if test $rc -ne 0; then :
647 if test "x$enable_linux_builtin" != xyes; then
648 SPL_CHECK_SYMBOL_EXPORT([$3], [$4], [rc=0], [rc=1])
650 if test $rc -ne 0; then :
659 dnl # SPL_CHECK_SYMBOL_HEADER
660 dnl # check if a symbol prototype is defined in listed headers.
662 AC_DEFUN([SPL_CHECK_SYMBOL_HEADER], [
663 AC_MSG_CHECKING([whether symbol $1 exists in header])
666 grep -q "$2" "$LINUX/$file" 2>/dev/null
668 if test $rc -eq 0; then
673 if test $header -eq 0; then
683 dnl # SPL_CHECK_HEADER
684 dnl # check whether header exists and define HAVE_$2_HEADER
686 AC_DEFUN([SPL_CHECK_HEADER],
687 [AC_MSG_CHECKING([whether header $1 exists])
688 SPL_LINUX_TRY_COMPILE([
693 AC_DEFINE(HAVE_$2_HEADER, 1, [$1 exists])
703 dnl # Basic toolchain sanity check.
705 AC_DEFUN([SPL_AC_TEST_MODULE],
706 [AC_MSG_CHECKING([whether modules can be built])
707 SPL_LINUX_TRY_COMPILE([],[],[
711 if test "x$enable_linux_builtin" != xyes; then
712 AC_MSG_ERROR([*** Unable to build an empty module.])
715 *** Unable to build an empty module.
716 *** Please run 'make scripts' inside the kernel source tree.])
722 dnl # Use the atomic implemenation based on global spinlocks. This
723 dnl # should only be needed by 32-bit kernels which do not provide
724 dnl # the atomic64_* API. It may be optionally enabled as a fallback
725 dnl # if problems are observed with the direct mapping to the native
726 dnl # Linux atomic operations. You may not disable atomic spinlocks
727 dnl # if you kernel does not an atomic64_* API.
729 AC_DEFUN([SPL_AC_ATOMIC_SPINLOCK], [
730 AC_ARG_ENABLE([atomic-spinlocks],
731 [AS_HELP_STRING([--enable-atomic-spinlocks],
732 [Atomic types use spinlocks @<:@default=check@:>@])],
734 [enable_atomic_spinlocks=check])
736 SPL_LINUX_TRY_COMPILE([
737 #include <linux/fs.h>
739 atomic64_t *ptr __attribute__ ((unused));
742 AC_DEFINE(HAVE_ATOMIC64_T, 1,
743 [kernel defines atomic64_t])
748 AS_IF([test "x$enable_atomic_spinlocks" = xcheck], [
749 AS_IF([test "x$have_atomic64_t" = xyes], [
750 enable_atomic_spinlocks=no
752 enable_atomic_spinlocks=yes
756 AS_IF([test "x$enable_atomic_spinlocks" = xyes], [
757 AC_DEFINE([ATOMIC_SPINLOCK], [1],
758 [Atomic types use spinlocks])
760 AS_IF([test "x$have_atomic64_t" = xno], [
762 [--disable-atomic-spinlocks given but required atomic64 support is unavailable])
766 AC_MSG_CHECKING([whether atomic types use spinlocks])
767 AC_MSG_RESULT([$enable_atomic_spinlocks])
769 AC_MSG_CHECKING([whether kernel defines atomic64_t])
770 AC_MSG_RESULT([$have_atomic64_t])
774 dnl # 2.6.24 API change,
775 dnl # check if atomic64_cmpxchg is defined
777 AC_DEFUN([SPL_AC_TYPE_ATOMIC64_CMPXCHG],
778 [AC_MSG_CHECKING([whether kernel defines atomic64_cmpxchg])
779 SPL_LINUX_TRY_COMPILE([
780 #include <linux/fs.h>
782 atomic64_cmpxchg((atomic64_t *)NULL, 0, 0);
785 AC_DEFINE(HAVE_ATOMIC64_CMPXCHG, 1,
786 [kernel defines atomic64_cmpxchg])
793 dnl # 2.6.24 API change,
794 dnl # check if atomic64_xchg is defined
796 AC_DEFUN([SPL_AC_TYPE_ATOMIC64_XCHG],
797 [AC_MSG_CHECKING([whether kernel defines atomic64_xchg])
798 SPL_LINUX_TRY_COMPILE([
799 #include <linux/fs.h>
801 atomic64_xchg((atomic64_t *)NULL, 0);
804 AC_DEFINE(HAVE_ATOMIC64_XCHG, 1,
805 [kernel defines atomic64_xchg])
812 dnl # 2.6.24 API change,
813 dnl # check if uintptr_t typedef is defined
815 AC_DEFUN([SPL_AC_TYPE_UINTPTR_T],
816 [AC_MSG_CHECKING([whether kernel defines uintptr_t])
817 SPL_LINUX_TRY_COMPILE([
818 #include <linux/types.h>
820 uintptr_t *ptr __attribute__ ((unused));
823 AC_DEFINE(HAVE_UINTPTR_T, 1,
824 [kernel defines uintptr_t])
831 dnl # 2.6.21 API change,
832 dnl # 'register_sysctl_table' use only one argument instead of two
834 AC_DEFUN([SPL_AC_2ARGS_REGISTER_SYSCTL],
835 [AC_MSG_CHECKING([whether register_sysctl_table() wants 2 args])
836 SPL_LINUX_TRY_COMPILE([
837 #include <linux/sysctl.h>
839 (void) register_sysctl_table(NULL, 0);
842 AC_DEFINE(HAVE_2ARGS_REGISTER_SYSCTL, 1,
843 [register_sysctl_table() wants 2 args])
850 dnl # 2.6.23 API change
851 dnl # Old set_shrinker API replaced with register_shrinker
853 AC_DEFUN([SPL_AC_SET_SHRINKER], [
854 AC_MSG_CHECKING([whether set_shrinker() available])
855 SPL_LINUX_TRY_COMPILE([
856 #include <linux/mm.h>
858 return set_shrinker(DEFAULT_SEEKS, NULL);
861 AC_DEFINE(HAVE_SET_SHRINKER, 1,
862 [set_shrinker() available])
869 dnl # 2.6.35 API change,
870 dnl # Add context to shrinker callback
872 AC_DEFUN([SPL_AC_3ARGS_SHRINKER_CALLBACK],
873 [AC_MSG_CHECKING([whether shrinker callback wants 3 args])
874 tmp_flags="$EXTRA_KCFLAGS"
875 EXTRA_KCFLAGS="-Werror"
876 SPL_LINUX_TRY_COMPILE([
877 #include <linux/mm.h>
879 int shrinker_cb(struct shrinker *, int, unsigned int);
881 struct shrinker cache_shrinker = {
882 .shrink = shrinker_cb,
883 .seeks = DEFAULT_SEEKS,
885 register_shrinker(&cache_shrinker);
888 AC_DEFINE(HAVE_3ARGS_SHRINKER_CALLBACK, 1,
889 [shrinker callback wants 3 args])
893 EXTRA_KCFLAGS="$tmp_flags"
897 dnl # 2.6.25 API change,
898 dnl # struct path entry added to struct nameidata
900 AC_DEFUN([SPL_AC_PATH_IN_NAMEIDATA],
901 [AC_MSG_CHECKING([whether struct path used in struct nameidata])
902 SPL_LINUX_TRY_COMPILE([
903 #include <linux/namei.h>
905 struct nameidata nd __attribute__ ((unused));
908 nd.path.dentry = NULL;
911 AC_DEFINE(HAVE_PATH_IN_NAMEIDATA, 1,
912 [struct path used in struct nameidata])
919 dnl # Custom SPL patch may export this system it is not required
921 AC_DEFUN([SPL_AC_TASK_CURR],
922 [AC_MSG_CHECKING([whether task_curr() is available])
923 SPL_LINUX_TRY_COMPILE_SYMBOL([
924 #include <linux/sched.h>
927 ], [task_curr], [kernel/sched.c], [
929 AC_DEFINE(HAVE_TASK_CURR, 1, [task_curr() is available])
936 dnl # 2.6.19 API change,
937 dnl # Use CTL_UNNUMBERED when binary sysctl is not required
939 AC_DEFUN([SPL_AC_CTL_UNNUMBERED],
940 [AC_MSG_CHECKING([whether unnumbered sysctl support exists])
941 SPL_LINUX_TRY_COMPILE([
942 #include <linux/sysctl.h>
944 #ifndef CTL_UNNUMBERED
945 #error CTL_UNNUMBERED undefined
949 AC_DEFINE(HAVE_CTL_UNNUMBERED, 1,
950 [unnumbered sysctl support exists])
957 dnl # 2.6.33 API change,
958 dnl # Removed .ctl_name from struct ctl_table.
960 AC_DEFUN([SPL_AC_CTL_NAME], [
961 AC_MSG_CHECKING([whether struct ctl_table has ctl_name])
962 SPL_LINUX_TRY_COMPILE([
963 #include <linux/sysctl.h>
965 struct ctl_table ctl __attribute__ ((unused));
969 AC_DEFINE(HAVE_CTL_NAME, 1, [struct ctl_table has ctl_name])
976 dnl # 2.6.16 API change.
977 dnl # Check if 'fls64()' is available
979 AC_DEFUN([SPL_AC_FLS64],
980 [AC_MSG_CHECKING([whether fls64() is available])
981 SPL_LINUX_TRY_COMPILE([
982 #include <linux/bitops.h>
987 AC_DEFINE(HAVE_FLS64, 1, [fls64() is available])
994 dnl # 2.6.18 API change, check whether device_create() is available.
995 dnl # Device_create() was introduced in 2.6.18 and depricated
996 dnl # class_device_create() which was fully removed in 2.6.26.
998 AC_DEFUN([SPL_AC_DEVICE_CREATE],
999 [AC_MSG_CHECKING([whether device_create() is available])
1000 SPL_CHECK_SYMBOL_EXPORT([device_create], [drivers/base/core.c], [
1002 AC_DEFINE(HAVE_DEVICE_CREATE, 1,
1003 [device_create() is available])
1010 dnl # 2.6.27 API change,
1011 dnl # device_create() uses 5 args, new 'drvdata' argument.
1013 AC_DEFUN([SPL_AC_5ARGS_DEVICE_CREATE], [
1014 AC_MSG_CHECKING([whether device_create() wants 5 args])
1015 tmp_flags="$EXTRA_KCFLAGS"
1016 EXTRA_KCFLAGS="-Werror"
1017 SPL_LINUX_TRY_COMPILE([
1018 #include <linux/device.h>
1020 device_create(NULL, NULL, 0, NULL, "%d", 1);
1023 AC_DEFINE(HAVE_5ARGS_DEVICE_CREATE, 1,
1024 [device_create wants 5 args])
1028 EXTRA_KCFLAGS="$tmp_flags"
1032 dnl # 2.6.13 API change, check whether class_device_create() is available.
1033 dnl # Class_device_create() was introduced in 2.6.13 and depricated
1034 dnl # class_simple_device_add() which was fully removed in 2.6.13.
1036 AC_DEFUN([SPL_AC_CLASS_DEVICE_CREATE],
1037 [AC_MSG_CHECKING([whether class_device_create() is available])
1038 SPL_LINUX_TRY_COMPILE_SYMBOL([
1039 #include <linux/device.h>
1041 class_device_create(NULL, NULL, 0, NULL, NULL);
1042 ], [class_device_create], [drivers/base/class.c], [
1044 AC_DEFINE(HAVE_CLASS_DEVICE_CREATE, 1,
1045 [class_device_create() is available])
1052 dnl # 2.6.26 API change, set_normalized_timespec() is exported.
1054 AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_EXPORT],
1055 [AC_MSG_CHECKING([whether set_normalized_timespec() is available as export])
1056 SPL_LINUX_TRY_COMPILE_SYMBOL([
1057 #include <linux/time.h>
1059 set_normalized_timespec(NULL, 0, 0);
1060 ], [set_normalized_timespec], [kernel/time.c], [
1062 AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_EXPORT, 1,
1063 [set_normalized_timespec() is available as export])
1070 dnl # 2.6.16 API change, set_normalize_timespec() moved to time.c
1071 dnl # previously it was available in time.h as an inline.
1073 AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE], [
1074 AC_MSG_CHECKING([whether set_normalized_timespec() is an inline])
1075 SPL_LINUX_TRY_COMPILE([
1076 #include <linux/time.h>
1077 void set_normalized_timespec(struct timespec *ts,
1078 time_t sec, long nsec) { }
1085 AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_INLINE, 1,
1086 [set_normalized_timespec() is available as inline])
1091 dnl # 2.6.18 API change,
1092 dnl # timespec_sub() inline function available in linux/time.h
1094 AC_DEFUN([SPL_AC_TIMESPEC_SUB], [
1095 AC_MSG_CHECKING([whether timespec_sub() is available])
1096 SPL_LINUX_TRY_COMPILE([
1097 #include <linux/time.h>
1099 struct timespec a = { 0 };
1100 struct timespec b = { 0 };
1101 struct timespec c __attribute__ ((unused));
1102 c = timespec_sub(a, b);
1105 AC_DEFINE(HAVE_TIMESPEC_SUB, 1, [timespec_sub() is available])
1112 dnl # 2.6.19 API change,
1113 dnl # check if init_utsname() is available in linux/utsname.h
1115 AC_DEFUN([SPL_AC_INIT_UTSNAME], [
1116 AC_MSG_CHECKING([whether init_utsname() is available])
1117 SPL_LINUX_TRY_COMPILE([
1118 #include <linux/utsname.h>
1120 struct new_utsname *a __attribute__ ((unused));
1124 AC_DEFINE(HAVE_INIT_UTSNAME, 1, [init_utsname() is available])
1131 dnl # 2.6.18 API change,
1132 dnl # added linux/uaccess.h
1134 AC_DEFUN([SPL_AC_UACCESS_HEADER], [
1135 SPL_CHECK_HEADER([linux/uaccess.h], [UACCESS], [], [])
1139 dnl # 2.6.12 API change,
1140 dnl # check whether 'kmalloc_node()' is available.
1142 AC_DEFUN([SPL_AC_KMALLOC_NODE], [
1143 AC_MSG_CHECKING([whether kmalloc_node() is available])
1144 SPL_LINUX_TRY_COMPILE([
1145 #include <linux/slab.h>
1147 void *a __attribute__ ((unused));
1148 a = kmalloc_node(1, GFP_KERNEL, 0);
1151 AC_DEFINE(HAVE_KMALLOC_NODE, 1, [kmalloc_node() is available])
1158 dnl # 2.6.9 API change,
1159 dnl # check whether 'monotonic_clock()' is available it may
1160 dnl # be available for some archs but not others.
1162 AC_DEFUN([SPL_AC_MONOTONIC_CLOCK],
1163 [AC_MSG_CHECKING([whether monotonic_clock() is available])
1164 SPL_LINUX_TRY_COMPILE_SYMBOL([
1165 #include <linux/timex.h>
1168 ], [monotonic_clock], [], [
1170 AC_DEFINE(HAVE_MONOTONIC_CLOCK, 1,
1171 [monotonic_clock() is available])
1178 dnl # 2.6.16 API change,
1179 dnl # check whether 'struct inode' has i_mutex
1181 AC_DEFUN([SPL_AC_INODE_I_MUTEX], [
1182 AC_MSG_CHECKING([whether struct inode has i_mutex])
1183 SPL_LINUX_TRY_COMPILE([
1184 #include <linux/fs.h>
1185 #include <linux/mutex.h>
1188 mutex_init(&i.i_mutex);
1191 AC_DEFINE(HAVE_INODE_I_MUTEX, 1, [struct inode has i_mutex])
1198 dnl # 2.6.29 API change,
1199 dnl # Adaptive mutexs introduced.
1201 AC_DEFUN([SPL_AC_MUTEX_OWNER], [
1202 AC_MSG_CHECKING([whether struct mutex has owner])
1203 SPL_LINUX_TRY_COMPILE([
1204 #include <linux/mutex.h>
1206 struct mutex mtx __attribute__ ((unused));
1210 AC_DEFINE(HAVE_MUTEX_OWNER, 1, [struct mutex has owner])
1217 dnl # 2.6.39 API change,
1218 dnl # Owner type change. A Linux mutex prior to 2.6.39 would store
1219 dnl # the owner as a thread_info pointer when CONFIG_DEBUG_MUTEXES
1220 dnl # was defined. As of 2.6.39 this was changed to a task_struct
1221 dnl # pointer which frankly makes a lot more sense.
1223 AC_DEFUN([SPL_AC_MUTEX_OWNER_TASK_STRUCT], [
1224 AC_MSG_CHECKING([whether struct mutex owner is a task_struct])
1225 tmp_flags="$EXTRA_KCFLAGS"
1226 EXTRA_KCFLAGS="-Werror"
1227 SPL_LINUX_TRY_COMPILE([
1228 #include <linux/mutex.h>
1229 #include <linux/sched.h>
1231 struct mutex mtx __attribute__ ((unused));
1232 mtx.owner = current;
1235 AC_DEFINE(HAVE_MUTEX_OWNER_TASK_STRUCT, 1,
1236 [struct mutex owner is a task_struct])
1240 EXTRA_KCFLAGS="$tmp_flags"
1244 dnl # 2.6.18 API change,
1245 dnl # First introduced 'mutex_lock_nested()' in include/linux/mutex.h,
1246 dnl # as part of the mutex validator. Fallback to using 'mutex_lock()'
1247 dnl # if the mutex validator is disabled or otherwise unavailable.
1249 AC_DEFUN([SPL_AC_MUTEX_LOCK_NESTED], [
1250 AC_MSG_CHECKING([whether mutex_lock_nested() is available])
1251 SPL_LINUX_TRY_COMPILE([
1252 #include <linux/mutex.h>
1256 mutex_lock_nested(&mutex, 0);
1259 AC_DEFINE(HAVE_MUTEX_LOCK_NESTED, 1,
1260 [mutex_lock_nested() is available])
1267 dnl # 2.6.27 API change,
1268 dnl # on_each_cpu() uses 3 args, no 'retry' argument
1270 AC_DEFUN([SPL_AC_3ARGS_ON_EACH_CPU], [
1271 AC_MSG_CHECKING([whether on_each_cpu() wants 3 args])
1272 SPL_LINUX_TRY_COMPILE([
1273 #include <linux/interrupt.h>
1274 #include <linux/smp.h>
1276 void on_each_cpu_func(void *data) { return; }
1278 on_each_cpu(on_each_cpu_func, NULL, 0);
1281 AC_DEFINE(HAVE_3ARGS_ON_EACH_CPU, 1,
1282 [on_each_cpu wants 3 args])
1289 dnl # 2.6.18 API change,
1290 dnl # kallsyms_lookup_name no longer exported
1292 AC_DEFUN([SPL_AC_KALLSYMS_LOOKUP_NAME],
1293 [AC_MSG_CHECKING([whether kallsyms_lookup_name() is available])
1294 SPL_LINUX_TRY_COMPILE_SYMBOL([
1295 #include <linux/kallsyms.h>
1297 kallsyms_lookup_name(NULL);
1298 ], [kallsyms_lookup_name], [], [
1300 AC_DEFINE(HAVE_KALLSYMS_LOOKUP_NAME, 1,
1301 [kallsyms_lookup_name() is available])
1308 dnl # Proposed API change,
1309 dnl # This symbol is not available in stock kernels. You may build a
1310 dnl # custom kernel with the *-spl-export-symbols.patch which will export
1311 dnl # these symbols for use. If your already rolling a custom kernel for
1312 dnl # your environment this is recommended.
1314 AC_DEFUN([SPL_AC_GET_VMALLOC_INFO],
1315 [AC_MSG_CHECKING([whether get_vmalloc_info() is available])
1316 SPL_CHECK_SYMBOL_EXPORT([get_vmalloc_info], [], [
1318 AC_DEFINE(HAVE_GET_VMALLOC_INFO, 1,
1319 [get_vmalloc_info() is available])
1326 dnl # 2.6.17 API change
1327 dnl # The helper functions first_online_pgdat(), next_online_pgdat(), and
1328 dnl # next_zone() are introduced to simplify for_each_zone(). These symbols
1329 dnl # were exported in 2.6.17 for use by modules which was consistent with
1330 dnl # the previous implementation of for_each_zone(). From 2.6.18 - 2.6.19
1331 dnl # the symbols were exported as 'unused', and by 2.6.20 they exports
1332 dnl # were dropped entirely leaving modules no way to directly iterate over
1333 dnl # the zone list. Because we need access to the zone helpers we check
1334 dnl # if the kernel contains the old or new implementation. Then we check
1335 dnl # to see if the symbols we need for each version are available. If they
1336 dnl # are not, dynamically aquire the addresses with kallsyms_lookup_name().
1338 AC_DEFUN([SPL_AC_PGDAT_HELPERS], [
1339 AC_MSG_CHECKING([whether symbol *_pgdat exist])
1340 grep -q -E 'first_online_pgdat' $LINUX/include/linux/mmzone.h 2>/dev/null
1342 if test $rc -eq 0; then
1343 AC_MSG_RESULT([yes])
1344 AC_DEFINE(HAVE_PGDAT_HELPERS, 1, [pgdat helpers are available])
1351 dnl # Proposed API change,
1352 dnl # This symbol is not available in stock kernels. You may build a
1353 dnl # custom kernel with the *-spl-export-symbols.patch which will export
1354 dnl # these symbols for use. If your already rolling a custom kernel for
1355 dnl # your environment this is recommended.
1357 AC_DEFUN([SPL_AC_FIRST_ONLINE_PGDAT],
1358 [AC_MSG_CHECKING([whether first_online_pgdat() is available])
1359 SPL_LINUX_TRY_COMPILE_SYMBOL([
1360 #include <linux/mmzone.h>
1362 first_online_pgdat();
1363 ], [first_online_pgdat], [], [
1365 AC_DEFINE(HAVE_FIRST_ONLINE_PGDAT, 1,
1366 [first_online_pgdat() is available])
1373 dnl # Proposed API change,
1374 dnl # This symbol is not available in stock kernels. You may build a
1375 dnl # custom kernel with the *-spl-export-symbols.patch which will export
1376 dnl # these symbols for use. If your already rolling a custom kernel for
1377 dnl # your environment this is recommended.
1379 AC_DEFUN([SPL_AC_NEXT_ONLINE_PGDAT],
1380 [AC_MSG_CHECKING([whether next_online_pgdat() is available])
1381 SPL_LINUX_TRY_COMPILE_SYMBOL([
1382 #include <linux/mmzone.h>
1384 next_online_pgdat(NULL);
1385 ], [next_online_pgdat], [], [
1387 AC_DEFINE(HAVE_NEXT_ONLINE_PGDAT, 1,
1388 [next_online_pgdat() is available])
1395 dnl # Proposed API change,
1396 dnl # This symbol is not available in stock kernels. You may build a
1397 dnl # custom kernel with the *-spl-export-symbols.patch which will export
1398 dnl # these symbols for use. If your already rolling a custom kernel for
1399 dnl # your environment this is recommended.
1401 AC_DEFUN([SPL_AC_NEXT_ZONE],
1402 [AC_MSG_CHECKING([whether next_zone() is available])
1403 SPL_LINUX_TRY_COMPILE_SYMBOL([
1404 #include <linux/mmzone.h>
1407 ], [next_zone], [], [
1409 AC_DEFINE(HAVE_NEXT_ZONE, 1, [next_zone() is available])
1416 dnl # 2.6.17 API change,
1417 dnl # See SPL_AC_PGDAT_HELPERS for details.
1419 AC_DEFUN([SPL_AC_PGDAT_LIST],
1420 [AC_MSG_CHECKING([whether pgdat_list is available])
1421 SPL_LINUX_TRY_COMPILE_SYMBOL([
1422 #include <linux/topology.h>
1423 pg_data_t *tmp = pgdat_list;
1424 ], [], [pgdat_list], [], [
1426 AC_DEFINE(HAVE_PGDAT_LIST, 1, [pgdat_list is available])
1433 dnl # 2.6.18 API change,
1434 dnl # First introduced global_page_state() support as an inline.
1436 AC_DEFUN([SPL_AC_GLOBAL_PAGE_STATE], [
1437 AC_MSG_CHECKING([whether global_page_state() is available])
1438 SPL_LINUX_TRY_COMPILE([
1439 #include <linux/mm.h>
1441 unsigned long state __attribute__ ((unused));
1442 state = global_page_state(0);
1445 AC_DEFINE(HAVE_GLOBAL_PAGE_STATE, 1,
1446 [global_page_state() is available])
1453 dnl # 2.6.21 API change (plus subsequent naming convention changes),
1454 dnl # Public global zone stats now include a free page count. However
1455 dnl # the enumerated names of the counters have changed since this API
1456 dnl # was introduced. We need to deduce the corrent name to use. This
1457 dnl # replaces the priviate get_zone_counts() interface.
1459 dnl # NR_FREE_PAGES was available from 2.6.21 to current kernels, which
1460 dnl # is 2.6.30 as of when this was written.
1462 AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_FREE], [
1463 AC_MSG_CHECKING([whether page state NR_FREE_PAGES is available])
1464 SPL_LINUX_TRY_COMPILE([
1465 #include <linux/mm.h>
1467 enum zone_stat_item zsi __attribute__ ((unused));
1468 zsi = NR_FREE_PAGES;
1471 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_FREE_PAGES, 1,
1472 [Page state NR_FREE_PAGES is available])
1479 dnl # 2.6.21 API change (plus subsequent naming convention changes),
1480 dnl # Public global zone stats now include an inactive page count. However
1481 dnl # the enumerated names of the counters have changed since this API
1482 dnl # was introduced. We need to deduce the corrent name to use. This
1483 dnl # replaces the priviate get_zone_counts() interface.
1485 dnl # NR_INACTIVE was available from 2.6.21 to 2.6.27 and included both
1486 dnl # anonymous and file inactive pages. As of 2.6.28 it was split in
1487 dnl # to NR_INACTIVE_ANON and NR_INACTIVE_FILE.
1489 AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_INACTIVE], [
1490 AC_MSG_CHECKING([whether page state NR_INACTIVE is available])
1491 SPL_LINUX_TRY_COMPILE([
1492 #include <linux/mm.h>
1494 enum zone_stat_item zsi __attribute__ ((unused));
1498 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_INACTIVE, 1,
1499 [Page state NR_INACTIVE is available])
1504 AC_MSG_CHECKING([whether page state NR_INACTIVE_ANON is available])
1505 SPL_LINUX_TRY_COMPILE([
1506 #include <linux/mm.h>
1508 enum zone_stat_item zsi __attribute__ ((unused));
1509 zsi = NR_INACTIVE_ANON;
1512 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_ANON, 1,
1513 [Page state NR_INACTIVE_ANON is available])
1518 AC_MSG_CHECKING([whether page state NR_INACTIVE_FILE is available])
1519 SPL_LINUX_TRY_COMPILE([
1520 #include <linux/mm.h>
1522 enum zone_stat_item zsi __attribute__ ((unused));
1523 zsi = NR_INACTIVE_FILE;
1526 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_FILE, 1,
1527 [Page state NR_INACTIVE_FILE is available])
1534 dnl # 2.6.21 API change (plus subsequent naming convention changes),
1535 dnl # Public global zone stats now include an active page count. However
1536 dnl # the enumerated names of the counters have changed since this API
1537 dnl # was introduced. We need to deduce the corrent name to use. This
1538 dnl # replaces the priviate get_zone_counts() interface.
1540 dnl # NR_ACTIVE was available from 2.6.21 to 2.6.27 and included both
1541 dnl # anonymous and file active pages. As of 2.6.28 it was split in
1542 dnl # to NR_ACTIVE_ANON and NR_ACTIVE_FILE.
1544 AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_ACTIVE], [
1545 AC_MSG_CHECKING([whether page state NR_ACTIVE is available])
1546 SPL_LINUX_TRY_COMPILE([
1547 #include <linux/mm.h>
1549 enum zone_stat_item zsi __attribute__ ((unused));
1553 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_ACTIVE, 1,
1554 [Page state NR_ACTIVE is available])
1559 AC_MSG_CHECKING([whether page state NR_ACTIVE_ANON is available])
1560 SPL_LINUX_TRY_COMPILE([
1561 #include <linux/mm.h>
1563 enum zone_stat_item zsi __attribute__ ((unused));
1564 zsi = NR_ACTIVE_ANON;
1567 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_ANON, 1,
1568 [Page state NR_ACTIVE_ANON is available])
1573 AC_MSG_CHECKING([whether page state NR_ACTIVE_FILE is available])
1574 SPL_LINUX_TRY_COMPILE([
1575 #include <linux/mm.h>
1577 enum zone_stat_item zsi __attribute__ ((unused));
1578 zsi = NR_ACTIVE_FILE;
1581 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_FILE, 1,
1582 [Page state NR_ACTIVE_FILE is available])
1589 dnl # Proposed API change for legacy kernels.
1590 dnl # This symbol is not available in older kernels. For kernels post
1591 dnl # 2.6.21 the global_page_state() API is used to get free/inactive/active
1592 dnl # page state information. This symbol is only used in legacy kernels
1593 dnl # any only as a last resort.
1595 AC_DEFUN([SPL_AC_GET_ZONE_COUNTS], [
1596 AC_MSG_CHECKING([whether symbol get_zone_counts is needed])
1597 SPL_LINUX_TRY_COMPILE([
1599 #if !defined(HAVE_ZONE_STAT_ITEM_NR_FREE_PAGES)
1600 #error "global_page_state needs NR_FREE_PAGES"
1603 #if !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE) && \
1604 !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_ANON) && \
1605 !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_FILE)
1606 #error "global_page_state needs NR_ACTIVE*"
1609 #if !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE) && \
1610 !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_ANON) && \
1611 !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_FILE)
1612 #error "global_page_state needs NR_INACTIVE*"
1618 AC_DEFINE(NEED_GET_ZONE_COUNTS, 1,
1619 [get_zone_counts() is needed])
1621 AC_MSG_CHECKING([whether get_zone_counts() is available])
1622 SPL_LINUX_TRY_COMPILE_SYMBOL([
1623 #include <linux/mmzone.h>
1625 get_zone_counts(NULL, NULL, NULL);
1626 ], [get_zone_counts], [], [
1628 AC_DEFINE(HAVE_GET_ZONE_COUNTS, 1,
1629 [get_zone_counts() is available])
1637 dnl # 2.6.27 API change,
1638 dnl # The user_path_dir() replaces __user_walk()
1640 AC_DEFUN([SPL_AC_USER_PATH_DIR],
1641 [AC_MSG_CHECKING([whether user_path_dir() is available])
1642 SPL_LINUX_TRY_COMPILE_SYMBOL([
1643 #include <linux/fcntl.h>
1644 #include <linux/namei.h>
1646 user_path_dir(NULL, NULL);
1647 ], [user_path_at], [], [
1649 AC_DEFINE(HAVE_USER_PATH_DIR, 1, [user_path_dir() is available])
1656 dnl # Symbol available in RHEL kernels not in stock kernels.
1658 AC_DEFUN([SPL_AC_SET_FS_PWD],
1659 [AC_MSG_CHECKING([whether set_fs_pwd() is available])
1660 SPL_LINUX_TRY_COMPILE_SYMBOL([
1661 #include <linux/spinlock.h>
1662 #include <linux/fs_struct.h>
1665 ], [set_fs_pwd], [], [
1667 AC_DEFINE(HAVE_SET_FS_PWD, 1, [set_fs_pwd() is available])
1674 dnl # 2.6.25 API change,
1675 dnl # Simplied API by replacing mnt+dentry args with a single path arg.
1677 AC_DEFUN([SPL_AC_2ARGS_SET_FS_PWD],
1678 [AC_MSG_CHECKING([whether set_fs_pwd() wants 2 args])
1679 SPL_LINUX_TRY_COMPILE([
1680 #include <linux/sched.h>
1681 #include <linux/fs_struct.h>
1683 set_fs_pwd(NULL, NULL);
1686 AC_DEFINE(HAVE_2ARGS_SET_FS_PWD, 1,
1687 [set_fs_pwd() wants 2 args])
1694 dnl # SLES API change, never adopted in mainline,
1695 dnl # Third 'struct vfsmount *' argument removed.
1697 AC_DEFUN([SPL_AC_2ARGS_VFS_UNLINK],
1698 [AC_MSG_CHECKING([whether vfs_unlink() wants 2 args])
1699 SPL_LINUX_TRY_COMPILE([
1700 #include <linux/fs.h>
1702 vfs_unlink(NULL, NULL);
1705 AC_DEFINE(HAVE_2ARGS_VFS_UNLINK, 1,
1706 [vfs_unlink() wants 2 args])
1713 dnl # SLES API change, never adopted in mainline,
1714 dnl # Third and sixth 'struct vfsmount *' argument removed.
1716 AC_DEFUN([SPL_AC_4ARGS_VFS_RENAME],
1717 [AC_MSG_CHECKING([whether vfs_rename() wants 4 args])
1718 SPL_LINUX_TRY_COMPILE([
1719 #include <linux/fs.h>
1721 vfs_rename(NULL, NULL, NULL, NULL);
1724 AC_DEFINE(HAVE_4ARGS_VFS_RENAME, 1,
1725 [vfs_rename() wants 4 args])
1732 dnl # 2.6.36 API change,
1733 dnl # The 'struct fs_struct->lock' was changed from a rwlock_t to
1734 dnl # a spinlock_t to improve the fastpath performance.
1736 AC_DEFUN([SPL_AC_FS_STRUCT_SPINLOCK], [
1737 AC_MSG_CHECKING([whether struct fs_struct uses spinlock_t])
1738 tmp_flags="$EXTRA_KCFLAGS"
1739 EXTRA_KCFLAGS="-Werror"
1740 SPL_LINUX_TRY_COMPILE([
1741 #include <linux/sched.h>
1742 #include <linux/fs_struct.h>
1744 struct fs_struct fs;
1745 spin_lock_init(&fs.lock);
1748 AC_DEFINE(HAVE_FS_STRUCT_SPINLOCK, 1,
1749 [struct fs_struct uses spinlock_t])
1753 EXTRA_KCFLAGS="$tmp_flags"
1757 dnl # 2.6.29 API change,
1758 dnl # check whether 'struct cred' exists
1760 AC_DEFUN([SPL_AC_CRED_STRUCT], [
1761 AC_MSG_CHECKING([whether struct cred exists])
1762 SPL_LINUX_TRY_COMPILE([
1763 #include <linux/cred.h>
1765 struct cred *cr __attribute__ ((unused));
1769 AC_DEFINE(HAVE_CRED_STRUCT, 1, [struct cred exists])
1776 dnl # Custom SPL patch may export this symbol.
1778 AC_DEFUN([SPL_AC_GROUPS_SEARCH],
1779 [AC_MSG_CHECKING([whether groups_search() is available])
1780 SPL_LINUX_TRY_COMPILE_SYMBOL([
1781 #include <linux/cred.h>
1783 groups_search(NULL, 0);
1784 ], [groups_search], [], [
1786 AC_DEFINE(HAVE_GROUPS_SEARCH, 1, [groups_search() is available])
1793 dnl # 2.6.x API change,
1794 dnl # __put_task_struct() was exported in RHEL5 but unavailable elsewhere.
1796 AC_DEFUN([SPL_AC_PUT_TASK_STRUCT],
1797 [AC_MSG_CHECKING([whether __put_task_struct() is available])
1798 SPL_LINUX_TRY_COMPILE_SYMBOL([
1799 #include <linux/sched.h>
1801 __put_task_struct(NULL);
1802 ], [__put_task_struct], [], [
1804 AC_DEFINE(HAVE_PUT_TASK_STRUCT, 1,
1805 [__put_task_struct() is available])
1812 dnl # 2.6.32 API change,
1813 dnl # Unused 'struct file *' removed from prototype.
1815 AC_DEFUN([SPL_AC_5ARGS_PROC_HANDLER], [
1816 AC_MSG_CHECKING([whether proc_handler() wants 5 args])
1817 SPL_LINUX_TRY_COMPILE([
1818 #include <linux/sysctl.h>
1820 proc_dostring(NULL, 0, NULL, NULL, NULL);
1823 AC_DEFINE(HAVE_5ARGS_PROC_HANDLER, 1,
1824 [proc_handler() wants 5 args])
1831 dnl # 2.6.x API change,
1832 dnl # kvasprintf() function added.
1834 AC_DEFUN([SPL_AC_KVASPRINTF],
1835 [AC_MSG_CHECKING([whether kvasprintf() is available])
1836 SPL_LINUX_TRY_COMPILE_SYMBOL([
1837 #include <linux/kernel.h>
1839 kvasprintf(0, NULL, *((va_list*)NULL));
1840 ], [kvasprintf], [], [
1842 AC_DEFINE(HAVE_KVASPRINTF, 1, [kvasprintf() is available])
1849 dnl # 2.6.29 API change,
1850 dnl # vfs_fsync() funcation added, prior to this use file_fsync().
1852 AC_DEFUN([SPL_AC_VFS_FSYNC],
1853 [AC_MSG_CHECKING([whether vfs_fsync() is available])
1854 SPL_LINUX_TRY_COMPILE_SYMBOL([
1855 #include <linux/fs.h>
1858 ], [vfs_fsync], [fs/sync.c], [
1860 AC_DEFINE(HAVE_VFS_FSYNC, 1, [vfs_fsync() is available])
1867 dnl # 2.6.35 API change,
1868 dnl # Unused 'struct dentry *' removed from vfs_fsync() prototype.
1870 AC_DEFUN([SPL_AC_2ARGS_VFS_FSYNC], [
1871 AC_MSG_CHECKING([whether vfs_fsync() wants 2 args])
1872 SPL_LINUX_TRY_COMPILE([
1873 #include <linux/fs.h>
1878 AC_DEFINE(HAVE_2ARGS_VFS_FSYNC, 1, [vfs_fsync() wants 2 args])
1885 dnl # 3.5 API change,
1886 dnl # inode_operations.truncate_range removed
1888 AC_DEFUN([SPL_AC_INODE_TRUNCATE_RANGE], [
1889 AC_MSG_CHECKING([whether truncate_range() inode operation is available])
1890 SPL_LINUX_TRY_COMPILE([
1891 #include <linux/fs.h>
1893 struct inode_operations ops;
1894 ops.truncate_range = NULL;
1897 AC_DEFINE(HAVE_INODE_TRUNCATE_RANGE, 1,
1898 [truncate_range() inode operation is available])
1905 dnl # Linux 2.6.38 - 3.x API
1907 AC_DEFUN([SPL_AC_KERNEL_FILE_FALLOCATE], [
1908 AC_MSG_CHECKING([whether fops->fallocate() exists])
1909 SPL_LINUX_TRY_COMPILE([
1910 #include <linux/fs.h>
1912 long (*fallocate) (struct file *, int, loff_t, loff_t) = NULL;
1913 struct file_operations fops __attribute__ ((unused)) = {
1914 .fallocate = fallocate,
1918 AC_DEFINE(HAVE_FILE_FALLOCATE, 1, [fops->fallocate() exists])
1925 dnl # Linux 2.6.x - 2.6.37 API
1927 AC_DEFUN([SPL_AC_KERNEL_INODE_FALLOCATE], [
1928 AC_MSG_CHECKING([whether iops->fallocate() exists])
1929 SPL_LINUX_TRY_COMPILE([
1930 #include <linux/fs.h>
1932 long (*fallocate) (struct inode *, int, loff_t, loff_t) = NULL;
1933 struct inode_operations fops __attribute__ ((unused)) = {
1934 .fallocate = fallocate,
1938 AC_DEFINE(HAVE_INODE_FALLOCATE, 1, [fops->fallocate() exists])
1945 dnl # PaX Linux 2.6.38 - 3.x API
1947 AC_DEFUN([SPL_AC_PAX_KERNEL_FILE_FALLOCATE], [
1948 AC_MSG_CHECKING([whether fops->fallocate() exists])
1949 SPL_LINUX_TRY_COMPILE([
1950 #include <linux/fs.h>
1952 long (*fallocate) (struct file *, int, loff_t, loff_t) = NULL;
1953 struct file_operations_no_const fops __attribute__ ((unused)) = {
1954 .fallocate = fallocate,
1958 AC_DEFINE(HAVE_FILE_FALLOCATE, 1, [fops->fallocate() exists])
1965 dnl # The fallocate callback was moved from the inode_operations
1966 dnl # structure to the file_operations structure.
1968 AC_DEFUN([SPL_AC_KERNEL_FALLOCATE], [
1969 SPL_AC_KERNEL_FILE_FALLOCATE
1970 SPL_AC_KERNEL_INODE_FALLOCATE
1971 SPL_AC_PAX_KERNEL_FILE_FALLOCATE
1975 dnl # 2.6.33 API change. Also backported in RHEL5 as of 2.6.18-190.el5.
1976 dnl # Earlier versions of rwsem_is_locked() were inline and had a race
1977 dnl # condition. The fixed version is exported as a symbol. The race
1978 dnl # condition is fixed by acquiring sem->wait_lock, so we must not
1979 dnl # call that version while holding sem->wait_lock.
1981 AC_DEFUN([SPL_AC_EXPORTED_RWSEM_IS_LOCKED],
1982 [AC_MSG_CHECKING([whether rwsem_is_locked() acquires sem->wait_lock])
1983 SPL_LINUX_TRY_COMPILE_SYMBOL([
1984 #include <linux/rwsem.h>
1985 int rwsem_is_locked(struct rw_semaphore *sem) { return 0; }
1986 ], [], [rwsem_is_locked], [lib/rwsem-spinlock.c], [
1988 AC_DEFINE(RWSEM_IS_LOCKED_TAKES_WAIT_LOCK, 1,
1989 [rwsem_is_locked() acquires sem->wait_lock])
1996 dnl # 2.6.xx API compat,
1997 dnl # There currently exists no exposed API to partially shrink the dcache.
1998 dnl # The expected mechanism to shrink the cache is a registered shrinker
1999 dnl # which is called during memory pressure.
2001 AC_DEFUN([SPL_AC_SHRINK_DCACHE_MEMORY],
2002 [AC_MSG_CHECKING([whether shrink_dcache_memory() is available])
2003 SPL_LINUX_TRY_COMPILE_SYMBOL([
2004 #include <linux/dcache.h>
2006 shrink_dcache_memory(0, 0);
2007 ], [shrink_dcache_memory], [fs/dcache.c], [
2009 AC_DEFINE(HAVE_SHRINK_DCACHE_MEMORY, 1,
2010 [shrink_dcache_memory() is available])
2017 dnl # 2.6.xx API compat,
2018 dnl # There currently exists no exposed API to partially shrink the icache.
2019 dnl # The expected mechanism to shrink the cache is a registered shrinker
2020 dnl # which is called during memory pressure.
2022 AC_DEFUN([SPL_AC_SHRINK_ICACHE_MEMORY],
2023 [AC_MSG_CHECKING([whether shrink_icache_memory() is available])
2024 SPL_LINUX_TRY_COMPILE_SYMBOL([
2025 #include <linux/dcache.h>
2027 shrink_icache_memory(0, 0);
2028 ], [shrink_icache_memory], [fs/inode.c], [
2030 AC_DEFINE(HAVE_SHRINK_ICACHE_MEMORY, 1,
2031 [shrink_icache_memory() is available])
2038 dnl # 2.6.39 API compat,
2039 dnl # The path_lookup() function has been renamed to kern_path_parent()
2040 dnl # and the flags argument has been removed. The only behavior now
2041 dnl # offered is that of LOOKUP_PARENT. The spl already always passed
2042 dnl # this flag so dropping the flag does not impact us.
2044 AC_DEFUN([SPL_AC_KERN_PATH_PARENT_HEADER], [
2045 SPL_CHECK_SYMBOL_HEADER(
2047 [int kern_path_parent(const char \*, struct nameidata \*)],
2048 [include/linux/namei.h],
2049 [AC_DEFINE(HAVE_KERN_PATH_PARENT_HEADER, 1,
2050 [kern_path_parent() is available])],
2055 dnl # 3.1 API compat,
2056 dnl # The kern_path_parent() symbol is no longer exported by the kernel.
2057 dnl # However, it remains the prefered interface and since we still have
2058 dnl # access to the prototype we dynamically lookup the required address.
2060 AC_DEFUN([SPL_AC_KERN_PATH_PARENT_SYMBOL],
2061 [AC_MSG_CHECKING([whether kern_path_parent() is available])
2062 SPL_LINUX_TRY_COMPILE_SYMBOL([
2063 #include <linux/namei.h>
2065 kern_path_parent(NULL, NULL);
2066 ], [kern_path_parent], [fs/namei.c], [
2068 AC_DEFINE(HAVE_KERN_PATH_PARENT_SYMBOL, 1,
2069 [kern_path_parent() is available])
2076 dnl # 3.6 API compat,
2077 dnl # The kern_path_parent() function was replaced by the kern_path_locked()
2078 dnl # function to eliminate all struct nameidata usage outside fs/namei.c.
2080 AC_DEFUN([SPL_AC_KERN_PATH_LOCKED], [
2081 SPL_CHECK_SYMBOL_HEADER(
2083 [struct dentry \*kern_path_locked(const char \*, struct path \*)],
2084 [include/linux/namei.h],
2085 [AC_DEFINE(HAVE_KERN_PATH_LOCKED, 1,
2086 [kern_path_locked() is available])],
2091 dnl # /proc/kallsyms support,
2092 dnl # Verify the kernel has CONFIG_KALLSYMS support enabled.
2094 AC_DEFUN([SPL_AC_CONFIG_KALLSYMS], [
2095 AC_MSG_CHECKING([whether CONFIG_KALLSYMS is defined])
2096 SPL_LINUX_TRY_COMPILE([
2097 #if !defined(CONFIG_KALLSYMS)
2098 #error CONFIG_KALLSYMS not defined
2101 AC_MSG_RESULT([yes])
2105 *** This kernel does not include the required kallsyms support.
2106 *** Rebuild the kernel with CONFIG_KALLSYMS=y set.])
2111 dnl # zlib inflate compat,
2112 dnl # Verify the kernel has CONFIG_ZLIB_INFLATE support enabled.
2114 AC_DEFUN([SPL_AC_CONFIG_ZLIB_INFLATE], [
2115 AC_MSG_CHECKING([whether CONFIG_ZLIB_INFLATE is defined])
2116 SPL_LINUX_TRY_COMPILE([
2117 #if !defined(CONFIG_ZLIB_INFLATE) && \
2118 !defined(CONFIG_ZLIB_INFLATE_MODULE)
2119 #error CONFIG_ZLIB_INFLATE not defined
2122 AC_MSG_RESULT([yes])
2126 *** This kernel does not include the required zlib inflate support.
2127 *** Rebuild the kernel with CONFIG_ZLIB_INFLATE=y|m set.])
2132 dnl # zlib deflate compat,
2133 dnl # Verify the kernel has CONFIG_ZLIB_DEFLATE support enabled.
2135 AC_DEFUN([SPL_AC_CONFIG_ZLIB_DEFLATE], [
2136 AC_MSG_CHECKING([whether CONFIG_ZLIB_DEFLATE is defined])
2137 SPL_LINUX_TRY_COMPILE([
2138 #if !defined(CONFIG_ZLIB_DEFLATE) && \
2139 !defined(CONFIG_ZLIB_DEFLATE_MODULE)
2140 #error CONFIG_ZLIB_DEFLATE not defined
2143 AC_MSG_RESULT([yes])
2147 *** This kernel does not include the required zlib deflate support.
2148 *** Rebuild the kernel with CONFIG_ZLIB_DEFLATE=y|m set.])
2153 dnl # 2.6.39 API compat,
2154 dnl # The function zlib_deflate_workspacesize() now take 2 arguments.
2155 dnl # This was done to avoid always having to allocate the maximum size
2156 dnl # workspace (268K). The caller can now specific the windowBits and
2157 dnl # memLevel compression parameters to get a smaller workspace.
2159 AC_DEFUN([SPL_AC_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE],
2160 [AC_MSG_CHECKING([whether zlib_deflate_workspacesize() wants 2 args])
2161 SPL_LINUX_TRY_COMPILE([
2162 #include <linux/zlib.h>
2164 return zlib_deflate_workspacesize(MAX_WBITS, MAX_MEM_LEVEL);
2167 AC_DEFINE(HAVE_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE, 1,
2168 [zlib_deflate_workspacesize() wants 2 args])
2175 dnl # 2.6.39 API change,
2176 dnl # Shrinker adjust to use common shrink_control structure.
2178 AC_DEFUN([SPL_AC_SHRINK_CONTROL_STRUCT], [
2179 AC_MSG_CHECKING([whether struct shrink_control exists])
2180 SPL_LINUX_TRY_COMPILE([
2181 #include <linux/mm.h>
2183 struct shrink_control sc __attribute__ ((unused));
2186 sc.gfp_mask = GFP_KERNEL;
2189 AC_DEFINE(HAVE_SHRINK_CONTROL_STRUCT, 1,
2190 [struct shrink_control exists])
2197 dnl # 3.1 API Change
2199 dnl # The rw_semaphore.wait_lock member was changed from spinlock_t to
2200 dnl # raw_spinlock_t at commit ddb6c9b58a19edcfac93ac670b066c836ff729f1.
2202 AC_DEFUN([SPL_AC_RWSEM_SPINLOCK_IS_RAW], [
2203 AC_MSG_CHECKING([whether struct rw_semaphore member wait_lock is raw])
2204 tmp_flags="$EXTRA_KCFLAGS"
2205 EXTRA_KCFLAGS="-Werror"
2206 SPL_LINUX_TRY_COMPILE([
2207 #include <linux/rwsem.h>
2209 struct rw_semaphore dummy_semaphore __attribute__ ((unused));
2210 raw_spinlock_t dummy_lock __attribute__ ((unused));
2211 dummy_semaphore.wait_lock = dummy_lock;
2214 AC_DEFINE(RWSEM_SPINLOCK_IS_RAW, 1,
2215 [struct rw_semaphore member wait_lock is raw_spinlock_t])
2219 EXTRA_KCFLAGS="$tmp_flags"
2223 dnl # 3.9 API change,
2224 dnl # Moved things from linux/sched.h to linux/sched/rt.h
2226 AC_DEFUN([SPL_AC_SCHED_RT_HEADER],
2227 [AC_MSG_CHECKING([whether header linux/sched/rt.h exists])
2228 SPL_LINUX_TRY_COMPILE([
2229 #include <linux/sched.h>
2230 #include <linux/sched/rt.h>
2234 AC_DEFINE(HAVE_SCHED_RT_HEADER, 1, [linux/sched/rt.h exists])