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