]> git.proxmox.com Git - mirror_spl-debian.git/blob - config/spl-build.m4
Linux 2.6.39 compat, invalidate_inodes()
[mirror_spl-debian.git] / config / spl-build.m4
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 ###############################################################################
8
9 AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
10 SPL_AC_KERNEL
11 SPL_AC_KERNEL_CONFIG
12
13 if test "${LINUX_OBJ}" != "${LINUX}"; then
14 KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ"
15 fi
16 AC_SUBST(KERNELMAKE_PARAMS)
17
18 KERNELCPPFLAGS="$KERNELCPPFLAGS -Wstrict-prototypes"
19 AC_SUBST(KERNELCPPFLAGS)
20
21 SPL_AC_DEBUG
22 SPL_AC_DEBUG_KMEM
23 SPL_AC_DEBUG_KMEM_TRACKING
24 SPL_AC_ATOMIC_SPINLOCK
25 SPL_AC_TYPE_ATOMIC64_CMPXCHG
26 SPL_AC_TYPE_ATOMIC64_XCHG
27 SPL_AC_TYPE_UINTPTR_T
28 SPL_AC_3ARGS_INIT_WORK
29 SPL_AC_2ARGS_REGISTER_SYSCTL
30 SPL_AC_SET_SHRINKER
31 SPL_AC_3ARGS_SHRINKER_CALLBACK
32 SPL_AC_PATH_IN_NAMEIDATA
33 SPL_AC_TASK_CURR
34 SPL_AC_CTL_UNNUMBERED
35 SPL_AC_CTL_NAME
36 SPL_AC_FLS64
37 SPL_AC_DEVICE_CREATE
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
42 SPL_AC_TIMESPEC_SUB
43 SPL_AC_INIT_UTSNAME
44 SPL_AC_FDTABLE_HEADER
45 SPL_AC_FILES_FDTABLE
46 SPL_AC_UACCESS_HEADER
47 SPL_AC_KMALLOC_NODE
48 SPL_AC_MONOTONIC_CLOCK
49 SPL_AC_INODE_I_MUTEX
50 SPL_AC_MUTEX_OWNER
51 SPL_AC_MUTEX_LOCK_NESTED
52 SPL_AC_3ARGS_ON_EACH_CPU
53 SPL_AC_KALLSYMS_LOOKUP_NAME
54 SPL_AC_GET_VMALLOC_INFO
55 SPL_AC_PGDAT_HELPERS
56 SPL_AC_FIRST_ONLINE_PGDAT
57 SPL_AC_NEXT_ONLINE_PGDAT
58 SPL_AC_NEXT_ZONE
59 SPL_AC_PGDAT_LIST
60 SPL_AC_GLOBAL_PAGE_STATE
61 SPL_AC_ZONE_STAT_ITEM_FREE
62 SPL_AC_ZONE_STAT_ITEM_INACTIVE
63 SPL_AC_ZONE_STAT_ITEM_ACTIVE
64 SPL_AC_GET_ZONE_COUNTS
65 SPL_AC_USER_PATH_DIR
66 SPL_AC_SET_FS_PWD
67 SPL_AC_2ARGS_SET_FS_PWD
68 SPL_AC_2ARGS_VFS_UNLINK
69 SPL_AC_4ARGS_VFS_RENAME
70 SPL_AC_FS_STRUCT_SPINLOCK
71 SPL_AC_CRED_STRUCT
72 SPL_AC_GROUPS_SEARCH
73 SPL_AC_PUT_TASK_STRUCT
74 SPL_AC_5ARGS_PROC_HANDLER
75 SPL_AC_KVASPRINTF
76 SPL_AC_3ARGS_FILE_FSYNC
77 SPL_AC_EXPORTED_RWSEM_IS_LOCKED
78 SPL_AC_KERNEL_INVALIDATE_INODES
79 SPL_AC_KERNEL_2ARGS_INVALIDATE_INODES
80 SPL_AC_SHRINK_DCACHE_MEMORY
81 SPL_AC_SHRINK_ICACHE_MEMORY
82 ])
83
84 AC_DEFUN([SPL_AC_MODULE_SYMVERS], [
85 modpost=$LINUX/scripts/Makefile.modpost
86 AC_MSG_CHECKING([kernel file name for module symbols])
87 if test -f "$modpost"; then
88 if grep -q Modules.symvers $modpost; then
89 LINUX_SYMBOLS=Modules.symvers
90 else
91 LINUX_SYMBOLS=Module.symvers
92 fi
93
94 if ! test -f "$LINUX_OBJ/$LINUX_SYMBOLS"; then
95 AC_MSG_ERROR([
96 *** Please make sure the kernel devel package for your distribution
97 *** is installed. If your building with a custom kernel make sure the
98 *** kernel is configured, built, and the '--with-linux=PATH' configure
99 *** option refers to the location of the kernel source.])
100 fi
101 else
102 LINUX_SYMBOLS=NONE
103 fi
104 AC_MSG_RESULT($LINUX_SYMBOLS)
105 AC_SUBST(LINUX_SYMBOLS)
106 ])
107
108 AC_DEFUN([SPL_AC_KERNEL], [
109 AC_ARG_WITH([linux],
110 AS_HELP_STRING([--with-linux=PATH],
111 [Path to kernel source]),
112 [kernelsrc="$withval"])
113
114 AC_ARG_WITH([linux-obj],
115 AS_HELP_STRING([--with-linux-obj=PATH],
116 [Path to kernel build objects]),
117 [kernelbuild="$withval"])
118
119 AC_MSG_CHECKING([kernel source directory])
120 if test -z "$kernelsrc"; then
121 if test -e "/lib/modules/$(uname -r)/source"; then
122 headersdir="/lib/modules/$(uname -r)/source"
123 sourcelink=$(readlink -f "$headersdir")
124 elif test -e "/lib/modules/$(uname -r)/build"; then
125 headersdir="/lib/modules/$(uname -r)/build"
126 sourcelink=$(readlink -f "$headersdir")
127 else
128 sourcelink=$(ls -1d /usr/src/kernels/* \
129 /usr/src/linux-* \
130 2>/dev/null | grep -v obj | tail -1)
131 fi
132
133 if test -n "$sourcelink" && test -e ${sourcelink}; then
134 kernelsrc=`readlink -f ${sourcelink}`
135 else
136 AC_MSG_RESULT([Not found])
137 AC_MSG_ERROR([
138 *** Please make sure the kernel devel package for your distribution
139 *** is installed then try again. If that fails you can specify the
140 *** location of the kernel source with the '--with-linux=PATH' option.])
141 fi
142 else
143 if test "$kernelsrc" = "NONE"; then
144 kernsrcver=NONE
145 fi
146 fi
147
148 AC_MSG_RESULT([$kernelsrc])
149 AC_MSG_CHECKING([kernel build directory])
150 if test -z "$kernelbuild"; then
151 if test -e "/lib/modules/$(uname -r)/build"; then
152 kernelbuild=`readlink -f /lib/modules/$(uname -r)/build`
153 elif test -d ${kernelsrc}-obj/${target_cpu}/${target_cpu}; then
154 kernelbuild=${kernelsrc}-obj/${target_cpu}/${target_cpu}
155 elif test -d ${kernelsrc}-obj/${target_cpu}/default; then
156 kernelbuild=${kernelsrc}-obj/${target_cpu}/default
157 elif test -d `dirname ${kernelsrc}`/build-${target_cpu}; then
158 kernelbuild=`dirname ${kernelsrc}`/build-${target_cpu}
159 else
160 kernelbuild=${kernelsrc}
161 fi
162 fi
163 AC_MSG_RESULT([$kernelbuild])
164
165 AC_MSG_CHECKING([kernel source version])
166 utsrelease1=$kernelbuild/include/linux/version.h
167 utsrelease2=$kernelbuild/include/linux/utsrelease.h
168 utsrelease3=$kernelbuild/include/generated/utsrelease.h
169 if test -r $utsrelease1 && fgrep -q UTS_RELEASE $utsrelease1; then
170 utsrelease=linux/version.h
171 elif test -r $utsrelease2 && fgrep -q UTS_RELEASE $utsrelease2; then
172 utsrelease=linux/utsrelease.h
173 elif test -r $utsrelease3 && fgrep -q UTS_RELEASE $utsrelease3; then
174 utsrelease=generated/utsrelease.h
175 fi
176
177 if test "$utsrelease"; then
178 kernsrcver=`(echo "#include <$utsrelease>";
179 echo "kernsrcver=UTS_RELEASE") |
180 cpp -I $kernelbuild/include |
181 grep "^kernsrcver=" | cut -d \" -f 2`
182
183 if test -z "$kernsrcver"; then
184 AC_MSG_RESULT([Not found])
185 AC_MSG_ERROR([*** Cannot determine kernel version.])
186 fi
187 else
188 AC_MSG_RESULT([Not found])
189 AC_MSG_ERROR([*** Cannot find UTS_RELEASE definition.])
190 fi
191
192 AC_MSG_RESULT([$kernsrcver])
193
194 LINUX=${kernelsrc}
195 LINUX_OBJ=${kernelbuild}
196 LINUX_VERSION=${kernsrcver}
197
198 AC_SUBST(LINUX)
199 AC_SUBST(LINUX_OBJ)
200 AC_SUBST(LINUX_VERSION)
201
202 SPL_AC_MODULE_SYMVERS
203 ])
204
205 AC_DEFUN([SPL_AC_KERNEL_CONFIG], [
206 SPL_LINUX_CONFIG([PREEMPT],
207 AC_MSG_ERROR([
208 *** Kernel built with CONFIG_PREEMPT which is not supported.
209 ** You must rebuild your kernel without this option.]), [])
210 ])
211
212 dnl #
213 dnl # Explicitly check for gawk, we require it for the the usermode
214 dnl # helper. For some reason the standard awk command does not
215 dnl # behave correctly when invoked from the usermode helper.
216 dnl #
217 AC_DEFUN([SPL_AC_GAWK], [
218 AS_IF([test "x$AWK" != xgawk], [
219 AC_MSG_ERROR([
220 *** Required util gawk missing. Please install the required
221 *** gawk package for your distribution and try again.])
222 ])
223 ])
224
225 dnl #
226 dnl # Default SPL user configuration
227 dnl #
228 AC_DEFUN([SPL_AC_CONFIG_USER], [
229 SPL_AC_GAWK
230 ])
231
232 dnl #
233 dnl # Check for rpm+rpmbuild to build RPM packages. If these tools
234 dnl # are missing it is non-fatal but you will not be able to build
235 dnl # RPM packages and will be warned if you try too.
236 dnl #
237 AC_DEFUN([SPL_AC_RPM], [
238 RPM=rpm
239 RPMBUILD=rpmbuild
240
241 AC_MSG_CHECKING([whether $RPM is available])
242 AS_IF([tmp=$($RPM --version 2>/dev/null)], [
243 RPM_VERSION=$(echo $tmp | $AWK '/RPM/ { print $[3] }')
244 HAVE_RPM=yes
245 AC_MSG_RESULT([$HAVE_RPM ($RPM_VERSION)])
246 ],[
247 HAVE_RPM=no
248 AC_MSG_RESULT([$HAVE_RPM])
249 ])
250
251 AC_MSG_CHECKING([whether $RPMBUILD is available])
252 AS_IF([tmp=$($RPMBUILD --version 2>/dev/null)], [
253 RPMBUILD_VERSION=$(echo $tmp | $AWK '/RPM/ { print $[3] }')
254 HAVE_RPMBUILD=yes
255 AC_MSG_RESULT([$HAVE_RPMBUILD ($RPMBUILD_VERSION)])
256 ],[
257 HAVE_RPMBUILD=no
258 AC_MSG_RESULT([$HAVE_RPMBUILD])
259 ])
260
261 AC_SUBST(HAVE_RPM)
262 AC_SUBST(RPM)
263 AC_SUBST(RPM_VERSION)
264
265 AC_SUBST(HAVE_RPMBUILD)
266 AC_SUBST(RPMBUILD)
267 AC_SUBST(RPMBUILD_VERSION)
268 ])
269
270 dnl #
271 dnl # Check for dpkg+dpkg-buildpackage to build DEB packages. If these
272 dnl # tools are missing it is non-fatal but you will not be able to build
273 dnl # DEB packages and will be warned if you try too.
274 dnl #
275 AC_DEFUN([SPL_AC_DPKG], [
276 DPKG=dpkg
277 DPKGBUILD=dpkg-buildpackage
278
279 AC_MSG_CHECKING([whether $DPKG is available])
280 AS_IF([tmp=$($DPKG --version 2>/dev/null)], [
281 DPKG_VERSION=$(echo $tmp | $AWK '/Debian/ { print $[7] }')
282 HAVE_DPKG=yes
283 AC_MSG_RESULT([$HAVE_DPKG ($DPKG_VERSION)])
284 ],[
285 HAVE_DPKG=no
286 AC_MSG_RESULT([$HAVE_DPKG])
287 ])
288
289 AC_MSG_CHECKING([whether $DPKGBUILD is available])
290 AS_IF([tmp=$($DPKGBUILD --version 2>/dev/null)], [
291 DPKGBUILD_VERSION=$(echo $tmp | \
292 $AWK '/Debian/ { print $[4] }' | cut -f-4 -d'.')
293 HAVE_DPKGBUILD=yes
294 AC_MSG_RESULT([$HAVE_DPKGBUILD ($DPKGBUILD_VERSION)])
295 ],[
296 HAVE_DPKGBUILD=no
297 AC_MSG_RESULT([$HAVE_DPKGBUILD])
298 ])
299
300 AC_SUBST(HAVE_DPKG)
301 AC_SUBST(DPKG)
302 AC_SUBST(DPKG_VERSION)
303
304 AC_SUBST(HAVE_DPKGBUILD)
305 AC_SUBST(DPKGBUILD)
306 AC_SUBST(DPKGBUILD_VERSION)
307 ])
308
309 dnl #
310 dnl # Until native packaging for various different packing systems
311 dnl # can be added the least we can do is attempt to use alien to
312 dnl # convert the RPM packages to the needed package type. This is
313 dnl # a hack but so far it has worked reasonable well.
314 dnl #
315 AC_DEFUN([SPL_AC_ALIEN], [
316 ALIEN=alien
317
318 AC_MSG_CHECKING([whether $ALIEN is available])
319 AS_IF([tmp=$($ALIEN --version 2>/dev/null)], [
320 ALIEN_VERSION=$(echo $tmp | $AWK '{ print $[3] }')
321 HAVE_ALIEN=yes
322 AC_MSG_RESULT([$HAVE_ALIEN ($ALIEN_VERSION)])
323 ],[
324 HAVE_ALIEN=no
325 AC_MSG_RESULT([$HAVE_ALIEN])
326 ])
327
328 AC_SUBST(HAVE_ALIEN)
329 AC_SUBST(ALIEN)
330 AC_SUBST(ALIEN_VERSION)
331 ])
332
333 dnl #
334 dnl # Using the VENDOR tag from config.guess set the default
335 dnl # package type for 'make pkg': (rpm | deb | tgz)
336 dnl #
337 AC_DEFUN([SPL_AC_DEFAULT_PACKAGE], [
338 AC_MSG_CHECKING([linux distribution])
339 if test -f /etc/redhat-release ; then
340 VENDOR=redhat ;
341 elif test -f /etc/fedora-release ; then
342 VENDOR=fedora ;
343 elif test -f /etc/lsb-release ; then
344 VENDOR=ubuntu ;
345 elif test -f /etc/debian_version ; then
346 VENDOR=debian ;
347 elif test -f /etc/SuSE-release ; then
348 VENDOR=sles ;
349 elif test -f /etc/slackware-version ; then
350 VENDOR=slackware ;
351 elif test -f /etc/gentoo-release ; then
352 VENDOR=gentoo ;
353 else
354 VENDOR= ;
355 fi
356 AC_MSG_RESULT([$VENDOR])
357 AC_SUBST(VENDOR)
358
359 AC_MSG_CHECKING([default package type])
360 case "$VENDOR" in
361 fedora) DEFAULT_PACKAGE=rpm ;;
362 redhat) DEFAULT_PACKAGE=rpm ;;
363 sles) DEFAULT_PACKAGE=rpm ;;
364 ubuntu) DEFAULT_PACKAGE=deb ;;
365 debian) DEFAULT_PACKAGE=deb ;;
366 slackware) DEFAULT_PACKAGE=tgz ;;
367 *) DEFAULT_PACKAGE=rpm ;;
368 esac
369
370 AC_MSG_RESULT([$DEFAULT_PACKAGE])
371 AC_SUBST(DEFAULT_PACKAGE)
372 ])
373
374 dnl #
375 dnl # Default SPL user configuration
376 dnl #
377 AC_DEFUN([SPL_AC_PACKAGE], [
378 SPL_AC_RPM
379 SPL_AC_DPKG
380 SPL_AC_ALIEN
381 SPL_AC_DEFAULT_PACKAGE
382 ])
383
384 AC_DEFUN([SPL_AC_LICENSE], [
385 AC_MSG_CHECKING([spl license])
386 LICENSE=GPL
387 AC_MSG_RESULT([$LICENSE])
388 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DHAVE_GPL_ONLY_SYMBOLS"
389 AC_SUBST(LICENSE)
390 ])
391
392 AC_DEFUN([SPL_AC_CONFIG], [
393 SPL_CONFIG=all
394 AC_ARG_WITH([config],
395 AS_HELP_STRING([--with-config=CONFIG],
396 [Config file 'kernel|user|all|srpm']),
397 [SPL_CONFIG="$withval"])
398
399 AC_MSG_CHECKING([spl config])
400 AC_MSG_RESULT([$SPL_CONFIG]);
401 AC_SUBST(SPL_CONFIG)
402
403 case "$SPL_CONFIG" in
404 kernel) SPL_AC_CONFIG_KERNEL ;;
405 user) SPL_AC_CONFIG_USER ;;
406 all) SPL_AC_CONFIG_KERNEL
407 SPL_AC_CONFIG_USER ;;
408 srpm) ;;
409 *)
410 AC_MSG_RESULT([Error!])
411 AC_MSG_ERROR([Bad value "$SPL_CONFIG" for --with-config,
412 user kernel|user|all|srpm]) ;;
413 esac
414
415 AM_CONDITIONAL([CONFIG_USER],
416 [test "$SPL_CONFIG" = user] ||
417 [test "$SPL_CONFIG" = all])
418 AM_CONDITIONAL([CONFIG_KERNEL],
419 [test "$SPL_CONFIG" = kernel] ||
420 [test "$SPL_CONFIG" = all])
421 ])
422
423 dnl #
424 dnl # Enable if the SPL should be compiled with internal debugging enabled.
425 dnl # By default this support is disabled.
426 dnl #
427 AC_DEFUN([SPL_AC_DEBUG], [
428 AC_MSG_CHECKING([whether debugging is enabled])
429 AC_ARG_ENABLE([debug],
430 [AS_HELP_STRING([--enable-debug],
431 [Enable generic debug support @<:@default=no@:>@])],
432 [],
433 [enable_debug=no])
434
435 AS_IF([test "x$enable_debug" = xyes],
436 [
437 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG -Werror"
438 DEBUG_CFLAGS="-DDEBUG -Werror"
439 ],
440 [
441 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG"
442 DEBUG_CFLAGS="-DNDEBUG"
443 ])
444
445 AC_SUBST(DEBUG_CFLAGS)
446 AC_MSG_RESULT([$enable_debug])
447 ])
448
449 dnl #
450 dnl # Enabled by default it provides a minimal level of memory tracking.
451 dnl # A total count of bytes allocated is kept for each alloc and free.
452 dnl # Then at module unload time a report to the console will be printed
453 dnl # if memory was leaked. Additionally, /proc/spl/kmem/slab will exist
454 dnl # and provide an easy way to inspect the kmem based slab.
455 dnl #
456 AC_DEFUN([SPL_AC_DEBUG_KMEM], [
457 AC_ARG_ENABLE([debug-kmem],
458 [AS_HELP_STRING([--enable-debug-kmem],
459 [Enable basic kmem accounting @<:@default=yes@:>@])],
460 [],
461 [enable_debug_kmem=yes])
462
463 AS_IF([test "x$enable_debug_kmem" = xyes],
464 [AC_DEFINE([DEBUG_KMEM], [1],
465 [Define to 1 to enable basic kmem accounting])
466 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM"])
467
468 AC_MSG_CHECKING([whether basic kmem accounting is enabled])
469 AC_MSG_RESULT([$enable_debug_kmem])
470 ])
471
472 dnl #
473 dnl # Disabled by default it provides detailed memory tracking. This
474 dnl # feature also requires --enable-debug-kmem to be set. When enabled
475 dnl # not only will total bytes be tracked but also the location of every
476 dnl # alloc and free. When the SPL module is unloaded a list of all leaked
477 dnl # addresses and where they were allocated will be dumped to the console.
478 dnl # Enabling this feature has a significant impact on performance but it
479 dnl # makes finding memory leaks pretty straight forward.
480 dnl #
481 AC_DEFUN([SPL_AC_DEBUG_KMEM_TRACKING], [
482 AC_ARG_ENABLE([debug-kmem-tracking],
483 [AS_HELP_STRING([--enable-debug-kmem-tracking],
484 [Enable detailed kmem tracking @<:@default=no@:>@])],
485 [],
486 [enable_debug_kmem_tracking=no])
487
488 AS_IF([test "x$enable_debug_kmem_tracking" = xyes],
489 [AC_DEFINE([DEBUG_KMEM_TRACKING], [1],
490 [Define to 1 to enable detailed kmem tracking])
491 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM_TRACKING"])
492
493 AC_MSG_CHECKING([whether detailed kmem tracking is enabled])
494 AC_MSG_RESULT([$enable_debug_kmem_tracking])
495 ])
496
497 dnl #
498 dnl # SPL_LINUX_CONFTEST
499 dnl #
500 AC_DEFUN([SPL_LINUX_CONFTEST], [
501 cat confdefs.h - <<_ACEOF >conftest.c
502 $1
503 _ACEOF
504 ])
505
506 dnl #
507 dnl # SPL_LANG_PROGRAM(C)([PROLOGUE], [BODY])
508 dnl #
509 m4_define([SPL_LANG_PROGRAM], [
510 $1
511 int
512 main (void)
513 {
514 dnl Do *not* indent the following line: there may be CPP directives.
515 dnl Don't move the `;' right after for the same reason.
516 $2
517 ;
518 return 0;
519 }
520 ])
521
522 dnl #
523 dnl # SPL_LINUX_COMPILE_IFELSE / like AC_COMPILE_IFELSE
524 dnl #
525 AC_DEFUN([SPL_LINUX_COMPILE_IFELSE], [
526 m4_ifvaln([$1], [SPL_LINUX_CONFTEST([$1])])
527 rm -Rf build && mkdir -p build
528 echo "obj-m := conftest.o" >build/Makefile
529 AS_IF(
530 [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])],
531 [$4],
532 [_AC_MSG_LOG_CONFTEST m4_ifvaln([$5],[$5])]
533 )
534 rm -Rf build
535 ])
536
537 dnl #
538 dnl # SPL_LINUX_TRY_COMPILE like AC_TRY_COMPILE
539 dnl #
540 AC_DEFUN([SPL_LINUX_TRY_COMPILE],
541 [SPL_LINUX_COMPILE_IFELSE(
542 [AC_LANG_SOURCE([SPL_LANG_PROGRAM([[$1]], [[$2]])])],
543 [modules],
544 [test -s build/conftest.o],
545 [$3], [$4])
546 ])
547
548 dnl #
549 dnl # SPL_LINUX_CONFIG
550 dnl #
551 AC_DEFUN([SPL_LINUX_CONFIG],
552 [AC_MSG_CHECKING([whether Linux was built with CONFIG_$1])
553 SPL_LINUX_TRY_COMPILE([
554 #ifndef AUTOCONF_INCLUDED
555 #include <linux/config.h>
556 #endif
557 ],[
558 #ifndef CONFIG_$1
559 #error CONFIG_$1 not #defined
560 #endif
561 ],[
562 AC_MSG_RESULT([yes])
563 $2
564 ],[
565 AC_MSG_RESULT([no])
566 $3
567 ])
568 ])
569
570 dnl #
571 dnl # SPL_CHECK_SYMBOL_EXPORT
572 dnl # check symbol exported or not
573 dnl #
574 AC_DEFUN([SPL_CHECK_SYMBOL_EXPORT],
575 [AC_MSG_CHECKING([whether symbol $1 is exported])
576 grep -q -E '[[[:space:]]]$1[[[:space:]]]' \
577 $LINUX_OBJ/Module*.symvers 2>/dev/null
578 rc=$?
579 if test $rc -ne 0; then
580 export=0
581 for file in $2; do
582 grep -q -E "EXPORT_SYMBOL.*($1)" \
583 "$LINUX_OBJ/$file" 2>/dev/null
584 rc=$?
585 if test $rc -eq 0; then
586 export=1
587 break;
588 fi
589 done
590 if test $export -eq 0; then
591 AC_MSG_RESULT([no])
592 $4
593 else
594 AC_MSG_RESULT([yes])
595 $3
596 fi
597 else
598 AC_MSG_RESULT([yes])
599 $3
600 fi
601 ])
602
603 dnl #
604 dnl # SPL_CHECK_HEADER
605 dnl # check whether header exists and define HAVE_$2_HEADER
606 dnl #
607 AC_DEFUN([SPL_CHECK_HEADER],
608 [AC_MSG_CHECKING([whether header $1 exists])
609 SPL_LINUX_TRY_COMPILE([
610 #include <$1>
611 ],[
612 return 0;
613 ],[
614 AC_DEFINE(HAVE_$2_HEADER, 1, [$1 exists])
615 AC_MSG_RESULT(yes)
616 $3
617 ],[
618 AC_MSG_RESULT(no)
619 $4
620 ])
621 ])
622
623 dnl #
624 dnl # Use the atomic implemenation based on global spinlocks. This
625 dnl # should only be needed by 32-bit kernels which do not provide
626 dnl # the atomic64_* API. It may be optionally enabled as a fallback
627 dnl # if problems are observed with the direct mapping to the native
628 dnl # Linux atomic operations. You may not disable atomic spinlocks
629 dnl # if you kernel does not an atomic64_* API.
630 dnl #
631 AC_DEFUN([SPL_AC_ATOMIC_SPINLOCK], [
632 AC_ARG_ENABLE([atomic-spinlocks],
633 [AS_HELP_STRING([--enable-atomic-spinlocks],
634 [Atomic types use spinlocks @<:@default=check@:>@])],
635 [],
636 [enable_atomic_spinlocks=check])
637
638 SPL_LINUX_TRY_COMPILE([
639 #include <asm/atomic.h>
640 ],[
641 atomic64_t *ptr;
642 ],[
643 have_atomic64_t=yes
644 AC_DEFINE(HAVE_ATOMIC64_T, 1,
645 [kernel defines atomic64_t])
646 ],[
647 have_atomic64_t=no
648 ])
649
650 AS_IF([test "x$enable_atomic_spinlocks" = xcheck], [
651 AS_IF([test "x$have_atomic64_t" = xyes], [
652 enable_atomic_spinlocks=no
653 ],[
654 enable_atomic_spinlocks=yes
655 ])
656 ])
657
658 AS_IF([test "x$enable_atomic_spinlocks" = xyes], [
659 AC_DEFINE([ATOMIC_SPINLOCK], [1],
660 [Atomic types use spinlocks])
661 ],[
662 AS_IF([test "x$have_atomic64_t" = xno], [
663 AC_MSG_FAILURE(
664 [--disable-atomic-spinlocks given but required atomic64 support is unavailable])
665 ])
666 ])
667
668 AC_MSG_CHECKING([whether atomic types use spinlocks])
669 AC_MSG_RESULT([$enable_atomic_spinlocks])
670
671 AC_MSG_CHECKING([whether kernel defines atomic64_t])
672 AC_MSG_RESULT([$have_atomic64_t])
673 ])
674
675 dnl #
676 dnl # 2.6.24 API change,
677 dnl # check if atomic64_cmpxchg is defined
678 dnl #
679 AC_DEFUN([SPL_AC_TYPE_ATOMIC64_CMPXCHG],
680 [AC_MSG_CHECKING([whether kernel defines atomic64_cmpxchg])
681 SPL_LINUX_TRY_COMPILE([
682 #include <asm/atomic.h>
683 #include <asm/system.h>
684 ],[
685 atomic64_cmpxchg((atomic64_t *)NULL, 0, 0);
686 ],[
687 AC_MSG_RESULT([yes])
688 AC_DEFINE(HAVE_ATOMIC64_CMPXCHG, 1,
689 [kernel defines atomic64_cmpxchg])
690 ],[
691 AC_MSG_RESULT([no])
692 ])
693 ])
694
695 dnl #
696 dnl # 2.6.24 API change,
697 dnl # check if atomic64_xchg is defined
698 dnl #
699 AC_DEFUN([SPL_AC_TYPE_ATOMIC64_XCHG],
700 [AC_MSG_CHECKING([whether kernel defines atomic64_xchg])
701 SPL_LINUX_TRY_COMPILE([
702 #include <asm/atomic.h>
703 ],[
704 atomic64_xchg((atomic64_t *)NULL, 0);
705 ],[
706 AC_MSG_RESULT([yes])
707 AC_DEFINE(HAVE_ATOMIC64_XCHG, 1,
708 [kernel defines atomic64_xchg])
709 ],[
710 AC_MSG_RESULT([no])
711 ])
712 ])
713
714 dnl #
715 dnl # 2.6.24 API change,
716 dnl # check if uintptr_t typedef is defined
717 dnl #
718 AC_DEFUN([SPL_AC_TYPE_UINTPTR_T],
719 [AC_MSG_CHECKING([whether kernel defines uintptr_t])
720 SPL_LINUX_TRY_COMPILE([
721 #include <linux/types.h>
722 ],[
723 uintptr_t *ptr;
724 ],[
725 AC_MSG_RESULT([yes])
726 AC_DEFINE(HAVE_UINTPTR_T, 1,
727 [kernel defines uintptr_t])
728 ],[
729 AC_MSG_RESULT([no])
730 ])
731 ])
732
733 dnl #
734 dnl # 2.6.20 API change,
735 dnl # INIT_WORK use 2 args and not store data inside
736 dnl #
737 AC_DEFUN([SPL_AC_3ARGS_INIT_WORK],
738 [AC_MSG_CHECKING([whether INIT_WORK wants 3 args])
739 SPL_LINUX_TRY_COMPILE([
740 #include <linux/workqueue.h>
741 ],[
742 struct work_struct work;
743 INIT_WORK(&work, NULL, NULL);
744 ],[
745 AC_MSG_RESULT(yes)
746 AC_DEFINE(HAVE_3ARGS_INIT_WORK, 1,
747 [INIT_WORK wants 3 args])
748 ],[
749 AC_MSG_RESULT(no)
750 ])
751 ])
752
753 dnl #
754 dnl # 2.6.21 API change,
755 dnl # 'register_sysctl_table' use only one argument instead of two
756 dnl #
757 AC_DEFUN([SPL_AC_2ARGS_REGISTER_SYSCTL],
758 [AC_MSG_CHECKING([whether register_sysctl_table() wants 2 args])
759 SPL_LINUX_TRY_COMPILE([
760 #include <linux/sysctl.h>
761 ],[
762 return register_sysctl_table(NULL,0);
763 ],[
764 AC_MSG_RESULT(yes)
765 AC_DEFINE(HAVE_2ARGS_REGISTER_SYSCTL, 1,
766 [register_sysctl_table() wants 2 args])
767 ],[
768 AC_MSG_RESULT(no)
769 ])
770 ])
771
772 dnl #
773 dnl # 2.6.23 API change
774 dnl # Old set_shrinker API replaced with register_shrinker
775 dnl #
776 AC_DEFUN([SPL_AC_SET_SHRINKER], [
777 AC_MSG_CHECKING([whether set_shrinker() available])
778 SPL_LINUX_TRY_COMPILE([
779 #include <linux/mm.h>
780 ],[
781 return set_shrinker(DEFAULT_SEEKS, NULL);
782 ],[
783 AC_MSG_RESULT([yes])
784 AC_DEFINE(HAVE_SET_SHRINKER, 1,
785 [set_shrinker() available])
786 ],[
787 AC_MSG_RESULT([no])
788 ])
789 ])
790
791 dnl #
792 dnl # 2.6.35 API change,
793 dnl # Add context to shrinker callback
794 dnl #
795 AC_DEFUN([SPL_AC_3ARGS_SHRINKER_CALLBACK],
796 [AC_MSG_CHECKING([whether shrinker callback wants 3 args])
797 tmp_flags="$EXTRA_KCFLAGS"
798 EXTRA_KCFLAGS="-Werror"
799 SPL_LINUX_TRY_COMPILE([
800 #include <linux/mm.h>
801
802 int shrinker_cb(struct shrinker *, int, unsigned int);
803 ],[
804 struct shrinker cache_shrinker = {
805 .shrink = shrinker_cb,
806 .seeks = DEFAULT_SEEKS,
807 };
808 register_shrinker(&cache_shrinker);
809 ],[
810 AC_MSG_RESULT(yes)
811 AC_DEFINE(HAVE_3ARGS_SHRINKER_CALLBACK, 1,
812 [shrinker callback wants 3 args])
813 ],[
814 AC_MSG_RESULT(no)
815 ])
816 EXTRA_KCFLAGS="$tmp_flags"
817 ])
818
819 dnl #
820 dnl # 2.6.25 API change,
821 dnl # struct path entry added to struct nameidata
822 dnl #
823 AC_DEFUN([SPL_AC_PATH_IN_NAMEIDATA],
824 [AC_MSG_CHECKING([whether struct path used in struct nameidata])
825 SPL_LINUX_TRY_COMPILE([
826 #include <linux/namei.h>
827 ],[
828 struct nameidata nd;
829
830 nd.path.mnt = NULL;
831 nd.path.dentry = NULL;
832 ],[
833 AC_MSG_RESULT(yes)
834 AC_DEFINE(HAVE_PATH_IN_NAMEIDATA, 1,
835 [struct path used in struct nameidata])
836 ],[
837 AC_MSG_RESULT(no)
838 ])
839 ])
840
841 dnl #
842 dnl # Custom SPL patch may export this system it is not required
843 dnl #
844 AC_DEFUN([SPL_AC_TASK_CURR], [
845 SPL_CHECK_SYMBOL_EXPORT([task_curr], [kernel/sched.c],
846 [AC_DEFINE(HAVE_TASK_CURR, 1, [task_curr() exported])],
847 [])
848 ])
849
850 dnl #
851 dnl # 2.6.19 API change,
852 dnl # Use CTL_UNNUMBERED when binary sysctl is not required
853 dnl #
854 AC_DEFUN([SPL_AC_CTL_UNNUMBERED],
855 [AC_MSG_CHECKING([whether unnumbered sysctl support exists])
856 SPL_LINUX_TRY_COMPILE([
857 #include <linux/sysctl.h>
858 ],[
859 #ifndef CTL_UNNUMBERED
860 #error CTL_UNNUMBERED undefined
861 #endif
862 ],[
863 AC_MSG_RESULT(yes)
864 AC_DEFINE(HAVE_CTL_UNNUMBERED, 1,
865 [unnumbered sysctl support exists])
866 ],[
867 AC_MSG_RESULT(no)
868 ])
869 ])
870
871 dnl #
872 dnl # 2.6.33 API change,
873 dnl # Removed .ctl_name from struct ctl_table.
874 dnl #
875 AC_DEFUN([SPL_AC_CTL_NAME], [
876 AC_MSG_CHECKING([whether struct ctl_table has ctl_name])
877 SPL_LINUX_TRY_COMPILE([
878 #include <linux/sysctl.h>
879 ],[
880 struct ctl_table ctl;
881 ctl.ctl_name = 0;
882 ],[
883 AC_MSG_RESULT(yes)
884 AC_DEFINE(HAVE_CTL_NAME, 1, [struct ctl_table has ctl_name])
885 ],[
886 AC_MSG_RESULT(no)
887 ])
888 ])
889
890 dnl #
891 dnl # 2.6.16 API change.
892 dnl # Check if 'fls64()' is available
893 dnl #
894 AC_DEFUN([SPL_AC_FLS64],
895 [AC_MSG_CHECKING([whether fls64() is available])
896 SPL_LINUX_TRY_COMPILE([
897 #include <linux/bitops.h>
898 ],[
899 return fls64(0);
900 ],[
901 AC_MSG_RESULT(yes)
902 AC_DEFINE(HAVE_FLS64, 1, [fls64() is available])
903 ],[
904 AC_MSG_RESULT(no)
905 ])
906 ])
907
908 dnl #
909 dnl # 2.6.18 API change, check whether device_create() is available.
910 dnl # Device_create() was introduced in 2.6.18 and depricated
911 dnl # class_device_create() which was fully removed in 2.6.26.
912 dnl #
913 AC_DEFUN([SPL_AC_DEVICE_CREATE], [
914 SPL_CHECK_SYMBOL_EXPORT(
915 [device_create],
916 [drivers/base/core.c],
917 [AC_DEFINE(HAVE_DEVICE_CREATE, 1,
918 [device_create() is available])],
919 [])
920 ])
921
922 dnl #
923 dnl # 2.6.27 API change,
924 dnl # device_create() uses 5 args, new 'drvdata' argument.
925 dnl #
926 AC_DEFUN([SPL_AC_5ARGS_DEVICE_CREATE], [
927 AC_MSG_CHECKING([whether device_create() wants 5 args])
928 tmp_flags="$EXTRA_KCFLAGS"
929 EXTRA_KCFLAGS="-Werror"
930 SPL_LINUX_TRY_COMPILE([
931 #include <linux/device.h>
932 ],[
933 device_create(NULL, NULL, 0, NULL, "%d", 1);
934 ],[
935 AC_MSG_RESULT(yes)
936 AC_DEFINE(HAVE_5ARGS_DEVICE_CREATE, 1,
937 [device_create wants 5 args])
938 ],[
939 AC_MSG_RESULT(no)
940 ])
941 EXTRA_KCFLAGS="$tmp_flags"
942 ])
943
944 dnl #
945 dnl # 2.6.13 API change, check whether class_device_create() is available.
946 dnl # Class_device_create() was introduced in 2.6.13 and depricated
947 dnl # class_simple_device_add() which was fully removed in 2.6.13.
948 dnl #
949 AC_DEFUN([SPL_AC_CLASS_DEVICE_CREATE], [
950 SPL_CHECK_SYMBOL_EXPORT(
951 [class_device_create],
952 [drivers/base/class.c],
953 [AC_DEFINE(HAVE_CLASS_DEVICE_CREATE, 1,
954 [class_device_create() is available])],
955 [])
956 ])
957
958 dnl #
959 dnl # 2.6.26 API change, set_normalized_timespec() is exported.
960 dnl #
961 AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_EXPORT], [
962 SPL_CHECK_SYMBOL_EXPORT(
963 [set_normalized_timespec],
964 [kernel/time.c],
965 [AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_EXPORT, 1,
966 [set_normalized_timespec() is available as export])],
967 [])
968 ])
969
970 dnl #
971 dnl # 2.6.16 API change, set_normalize_timespec() moved to time.c
972 dnl # previously it was available in time.h as an inline.
973 dnl #
974 AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE], [
975 AC_MSG_CHECKING([whether set_normalized_timespec() is an inline])
976 SPL_LINUX_TRY_COMPILE([
977 #include <linux/time.h>
978 void set_normalized_timespec(struct timespec *ts,
979 time_t sec, long nsec) { }
980 ],
981 [],
982 [
983 AC_MSG_RESULT(no)
984 ],[
985 AC_MSG_RESULT(yes)
986 AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_INLINE, 1,
987 [set_normalized_timespec() is available as inline])
988 ])
989 ])
990
991 dnl #
992 dnl # 2.6.18 API change,
993 dnl # timespec_sub() inline function available in linux/time.h
994 dnl #
995 AC_DEFUN([SPL_AC_TIMESPEC_SUB], [
996 AC_MSG_CHECKING([whether timespec_sub() is available])
997 SPL_LINUX_TRY_COMPILE([
998 #include <linux/time.h>
999 ],[
1000 struct timespec a, b, c = { 0 };
1001 c = timespec_sub(a, b);
1002 ],[
1003 AC_MSG_RESULT(yes)
1004 AC_DEFINE(HAVE_TIMESPEC_SUB, 1, [timespec_sub() is available])
1005 ],[
1006 AC_MSG_RESULT(no)
1007 ])
1008 ])
1009
1010 dnl #
1011 dnl # 2.6.19 API change,
1012 dnl # check if init_utsname() is available in linux/utsname.h
1013 dnl #
1014 AC_DEFUN([SPL_AC_INIT_UTSNAME], [
1015 AC_MSG_CHECKING([whether init_utsname() is available])
1016 SPL_LINUX_TRY_COMPILE([
1017 #include <linux/utsname.h>
1018 ],[
1019 struct new_utsname *a = init_utsname();
1020 ],[
1021 AC_MSG_RESULT(yes)
1022 AC_DEFINE(HAVE_INIT_UTSNAME, 1, [init_utsname() is available])
1023 ],[
1024 AC_MSG_RESULT(no)
1025 ])
1026 ])
1027
1028 dnl #
1029 dnl # 2.6.26 API change,
1030 dnl # definition of struct fdtable relocated to linux/fdtable.h
1031 dnl #
1032 AC_DEFUN([SPL_AC_FDTABLE_HEADER], [
1033 SPL_CHECK_HEADER([linux/fdtable.h], [FDTABLE], [], [])
1034 ])
1035
1036 dnl #
1037 dnl # 2.6.14 API change,
1038 dnl # check whether 'files_fdtable()' exists
1039 dnl #
1040 AC_DEFUN([SPL_AC_FILES_FDTABLE], [
1041 AC_MSG_CHECKING([whether files_fdtable() is available])
1042 SPL_LINUX_TRY_COMPILE([
1043 #include <linux/sched.h>
1044 #include <linux/file.h>
1045 #ifdef HAVE_FDTABLE_HEADER
1046 #include <linux/fdtable.h>
1047 #endif
1048 ],[
1049 struct files_struct *files = current->files;
1050 struct fdtable *fdt = files_fdtable(files);
1051 ],[
1052 AC_MSG_RESULT(yes)
1053 AC_DEFINE(HAVE_FILES_FDTABLE, 1, [files_fdtable() is available])
1054 ],[
1055 AC_MSG_RESULT(no)
1056 ])
1057 ])
1058
1059 dnl #
1060 dnl # 2.6.18 API change,
1061 dnl # added linux/uaccess.h
1062 dnl #
1063 AC_DEFUN([SPL_AC_UACCESS_HEADER], [
1064 SPL_CHECK_HEADER([linux/uaccess.h], [UACCESS], [], [])
1065 ])
1066
1067 dnl #
1068 dnl # 2.6.12 API change,
1069 dnl # check whether 'kmalloc_node()' is available.
1070 dnl #
1071 AC_DEFUN([SPL_AC_KMALLOC_NODE], [
1072 AC_MSG_CHECKING([whether kmalloc_node() is available])
1073 SPL_LINUX_TRY_COMPILE([
1074 #include <linux/slab.h>
1075 ],[
1076 void *a = kmalloc_node(1, GFP_KERNEL, 0);
1077 ],[
1078 AC_MSG_RESULT(yes)
1079 AC_DEFINE(HAVE_KMALLOC_NODE, 1, [kmalloc_node() is available])
1080 ],[
1081 AC_MSG_RESULT(no)
1082 ])
1083 ])
1084
1085 dnl #
1086 dnl # 2.6.9 API change,
1087 dnl # check whether 'monotonic_clock()' is available it may
1088 dnl # be available for some archs but not others.
1089 dnl #
1090 AC_DEFUN([SPL_AC_MONOTONIC_CLOCK], [
1091 SPL_CHECK_SYMBOL_EXPORT(
1092 [monotonic_clock],
1093 [],
1094 [AC_DEFINE(HAVE_MONOTONIC_CLOCK, 1,
1095 [monotonic_clock() is available])],
1096 [])
1097 ])
1098
1099 dnl #
1100 dnl # 2.6.16 API change,
1101 dnl # check whether 'struct inode' has i_mutex
1102 dnl #
1103 AC_DEFUN([SPL_AC_INODE_I_MUTEX], [
1104 AC_MSG_CHECKING([whether struct inode has i_mutex])
1105 SPL_LINUX_TRY_COMPILE([
1106 #include <linux/fs.h>
1107 #include <linux/mutex.h>
1108 ],[
1109 struct inode i;
1110 mutex_init(&i.i_mutex);
1111 ],[
1112 AC_MSG_RESULT(yes)
1113 AC_DEFINE(HAVE_INODE_I_MUTEX, 1, [struct inode has i_mutex])
1114 ],[
1115 AC_MSG_RESULT(no)
1116 ])
1117 ])
1118
1119 dnl #
1120 dnl # 2.6.29 API change,
1121 dnl # Adaptive mutexs introduced.
1122 dnl #
1123 AC_DEFUN([SPL_AC_MUTEX_OWNER], [
1124 AC_MSG_CHECKING([whether struct mutex has owner])
1125 SPL_LINUX_TRY_COMPILE([
1126 #include <linux/mutex.h>
1127 ],[
1128 struct mutex mtx;
1129 mtx.owner = NULL;
1130 ],[
1131 AC_MSG_RESULT(yes)
1132 AC_DEFINE(HAVE_MUTEX_OWNER, 1, [struct mutex has owner])
1133 ],[
1134 AC_MSG_RESULT(no)
1135 ])
1136 ])
1137
1138 dnl #
1139 dnl # 2.6.18 API change,
1140 dnl # First introduced 'mutex_lock_nested()' in include/linux/mutex.h,
1141 dnl # as part of the mutex validator. Fallback to using 'mutex_lock()'
1142 dnl # if the mutex validator is disabled or otherwise unavailable.
1143 dnl #
1144 AC_DEFUN([SPL_AC_MUTEX_LOCK_NESTED], [
1145 AC_MSG_CHECKING([whether mutex_lock_nested() is available])
1146 SPL_LINUX_TRY_COMPILE([
1147 #include <linux/mutex.h>
1148 ],[
1149 struct mutex mutex;
1150 mutex_init(&mutex);
1151 mutex_lock_nested(&mutex, 0);
1152 ],[
1153 AC_MSG_RESULT(yes)
1154 AC_DEFINE(HAVE_MUTEX_LOCK_NESTED, 1,
1155 [mutex_lock_nested() is available])
1156 ],[
1157 AC_MSG_RESULT(no)
1158 ])
1159 ])
1160
1161 dnl #
1162 dnl # 2.6.27 API change,
1163 dnl # on_each_cpu() uses 3 args, no 'retry' argument
1164 dnl #
1165 AC_DEFUN([SPL_AC_3ARGS_ON_EACH_CPU], [
1166 AC_MSG_CHECKING([whether on_each_cpu() wants 3 args])
1167 SPL_LINUX_TRY_COMPILE([
1168 #include <linux/smp.h>
1169 ],[
1170 on_each_cpu(NULL, NULL, 0);
1171 ],[
1172 AC_MSG_RESULT(yes)
1173 AC_DEFINE(HAVE_3ARGS_ON_EACH_CPU, 1,
1174 [on_each_cpu wants 3 args])
1175 ],[
1176 AC_MSG_RESULT(no)
1177 ])
1178 ])
1179
1180 dnl #
1181 dnl # 2.6.18 API change,
1182 dnl # kallsyms_lookup_name no longer exported
1183 dnl #
1184 AC_DEFUN([SPL_AC_KALLSYMS_LOOKUP_NAME], [
1185 SPL_CHECK_SYMBOL_EXPORT(
1186 [kallsyms_lookup_name],
1187 [],
1188 [AC_DEFINE(HAVE_KALLSYMS_LOOKUP_NAME, 1,
1189 [kallsyms_lookup_name() is available])],
1190 [])
1191 ])
1192
1193 dnl #
1194 dnl # Proposed API change,
1195 dnl # This symbol is not available in stock kernels. You may build a
1196 dnl # custom kernel with the *-spl-export-symbols.patch which will export
1197 dnl # these symbols for use. If your already rolling a custom kernel for
1198 dnl # your environment this is recommended.
1199 dnl #
1200 AC_DEFUN([SPL_AC_GET_VMALLOC_INFO], [
1201 SPL_CHECK_SYMBOL_EXPORT(
1202 [get_vmalloc_info],
1203 [],
1204 [AC_DEFINE(HAVE_GET_VMALLOC_INFO, 1,
1205 [get_vmalloc_info() is available])],
1206 [])
1207 ])
1208
1209 dnl #
1210 dnl # 2.6.17 API change
1211 dnl # The helper functions first_online_pgdat(), next_online_pgdat(), and
1212 dnl # next_zone() are introduced to simplify for_each_zone(). These symbols
1213 dnl # were exported in 2.6.17 for use by modules which was consistent with
1214 dnl # the previous implementation of for_each_zone(). From 2.6.18 - 2.6.19
1215 dnl # the symbols were exported as 'unused', and by 2.6.20 they exports
1216 dnl # were dropped entirely leaving modules no way to directly iterate over
1217 dnl # the zone list. Because we need access to the zone helpers we check
1218 dnl # if the kernel contains the old or new implementation. Then we check
1219 dnl # to see if the symbols we need for each version are available. If they
1220 dnl # are not, dynamically aquire the addresses with kallsyms_lookup_name().
1221 dnl #
1222 AC_DEFUN([SPL_AC_PGDAT_HELPERS], [
1223 AC_MSG_CHECKING([whether symbol *_pgdat exist])
1224 grep -q -E 'first_online_pgdat' $LINUX/include/linux/mmzone.h 2>/dev/null
1225 rc=$?
1226 if test $rc -eq 0; then
1227 AC_MSG_RESULT([yes])
1228 AC_DEFINE(HAVE_PGDAT_HELPERS, 1, [pgdat helpers are available])
1229 else
1230 AC_MSG_RESULT([no])
1231 fi
1232 ])
1233
1234 dnl #
1235 dnl # Proposed API change,
1236 dnl # This symbol is not available in stock kernels. You may build a
1237 dnl # custom kernel with the *-spl-export-symbols.patch which will export
1238 dnl # these symbols for use. If your already rolling a custom kernel for
1239 dnl # your environment this is recommended.
1240 dnl #
1241 AC_DEFUN([SPL_AC_FIRST_ONLINE_PGDAT], [
1242 SPL_CHECK_SYMBOL_EXPORT(
1243 [first_online_pgdat],
1244 [],
1245 [AC_DEFINE(HAVE_FIRST_ONLINE_PGDAT, 1,
1246 [first_online_pgdat() is available])],
1247 [])
1248 ])
1249
1250 dnl #
1251 dnl # Proposed API change,
1252 dnl # This symbol is not available in stock kernels. You may build a
1253 dnl # custom kernel with the *-spl-export-symbols.patch which will export
1254 dnl # these symbols for use. If your already rolling a custom kernel for
1255 dnl # your environment this is recommended.
1256 dnl #
1257 AC_DEFUN([SPL_AC_NEXT_ONLINE_PGDAT], [
1258 SPL_CHECK_SYMBOL_EXPORT(
1259 [next_online_pgdat],
1260 [],
1261 [AC_DEFINE(HAVE_NEXT_ONLINE_PGDAT, 1,
1262 [next_online_pgdat() is available])],
1263 [])
1264 ])
1265
1266 dnl #
1267 dnl # Proposed API change,
1268 dnl # This symbol is not available in stock kernels. You may build a
1269 dnl # custom kernel with the *-spl-export-symbols.patch which will export
1270 dnl # these symbols for use. If your already rolling a custom kernel for
1271 dnl # your environment this is recommended.
1272 dnl #
1273 AC_DEFUN([SPL_AC_NEXT_ZONE], [
1274 SPL_CHECK_SYMBOL_EXPORT(
1275 [next_zone],
1276 [],
1277 [AC_DEFINE(HAVE_NEXT_ZONE, 1,
1278 [next_zone() is available])],
1279 [])
1280 ])
1281
1282 dnl #
1283 dnl # 2.6.17 API change,
1284 dnl # See SPL_AC_PGDAT_HELPERS for details.
1285 dnl #
1286 AC_DEFUN([SPL_AC_PGDAT_LIST], [
1287 SPL_CHECK_SYMBOL_EXPORT(
1288 [pgdat_list],
1289 [],
1290 [AC_DEFINE(HAVE_PGDAT_LIST, 1,
1291 [pgdat_list is available])],
1292 [])
1293 ])
1294
1295 dnl #
1296 dnl # 2.6.18 API change,
1297 dnl # First introduced global_page_state() support as an inline.
1298 dnl #
1299 AC_DEFUN([SPL_AC_GLOBAL_PAGE_STATE], [
1300 AC_MSG_CHECKING([whether global_page_state() is available])
1301 SPL_LINUX_TRY_COMPILE([
1302 #include <linux/mm.h>
1303 ],[
1304 unsigned long state;
1305 state = global_page_state(0);
1306 ],[
1307 AC_MSG_RESULT(yes)
1308 AC_DEFINE(HAVE_GLOBAL_PAGE_STATE, 1,
1309 [global_page_state() is available])
1310 ],[
1311 AC_MSG_RESULT(no)
1312 ])
1313 ])
1314
1315 dnl #
1316 dnl # 2.6.21 API change (plus subsequent naming convention changes),
1317 dnl # Public global zone stats now include a free page count. However
1318 dnl # the enumerated names of the counters have changed since this API
1319 dnl # was introduced. We need to deduce the corrent name to use. This
1320 dnl # replaces the priviate get_zone_counts() interface.
1321 dnl #
1322 dnl # NR_FREE_PAGES was available from 2.6.21 to current kernels, which
1323 dnl # is 2.6.30 as of when this was written.
1324 dnl #
1325 AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_FREE], [
1326 AC_MSG_CHECKING([whether page state NR_FREE_PAGES is available])
1327 SPL_LINUX_TRY_COMPILE([
1328 #include <linux/mm.h>
1329 ],[
1330 enum zone_stat_item zsi;
1331 zsi = NR_FREE_PAGES;
1332 ],[
1333 AC_MSG_RESULT(yes)
1334 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_FREE_PAGES, 1,
1335 [Page state NR_FREE_PAGES is available])
1336 ],[
1337 AC_MSG_RESULT(no)
1338 ])
1339 ])
1340
1341 dnl #
1342 dnl # 2.6.21 API change (plus subsequent naming convention changes),
1343 dnl # Public global zone stats now include an inactive page count. However
1344 dnl # the enumerated names of the counters have changed since this API
1345 dnl # was introduced. We need to deduce the corrent name to use. This
1346 dnl # replaces the priviate get_zone_counts() interface.
1347 dnl #
1348 dnl # NR_INACTIVE was available from 2.6.21 to 2.6.27 and included both
1349 dnl # anonymous and file inactive pages. As of 2.6.28 it was split in
1350 dnl # to NR_INACTIVE_ANON and NR_INACTIVE_FILE.
1351 dnl #
1352 AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_INACTIVE], [
1353 AC_MSG_CHECKING([whether page state NR_INACTIVE is available])
1354 SPL_LINUX_TRY_COMPILE([
1355 #include <linux/mm.h>
1356 ],[
1357 enum zone_stat_item zsi;
1358 zsi = NR_INACTIVE;
1359 ],[
1360 AC_MSG_RESULT(yes)
1361 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_INACTIVE, 1,
1362 [Page state NR_INACTIVE is available])
1363 ],[
1364 AC_MSG_RESULT(no)
1365 ])
1366
1367 AC_MSG_CHECKING([whether page state NR_INACTIVE_ANON is available])
1368 SPL_LINUX_TRY_COMPILE([
1369 #include <linux/mm.h>
1370 ],[
1371 enum zone_stat_item zsi;
1372 zsi = NR_INACTIVE_ANON;
1373 ],[
1374 AC_MSG_RESULT(yes)
1375 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_ANON, 1,
1376 [Page state NR_INACTIVE_ANON is available])
1377 ],[
1378 AC_MSG_RESULT(no)
1379 ])
1380
1381 AC_MSG_CHECKING([whether page state NR_INACTIVE_FILE is available])
1382 SPL_LINUX_TRY_COMPILE([
1383 #include <linux/mm.h>
1384 ],[
1385 enum zone_stat_item zsi;
1386 zsi = NR_INACTIVE_FILE;
1387 ],[
1388 AC_MSG_RESULT(yes)
1389 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_FILE, 1,
1390 [Page state NR_INACTIVE_FILE is available])
1391 ],[
1392 AC_MSG_RESULT(no)
1393 ])
1394 ])
1395
1396 dnl #
1397 dnl # 2.6.21 API change (plus subsequent naming convention changes),
1398 dnl # Public global zone stats now include an active page count. However
1399 dnl # the enumerated names of the counters have changed since this API
1400 dnl # was introduced. We need to deduce the corrent name to use. This
1401 dnl # replaces the priviate get_zone_counts() interface.
1402 dnl #
1403 dnl # NR_ACTIVE was available from 2.6.21 to 2.6.27 and included both
1404 dnl # anonymous and file active pages. As of 2.6.28 it was split in
1405 dnl # to NR_ACTIVE_ANON and NR_ACTIVE_FILE.
1406 dnl #
1407 AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_ACTIVE], [
1408 AC_MSG_CHECKING([whether page state NR_ACTIVE is available])
1409 SPL_LINUX_TRY_COMPILE([
1410 #include <linux/mm.h>
1411 ],[
1412 enum zone_stat_item zsi;
1413 zsi = NR_ACTIVE;
1414 ],[
1415 AC_MSG_RESULT(yes)
1416 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_ACTIVE, 1,
1417 [Page state NR_ACTIVE is available])
1418 ],[
1419 AC_MSG_RESULT(no)
1420 ])
1421
1422 AC_MSG_CHECKING([whether page state NR_ACTIVE_ANON is available])
1423 SPL_LINUX_TRY_COMPILE([
1424 #include <linux/mm.h>
1425 ],[
1426 enum zone_stat_item zsi;
1427 zsi = NR_ACTIVE_ANON;
1428 ],[
1429 AC_MSG_RESULT(yes)
1430 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_ANON, 1,
1431 [Page state NR_ACTIVE_ANON is available])
1432 ],[
1433 AC_MSG_RESULT(no)
1434 ])
1435
1436 AC_MSG_CHECKING([whether page state NR_ACTIVE_FILE is available])
1437 SPL_LINUX_TRY_COMPILE([
1438 #include <linux/mm.h>
1439 ],[
1440 enum zone_stat_item zsi;
1441 zsi = NR_ACTIVE_FILE;
1442 ],[
1443 AC_MSG_RESULT(yes)
1444 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_FILE, 1,
1445 [Page state NR_ACTIVE_FILE is available])
1446 ],[
1447 AC_MSG_RESULT(no)
1448 ])
1449 ])
1450
1451 dnl #
1452 dnl # Proposed API change for legacy kernels.
1453 dnl # This symbol is not available in older kernels. For kernels post
1454 dnl # 2.6.21 the global_page_state() API is used to get free/inactive/active
1455 dnl # page state information. This symbol is only used in legacy kernels
1456 dnl # any only as a last resort.
1457 dnl
1458 AC_DEFUN([SPL_AC_GET_ZONE_COUNTS], [
1459 AC_MSG_CHECKING([whether symbol get_zone_counts is needed])
1460 SPL_LINUX_TRY_COMPILE([
1461 ],[
1462 #if !defined(HAVE_ZONE_STAT_ITEM_NR_FREE_PAGES)
1463 #error "global_page_state needs NR_FREE_PAGES"
1464 #endif
1465
1466 #if !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE) && \
1467 !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_ANON) && \
1468 !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_FILE)
1469 #error "global_page_state needs NR_ACTIVE*"
1470 #endif
1471
1472 #if !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE) && \
1473 !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_ANON) && \
1474 !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_FILE)
1475 #error "global_page_state needs NR_INACTIVE*"
1476 #endif
1477 ],[
1478 AC_MSG_RESULT(no)
1479 ],[
1480 AC_MSG_RESULT(yes)
1481 AC_DEFINE(NEED_GET_ZONE_COUNTS, 1,
1482 [get_zone_counts() is needed])
1483
1484 SPL_CHECK_SYMBOL_EXPORT(
1485 [get_zone_counts],
1486 [],
1487 [AC_DEFINE(HAVE_GET_ZONE_COUNTS, 1,
1488 [get_zone_counts() is available])],
1489 [])
1490 ])
1491 ])
1492
1493 dnl #
1494 dnl # 2.6.27 API change,
1495 dnl # The user_path_dir() replaces __user_walk()
1496 dnl #
1497 AC_DEFUN([SPL_AC_USER_PATH_DIR], [
1498 SPL_CHECK_SYMBOL_EXPORT(
1499 [user_path_at],
1500 [],
1501 [AC_DEFINE(HAVE_USER_PATH_DIR, 1,
1502 [user_path_dir() is available])],
1503 [])
1504 ])
1505
1506 dnl #
1507 dnl # Symbol available in RHEL kernels not in stock kernels.
1508 dnl #
1509 AC_DEFUN([SPL_AC_SET_FS_PWD], [
1510 SPL_CHECK_SYMBOL_EXPORT(
1511 [set_fs_pwd],
1512 [],
1513 [AC_DEFINE(HAVE_SET_FS_PWD, 1,
1514 [set_fs_pwd() is available])],
1515 [])
1516 ])
1517
1518 dnl #
1519 dnl # 2.6.25 API change,
1520 dnl # Simplied API by replacing mnt+dentry args with a single path arg.
1521 dnl #
1522 AC_DEFUN([SPL_AC_2ARGS_SET_FS_PWD],
1523 [AC_MSG_CHECKING([whether set_fs_pwd() wants 2 args])
1524 SPL_LINUX_TRY_COMPILE([
1525 #include <linux/sched.h>
1526 #include <linux/fs_struct.h>
1527 ],[
1528 set_fs_pwd(NULL, NULL);
1529 ],[
1530 AC_MSG_RESULT(yes)
1531 AC_DEFINE(HAVE_2ARGS_SET_FS_PWD, 1,
1532 [set_fs_pwd() wants 2 args])
1533 ],[
1534 AC_MSG_RESULT(no)
1535 ])
1536 ])
1537
1538 dnl #
1539 dnl # SLES API change, never adopted in mainline,
1540 dnl # Third 'struct vfsmount *' argument removed.
1541 dnl #
1542 AC_DEFUN([SPL_AC_2ARGS_VFS_UNLINK],
1543 [AC_MSG_CHECKING([whether vfs_unlink() wants 2 args])
1544 SPL_LINUX_TRY_COMPILE([
1545 #include <linux/fs.h>
1546 ],[
1547 vfs_unlink(NULL, NULL);
1548 ],[
1549 AC_MSG_RESULT(yes)
1550 AC_DEFINE(HAVE_2ARGS_VFS_UNLINK, 1,
1551 [vfs_unlink() wants 2 args])
1552 ],[
1553 AC_MSG_RESULT(no)
1554 ])
1555 ])
1556
1557 dnl #
1558 dnl # SLES API change, never adopted in mainline,
1559 dnl # Third and sixth 'struct vfsmount *' argument removed.
1560 dnl #
1561 AC_DEFUN([SPL_AC_4ARGS_VFS_RENAME],
1562 [AC_MSG_CHECKING([whether vfs_rename() wants 4 args])
1563 SPL_LINUX_TRY_COMPILE([
1564 #include <linux/fs.h>
1565 ],[
1566 vfs_rename(NULL, NULL, NULL, NULL);
1567 ],[
1568 AC_MSG_RESULT(yes)
1569 AC_DEFINE(HAVE_4ARGS_VFS_RENAME, 1,
1570 [vfs_rename() wants 4 args])
1571 ],[
1572 AC_MSG_RESULT(no)
1573 ])
1574 ])
1575
1576 dnl #
1577 dnl # 2.6.36 API change,
1578 dnl # The 'struct fs_struct->lock' was changed from a rwlock_t to
1579 dnl # a spinlock_t to improve the fastpath performance.
1580 dnl #
1581 AC_DEFUN([SPL_AC_FS_STRUCT_SPINLOCK], [
1582 AC_MSG_CHECKING([whether struct fs_struct uses spinlock_t])
1583 SPL_LINUX_TRY_COMPILE([
1584 #include <linux/sched.h>
1585 #include <linux/fs_struct.h>
1586 ],[
1587 struct fs_struct fs;
1588 spin_lock_init(&fs.lock);
1589 ],[
1590 AC_MSG_RESULT(yes)
1591 AC_DEFINE(HAVE_FS_STRUCT_SPINLOCK, 1,
1592 [struct fs_struct uses spinlock_t])
1593 ],[
1594 AC_MSG_RESULT(no)
1595 ])
1596 ])
1597
1598 dnl #
1599 dnl # 2.6.29 API change,
1600 dnl # check whether 'struct cred' exists
1601 dnl #
1602 AC_DEFUN([SPL_AC_CRED_STRUCT], [
1603 AC_MSG_CHECKING([whether struct cred exists])
1604 SPL_LINUX_TRY_COMPILE([
1605 #include <linux/cred.h>
1606 ],[
1607 struct cred *cr;
1608 cr = NULL;
1609 ],[
1610 AC_MSG_RESULT(yes)
1611 AC_DEFINE(HAVE_CRED_STRUCT, 1, [struct cred exists])
1612 ],[
1613 AC_MSG_RESULT(no)
1614 ])
1615 ])
1616
1617 dnl #
1618 dnl # Custom SPL patch may export this symbol.
1619 dnl #
1620 AC_DEFUN([SPL_AC_GROUPS_SEARCH], [
1621 SPL_CHECK_SYMBOL_EXPORT(
1622 [groups_search],
1623 [],
1624 [AC_DEFINE(HAVE_GROUPS_SEARCH, 1,
1625 [groups_search() is available])],
1626 [])
1627 ])
1628
1629 dnl #
1630 dnl # 2.6.x API change,
1631 dnl # __put_task_struct() was exported in RHEL5 but unavailable elsewhere.
1632 dnl #
1633 AC_DEFUN([SPL_AC_PUT_TASK_STRUCT], [
1634 SPL_CHECK_SYMBOL_EXPORT(
1635 [__put_task_struct],
1636 [],
1637 [AC_DEFINE(HAVE_PUT_TASK_STRUCT, 1,
1638 [__put_task_struct() is available])],
1639 [])
1640 ])
1641
1642 dnl #
1643 dnl # 2.6.32 API change,
1644 dnl # Unused 'struct file *' removed from prototype.
1645 dnl #
1646 AC_DEFUN([SPL_AC_5ARGS_PROC_HANDLER], [
1647 AC_MSG_CHECKING([whether proc_handler() wants 5 args])
1648 SPL_LINUX_TRY_COMPILE([
1649 #include <linux/sysctl.h>
1650 ],[
1651 proc_dostring(NULL, 0, NULL, NULL, NULL);
1652 ],[
1653 AC_MSG_RESULT(yes)
1654 AC_DEFINE(HAVE_5ARGS_PROC_HANDLER, 1,
1655 [proc_handler() wants 5 args])
1656 ],[
1657 AC_MSG_RESULT(no)
1658 ])
1659 ])
1660
1661 dnl #
1662 dnl # 2.6.x API change,
1663 dnl # kvasprintf() function added.
1664 dnl #
1665 AC_DEFUN([SPL_AC_KVASPRINTF], [
1666 SPL_CHECK_SYMBOL_EXPORT(
1667 [kvasprintf],
1668 [],
1669 [AC_DEFINE(HAVE_KVASPRINTF, 1,
1670 [kvasprintf() is available])],
1671 [])
1672 ])
1673
1674 dnl #
1675 dnl # 2.6.35 API change,
1676 dnl # Unused 'struct dentry *' removed from prototype.
1677 dnl #
1678 AC_DEFUN([SPL_AC_3ARGS_FILE_FSYNC], [
1679 AC_MSG_CHECKING([whether file_fsync() wants 3 args])
1680 SPL_LINUX_TRY_COMPILE([
1681 #include <linux/buffer_head.h>
1682 ],[
1683 file_fsync(NULL, NULL, 0);
1684 ],[
1685 AC_MSG_RESULT(yes)
1686 AC_DEFINE(HAVE_3ARGS_FILE_FSYNC, 1,
1687 [file_fsync() wants 3 args])
1688 ],[
1689 AC_MSG_RESULT(no)
1690 ])
1691 ])
1692
1693 dnl #
1694 dnl # 2.6.33 API change. Also backported in RHEL5 as of 2.6.18-190.el5.
1695 dnl # Earlier versions of rwsem_is_locked() were inline and had a race
1696 dnl # condition. The fixed version is exported as a symbol. The race
1697 dnl # condition is fixed by acquiring sem->wait_lock, so we must not
1698 dnl # call that version while holding sem->wait_lock.
1699 dnl #
1700 AC_DEFUN([SPL_AC_EXPORTED_RWSEM_IS_LOCKED], [
1701 SPL_CHECK_SYMBOL_EXPORT(
1702 [rwsem_is_locked],
1703 [lib/rwsem-spinlock.c],
1704 [AC_DEFINE(RWSEM_IS_LOCKED_TAKES_WAIT_LOCK, 1,
1705 [rwsem_is_locked() acquires sem->wait_lock])],
1706 [])
1707 ])
1708
1709 dnl #
1710 dnl # 2.6.37 API compat,
1711 dnl # The function invalidate_inodes() is no longer exported by the kernel.
1712 dnl # The prototype however is still available which means it is safe
1713 dnl # to acquire the symbol's address using spl_kallsyms_lookup_name().
1714 dnl #
1715 AC_DEFUN([SPL_AC_KERNEL_INVALIDATE_INODES], [
1716 SPL_CHECK_SYMBOL_EXPORT(
1717 [invalidate_inodes],
1718 [],
1719 [AC_DEFINE(HAVE_INVALIDATE_INODES, 1,
1720 [invalidate_inodes() is available])],
1721 [])
1722 ])
1723
1724 dnl #
1725 dnl # 2.6.39 API compat,
1726 dnl # The function invalidate_inodes() now take 2 arguments. The second
1727 dnl # 'kill_dirty' argument describes how invalidate_inodes() should
1728 dnl # handle dirty inodes. Only when set will dirty inodes be discarded,
1729 dnl # otherwise they will be handled as busy.
1730 dnl #
1731 dnl # Unfortunately, we don't have access to the invalidate_inodes()
1732 dnl # prototype so it's not easy to check how many arguments it takes.
1733 dnl # However, this change was done for the benefit of invalidate_device()
1734 dnl # which also added an argument. The invalidate_device() symbol does
1735 dnl # exist in the development headers so if it takes two arguments we
1736 dnl # can fairly safely infer that invalidate_inodes() takes two arguments
1737 dnl # as well. See commit 93b270f76e7ef3b81001576860c2701931cdc78b.
1738 dnl #
1739 AC_DEFUN([SPL_AC_KERNEL_2ARGS_INVALIDATE_INODES],
1740 [AC_MSG_CHECKING([whether invalidate_inodes() wants 2 args])
1741 SPL_LINUX_TRY_COMPILE([
1742 #include <linux/fs.h>
1743 ],[
1744 return __invalidate_device(NULL, 0);
1745 ],[
1746 AC_MSG_RESULT(yes)
1747 AC_DEFINE(HAVE_2ARGS_INVALIDATE_INODES, 1,
1748 [invalidate_inodes() wants 2 args])
1749 ],[
1750 AC_MSG_RESULT(no)
1751 ])
1752 ])
1753
1754 dnl #
1755 dnl # 2.6.xx API compat,
1756 dnl # There currently exists no exposed API to partially shrink the dcache.
1757 dnl # The expected mechanism to shrink the cache is a registered shrinker
1758 dnl # which is called during memory pressure.
1759 dnl #
1760 AC_DEFUN([SPL_AC_SHRINK_DCACHE_MEMORY], [
1761 SPL_CHECK_SYMBOL_EXPORT(
1762 [shrink_dcache_memory],
1763 [fs/dcache.c],
1764 [AC_DEFINE(HAVE_SHRINK_DCACHE_MEMORY, 1,
1765 [shrink_dcache_memory() is available])],
1766 [])
1767 ])
1768
1769 dnl #
1770 dnl # 2.6.xx API compat,
1771 dnl # There currently exists no exposed API to partially shrink the icache.
1772 dnl # The expected mechanism to shrink the cache is a registered shrinker
1773 dnl # which is called during memory pressure.
1774 dnl #
1775 AC_DEFUN([SPL_AC_SHRINK_ICACHE_MEMORY], [
1776 SPL_CHECK_SYMBOL_EXPORT(
1777 [shrink_icache_memory],
1778 [fs/inode.c],
1779 [AC_DEFINE(HAVE_SHRINK_ICACHE_MEMORY, 1,
1780 [shrink_icache_memory() is available])],
1781 [])
1782 ])