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