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