]>
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 | |
26 | SPL_AC_DEBUG_MUTEX | |
27 | SPL_AC_DEBUG_KSTAT | |
28 | SPL_AC_DEBUG_CALLB | |
29 | SPL_AC_TYPE_UINTPTR_T | |
30 | SPL_AC_TYPE_ATOMIC64_T | |
31 | SPL_AC_3ARGS_INIT_WORK | |
32 | SPL_AC_2ARGS_REGISTER_SYSCTL | |
33 | SPL_AC_SET_SHRINKER | |
34 | SPL_AC_PATH_IN_NAMEIDATA | |
35 | SPL_AC_TASK_CURR | |
36 | SPL_AC_CTL_UNNUMBERED | |
37 | SPL_AC_FLS64 | |
38 | SPL_AC_DEVICE_CREATE | |
39 | SPL_AC_5ARGS_DEVICE_CREATE | |
40 | SPL_AC_CLASS_DEVICE_CREATE | |
41 | SPL_AC_SET_NORMALIZED_TIMESPEC_EXPORT | |
42 | SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE | |
43 | SPL_AC_TIMESPEC_SUB | |
44 | SPL_AC_INIT_UTSNAME | |
45 | SPL_AC_FDTABLE_HEADER | |
46 | SPL_AC_FILES_FDTABLE | |
47 | SPL_AC_UACCESS_HEADER | |
48 | SPL_AC_KMALLOC_NODE | |
49 | SPL_AC_MONOTONIC_CLOCK | |
50 | SPL_AC_INODE_I_MUTEX | |
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 | |
86933a6e | 62 | SPL_AC_GLOBAL_PAGE_STATE |
6ae7fef5 BB |
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 | |
86933a6e BB |
67 | SPL_AC_2ARGS_VFS_UNLINK |
68 | SPL_AC_4ARGS_VFS_RENAME | |
ec7d53e9 BB |
69 | SPL_AC_CRED_STRUCT |
70 | SPL_AC_GROUPS_SEARCH | |
86933a6e BB |
71 | ]) |
72 | ||
73 | AC_DEFUN([SPL_AC_MODULE_SYMVERS], [ | |
bb339d06 | 74 | modpost=$LINUX/scripts/Makefile.modpost |
86933a6e | 75 | AC_MSG_CHECKING([kernel file name for module symbols]) |
bb339d06 BB |
76 | if test -f "$modpost"; then |
77 | if grep -q Modules.symvers $modpost; then | |
78 | LINUX_SYMBOLS=Modules.symvers | |
79 | else | |
80 | LINUX_SYMBOLS=Module.symvers | |
81 | fi | |
86933a6e | 82 | else |
bb339d06 | 83 | LINUX_SYMBOLS=NONE |
86933a6e BB |
84 | fi |
85 | AC_MSG_RESULT($LINUX_SYMBOLS) | |
86 | AC_SUBST(LINUX_SYMBOLS) | |
87 | ]) | |
88 | ||
57d86234 | 89 | AC_DEFUN([SPL_AC_KERNEL], [ |
57d86234 | 90 | AC_ARG_WITH([linux], |
91 | AS_HELP_STRING([--with-linux=PATH], | |
92 | [Path to kernel source]), | |
39a3d2a4 | 93 | [kernelsrc="$withval"]) |
57d86234 | 94 | |
95 | AC_ARG_WITH([linux-obj], | |
96 | AS_HELP_STRING([--with-linux-obj=PATH], | |
97 | [Path to kernel build objects]), | |
98 | [kernelbuild="$withval"]) | |
99 | ||
100 | AC_MSG_CHECKING([kernel source directory]) | |
101 | if test -z "$kernelsrc"; then | |
bf338d8d BB |
102 | sourcelink=`ls -1d /usr/src/kernels/* /usr/src/linux-* \ |
103 | 2>/dev/null | grep -v obj | tail -1` | |
57d86234 | 104 | |
d4326403 BB |
105 | if test -e ${sourcelink}; then |
106 | kernelsrc=`readlink -f ${sourcelink}` | |
d4326403 | 107 | else |
57d86234 | 108 | AC_MSG_RESULT([Not found]) |
109 | AC_MSG_ERROR([ | |
110 | *** Please specify the location of the kernel source | |
6a1c3d41 | 111 | *** with the '--with-linux=PATH' option]) |
57d86234 | 112 | fi |
c5f70460 BB |
113 | else |
114 | if test "$kernelsrc" = "NONE"; then | |
115 | kernsrcver=NONE | |
116 | fi | |
57d86234 | 117 | fi |
118 | ||
119 | AC_MSG_RESULT([$kernelsrc]) | |
120 | AC_MSG_CHECKING([kernel build directory]) | |
39a3d2a4 | 121 | if test -z "$kernelbuild"; then |
749e5eb1 | 122 | if test -d ${kernelsrc}-obj/`arch`/`arch`; then |
39a3d2a4 | 123 | kernelbuild=${kernelsrc}-obj/`arch`/`arch` |
749e5eb1 BB |
124 | elif test -d ${kernelsrc}-obj/`arch`/default; then |
125 | kernelbuild=${kernelsrc}-obj/`arch`/default | |
39a3d2a4 BB |
126 | elif test -d `dirname ${kernelsrc}`/build-`arch`; then |
127 | kernelbuild=`dirname ${kernelsrc}`/build-`arch` | |
128 | else | |
129 | kernelbuild=${kernelsrc} | |
130 | fi | |
bf338d8d | 131 | fi |
57d86234 | 132 | AC_MSG_RESULT([$kernelbuild]) |
133 | ||
134 | AC_MSG_CHECKING([kernel source version]) | |
135 | if test -r $kernelbuild/include/linux/version.h && | |
136 | fgrep -q UTS_RELEASE $kernelbuild/include/linux/version.h; then | |
137 | ||
138 | kernsrcver=`(echo "#include <linux/version.h>"; | |
139 | echo "kernsrcver=UTS_RELEASE") | | |
d4326403 | 140 | cpp -I $kernelbuild/include | |
57d86234 | 141 | grep "^kernsrcver=" | cut -d \" -f 2` |
142 | ||
143 | elif test -r $kernelbuild/include/linux/utsrelease.h && | |
144 | fgrep -q UTS_RELEASE $kernelbuild/include/linux/utsrelease.h; then | |
145 | ||
146 | kernsrcver=`(echo "#include <linux/utsrelease.h>"; | |
147 | echo "kernsrcver=UTS_RELEASE") | | |
d4326403 | 148 | cpp -I $kernelbuild/include | |
57d86234 | 149 | grep "^kernsrcver=" | cut -d \" -f 2` |
150 | fi | |
151 | ||
152 | if test -z "$kernsrcver"; then | |
153 | AC_MSG_RESULT([Not found]) | |
154 | AC_MSG_ERROR([ | |
155 | *** Cannot determine the version of the linux kernel source. | |
156 | *** Please prepare the kernel before running this script]) | |
157 | fi | |
158 | ||
159 | AC_MSG_RESULT([$kernsrcver]) | |
160 | ||
57d86234 | 161 | LINUX=${kernelsrc} |
162 | LINUX_OBJ=${kernelbuild} | |
c5f70460 BB |
163 | LINUX_VERSION=${kernsrcver} |
164 | ||
57d86234 | 165 | AC_SUBST(LINUX) |
166 | AC_SUBST(LINUX_OBJ) | |
c5f70460 | 167 | AC_SUBST(LINUX_VERSION) |
57d86234 | 168 | |
86933a6e | 169 | SPL_AC_MODULE_SYMVERS |
2e0e7e69 BB |
170 | ]) |
171 | ||
86933a6e BB |
172 | dnl # |
173 | dnl # Default SPL user configuration | |
174 | dnl # | |
175 | AC_DEFUN([SPL_AC_CONFIG_USER], []) | |
176 | ||
6a1c3d41 | 177 | AC_DEFUN([SPL_AC_LICENSE], [ |
86933a6e BB |
178 | AC_MSG_CHECKING([spl license]) |
179 | LICENSE=GPL | |
180 | AC_MSG_RESULT([$LICENSE]) | |
6a1c3d41 | 181 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DHAVE_GPL_ONLY_SYMBOLS" |
86933a6e BB |
182 | AC_SUBST(LICENSE) |
183 | ]) | |
184 | ||
185 | AC_DEFUN([SPL_AC_CONFIG], [ | |
186 | SPL_CONFIG=all | |
187 | AC_ARG_WITH([config], | |
188 | AS_HELP_STRING([--with-config=CONFIG], | |
189 | [Config file 'kernel|user|all']), | |
190 | [SPL_CONFIG="$withval"]) | |
191 | ||
192 | AC_MSG_CHECKING([spl config]) | |
193 | AC_MSG_RESULT([$SPL_CONFIG]); | |
194 | AC_SUBST(SPL_CONFIG) | |
195 | ||
196 | case "$SPL_CONFIG" in | |
197 | kernel) SPL_AC_CONFIG_KERNEL ;; | |
198 | user) SPL_AC_CONFIG_USER ;; | |
199 | all) SPL_AC_CONFIG_KERNEL | |
200 | SPL_AC_CONFIG_USER ;; | |
201 | *) | |
202 | AC_MSG_RESULT([Error!]) | |
203 | AC_MSG_ERROR([Bad value "$SPL_CONFIG" for --with-config, | |
204 | user kernel|user|all]) ;; | |
205 | esac | |
206 | ||
207 | AM_CONDITIONAL([CONFIG_USER], | |
208 | [test "$SPL_CONFIG" = user] || | |
209 | [test "$SPL_CONFIG" = all]) | |
210 | AM_CONDITIONAL([CONFIG_KERNEL], | |
211 | [test "$SPL_CONFIG" = kernel] || | |
212 | [test "$SPL_CONFIG" = all]) | |
6a1c3d41 | 213 | ]) |
214 | ||
57d86234 | 215 | AC_DEFUN([SPL_AC_DEBUG], [ |
216 | AC_MSG_CHECKING([whether debugging is enabled]) | |
217 | AC_ARG_ENABLE( [debug], | |
218 | AS_HELP_STRING([--enable-debug], | |
219 | [Enable generic debug support (default off)]), | |
220 | [ case "$enableval" in | |
221 | yes) spl_ac_debug=yes ;; | |
475cdc78 | 222 | no) spl_ac_debug=no ;; |
57d86234 | 223 | *) AC_MSG_RESULT([Error!]) |
224 | AC_MSG_ERROR([Bad value "$enableval" for --enable-debug]) ;; | |
225 | esac ] | |
226 | ) | |
227 | if test "$spl_ac_debug" = yes; then | |
475cdc78 | 228 | AC_MSG_RESULT([yes]) |
57d86234 | 229 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG" |
230 | else | |
475cdc78 | 231 | AC_MSG_RESULT([no]) |
475cdc78 | 232 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG" |
57d86234 | 233 | fi |
57d86234 | 234 | ]) |
235 | ||
236 | AC_DEFUN([SPL_AC_DEBUG_KMEM], [ | |
237 | AC_MSG_CHECKING([whether kmem debugging is enabled]) | |
238 | AC_ARG_ENABLE( [debug-kmem], | |
239 | AS_HELP_STRING([--enable-debug-kmem], | |
240 | [Enable kmem debug support (default off)]), | |
241 | [ case "$enableval" in | |
475cdc78 | 242 | yes) spl_ac_debug_kmem=yes ;; |
243 | no) spl_ac_debug_kmem=no ;; | |
57d86234 | 244 | *) AC_MSG_RESULT([Error!]) |
245 | AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-kmem]) ;; | |
246 | esac ] | |
247 | ) | |
475cdc78 | 248 | if test "$spl_ac_debug_kmem" = yes; then |
249 | AC_MSG_RESULT([yes]) | |
57d86234 | 250 | AC_DEFINE([DEBUG_KMEM], [1], |
251 | [Define to 1 to enable kmem debugging]) | |
475cdc78 | 252 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM" |
253 | else | |
254 | AC_MSG_RESULT([no]) | |
57d86234 | 255 | fi |
57d86234 | 256 | ]) |
257 | ||
258 | AC_DEFUN([SPL_AC_DEBUG_MUTEX], [ | |
259 | AC_MSG_CHECKING([whether mutex debugging is enabled]) | |
260 | AC_ARG_ENABLE( [debug-mutex], | |
261 | AS_HELP_STRING([--enable-debug-mutex], | |
262 | [Enable mutex debug support (default off)]), | |
263 | [ case "$enableval" in | |
475cdc78 | 264 | yes) spl_ac_debug_mutex=yes ;; |
265 | no) spl_ac_debug_mutex=no ;; | |
57d86234 | 266 | *) AC_MSG_RESULT([Error!]) |
267 | AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-mutex]) ;; | |
268 | esac ] | |
269 | ) | |
475cdc78 | 270 | if test "$spl_ac_debug_mutex" = yes; then |
271 | AC_MSG_RESULT([yes]) | |
57d86234 | 272 | AC_DEFINE([DEBUG_MUTEX], [1], |
273 | [Define to 1 to enable mutex debugging]) | |
475cdc78 | 274 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_MUTEX" |
275 | else | |
276 | AC_MSG_RESULT([no]) | |
57d86234 | 277 | fi |
57d86234 | 278 | ]) |
279 | ||
280 | AC_DEFUN([SPL_AC_DEBUG_KSTAT], [ | |
281 | AC_MSG_CHECKING([whether kstat debugging is enabled]) | |
282 | AC_ARG_ENABLE( [debug-kstat], | |
283 | AS_HELP_STRING([--enable-debug-kstat], | |
284 | [Enable kstat debug support (default off)]), | |
285 | [ case "$enableval" in | |
475cdc78 | 286 | yes) spl_ac_debug_kstat=yes ;; |
287 | no) spl_ac_debug_kstat=no ;; | |
57d86234 | 288 | *) AC_MSG_RESULT([Error!]) |
289 | AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-kstat]) ;; | |
290 | esac ] | |
291 | ) | |
475cdc78 | 292 | if test "$spl_ac_debug_kstat" = yes; then |
293 | AC_MSG_RESULT([yes]) | |
57d86234 | 294 | AC_DEFINE([DEBUG_KSTAT], [1], |
295 | [Define to 1 to enable kstat debugging]) | |
475cdc78 | 296 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KSTAT" |
297 | else | |
298 | AC_MSG_RESULT([no]) | |
57d86234 | 299 | fi |
57d86234 | 300 | ]) |
301 | ||
302 | AC_DEFUN([SPL_AC_DEBUG_CALLB], [ | |
303 | AC_MSG_CHECKING([whether callb debugging is enabled]) | |
304 | AC_ARG_ENABLE( [debug-callb], | |
305 | AS_HELP_STRING([--enable-debug-callb], | |
306 | [Enable callb debug support (default off)]), | |
307 | [ case "$enableval" in | |
475cdc78 | 308 | yes) spl_ac_debug_callb=yes ;; |
309 | no) spl_ac_debug_callb=no ;; | |
57d86234 | 310 | *) AC_MSG_RESULT([Error!]) |
311 | AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-callb]) ;; | |
312 | esac ] | |
313 | ) | |
475cdc78 | 314 | if test "$spl_ac_debug_callb" = yes; then |
315 | AC_MSG_RESULT([yes]) | |
57d86234 | 316 | AC_DEFINE([DEBUG_CALLB], [1], |
317 | [Define to 1 to enable callb debugging]) | |
475cdc78 | 318 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_CALLB" |
319 | else | |
320 | AC_MSG_RESULT([no]) | |
57d86234 | 321 | fi |
57d86234 | 322 | ]) |
323 | ||
324 | dnl # | |
325 | dnl # SPL_LINUX_CONFTEST | |
326 | dnl # | |
327 | AC_DEFUN([SPL_LINUX_CONFTEST], [ | |
328 | cat >conftest.c <<_ACEOF | |
329 | $1 | |
330 | _ACEOF | |
331 | ]) | |
332 | ||
333 | dnl # | |
334 | dnl # SPL_LANG_PROGRAM(C)([PROLOGUE], [BODY]) | |
335 | dnl # | |
336 | m4_define([SPL_LANG_PROGRAM], [ | |
337 | $1 | |
338 | int | |
339 | main (void) | |
340 | { | |
341 | dnl Do *not* indent the following line: there may be CPP directives. | |
342 | dnl Don't move the `;' right after for the same reason. | |
343 | $2 | |
344 | ; | |
345 | return 0; | |
346 | } | |
347 | ]) | |
348 | ||
349 | dnl # | |
350 | dnl # SPL_LINUX_COMPILE_IFELSE / like AC_COMPILE_IFELSE | |
351 | dnl # | |
352 | AC_DEFUN([SPL_LINUX_COMPILE_IFELSE], [ | |
c5f70460 BB |
353 | m4_ifvaln([$1], [SPL_LINUX_CONFTEST([$1])]) |
354 | rm -Rf build && mkdir -p build | |
355 | echo "obj-m := conftest.o" >build/Makefile | |
356 | AS_IF( | |
3d0cb2d3 | 357 | [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 |
358 | [$4], |
359 | [_AC_MSG_LOG_CONFTEST m4_ifvaln([$5],[$5])] | |
360 | ) | |
361 | rm -Rf build | |
57d86234 | 362 | ]) |
363 | ||
364 | dnl # | |
365 | dnl # SPL_LINUX_TRY_COMPILE like AC_TRY_COMPILE | |
366 | dnl # | |
367 | AC_DEFUN([SPL_LINUX_TRY_COMPILE], | |
368 | [SPL_LINUX_COMPILE_IFELSE( | |
d50bd9e2 | 369 | [AC_LANG_SOURCE([SPL_LANG_PROGRAM([[$1]], [[$2]])])], |
370 | [modules], | |
371 | [test -s build/conftest.o], | |
372 | [$3], [$4]) | |
57d86234 | 373 | ]) |
374 | ||
375 | dnl # | |
376 | dnl # SPL_LINUX_CONFIG | |
377 | dnl # | |
378 | AC_DEFUN([SPL_LINUX_CONFIG], | |
379 | [AC_MSG_CHECKING([whether Linux was built with CONFIG_$1]) | |
380 | SPL_LINUX_TRY_COMPILE([ | |
381 | #ifndef AUTOCONF_INCLUDED | |
382 | #include <linux/config.h> | |
383 | #endif | |
384 | ],[ | |
385 | #ifndef CONFIG_$1 | |
386 | #error CONFIG_$1 not #defined | |
387 | #endif | |
388 | ],[ | |
389 | AC_MSG_RESULT([yes]) | |
390 | $2 | |
391 | ],[ | |
392 | AC_MSG_RESULT([no]) | |
393 | $3 | |
394 | ]) | |
395 | ]) | |
396 | ||
397 | dnl # | |
398 | dnl # SPL_CHECK_SYMBOL_EXPORT | |
399 | dnl # check symbol exported or not | |
400 | dnl # | |
401 | AC_DEFUN([SPL_CHECK_SYMBOL_EXPORT], | |
402 | [AC_MSG_CHECKING([whether symbol $1 is exported]) | |
2e0e7e69 BB |
403 | grep -q -E '[[[:space:]]]$1[[[:space:]]]' \ |
404 | $LINUX_OBJ/Module*.symvers 2>/dev/null | |
57d86234 | 405 | rc=$? |
406 | if test $rc -ne 0; then | |
407 | export=0 | |
408 | for file in $2; do | |
2e0e7e69 BB |
409 | grep -q -E "EXPORT_SYMBOL.*($1)" \ |
410 | "$LINUX_OBJ/$file" 2>/dev/null | |
57d86234 | 411 | rc=$? |
412 | if test $rc -eq 0; then | |
413 | export=1 | |
414 | break; | |
415 | fi | |
416 | done | |
417 | if test $export -eq 0; then | |
418 | AC_MSG_RESULT([no]) | |
419 | $4 | |
420 | else | |
421 | AC_MSG_RESULT([yes]) | |
422 | $3 | |
423 | fi | |
424 | else | |
425 | AC_MSG_RESULT([yes]) | |
426 | $3 | |
427 | fi | |
428 | ]) | |
429 | ||
86de8532 | 430 | dnl # |
431 | dnl # SPL_CHECK_HEADER | |
432 | dnl # check whether header exists and define HAVE_$2_HEADER | |
433 | dnl # | |
434 | AC_DEFUN([SPL_CHECK_HEADER], | |
435 | [AC_MSG_CHECKING([whether header $1 exists]) | |
436 | SPL_LINUX_TRY_COMPILE([ | |
d50bd9e2 | 437 | #include <$1> |
86de8532 | 438 | ],[ |
439 | return 0; | |
440 | ],[ | |
441 | AC_DEFINE(HAVE_$2_HEADER, 1, [$1 exists]) | |
442 | AC_MSG_RESULT(yes) | |
443 | $3 | |
444 | ],[ | |
445 | AC_MSG_RESULT(no) | |
446 | $4 | |
447 | ]) | |
448 | ]) | |
6a6cafbe | 449 | |
57d86234 | 450 | dnl # |
3d061e9d | 451 | dnl # 2.6.24 API change, |
57d86234 | 452 | dnl # check if uintptr_t typedef is defined |
453 | dnl # | |
454 | AC_DEFUN([SPL_AC_TYPE_UINTPTR_T], | |
455 | [AC_MSG_CHECKING([whether kernel defines uintptr_t]) | |
456 | SPL_LINUX_TRY_COMPILE([ | |
d50bd9e2 | 457 | #include <linux/types.h> |
57d86234 | 458 | ],[ |
d50bd9e2 | 459 | uintptr_t *ptr; |
57d86234 | 460 | ],[ |
d50bd9e2 | 461 | AC_MSG_RESULT([yes]) |
462 | AC_DEFINE(HAVE_UINTPTR_T, 1, | |
57d86234 | 463 | [kernel defines uintptr_t]) |
464 | ],[ | |
d50bd9e2 | 465 | AC_MSG_RESULT([no]) |
57d86234 | 466 | ]) |
467 | ]) | |
468 | ||
a0f6da3d | 469 | dnl # |
470 | dnl # 2.6.x API change, | |
471 | dnl # check if atomic64_t typedef is defined | |
472 | dnl # | |
473 | AC_DEFUN([SPL_AC_TYPE_ATOMIC64_T], | |
474 | [AC_MSG_CHECKING([whether kernel defines atomic64_t]) | |
475 | SPL_LINUX_TRY_COMPILE([ | |
476 | #include <asm/atomic.h> | |
477 | ],[ | |
478 | atomic64_t *ptr; | |
479 | ],[ | |
480 | AC_MSG_RESULT([yes]) | |
481 | AC_DEFINE(HAVE_ATOMIC64_T, 1, | |
482 | [kernel defines atomic64_t]) | |
483 | ],[ | |
484 | AC_MSG_RESULT([no]) | |
485 | ]) | |
486 | ]) | |
487 | ||
57d86234 | 488 | dnl # |
3d061e9d | 489 | dnl # 2.6.20 API change, |
57d86234 | 490 | dnl # INIT_WORK use 2 args and not store data inside |
491 | dnl # | |
492 | AC_DEFUN([SPL_AC_3ARGS_INIT_WORK], | |
493 | [AC_MSG_CHECKING([whether INIT_WORK wants 3 args]) | |
494 | SPL_LINUX_TRY_COMPILE([ | |
d50bd9e2 | 495 | #include <linux/workqueue.h> |
57d86234 | 496 | ],[ |
d50bd9e2 | 497 | struct work_struct work; |
498 | INIT_WORK(&work, NULL, NULL); | |
57d86234 | 499 | ],[ |
d50bd9e2 | 500 | AC_MSG_RESULT(yes) |
501 | AC_DEFINE(HAVE_3ARGS_INIT_WORK, 1, | |
502 | [INIT_WORK wants 3 args]) | |
57d86234 | 503 | ],[ |
d50bd9e2 | 504 | AC_MSG_RESULT(no) |
57d86234 | 505 | ]) |
506 | ]) | |
507 | ||
508 | dnl # | |
3d061e9d | 509 | dnl # 2.6.21 API change, |
57d86234 | 510 | dnl # 'register_sysctl_table' use only one argument instead of two |
511 | dnl # | |
512 | AC_DEFUN([SPL_AC_2ARGS_REGISTER_SYSCTL], | |
513 | [AC_MSG_CHECKING([whether register_sysctl_table() wants 2 args]) | |
514 | SPL_LINUX_TRY_COMPILE([ | |
d50bd9e2 | 515 | #include <linux/sysctl.h> |
57d86234 | 516 | ],[ |
d50bd9e2 | 517 | return register_sysctl_table(NULL,0); |
57d86234 | 518 | ],[ |
d50bd9e2 | 519 | AC_MSG_RESULT(yes) |
520 | AC_DEFINE(HAVE_2ARGS_REGISTER_SYSCTL, 1, | |
521 | [register_sysctl_table() wants 2 args]) | |
57d86234 | 522 | ],[ |
d50bd9e2 | 523 | AC_MSG_RESULT(no) |
57d86234 | 524 | ]) |
525 | ]) | |
526 | ||
57d86234 | 527 | dnl # |
3d061e9d | 528 | dnl # 2.6.23 API change |
57d86234 | 529 | dnl # Old set_shrinker API replaced with register_shrinker |
530 | dnl # | |
531 | AC_DEFUN([SPL_AC_SET_SHRINKER], [ | |
532 | AC_MSG_CHECKING([whether set_shrinker() available]) | |
533 | SPL_LINUX_TRY_COMPILE([ | |
534 | #include <linux/mm.h> | |
535 | ],[ | |
536 | return set_shrinker(DEFAULT_SEEKS, NULL); | |
537 | ],[ | |
538 | AC_MSG_RESULT([yes]) | |
539 | AC_DEFINE(HAVE_SET_SHRINKER, 1, | |
540 | [set_shrinker() available]) | |
541 | ],[ | |
542 | AC_MSG_RESULT([no]) | |
543 | ]) | |
544 | ]) | |
545 | ||
546 | dnl # | |
3d061e9d | 547 | dnl # 2.6.25 API change, |
57d86234 | 548 | dnl # struct path entry added to struct nameidata |
549 | dnl # | |
550 | AC_DEFUN([SPL_AC_PATH_IN_NAMEIDATA], | |
551 | [AC_MSG_CHECKING([whether struct path used in struct nameidata]) | |
552 | SPL_LINUX_TRY_COMPILE([ | |
d50bd9e2 | 553 | #include <linux/namei.h> |
57d86234 | 554 | ],[ |
d50bd9e2 | 555 | struct nameidata nd; |
57d86234 | 556 | |
557 | nd.path.mnt = NULL; | |
558 | nd.path.dentry = NULL; | |
559 | ],[ | |
d50bd9e2 | 560 | AC_MSG_RESULT(yes) |
561 | AC_DEFINE(HAVE_PATH_IN_NAMEIDATA, 1, | |
562 | [struct path used in struct nameidata]) | |
57d86234 | 563 | ],[ |
d50bd9e2 | 564 | AC_MSG_RESULT(no) |
57d86234 | 565 | ]) |
566 | ]) | |
567 | ||
568 | dnl # | |
569 | dnl # Custom SPL patch may export this system it is not required | |
570 | dnl # | |
571 | AC_DEFUN([SPL_AC_TASK_CURR], [ | |
572 | SPL_CHECK_SYMBOL_EXPORT([task_curr], [kernel/sched.c], | |
573 | [AC_DEFINE(HAVE_TASK_CURR, 1, [task_curr() exported])], | |
574 | []) | |
575 | ]) | |
576 | ||
577 | dnl # | |
3d061e9d | 578 | dnl # 2.6.19 API change, |
57d86234 | 579 | dnl # Use CTL_UNNUMBERED when binary sysctl is not required |
580 | dnl # | |
581 | AC_DEFUN([SPL_AC_CTL_UNNUMBERED], | |
582 | [AC_MSG_CHECKING([whether unnumbered sysctl support exists]) | |
583 | SPL_LINUX_TRY_COMPILE([ | |
d50bd9e2 | 584 | #include <linux/sysctl.h> |
57d86234 | 585 | ],[ |
586 | #ifndef CTL_UNNUMBERED | |
587 | #error CTL_UNNUMBERED undefined | |
588 | #endif | |
589 | ],[ | |
d50bd9e2 | 590 | AC_MSG_RESULT(yes) |
591 | AC_DEFINE(HAVE_CTL_UNNUMBERED, 1, | |
592 | [unnumbered sysctl support exists]) | |
57d86234 | 593 | ],[ |
d50bd9e2 | 594 | AC_MSG_RESULT(no) |
57d86234 | 595 | ]) |
596 | ]) | |
877a32e9 | 597 | |
598 | dnl # | |
599 | dnl # 2.6.16 API change. | |
600 | dnl # Check if 'fls64()' is available | |
601 | dnl # | |
602 | AC_DEFUN([SPL_AC_FLS64], | |
6a6cafbe | 603 | [AC_MSG_CHECKING([whether fls64() is available]) |
604 | SPL_LINUX_TRY_COMPILE([ | |
605 | #include <linux/bitops.h> | |
606 | ],[ | |
607 | return fls64(0); | |
608 | ],[ | |
609 | AC_MSG_RESULT(yes) | |
610 | AC_DEFINE(HAVE_FLS64, 1, [fls64() is available]) | |
611 | ],[ | |
612 | AC_MSG_RESULT(no) | |
613 | ]) | |
877a32e9 | 614 | ]) |
46c685d0 | 615 | |
616 | dnl # | |
617 | dnl # 2.6.18 API change, check whether device_create() is available. | |
618 | dnl # Device_create() was introduced in 2.6.18 and depricated | |
619 | dnl # class_device_create() which was fully removed in 2.6.26. | |
620 | dnl # | |
621 | AC_DEFUN([SPL_AC_DEVICE_CREATE], [ | |
622 | SPL_CHECK_SYMBOL_EXPORT( | |
623 | [device_create], | |
624 | [drivers/base/core.c], | |
625 | [AC_DEFINE(HAVE_DEVICE_CREATE, 1, | |
626 | [device_create() is available])], | |
6a6cafbe | 627 | []) |
46c685d0 | 628 | ]) |
629 | ||
8123ac4f BB |
630 | dnl # |
631 | dnl # 2.6.27 API change, | |
632 | dnl # device_create() uses 5 args, new 'drvdata' argument. | |
633 | dnl # | |
634 | AC_DEFUN([SPL_AC_5ARGS_DEVICE_CREATE], [ | |
635 | AC_MSG_CHECKING([whether device_create() wants 5 args]) | |
636 | tmp_flags="$EXTRA_KCFLAGS" | |
637 | EXTRA_KCFLAGS="-Werror" | |
638 | SPL_LINUX_TRY_COMPILE([ | |
639 | #include <linux/device.h> | |
640 | ],[ | |
641 | device_create(NULL, NULL, 0, NULL, "%d", 1); | |
642 | ],[ | |
643 | AC_MSG_RESULT(yes) | |
644 | AC_DEFINE(HAVE_5ARGS_DEVICE_CREATE, 1, | |
645 | [device_create wants 5 args]) | |
646 | ],[ | |
647 | AC_MSG_RESULT(no) | |
648 | ]) | |
649 | EXTRA_KCFLAGS="$tmp_flags" | |
650 | ]) | |
651 | ||
46c685d0 | 652 | dnl # |
653 | dnl # 2.6.13 API change, check whether class_device_create() is available. | |
654 | dnl # Class_device_create() was introduced in 2.6.13 and depricated | |
655 | dnl # class_simple_device_add() which was fully removed in 2.6.13. | |
656 | dnl # | |
657 | AC_DEFUN([SPL_AC_CLASS_DEVICE_CREATE], [ | |
658 | SPL_CHECK_SYMBOL_EXPORT( | |
659 | [class_device_create], | |
660 | [drivers/base/class.c], | |
661 | [AC_DEFINE(HAVE_CLASS_DEVICE_CREATE, 1, | |
662 | [class_device_create() is available])], | |
6a6cafbe | 663 | []) |
46c685d0 | 664 | ]) |
6a6cafbe | 665 | |
6a6cafbe | 666 | dnl # |
667 | dnl # 2.6.26 API change, set_normalized_timespec() is exported. | |
668 | dnl # | |
669 | AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_EXPORT], [ | |
670 | SPL_CHECK_SYMBOL_EXPORT( | |
671 | [set_normalized_timespec], | |
672 | [kernel/time.c], | |
673 | [AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_EXPORT, 1, | |
674 | [set_normalized_timespec() is available as export])], | |
675 | []) | |
676 | ]) | |
677 | ||
678 | dnl # | |
679 | dnl # 2.6.16 API change, set_normalize_timespec() moved to time.c | |
680 | dnl # previously it was available in time.h as an inline. | |
681 | dnl # | |
86de8532 | 682 | AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE], [ |
683 | AC_MSG_CHECKING([whether set_normalized_timespec() is an inline]) | |
6a6cafbe | 684 | SPL_LINUX_TRY_COMPILE([ |
685 | #include <linux/time.h> | |
6a6cafbe | 686 | void set_normalized_timespec(struct timespec *ts, |
25557fd8 | 687 | time_t sec, long nsec) { } |
688 | ], | |
689 | [], | |
690 | [ | |
6a6cafbe | 691 | AC_MSG_RESULT(no) |
692 | ],[ | |
693 | AC_MSG_RESULT(yes) | |
694 | AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_INLINE, 1, | |
695 | [set_normalized_timespec() is available as inline]) | |
696 | ]) | |
697 | ]) | |
698 | ||
699 | dnl # | |
700 | dnl # 2.6.18 API change, | |
701 | dnl # timespec_sub() inline function available in linux/time.h | |
702 | dnl # | |
86de8532 | 703 | AC_DEFUN([SPL_AC_TIMESPEC_SUB], [ |
704 | AC_MSG_CHECKING([whether timespec_sub() is available]) | |
6a6cafbe | 705 | SPL_LINUX_TRY_COMPILE([ |
706 | #include <linux/time.h> | |
707 | ],[ | |
708 | struct timespec a, b, c = { 0 }; | |
709 | c = timespec_sub(a, b); | |
710 | ],[ | |
711 | AC_MSG_RESULT(yes) | |
712 | AC_DEFINE(HAVE_TIMESPEC_SUB, 1, [timespec_sub() is available]) | |
713 | ],[ | |
714 | AC_MSG_RESULT(no) | |
715 | ]) | |
716 | ]) | |
717 | ||
86de8532 | 718 | dnl # |
3d061e9d | 719 | dnl # 2.6.19 API change, |
720 | dnl # check if init_utsname() is available in linux/utsname.h | |
721 | dnl # | |
722 | AC_DEFUN([SPL_AC_INIT_UTSNAME], [ | |
723 | AC_MSG_CHECKING([whether init_utsname() is available]) | |
724 | SPL_LINUX_TRY_COMPILE([ | |
725 | #include <linux/utsname.h> | |
726 | ],[ | |
727 | struct new_utsname *a = init_utsname(); | |
728 | ],[ | |
729 | AC_MSG_RESULT(yes) | |
730 | AC_DEFINE(HAVE_INIT_UTSNAME, 1, [init_utsname() is available]) | |
731 | ],[ | |
732 | AC_MSG_RESULT(no) | |
733 | ]) | |
734 | ]) | |
735 | ||
736 | dnl # | |
737 | dnl # 2.6.26 API change, | |
738 | dnl # definition of struct fdtable relocated to linux/fdtable.h | |
86de8532 | 739 | dnl # |
740 | AC_DEFUN([SPL_AC_FDTABLE_HEADER], [ | |
741 | SPL_CHECK_HEADER([linux/fdtable.h], [FDTABLE], [], []) | |
742 | ]) | |
322640b7 | 743 | |
744 | dnl # | |
3d061e9d | 745 | dnl # 2.6.14 API change, |
746 | dnl # check whether 'files_fdtable()' exists | |
747 | dnl # | |
748 | AC_DEFUN([SPL_AC_FILES_FDTABLE], [ | |
749 | AC_MSG_CHECKING([whether files_fdtable() is available]) | |
750 | SPL_LINUX_TRY_COMPILE([ | |
751 | #include <linux/sched.h> | |
752 | #include <linux/file.h> | |
753 | #ifdef HAVE_FDTABLE_HEADER | |
754 | #include <linux/fdtable.h> | |
755 | #endif | |
756 | ],[ | |
757 | struct files_struct *files = current->files; | |
758 | struct fdtable *fdt = files_fdtable(files); | |
759 | ],[ | |
760 | AC_MSG_RESULT(yes) | |
761 | AC_DEFINE(HAVE_FILES_FDTABLE, 1, [files_fdtable() is available]) | |
762 | ],[ | |
763 | AC_MSG_RESULT(no) | |
764 | ]) | |
765 | ]) | |
766 | ||
767 | dnl # | |
768 | dnl # 2.6.18 API change, | |
769 | dnl # added linux/uaccess.h | |
322640b7 | 770 | dnl # |
771 | AC_DEFUN([SPL_AC_UACCESS_HEADER], [ | |
772 | SPL_CHECK_HEADER([linux/uaccess.h], [UACCESS], [], []) | |
773 | ]) | |
3d061e9d | 774 | |
775 | dnl # | |
776 | dnl # 2.6.12 API change, | |
777 | dnl # check whether 'kmalloc_node()' is available. | |
778 | dnl # | |
779 | AC_DEFUN([SPL_AC_KMALLOC_NODE], [ | |
780 | AC_MSG_CHECKING([whether kmalloc_node() is available]) | |
781 | SPL_LINUX_TRY_COMPILE([ | |
782 | #include <linux/slab.h> | |
783 | ],[ | |
784 | void *a = kmalloc_node(1, GFP_KERNEL, 0); | |
785 | ],[ | |
786 | AC_MSG_RESULT(yes) | |
787 | AC_DEFINE(HAVE_KMALLOC_NODE, 1, [kmalloc_node() is available]) | |
788 | ],[ | |
789 | AC_MSG_RESULT(no) | |
790 | ]) | |
791 | ]) | |
792 | ||
793 | dnl # | |
794 | dnl # 2.6.9 API change, | |
795 | dnl # check whether 'monotonic_clock()' is available it may | |
796 | dnl # be available for some archs but not others. | |
797 | dnl # | |
798 | AC_DEFUN([SPL_AC_MONOTONIC_CLOCK], [ | |
799 | SPL_CHECK_SYMBOL_EXPORT( | |
800 | [monotonic_clock], | |
801 | [], | |
802 | [AC_DEFINE(HAVE_MONOTONIC_CLOCK, 1, | |
803 | [monotonic_clock() is available])], | |
804 | []) | |
805 | ]) | |
806 | ||
807 | dnl # | |
808 | dnl # 2.6.16 API change, | |
809 | dnl # check whether 'struct inode' has i_mutex | |
810 | dnl # | |
811 | AC_DEFUN([SPL_AC_INODE_I_MUTEX], [ | |
812 | AC_MSG_CHECKING([whether struct inode has i_mutex]) | |
813 | SPL_LINUX_TRY_COMPILE([ | |
814 | #include <linux/fs.h> | |
815 | #include <linux/mutex.h> | |
816 | ],[ | |
817 | struct inode i; | |
818 | mutex_init(&i.i_mutex); | |
819 | ],[ | |
820 | AC_MSG_RESULT(yes) | |
821 | AC_DEFINE(HAVE_INODE_I_MUTEX, 1, [struct inode has i_mutex]) | |
822 | ],[ | |
823 | AC_MSG_RESULT(no) | |
824 | ]) | |
825 | ]) | |
b61a6e8b | 826 | |
6c9433c1 BB |
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 | ||
b61a6e8b | 850 | dnl # |
96dded38 BB |
851 | dnl # 2.6.22 API change, |
852 | dnl # First introduced 'div64_64()' in lib/div64.c | |
853 | dnl | |
b61a6e8b | 854 | AC_DEFUN([SPL_AC_DIV64_64], [ |
96dded38 BB |
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 | []) | |
b61a6e8b | 874 | ]) |
31a033ec BB |
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 | ]) | |
36b313da BB |
894 | |
895 | dnl # | |
d1ff2312 BB |
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 # | |
e11d6c5f BB |
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. | |
d1ff2312 BB |
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 | ||
5232d256 BB |
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 | ||
d1ff2312 | 949 | dnl # |
e11d6c5f BB |
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. | |
36b313da BB |
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 # | |
e11d6c5f BB |
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. | |
36b313da BB |
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 # | |
e11d6c5f BB |
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. | |
36b313da BB |
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 | ]) | |
4ab13d3b | 996 | |
5232d256 BB |
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 | ||
96dded38 BB |
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([ | |
6ae7fef5 | 1017 | #include <linux/mm.h> |
96dded38 BB |
1018 | ],[ |
1019 | unsigned long state; | |
6ae7fef5 | 1020 | state = global_page_state(0); |
96dded38 BB |
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 | ||
e11d6c5f | 1030 | dnl # |
6ae7fef5 BB |
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. | |
e11d6c5f | 1039 | dnl # |
6ae7fef5 BB |
1040 | AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_FREE], [ |
1041 | AC_MSG_CHECKING([whether page state NR_FREE_PAGES is available]) | |
e11d6c5f | 1042 | SPL_LINUX_TRY_COMPILE([ |
6ae7fef5 | 1043 | #include <linux/mm.h> |
e11d6c5f | 1044 | ],[ |
6ae7fef5 BB |
1045 | enum zone_stat_item zsi; |
1046 | zsi = NR_FREE_PAGES; | |
e11d6c5f BB |
1047 | ],[ |
1048 | AC_MSG_RESULT(yes) | |
6ae7fef5 BB |
1049 | AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_FREE_PAGES, 1, |
1050 | [Page state NR_FREE_PAGES is available]) | |
e11d6c5f BB |
1051 | ],[ |
1052 | AC_MSG_RESULT(no) | |
1053 | ]) | |
1054 | ]) | |
a093c6a4 | 1055 | |
6ae7fef5 BB |
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 | ||
a093c6a4 BB |
1208 | dnl # |
1209 | dnl # SLES API change, never adopted in mainline, | |
1210 | dnl # Third 'struct vfsmount *' argument removed. | |
1211 | dnl # | |
1212 | AC_DEFUN([SPL_AC_2ARGS_VFS_UNLINK], | |
1213 | [AC_MSG_CHECKING([whether vfs_unlink() wants 2 args]) | |
1214 | SPL_LINUX_TRY_COMPILE([ | |
1215 | #include <linux/fs.h> | |
1216 | ],[ | |
1217 | vfs_unlink(NULL, NULL); | |
1218 | ],[ | |
1219 | AC_MSG_RESULT(yes) | |
1220 | AC_DEFINE(HAVE_2ARGS_VFS_UNLINK, 1, | |
1221 | [vfs_unlink() wants 2 args]) | |
1222 | ],[ | |
1223 | AC_MSG_RESULT(no) | |
1224 | ]) | |
1225 | ]) | |
1226 | ||
1227 | dnl # | |
1228 | dnl # SLES API change, never adopted in mainline, | |
1229 | dnl # Third and sixth 'struct vfsmount *' argument removed. | |
1230 | dnl # | |
1231 | AC_DEFUN([SPL_AC_4ARGS_VFS_RENAME], | |
1232 | [AC_MSG_CHECKING([whether vfs_rename() wants 4 args]) | |
1233 | SPL_LINUX_TRY_COMPILE([ | |
1234 | #include <linux/fs.h> | |
1235 | ],[ | |
1236 | vfs_rename(NULL, NULL, NULL, NULL); | |
1237 | ],[ | |
1238 | AC_MSG_RESULT(yes) | |
1239 | AC_DEFINE(HAVE_4ARGS_VFS_RENAME, 1, | |
1240 | [vfs_rename() wants 4 args]) | |
1241 | ],[ | |
1242 | AC_MSG_RESULT(no) | |
1243 | ]) | |
1244 | ]) | |
ec7d53e9 BB |
1245 | |
1246 | dnl # | |
1247 | dnl # 2.6.29 API change, | |
1248 | dnl # check whether 'struct cred' exists | |
1249 | dnl # | |
1250 | AC_DEFUN([SPL_AC_CRED_STRUCT], [ | |
1251 | AC_MSG_CHECKING([whether struct cred exists]) | |
1252 | SPL_LINUX_TRY_COMPILE([ | |
1253 | #include <linux/cred.h> | |
1254 | ],[ | |
1255 | struct cred *cr; | |
1256 | cr = NULL; | |
1257 | ],[ | |
1258 | AC_MSG_RESULT(yes) | |
1259 | AC_DEFINE(HAVE_CRED_STRUCT, 1, [struct cred exists]) | |
1260 | ],[ | |
1261 | AC_MSG_RESULT(no) | |
1262 | ]) | |
1263 | ]) | |
1264 | ||
1265 | dnl # | |
1266 | dnl # Custom SPL patch may export this symbol | |
1267 | dnl # | |
1268 | AC_DEFUN([SPL_AC_GROUPS_SEARCH], [ | |
1269 | SPL_CHECK_SYMBOL_EXPORT( | |
1270 | [groups_search], | |
1271 | [], | |
1272 | [AC_DEFINE(HAVE_GROUPS_SEARCH, 1, | |
1273 | [groups_search() is available])], | |
1274 | []) | |
1275 | ]) |