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