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