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