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