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