]> git.proxmox.com Git - mirror_spl-debian.git/blob - config/spl-build.m4
Reimplement mutexs for Linux lock profiling/analysis
[mirror_spl-debian.git] / config / spl-build.m4
1 dnl #
2 dnl # Default SPL kernel configuration
3 dnl #
4 AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
5 SPL_AC_KERNEL
6
7 dnl # Kernel build make options
8 dnl # KERNELMAKE_PARAMS="V=1" # Enable verbose module build
9 KERNELMAKE_PARAMS="V=1"
10
11 dnl # -Wall -fno-strict-aliasing -Wstrict-prototypes and other
12 dnl # compiler options are added by the kernel build system.
13 abs_srcdir=`readlink -f ${srcdir}`
14 KERNELCPPFLAGS="$KERNELCPPFLAGS -Wstrict-prototypes -Werror"
15 KERNELCPPFLAGS="$KERNELCPPFLAGS -I${abs_srcdir} -I${abs_srcdir}/include"
16
17 if test "${LINUX_OBJ}" != "${LINUX}"; then
18 KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ"
19 fi
20
21 AC_SUBST(KERNELMAKE_PARAMS)
22 AC_SUBST(KERNELCPPFLAGS)
23
24 SPL_AC_DEBUG
25 SPL_AC_DEBUG_KMEM
26 SPL_AC_DEBUG_KSTAT
27 SPL_AC_DEBUG_CALLB
28 SPL_AC_TYPE_UINTPTR_T
29 SPL_AC_TYPE_ATOMIC64_T
30 SPL_AC_3ARGS_INIT_WORK
31 SPL_AC_2ARGS_REGISTER_SYSCTL
32 SPL_AC_SET_SHRINKER
33 SPL_AC_PATH_IN_NAMEIDATA
34 SPL_AC_TASK_CURR
35 SPL_AC_CTL_UNNUMBERED
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_DIV64_64
53 SPL_AC_DIV64_U64
54 SPL_AC_3ARGS_ON_EACH_CPU
55 SPL_AC_KALLSYMS_LOOKUP_NAME
56 SPL_AC_GET_VMALLOC_INFO
57 SPL_AC_PGDAT_HELPERS
58 SPL_AC_FIRST_ONLINE_PGDAT
59 SPL_AC_NEXT_ONLINE_PGDAT
60 SPL_AC_NEXT_ZONE
61 SPL_AC_PGDAT_LIST
62 SPL_AC_GLOBAL_PAGE_STATE
63 SPL_AC_ZONE_STAT_ITEM_FREE
64 SPL_AC_ZONE_STAT_ITEM_INACTIVE
65 SPL_AC_ZONE_STAT_ITEM_ACTIVE
66 SPL_AC_GET_ZONE_COUNTS
67 SPL_AC_2ARGS_VFS_UNLINK
68 SPL_AC_4ARGS_VFS_RENAME
69 SPL_AC_CRED_STRUCT
70 SPL_AC_GROUPS_SEARCH
71 SPL_AC_PUT_TASK_STRUCT
72 ])
73
74 AC_DEFUN([SPL_AC_MODULE_SYMVERS], [
75 modpost=$LINUX/scripts/Makefile.modpost
76 AC_MSG_CHECKING([kernel file name for module symbols])
77 if test -f "$modpost"; then
78 if grep -q Modules.symvers $modpost; then
79 LINUX_SYMBOLS=Modules.symvers
80 else
81 LINUX_SYMBOLS=Module.symvers
82 fi
83 else
84 LINUX_SYMBOLS=NONE
85 fi
86 AC_MSG_RESULT($LINUX_SYMBOLS)
87 AC_SUBST(LINUX_SYMBOLS)
88 ])
89
90 AC_DEFUN([SPL_AC_KERNEL], [
91 AC_ARG_WITH([linux],
92 AS_HELP_STRING([--with-linux=PATH],
93 [Path to kernel source]),
94 [kernelsrc="$withval"])
95
96 AC_ARG_WITH([linux-obj],
97 AS_HELP_STRING([--with-linux-obj=PATH],
98 [Path to kernel build objects]),
99 [kernelbuild="$withval"])
100
101 AC_MSG_CHECKING([kernel source directory])
102 if test -z "$kernelsrc"; then
103 sourcelink=`ls -1d /usr/src/kernels/* /usr/src/linux-* \
104 2>/dev/null | grep -v obj | tail -1`
105
106 if test -e ${sourcelink}; then
107 kernelsrc=`readlink -f ${sourcelink}`
108 else
109 AC_MSG_RESULT([Not found])
110 AC_MSG_ERROR([
111 *** Please specify the location of the kernel source
112 *** with the '--with-linux=PATH' option])
113 fi
114 else
115 if test "$kernelsrc" = "NONE"; then
116 kernsrcver=NONE
117 fi
118 fi
119
120 AC_MSG_RESULT([$kernelsrc])
121 AC_MSG_CHECKING([kernel build directory])
122 if test -z "$kernelbuild"; then
123 if test -d ${kernelsrc}-obj/`arch`/`arch`; then
124 kernelbuild=${kernelsrc}-obj/`arch`/`arch`
125 elif test -d ${kernelsrc}-obj/`arch`/default; then
126 kernelbuild=${kernelsrc}-obj/`arch`/default
127 elif test -d `dirname ${kernelsrc}`/build-`arch`; then
128 kernelbuild=`dirname ${kernelsrc}`/build-`arch`
129 else
130 kernelbuild=${kernelsrc}
131 fi
132 fi
133 AC_MSG_RESULT([$kernelbuild])
134
135 AC_MSG_CHECKING([kernel source version])
136 if test -r $kernelbuild/include/linux/version.h &&
137 fgrep -q UTS_RELEASE $kernelbuild/include/linux/version.h; then
138
139 kernsrcver=`(echo "#include <linux/version.h>";
140 echo "kernsrcver=UTS_RELEASE") |
141 cpp -I $kernelbuild/include |
142 grep "^kernsrcver=" | cut -d \" -f 2`
143
144 elif test -r $kernelbuild/include/linux/utsrelease.h &&
145 fgrep -q UTS_RELEASE $kernelbuild/include/linux/utsrelease.h; then
146
147 kernsrcver=`(echo "#include <linux/utsrelease.h>";
148 echo "kernsrcver=UTS_RELEASE") |
149 cpp -I $kernelbuild/include |
150 grep "^kernsrcver=" | cut -d \" -f 2`
151 fi
152
153 if test -z "$kernsrcver"; then
154 AC_MSG_RESULT([Not found])
155 AC_MSG_ERROR([
156 *** Cannot determine the version of the linux kernel source.
157 *** Please prepare the kernel before running this script])
158 fi
159
160 AC_MSG_RESULT([$kernsrcver])
161
162 LINUX=${kernelsrc}
163 LINUX_OBJ=${kernelbuild}
164 LINUX_VERSION=${kernsrcver}
165
166 AC_SUBST(LINUX)
167 AC_SUBST(LINUX_OBJ)
168 AC_SUBST(LINUX_VERSION)
169
170 SPL_AC_MODULE_SYMVERS
171 ])
172
173 dnl #
174 dnl # Default SPL user configuration
175 dnl #
176 AC_DEFUN([SPL_AC_CONFIG_USER], [])
177
178 AC_DEFUN([SPL_AC_LICENSE], [
179 AC_MSG_CHECKING([spl license])
180 LICENSE=GPL
181 AC_MSG_RESULT([$LICENSE])
182 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DHAVE_GPL_ONLY_SYMBOLS"
183 AC_SUBST(LICENSE)
184 ])
185
186 AC_DEFUN([SPL_AC_CONFIG], [
187 SPL_CONFIG=all
188 AC_ARG_WITH([config],
189 AS_HELP_STRING([--with-config=CONFIG],
190 [Config file 'kernel|user|all']),
191 [SPL_CONFIG="$withval"])
192
193 AC_MSG_CHECKING([spl config])
194 AC_MSG_RESULT([$SPL_CONFIG]);
195 AC_SUBST(SPL_CONFIG)
196
197 case "$SPL_CONFIG" in
198 kernel) SPL_AC_CONFIG_KERNEL ;;
199 user) SPL_AC_CONFIG_USER ;;
200 all) SPL_AC_CONFIG_KERNEL
201 SPL_AC_CONFIG_USER ;;
202 *)
203 AC_MSG_RESULT([Error!])
204 AC_MSG_ERROR([Bad value "$SPL_CONFIG" for --with-config,
205 user kernel|user|all]) ;;
206 esac
207
208 AM_CONDITIONAL([CONFIG_USER],
209 [test "$SPL_CONFIG" = user] ||
210 [test "$SPL_CONFIG" = all])
211 AM_CONDITIONAL([CONFIG_KERNEL],
212 [test "$SPL_CONFIG" = kernel] ||
213 [test "$SPL_CONFIG" = all])
214 ])
215
216 AC_DEFUN([SPL_AC_DEBUG], [
217 AC_MSG_CHECKING([whether debugging is enabled])
218 AC_ARG_ENABLE( [debug],
219 AS_HELP_STRING([--enable-debug],
220 [Enable generic debug support (default off)]),
221 [ case "$enableval" in
222 yes) spl_ac_debug=yes ;;
223 no) spl_ac_debug=no ;;
224 *) AC_MSG_RESULT([Error!])
225 AC_MSG_ERROR([Bad value "$enableval" for --enable-debug]) ;;
226 esac ]
227 )
228 if test "$spl_ac_debug" = yes; then
229 AC_MSG_RESULT([yes])
230 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG"
231 else
232 AC_MSG_RESULT([no])
233 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG"
234 fi
235 ])
236
237 AC_DEFUN([SPL_AC_DEBUG_KMEM], [
238 AC_MSG_CHECKING([whether kmem debugging is enabled])
239 AC_ARG_ENABLE( [debug-kmem],
240 AS_HELP_STRING([--enable-debug-kmem],
241 [Enable kmem debug support (default off)]),
242 [ case "$enableval" in
243 yes) spl_ac_debug_kmem=yes ;;
244 no) spl_ac_debug_kmem=no ;;
245 *) AC_MSG_RESULT([Error!])
246 AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-kmem]) ;;
247 esac ]
248 )
249 if test "$spl_ac_debug_kmem" = yes; then
250 AC_MSG_RESULT([yes])
251 AC_DEFINE([DEBUG_KMEM], [1],
252 [Define to 1 to enable kmem debugging])
253 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM"
254 else
255 AC_MSG_RESULT([no])
256 fi
257 ])
258
259 AC_DEFUN([SPL_AC_DEBUG_KSTAT], [
260 AC_MSG_CHECKING([whether kstat debugging is enabled])
261 AC_ARG_ENABLE( [debug-kstat],
262 AS_HELP_STRING([--enable-debug-kstat],
263 [Enable kstat debug support (default off)]),
264 [ case "$enableval" in
265 yes) spl_ac_debug_kstat=yes ;;
266 no) spl_ac_debug_kstat=no ;;
267 *) AC_MSG_RESULT([Error!])
268 AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-kstat]) ;;
269 esac ]
270 )
271 if test "$spl_ac_debug_kstat" = yes; then
272 AC_MSG_RESULT([yes])
273 AC_DEFINE([DEBUG_KSTAT], [1],
274 [Define to 1 to enable kstat debugging])
275 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KSTAT"
276 else
277 AC_MSG_RESULT([no])
278 fi
279 ])
280
281 AC_DEFUN([SPL_AC_DEBUG_CALLB], [
282 AC_MSG_CHECKING([whether callb debugging is enabled])
283 AC_ARG_ENABLE( [debug-callb],
284 AS_HELP_STRING([--enable-debug-callb],
285 [Enable callb debug support (default off)]),
286 [ case "$enableval" in
287 yes) spl_ac_debug_callb=yes ;;
288 no) spl_ac_debug_callb=no ;;
289 *) AC_MSG_RESULT([Error!])
290 AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-callb]) ;;
291 esac ]
292 )
293 if test "$spl_ac_debug_callb" = yes; then
294 AC_MSG_RESULT([yes])
295 AC_DEFINE([DEBUG_CALLB], [1],
296 [Define to 1 to enable callb debugging])
297 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_CALLB"
298 else
299 AC_MSG_RESULT([no])
300 fi
301 ])
302
303 dnl #
304 dnl # SPL_LINUX_CONFTEST
305 dnl #
306 AC_DEFUN([SPL_LINUX_CONFTEST], [
307 cat >conftest.c <<_ACEOF
308 $1
309 _ACEOF
310 ])
311
312 dnl #
313 dnl # SPL_LANG_PROGRAM(C)([PROLOGUE], [BODY])
314 dnl #
315 m4_define([SPL_LANG_PROGRAM], [
316 $1
317 int
318 main (void)
319 {
320 dnl Do *not* indent the following line: there may be CPP directives.
321 dnl Don't move the `;' right after for the same reason.
322 $2
323 ;
324 return 0;
325 }
326 ])
327
328 dnl #
329 dnl # SPL_LINUX_COMPILE_IFELSE / like AC_COMPILE_IFELSE
330 dnl #
331 AC_DEFUN([SPL_LINUX_COMPILE_IFELSE], [
332 m4_ifvaln([$1], [SPL_LINUX_CONFTEST([$1])])
333 rm -Rf build && mkdir -p build
334 echo "obj-m := conftest.o" >build/Makefile
335 AS_IF(
336 [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])],
337 [$4],
338 [_AC_MSG_LOG_CONFTEST m4_ifvaln([$5],[$5])]
339 )
340 rm -Rf build
341 ])
342
343 dnl #
344 dnl # SPL_LINUX_TRY_COMPILE like AC_TRY_COMPILE
345 dnl #
346 AC_DEFUN([SPL_LINUX_TRY_COMPILE],
347 [SPL_LINUX_COMPILE_IFELSE(
348 [AC_LANG_SOURCE([SPL_LANG_PROGRAM([[$1]], [[$2]])])],
349 [modules],
350 [test -s build/conftest.o],
351 [$3], [$4])
352 ])
353
354 dnl #
355 dnl # SPL_LINUX_CONFIG
356 dnl #
357 AC_DEFUN([SPL_LINUX_CONFIG],
358 [AC_MSG_CHECKING([whether Linux was built with CONFIG_$1])
359 SPL_LINUX_TRY_COMPILE([
360 #ifndef AUTOCONF_INCLUDED
361 #include <linux/config.h>
362 #endif
363 ],[
364 #ifndef CONFIG_$1
365 #error CONFIG_$1 not #defined
366 #endif
367 ],[
368 AC_MSG_RESULT([yes])
369 $2
370 ],[
371 AC_MSG_RESULT([no])
372 $3
373 ])
374 ])
375
376 dnl #
377 dnl # SPL_CHECK_SYMBOL_EXPORT
378 dnl # check symbol exported or not
379 dnl #
380 AC_DEFUN([SPL_CHECK_SYMBOL_EXPORT],
381 [AC_MSG_CHECKING([whether symbol $1 is exported])
382 grep -q -E '[[[:space:]]]$1[[[:space:]]]' \
383 $LINUX_OBJ/Module*.symvers 2>/dev/null
384 rc=$?
385 if test $rc -ne 0; then
386 export=0
387 for file in $2; do
388 grep -q -E "EXPORT_SYMBOL.*($1)" \
389 "$LINUX_OBJ/$file" 2>/dev/null
390 rc=$?
391 if test $rc -eq 0; then
392 export=1
393 break;
394 fi
395 done
396 if test $export -eq 0; then
397 AC_MSG_RESULT([no])
398 $4
399 else
400 AC_MSG_RESULT([yes])
401 $3
402 fi
403 else
404 AC_MSG_RESULT([yes])
405 $3
406 fi
407 ])
408
409 dnl #
410 dnl # SPL_CHECK_HEADER
411 dnl # check whether header exists and define HAVE_$2_HEADER
412 dnl #
413 AC_DEFUN([SPL_CHECK_HEADER],
414 [AC_MSG_CHECKING([whether header $1 exists])
415 SPL_LINUX_TRY_COMPILE([
416 #include <$1>
417 ],[
418 return 0;
419 ],[
420 AC_DEFINE(HAVE_$2_HEADER, 1, [$1 exists])
421 AC_MSG_RESULT(yes)
422 $3
423 ],[
424 AC_MSG_RESULT(no)
425 $4
426 ])
427 ])
428
429 dnl #
430 dnl # 2.6.24 API change,
431 dnl # check if uintptr_t typedef is defined
432 dnl #
433 AC_DEFUN([SPL_AC_TYPE_UINTPTR_T],
434 [AC_MSG_CHECKING([whether kernel defines uintptr_t])
435 SPL_LINUX_TRY_COMPILE([
436 #include <linux/types.h>
437 ],[
438 uintptr_t *ptr;
439 ],[
440 AC_MSG_RESULT([yes])
441 AC_DEFINE(HAVE_UINTPTR_T, 1,
442 [kernel defines uintptr_t])
443 ],[
444 AC_MSG_RESULT([no])
445 ])
446 ])
447
448 dnl #
449 dnl # 2.6.x API change,
450 dnl # check if atomic64_t typedef is defined
451 dnl #
452 AC_DEFUN([SPL_AC_TYPE_ATOMIC64_T],
453 [AC_MSG_CHECKING([whether kernel defines atomic64_t])
454 SPL_LINUX_TRY_COMPILE([
455 #include <asm/atomic.h>
456 ],[
457 atomic64_t *ptr;
458 ],[
459 AC_MSG_RESULT([yes])
460 AC_DEFINE(HAVE_ATOMIC64_T, 1,
461 [kernel defines atomic64_t])
462 ],[
463 AC_MSG_RESULT([no])
464 ])
465 ])
466
467 dnl #
468 dnl # 2.6.20 API change,
469 dnl # INIT_WORK use 2 args and not store data inside
470 dnl #
471 AC_DEFUN([SPL_AC_3ARGS_INIT_WORK],
472 [AC_MSG_CHECKING([whether INIT_WORK wants 3 args])
473 SPL_LINUX_TRY_COMPILE([
474 #include <linux/workqueue.h>
475 ],[
476 struct work_struct work;
477 INIT_WORK(&work, NULL, NULL);
478 ],[
479 AC_MSG_RESULT(yes)
480 AC_DEFINE(HAVE_3ARGS_INIT_WORK, 1,
481 [INIT_WORK wants 3 args])
482 ],[
483 AC_MSG_RESULT(no)
484 ])
485 ])
486
487 dnl #
488 dnl # 2.6.21 API change,
489 dnl # 'register_sysctl_table' use only one argument instead of two
490 dnl #
491 AC_DEFUN([SPL_AC_2ARGS_REGISTER_SYSCTL],
492 [AC_MSG_CHECKING([whether register_sysctl_table() wants 2 args])
493 SPL_LINUX_TRY_COMPILE([
494 #include <linux/sysctl.h>
495 ],[
496 return register_sysctl_table(NULL,0);
497 ],[
498 AC_MSG_RESULT(yes)
499 AC_DEFINE(HAVE_2ARGS_REGISTER_SYSCTL, 1,
500 [register_sysctl_table() wants 2 args])
501 ],[
502 AC_MSG_RESULT(no)
503 ])
504 ])
505
506 dnl #
507 dnl # 2.6.23 API change
508 dnl # Old set_shrinker API replaced with register_shrinker
509 dnl #
510 AC_DEFUN([SPL_AC_SET_SHRINKER], [
511 AC_MSG_CHECKING([whether set_shrinker() available])
512 SPL_LINUX_TRY_COMPILE([
513 #include <linux/mm.h>
514 ],[
515 return set_shrinker(DEFAULT_SEEKS, NULL);
516 ],[
517 AC_MSG_RESULT([yes])
518 AC_DEFINE(HAVE_SET_SHRINKER, 1,
519 [set_shrinker() available])
520 ],[
521 AC_MSG_RESULT([no])
522 ])
523 ])
524
525 dnl #
526 dnl # 2.6.25 API change,
527 dnl # struct path entry added to struct nameidata
528 dnl #
529 AC_DEFUN([SPL_AC_PATH_IN_NAMEIDATA],
530 [AC_MSG_CHECKING([whether struct path used in struct nameidata])
531 SPL_LINUX_TRY_COMPILE([
532 #include <linux/namei.h>
533 ],[
534 struct nameidata nd;
535
536 nd.path.mnt = NULL;
537 nd.path.dentry = NULL;
538 ],[
539 AC_MSG_RESULT(yes)
540 AC_DEFINE(HAVE_PATH_IN_NAMEIDATA, 1,
541 [struct path used in struct nameidata])
542 ],[
543 AC_MSG_RESULT(no)
544 ])
545 ])
546
547 dnl #
548 dnl # Custom SPL patch may export this system it is not required
549 dnl #
550 AC_DEFUN([SPL_AC_TASK_CURR], [
551 SPL_CHECK_SYMBOL_EXPORT([task_curr], [kernel/sched.c],
552 [AC_DEFINE(HAVE_TASK_CURR, 1, [task_curr() exported])],
553 [])
554 ])
555
556 dnl #
557 dnl # 2.6.19 API change,
558 dnl # Use CTL_UNNUMBERED when binary sysctl is not required
559 dnl #
560 AC_DEFUN([SPL_AC_CTL_UNNUMBERED],
561 [AC_MSG_CHECKING([whether unnumbered sysctl support exists])
562 SPL_LINUX_TRY_COMPILE([
563 #include <linux/sysctl.h>
564 ],[
565 #ifndef CTL_UNNUMBERED
566 #error CTL_UNNUMBERED undefined
567 #endif
568 ],[
569 AC_MSG_RESULT(yes)
570 AC_DEFINE(HAVE_CTL_UNNUMBERED, 1,
571 [unnumbered sysctl support exists])
572 ],[
573 AC_MSG_RESULT(no)
574 ])
575 ])
576
577 dnl #
578 dnl # 2.6.16 API change.
579 dnl # Check if 'fls64()' is available
580 dnl #
581 AC_DEFUN([SPL_AC_FLS64],
582 [AC_MSG_CHECKING([whether fls64() is available])
583 SPL_LINUX_TRY_COMPILE([
584 #include <linux/bitops.h>
585 ],[
586 return fls64(0);
587 ],[
588 AC_MSG_RESULT(yes)
589 AC_DEFINE(HAVE_FLS64, 1, [fls64() is available])
590 ],[
591 AC_MSG_RESULT(no)
592 ])
593 ])
594
595 dnl #
596 dnl # 2.6.18 API change, check whether device_create() is available.
597 dnl # Device_create() was introduced in 2.6.18 and depricated
598 dnl # class_device_create() which was fully removed in 2.6.26.
599 dnl #
600 AC_DEFUN([SPL_AC_DEVICE_CREATE], [
601 SPL_CHECK_SYMBOL_EXPORT(
602 [device_create],
603 [drivers/base/core.c],
604 [AC_DEFINE(HAVE_DEVICE_CREATE, 1,
605 [device_create() is available])],
606 [])
607 ])
608
609 dnl #
610 dnl # 2.6.27 API change,
611 dnl # device_create() uses 5 args, new 'drvdata' argument.
612 dnl #
613 AC_DEFUN([SPL_AC_5ARGS_DEVICE_CREATE], [
614 AC_MSG_CHECKING([whether device_create() wants 5 args])
615 tmp_flags="$EXTRA_KCFLAGS"
616 EXTRA_KCFLAGS="-Werror"
617 SPL_LINUX_TRY_COMPILE([
618 #include <linux/device.h>
619 ],[
620 device_create(NULL, NULL, 0, NULL, "%d", 1);
621 ],[
622 AC_MSG_RESULT(yes)
623 AC_DEFINE(HAVE_5ARGS_DEVICE_CREATE, 1,
624 [device_create wants 5 args])
625 ],[
626 AC_MSG_RESULT(no)
627 ])
628 EXTRA_KCFLAGS="$tmp_flags"
629 ])
630
631 dnl #
632 dnl # 2.6.13 API change, check whether class_device_create() is available.
633 dnl # Class_device_create() was introduced in 2.6.13 and depricated
634 dnl # class_simple_device_add() which was fully removed in 2.6.13.
635 dnl #
636 AC_DEFUN([SPL_AC_CLASS_DEVICE_CREATE], [
637 SPL_CHECK_SYMBOL_EXPORT(
638 [class_device_create],
639 [drivers/base/class.c],
640 [AC_DEFINE(HAVE_CLASS_DEVICE_CREATE, 1,
641 [class_device_create() is available])],
642 [])
643 ])
644
645 dnl #
646 dnl # 2.6.26 API change, set_normalized_timespec() is exported.
647 dnl #
648 AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_EXPORT], [
649 SPL_CHECK_SYMBOL_EXPORT(
650 [set_normalized_timespec],
651 [kernel/time.c],
652 [AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_EXPORT, 1,
653 [set_normalized_timespec() is available as export])],
654 [])
655 ])
656
657 dnl #
658 dnl # 2.6.16 API change, set_normalize_timespec() moved to time.c
659 dnl # previously it was available in time.h as an inline.
660 dnl #
661 AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE], [
662 AC_MSG_CHECKING([whether set_normalized_timespec() is an inline])
663 SPL_LINUX_TRY_COMPILE([
664 #include <linux/time.h>
665 void set_normalized_timespec(struct timespec *ts,
666 time_t sec, long nsec) { }
667 ],
668 [],
669 [
670 AC_MSG_RESULT(no)
671 ],[
672 AC_MSG_RESULT(yes)
673 AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_INLINE, 1,
674 [set_normalized_timespec() is available as inline])
675 ])
676 ])
677
678 dnl #
679 dnl # 2.6.18 API change,
680 dnl # timespec_sub() inline function available in linux/time.h
681 dnl #
682 AC_DEFUN([SPL_AC_TIMESPEC_SUB], [
683 AC_MSG_CHECKING([whether timespec_sub() is available])
684 SPL_LINUX_TRY_COMPILE([
685 #include <linux/time.h>
686 ],[
687 struct timespec a, b, c = { 0 };
688 c = timespec_sub(a, b);
689 ],[
690 AC_MSG_RESULT(yes)
691 AC_DEFINE(HAVE_TIMESPEC_SUB, 1, [timespec_sub() is available])
692 ],[
693 AC_MSG_RESULT(no)
694 ])
695 ])
696
697 dnl #
698 dnl # 2.6.19 API change,
699 dnl # check if init_utsname() is available in linux/utsname.h
700 dnl #
701 AC_DEFUN([SPL_AC_INIT_UTSNAME], [
702 AC_MSG_CHECKING([whether init_utsname() is available])
703 SPL_LINUX_TRY_COMPILE([
704 #include <linux/utsname.h>
705 ],[
706 struct new_utsname *a = init_utsname();
707 ],[
708 AC_MSG_RESULT(yes)
709 AC_DEFINE(HAVE_INIT_UTSNAME, 1, [init_utsname() is available])
710 ],[
711 AC_MSG_RESULT(no)
712 ])
713 ])
714
715 dnl #
716 dnl # 2.6.26 API change,
717 dnl # definition of struct fdtable relocated to linux/fdtable.h
718 dnl #
719 AC_DEFUN([SPL_AC_FDTABLE_HEADER], [
720 SPL_CHECK_HEADER([linux/fdtable.h], [FDTABLE], [], [])
721 ])
722
723 dnl #
724 dnl # 2.6.14 API change,
725 dnl # check whether 'files_fdtable()' exists
726 dnl #
727 AC_DEFUN([SPL_AC_FILES_FDTABLE], [
728 AC_MSG_CHECKING([whether files_fdtable() is available])
729 SPL_LINUX_TRY_COMPILE([
730 #include <linux/sched.h>
731 #include <linux/file.h>
732 #ifdef HAVE_FDTABLE_HEADER
733 #include <linux/fdtable.h>
734 #endif
735 ],[
736 struct files_struct *files = current->files;
737 struct fdtable *fdt = files_fdtable(files);
738 ],[
739 AC_MSG_RESULT(yes)
740 AC_DEFINE(HAVE_FILES_FDTABLE, 1, [files_fdtable() is available])
741 ],[
742 AC_MSG_RESULT(no)
743 ])
744 ])
745
746 dnl #
747 dnl # 2.6.18 API change,
748 dnl # added linux/uaccess.h
749 dnl #
750 AC_DEFUN([SPL_AC_UACCESS_HEADER], [
751 SPL_CHECK_HEADER([linux/uaccess.h], [UACCESS], [], [])
752 ])
753
754 dnl #
755 dnl # 2.6.12 API change,
756 dnl # check whether 'kmalloc_node()' is available.
757 dnl #
758 AC_DEFUN([SPL_AC_KMALLOC_NODE], [
759 AC_MSG_CHECKING([whether kmalloc_node() is available])
760 SPL_LINUX_TRY_COMPILE([
761 #include <linux/slab.h>
762 ],[
763 void *a = kmalloc_node(1, GFP_KERNEL, 0);
764 ],[
765 AC_MSG_RESULT(yes)
766 AC_DEFINE(HAVE_KMALLOC_NODE, 1, [kmalloc_node() is available])
767 ],[
768 AC_MSG_RESULT(no)
769 ])
770 ])
771
772 dnl #
773 dnl # 2.6.9 API change,
774 dnl # check whether 'monotonic_clock()' is available it may
775 dnl # be available for some archs but not others.
776 dnl #
777 AC_DEFUN([SPL_AC_MONOTONIC_CLOCK], [
778 SPL_CHECK_SYMBOL_EXPORT(
779 [monotonic_clock],
780 [],
781 [AC_DEFINE(HAVE_MONOTONIC_CLOCK, 1,
782 [monotonic_clock() is available])],
783 [])
784 ])
785
786 dnl #
787 dnl # 2.6.16 API change,
788 dnl # check whether 'struct inode' has i_mutex
789 dnl #
790 AC_DEFUN([SPL_AC_INODE_I_MUTEX], [
791 AC_MSG_CHECKING([whether struct inode has i_mutex])
792 SPL_LINUX_TRY_COMPILE([
793 #include <linux/fs.h>
794 #include <linux/mutex.h>
795 ],[
796 struct inode i;
797 mutex_init(&i.i_mutex);
798 ],[
799 AC_MSG_RESULT(yes)
800 AC_DEFINE(HAVE_INODE_I_MUTEX, 1, [struct inode has i_mutex])
801 ],[
802 AC_MSG_RESULT(no)
803 ])
804 ])
805
806 dnl #
807 dnl # 2.6.29 API change,
808 dnl # Adaptive mutexs introduced.
809 dnl #
810 AC_DEFUN([SPL_AC_MUTEX_OWNER], [
811 AC_MSG_CHECKING([whether struct mutex has owner])
812 SPL_LINUX_TRY_COMPILE([
813 #include <linux/mutex.h>
814 ],[
815 struct mutex mtx;
816 mtx.owner = NULL;
817 ],[
818 AC_MSG_RESULT(yes)
819 AC_DEFINE(HAVE_MUTEX_OWNER, 1, [struct mutex has owner])
820 ],[
821 AC_MSG_RESULT(no)
822 ])
823 ])
824
825 dnl #
826 dnl # 2.6.18 API change,
827 dnl # First introduced 'mutex_lock_nested()' in include/linux/mutex.h,
828 dnl # as part of the mutex validator. Fallback to using 'mutex_lock()'
829 dnl # if the mutex validator is disabled or otherwise unavailable.
830 dnl #
831 AC_DEFUN([SPL_AC_MUTEX_LOCK_NESTED], [
832 AC_MSG_CHECKING([whether mutex_lock_nested() is available])
833 SPL_LINUX_TRY_COMPILE([
834 #include <linux/mutex.h>
835 ],[
836 struct mutex mutex;
837 mutex_init(&mutex);
838 mutex_lock_nested(&mutex, 0);
839 ],[
840 AC_MSG_RESULT(yes)
841 AC_DEFINE(HAVE_MUTEX_LOCK_NESTED, 1,
842 [mutex_lock_nested() is available])
843 ],[
844 AC_MSG_RESULT(no)
845 ])
846 ])
847
848 dnl #
849 dnl # 2.6.22 API change,
850 dnl # First introduced 'div64_64()' in lib/div64.c
851 dnl
852 AC_DEFUN([SPL_AC_DIV64_64], [
853 SPL_CHECK_SYMBOL_EXPORT(
854 [div64_64],
855 [],
856 [AC_DEFINE(HAVE_DIV64_64, 1,
857 [div64_64() is available])],
858 [])
859 ])
860
861 dnl #
862 dnl # 2.6.26 API change,
863 dnl # Renamed 'div64_64()' to 'div64_u64' in lib/div64.c
864 dnl #
865 AC_DEFUN([SPL_AC_DIV64_U64], [
866 SPL_CHECK_SYMBOL_EXPORT(
867 [div64_u64],
868 [],
869 [AC_DEFINE(HAVE_DIV64_U64, 1,
870 [div64_u64() is available])],
871 [])
872 ])
873
874 dnl #
875 dnl # 2.6.27 API change,
876 dnl # on_each_cpu() uses 3 args, no 'retry' argument
877 dnl #
878 AC_DEFUN([SPL_AC_3ARGS_ON_EACH_CPU], [
879 AC_MSG_CHECKING([whether on_each_cpu() wants 3 args])
880 SPL_LINUX_TRY_COMPILE([
881 #include <linux/smp.h>
882 ],[
883 on_each_cpu(NULL, NULL, 0);
884 ],[
885 AC_MSG_RESULT(yes)
886 AC_DEFINE(HAVE_3ARGS_ON_EACH_CPU, 1,
887 [on_each_cpu wants 3 args])
888 ],[
889 AC_MSG_RESULT(no)
890 ])
891 ])
892
893 dnl #
894 dnl # 2.6.18 API change,
895 dnl # kallsyms_lookup_name no longer exported
896 dnl #
897 AC_DEFUN([SPL_AC_KALLSYMS_LOOKUP_NAME], [
898 SPL_CHECK_SYMBOL_EXPORT(
899 [kallsyms_lookup_name],
900 [],
901 [AC_DEFINE(HAVE_KALLSYMS_LOOKUP_NAME, 1,
902 [kallsyms_lookup_name() is available])],
903 [])
904 ])
905
906 dnl #
907 dnl # Proposed API change,
908 dnl # This symbol is not available in stock kernels. You may build a
909 dnl # custom kernel with the *-spl-export-symbols.patch which will export
910 dnl # these symbols for use. If your already rolling a custom kernel for
911 dnl # your environment this is recommended.
912 dnl #
913 AC_DEFUN([SPL_AC_GET_VMALLOC_INFO], [
914 SPL_CHECK_SYMBOL_EXPORT(
915 [get_vmalloc_info],
916 [],
917 [AC_DEFINE(HAVE_GET_VMALLOC_INFO, 1,
918 [get_vmalloc_info() is available])],
919 [])
920 ])
921
922 dnl #
923 dnl # 2.6.17 API change
924 dnl # The helper functions first_online_pgdat(), next_online_pgdat(), and
925 dnl # next_zone() are introduced to simplify for_each_zone(). These symbols
926 dnl # were exported in 2.6.17 for use by modules which was consistent with
927 dnl # the previous implementation of for_each_zone(). From 2.6.18 - 2.6.19
928 dnl # the symbols were exported as 'unused', and by 2.6.20 they exports
929 dnl # were dropped entirely leaving modules no way to directly iterate over
930 dnl # the zone list. Because we need access to the zone helpers we check
931 dnl # if the kernel contains the old or new implementation. Then we check
932 dnl # to see if the symbols we need for each version are available. If they
933 dnl # are not, dynamically aquire the addresses with kallsyms_lookup_name().
934 dnl #
935 AC_DEFUN([SPL_AC_PGDAT_HELPERS], [
936 AC_MSG_CHECKING([whether symbol *_pgdat exist])
937 grep -q -E 'first_online_pgdat' $LINUX/include/linux/mmzone.h 2>/dev/null
938 rc=$?
939 if test $rc -eq 0; then
940 AC_MSG_RESULT([yes])
941 AC_DEFINE(HAVE_PGDAT_HELPERS, 1, [pgdat helpers are available])
942 else
943 AC_MSG_RESULT([no])
944 fi
945 ])
946
947 dnl #
948 dnl # Proposed API change,
949 dnl # This symbol is not available in stock kernels. You may build a
950 dnl # custom kernel with the *-spl-export-symbols.patch which will export
951 dnl # these symbols for use. If your already rolling a custom kernel for
952 dnl # your environment this is recommended.
953 dnl #
954 AC_DEFUN([SPL_AC_FIRST_ONLINE_PGDAT], [
955 SPL_CHECK_SYMBOL_EXPORT(
956 [first_online_pgdat],
957 [],
958 [AC_DEFINE(HAVE_FIRST_ONLINE_PGDAT, 1,
959 [first_online_pgdat() is available])],
960 [])
961 ])
962
963 dnl #
964 dnl # Proposed API change,
965 dnl # This symbol is not available in stock kernels. You may build a
966 dnl # custom kernel with the *-spl-export-symbols.patch which will export
967 dnl # these symbols for use. If your already rolling a custom kernel for
968 dnl # your environment this is recommended.
969 dnl #
970 AC_DEFUN([SPL_AC_NEXT_ONLINE_PGDAT], [
971 SPL_CHECK_SYMBOL_EXPORT(
972 [next_online_pgdat],
973 [],
974 [AC_DEFINE(HAVE_NEXT_ONLINE_PGDAT, 1,
975 [next_online_pgdat() is available])],
976 [])
977 ])
978
979 dnl #
980 dnl # Proposed API change,
981 dnl # This symbol is not available in stock kernels. You may build a
982 dnl # custom kernel with the *-spl-export-symbols.patch which will export
983 dnl # these symbols for use. If your already rolling a custom kernel for
984 dnl # your environment this is recommended.
985 dnl #
986 AC_DEFUN([SPL_AC_NEXT_ZONE], [
987 SPL_CHECK_SYMBOL_EXPORT(
988 [next_zone],
989 [],
990 [AC_DEFINE(HAVE_NEXT_ZONE, 1,
991 [next_zone() is available])],
992 [])
993 ])
994
995 dnl #
996 dnl # 2.6.17 API change,
997 dnl # See SPL_AC_PGDAT_HELPERS for details.
998 dnl #
999 AC_DEFUN([SPL_AC_PGDAT_LIST], [
1000 SPL_CHECK_SYMBOL_EXPORT(
1001 [pgdat_list],
1002 [],
1003 [AC_DEFINE(HAVE_PGDAT_LIST, 1,
1004 [pgdat_list is available])],
1005 [])
1006 ])
1007
1008 dnl #
1009 dnl # 2.6.18 API change,
1010 dnl # First introduced global_page_state() support as an inline.
1011 dnl #
1012 AC_DEFUN([SPL_AC_GLOBAL_PAGE_STATE], [
1013 AC_MSG_CHECKING([whether global_page_state() is available])
1014 SPL_LINUX_TRY_COMPILE([
1015 #include <linux/mm.h>
1016 ],[
1017 unsigned long state;
1018 state = global_page_state(0);
1019 ],[
1020 AC_MSG_RESULT(yes)
1021 AC_DEFINE(HAVE_GLOBAL_PAGE_STATE, 1,
1022 [global_page_state() is available])
1023 ],[
1024 AC_MSG_RESULT(no)
1025 ])
1026 ])
1027
1028 dnl #
1029 dnl # 2.6.21 API change (plus subsequent naming convention changes),
1030 dnl # Public global zone stats now include a free page count. However
1031 dnl # the enumerated names of the counters have changed since this API
1032 dnl # was introduced. We need to deduce the corrent name to use. This
1033 dnl # replaces the priviate get_zone_counts() interface.
1034 dnl #
1035 dnl # NR_FREE_PAGES was available from 2.6.21 to current kernels, which
1036 dnl # is 2.6.30 as of when this was written.
1037 dnl #
1038 AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_FREE], [
1039 AC_MSG_CHECKING([whether page state NR_FREE_PAGES is available])
1040 SPL_LINUX_TRY_COMPILE([
1041 #include <linux/mm.h>
1042 ],[
1043 enum zone_stat_item zsi;
1044 zsi = NR_FREE_PAGES;
1045 ],[
1046 AC_MSG_RESULT(yes)
1047 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_FREE_PAGES, 1,
1048 [Page state NR_FREE_PAGES is available])
1049 ],[
1050 AC_MSG_RESULT(no)
1051 ])
1052 ])
1053
1054 dnl #
1055 dnl # 2.6.21 API change (plus subsequent naming convention changes),
1056 dnl # Public global zone stats now include an inactive page count. However
1057 dnl # the enumerated names of the counters have changed since this API
1058 dnl # was introduced. We need to deduce the corrent name to use. This
1059 dnl # replaces the priviate get_zone_counts() interface.
1060 dnl #
1061 dnl # NR_INACTIVE was available from 2.6.21 to 2.6.27 and included both
1062 dnl # anonymous and file inactive pages. As of 2.6.28 it was split in
1063 dnl # to NR_INACTIVE_ANON and NR_INACTIVE_FILE.
1064 dnl #
1065 AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_INACTIVE], [
1066 AC_MSG_CHECKING([whether page state NR_INACTIVE is available])
1067 SPL_LINUX_TRY_COMPILE([
1068 #include <linux/mm.h>
1069 ],[
1070 enum zone_stat_item zsi;
1071 zsi = NR_INACTIVE;
1072 ],[
1073 AC_MSG_RESULT(yes)
1074 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_INACTIVE, 1,
1075 [Page state NR_INACTIVE is available])
1076 ],[
1077 AC_MSG_RESULT(no)
1078 ])
1079
1080 AC_MSG_CHECKING([whether page state NR_INACTIVE_ANON is available])
1081 SPL_LINUX_TRY_COMPILE([
1082 #include <linux/mm.h>
1083 ],[
1084 enum zone_stat_item zsi;
1085 zsi = NR_INACTIVE_ANON;
1086 ],[
1087 AC_MSG_RESULT(yes)
1088 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_ANON, 1,
1089 [Page state NR_INACTIVE_ANON is available])
1090 ],[
1091 AC_MSG_RESULT(no)
1092 ])
1093
1094 AC_MSG_CHECKING([whether page state NR_INACTIVE_FILE is available])
1095 SPL_LINUX_TRY_COMPILE([
1096 #include <linux/mm.h>
1097 ],[
1098 enum zone_stat_item zsi;
1099 zsi = NR_INACTIVE_FILE;
1100 ],[
1101 AC_MSG_RESULT(yes)
1102 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_FILE, 1,
1103 [Page state NR_INACTIVE_FILE is available])
1104 ],[
1105 AC_MSG_RESULT(no)
1106 ])
1107 ])
1108
1109 dnl #
1110 dnl # 2.6.21 API change (plus subsequent naming convention changes),
1111 dnl # Public global zone stats now include an active page count. However
1112 dnl # the enumerated names of the counters have changed since this API
1113 dnl # was introduced. We need to deduce the corrent name to use. This
1114 dnl # replaces the priviate get_zone_counts() interface.
1115 dnl #
1116 dnl # NR_ACTIVE was available from 2.6.21 to 2.6.27 and included both
1117 dnl # anonymous and file active pages. As of 2.6.28 it was split in
1118 dnl # to NR_ACTIVE_ANON and NR_ACTIVE_FILE.
1119 dnl #
1120 AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_ACTIVE], [
1121 AC_MSG_CHECKING([whether page state NR_ACTIVE is available])
1122 SPL_LINUX_TRY_COMPILE([
1123 #include <linux/mm.h>
1124 ],[
1125 enum zone_stat_item zsi;
1126 zsi = NR_ACTIVE;
1127 ],[
1128 AC_MSG_RESULT(yes)
1129 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_ACTIVE, 1,
1130 [Page state NR_ACTIVE is available])
1131 ],[
1132 AC_MSG_RESULT(no)
1133 ])
1134
1135 AC_MSG_CHECKING([whether page state NR_ACTIVE_ANON is available])
1136 SPL_LINUX_TRY_COMPILE([
1137 #include <linux/mm.h>
1138 ],[
1139 enum zone_stat_item zsi;
1140 zsi = NR_ACTIVE_ANON;
1141 ],[
1142 AC_MSG_RESULT(yes)
1143 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_ANON, 1,
1144 [Page state NR_ACTIVE_ANON is available])
1145 ],[
1146 AC_MSG_RESULT(no)
1147 ])
1148
1149 AC_MSG_CHECKING([whether page state NR_ACTIVE_FILE is available])
1150 SPL_LINUX_TRY_COMPILE([
1151 #include <linux/mm.h>
1152 ],[
1153 enum zone_stat_item zsi;
1154 zsi = NR_ACTIVE_FILE;
1155 ],[
1156 AC_MSG_RESULT(yes)
1157 AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_FILE, 1,
1158 [Page state NR_ACTIVE_FILE is available])
1159 ],[
1160 AC_MSG_RESULT(no)
1161 ])
1162 ])
1163
1164 dnl #
1165 dnl # Proposed API change for legacy kernels.
1166 dnl # This symbol is not available in older kernels. For kernels post
1167 dnl # 2.6.21 the global_page_state() API is used to get free/inactive/active
1168 dnl # page state information. This symbol is only used in legacy kernels
1169 dnl # any only as a last resort.
1170 dnl
1171 AC_DEFUN([SPL_AC_GET_ZONE_COUNTS], [
1172 AC_MSG_CHECKING([whether symbol get_zone_counts is needed])
1173 SPL_LINUX_TRY_COMPILE([
1174 ],[
1175 #if !defined(HAVE_ZONE_STAT_ITEM_NR_FREE_PAGES)
1176 #error "global_page_state needs NR_FREE_PAGES"
1177 #endif
1178
1179 #if !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE) && \
1180 !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_ANON) && \
1181 !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_FILE)
1182 #error "global_page_state needs NR_ACTIVE*"
1183 #endif
1184
1185 #if !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE) && \
1186 !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_ANON) && \
1187 !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_FILE)
1188 #error "global_page_state needs NR_INACTIVE*"
1189 #endif
1190 ],[
1191 AC_MSG_RESULT(no)
1192 ],[
1193 AC_MSG_RESULT(yes)
1194 AC_DEFINE(NEED_GET_ZONE_COUNTS, 1,
1195 [get_zone_counts() is needed])
1196
1197 SPL_CHECK_SYMBOL_EXPORT(
1198 [get_zone_counts],
1199 [],
1200 [AC_DEFINE(HAVE_GET_ZONE_COUNTS, 1,
1201 [get_zone_counts() is available])],
1202 [])
1203 ])
1204 ])
1205
1206 dnl #
1207 dnl # SLES API change, never adopted in mainline,
1208 dnl # Third 'struct vfsmount *' argument removed.
1209 dnl #
1210 AC_DEFUN([SPL_AC_2ARGS_VFS_UNLINK],
1211 [AC_MSG_CHECKING([whether vfs_unlink() wants 2 args])
1212 SPL_LINUX_TRY_COMPILE([
1213 #include <linux/fs.h>
1214 ],[
1215 vfs_unlink(NULL, NULL);
1216 ],[
1217 AC_MSG_RESULT(yes)
1218 AC_DEFINE(HAVE_2ARGS_VFS_UNLINK, 1,
1219 [vfs_unlink() wants 2 args])
1220 ],[
1221 AC_MSG_RESULT(no)
1222 ])
1223 ])
1224
1225 dnl #
1226 dnl # SLES API change, never adopted in mainline,
1227 dnl # Third and sixth 'struct vfsmount *' argument removed.
1228 dnl #
1229 AC_DEFUN([SPL_AC_4ARGS_VFS_RENAME],
1230 [AC_MSG_CHECKING([whether vfs_rename() wants 4 args])
1231 SPL_LINUX_TRY_COMPILE([
1232 #include <linux/fs.h>
1233 ],[
1234 vfs_rename(NULL, NULL, NULL, NULL);
1235 ],[
1236 AC_MSG_RESULT(yes)
1237 AC_DEFINE(HAVE_4ARGS_VFS_RENAME, 1,
1238 [vfs_rename() wants 4 args])
1239 ],[
1240 AC_MSG_RESULT(no)
1241 ])
1242 ])
1243
1244 dnl #
1245 dnl # 2.6.29 API change,
1246 dnl # check whether 'struct cred' exists
1247 dnl #
1248 AC_DEFUN([SPL_AC_CRED_STRUCT], [
1249 AC_MSG_CHECKING([whether struct cred exists])
1250 SPL_LINUX_TRY_COMPILE([
1251 #include <linux/cred.h>
1252 ],[
1253 struct cred *cr;
1254 cr = NULL;
1255 ],[
1256 AC_MSG_RESULT(yes)
1257 AC_DEFINE(HAVE_CRED_STRUCT, 1, [struct cred exists])
1258 ],[
1259 AC_MSG_RESULT(no)
1260 ])
1261 ])
1262
1263 dnl #
1264 dnl # Custom SPL patch may export this symbol.
1265 dnl #
1266 AC_DEFUN([SPL_AC_GROUPS_SEARCH], [
1267 SPL_CHECK_SYMBOL_EXPORT(
1268 [groups_search],
1269 [],
1270 [AC_DEFINE(HAVE_GROUPS_SEARCH, 1,
1271 [groups_search() is available])],
1272 [])
1273 ])
1274
1275 dnl #
1276 dnl # 2.6.x API change,
1277 dnl # __put_task_struct() was exported in RHEL5 but unavailable elsewhere.
1278 dnl #
1279 AC_DEFUN([SPL_AC_PUT_TASK_STRUCT], [
1280 SPL_CHECK_SYMBOL_EXPORT(
1281 [__put_task_struct],
1282 [],
1283 [AC_DEFINE(HAVE_PUT_TASK_STRUCT, 1,
1284 [__put_task_struct() is available])],
1285 [])
1286 ])