]>
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 | if test "${LINUX_OBJ}" != "${LINUX}"; then |
13 | KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ" | |
14 | fi | |
86933a6e | 15 | AC_SUBST(KERNELMAKE_PARAMS) |
a7958f7e BB |
16 | |
17 | KERNELCPPFLAGS="$KERNELCPPFLAGS -Wstrict-prototypes" | |
86933a6e BB |
18 | AC_SUBST(KERNELCPPFLAGS) |
19 | ||
20 | SPL_AC_DEBUG | |
4b2220f0 | 21 | SPL_AC_DEBUG_LOG |
86933a6e | 22 | SPL_AC_DEBUG_KMEM |
055ffd98 | 23 | SPL_AC_DEBUG_KMEM_TRACKING |
0408008b | 24 | SPL_AC_TEST_MODULE |
5e9b5d83 | 25 | SPL_AC_ATOMIC_SPINLOCK |
302b88e6 BB |
26 | SPL_AC_TYPE_ATOMIC64_CMPXCHG |
27 | SPL_AC_TYPE_ATOMIC64_XCHG | |
d04c8a56 | 28 | SPL_AC_TYPE_UINTPTR_T |
86933a6e BB |
29 | SPL_AC_2ARGS_REGISTER_SYSCTL |
30 | SPL_AC_SET_SHRINKER | |
23aa63cb | 31 | SPL_AC_3ARGS_SHRINKER_CALLBACK |
86933a6e BB |
32 | SPL_AC_PATH_IN_NAMEIDATA |
33 | SPL_AC_TASK_CURR | |
34 | SPL_AC_CTL_UNNUMBERED | |
79a3bf13 | 35 | SPL_AC_CTL_NAME |
86933a6e BB |
36 | SPL_AC_FLS64 |
37 | SPL_AC_DEVICE_CREATE | |
38 | SPL_AC_5ARGS_DEVICE_CREATE | |
39 | SPL_AC_CLASS_DEVICE_CREATE | |
40 | SPL_AC_SET_NORMALIZED_TIMESPEC_EXPORT | |
41 | SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE | |
42 | SPL_AC_TIMESPEC_SUB | |
43 | SPL_AC_INIT_UTSNAME | |
86933a6e BB |
44 | SPL_AC_UACCESS_HEADER |
45 | SPL_AC_KMALLOC_NODE | |
46 | SPL_AC_MONOTONIC_CLOCK | |
47 | SPL_AC_INODE_I_MUTEX | |
4d54fdee | 48 | SPL_AC_MUTEX_OWNER |
86fd39f3 | 49 | SPL_AC_MUTEX_OWNER_TASK_STRUCT |
86933a6e | 50 | SPL_AC_MUTEX_LOCK_NESTED |
86933a6e BB |
51 | SPL_AC_3ARGS_ON_EACH_CPU |
52 | SPL_AC_KALLSYMS_LOOKUP_NAME | |
53 | SPL_AC_GET_VMALLOC_INFO | |
54 | SPL_AC_PGDAT_HELPERS | |
55 | SPL_AC_FIRST_ONLINE_PGDAT | |
56 | SPL_AC_NEXT_ONLINE_PGDAT | |
57 | SPL_AC_NEXT_ZONE | |
58 | SPL_AC_PGDAT_LIST | |
86933a6e | 59 | SPL_AC_GLOBAL_PAGE_STATE |
6ae7fef5 BB |
60 | SPL_AC_ZONE_STAT_ITEM_FREE |
61 | SPL_AC_ZONE_STAT_ITEM_INACTIVE | |
62 | SPL_AC_ZONE_STAT_ITEM_ACTIVE | |
63 | SPL_AC_GET_ZONE_COUNTS | |
7119bf70 | 64 | SPL_AC_USER_PATH_DIR |
51a727e9 BB |
65 | SPL_AC_SET_FS_PWD |
66 | SPL_AC_2ARGS_SET_FS_PWD | |
a54718cf | 67 | SPL_AC_SET_FS_PWD_WITH_CONST |
86933a6e BB |
68 | SPL_AC_2ARGS_VFS_UNLINK |
69 | SPL_AC_4ARGS_VFS_RENAME | |
0d0b5237 BB |
70 | SPL_AC_VFS_FSYNC |
71 | SPL_AC_2ARGS_VFS_FSYNC | |
bbdc6ae4 | 72 | SPL_AC_INODE_TRUNCATE_RANGE |
9b2048c2 | 73 | SPL_AC_FS_STRUCT_SPINLOCK |
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 |
46aa7b39 | 79 | SPL_AC_EXPORTED_RWSEM_IS_LOCKED |
1c7b3eaf | 80 | SPL_AC_KERNEL_FALLOCATE |
e76f4bf1 BB |
81 | SPL_AC_SHRINK_DCACHE_MEMORY |
82 | SPL_AC_SHRINK_ICACHE_MEMORY | |
12ff95ff BB |
83 | SPL_AC_KERN_PATH_PARENT_HEADER |
84 | SPL_AC_KERN_PATH_PARENT_SYMBOL | |
bcb15891 | 85 | SPL_AC_KERN_PATH_LOCKED |
de081a2a | 86 | SPL_AC_CONFIG_KALLSYMS |
42b3ce62 BB |
87 | SPL_AC_CONFIG_ZLIB_INFLATE |
88 | SPL_AC_CONFIG_ZLIB_DEFLATE | |
3dfc591a | 89 | SPL_AC_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE |
a55bcaad | 90 | SPL_AC_SHRINK_CONTROL_STRUCT |
588d9004 | 91 | SPL_AC_RWSEM_SPINLOCK_IS_RAW |
10087fe1 | 92 | SPL_AC_SCHED_RT_HEADER |
2a305c34 | 93 | SPL_AC_2ARGS_VFS_GETATTR |
86933a6e BB |
94 | ]) |
95 | ||
96 | AC_DEFUN([SPL_AC_MODULE_SYMVERS], [ | |
bb339d06 | 97 | modpost=$LINUX/scripts/Makefile.modpost |
86933a6e | 98 | AC_MSG_CHECKING([kernel file name for module symbols]) |
0408008b | 99 | if test "x$enable_linux_builtin" != xyes -a -f "$modpost"; then |
bb339d06 BB |
100 | if grep -q Modules.symvers $modpost; then |
101 | LINUX_SYMBOLS=Modules.symvers | |
102 | else | |
103 | LINUX_SYMBOLS=Module.symvers | |
104 | fi | |
912fd84d BB |
105 | |
106 | if ! test -f "$LINUX_OBJ/$LINUX_SYMBOLS"; then | |
107 | AC_MSG_ERROR([ | |
108 | *** Please make sure the kernel devel package for your distribution | |
109 | *** is installed. If your building with a custom kernel make sure the | |
110 | *** kernel is configured, built, and the '--with-linux=PATH' configure | |
111 | *** option refers to the location of the kernel source.]) | |
112 | fi | |
86933a6e | 113 | else |
bb339d06 | 114 | LINUX_SYMBOLS=NONE |
86933a6e BB |
115 | fi |
116 | AC_MSG_RESULT($LINUX_SYMBOLS) | |
117 | AC_SUBST(LINUX_SYMBOLS) | |
118 | ]) | |
119 | ||
57d86234 | 120 | AC_DEFUN([SPL_AC_KERNEL], [ |
57d86234 | 121 | AC_ARG_WITH([linux], |
122 | AS_HELP_STRING([--with-linux=PATH], | |
123 | [Path to kernel source]), | |
39a3d2a4 | 124 | [kernelsrc="$withval"]) |
57d86234 | 125 | |
126 | AC_ARG_WITH([linux-obj], | |
127 | AS_HELP_STRING([--with-linux-obj=PATH], | |
128 | [Path to kernel build objects]), | |
129 | [kernelbuild="$withval"]) | |
130 | ||
131 | AC_MSG_CHECKING([kernel source directory]) | |
132 | if test -z "$kernelsrc"; then | |
22ccfaa8 BB |
133 | if test -e "/lib/modules/$(uname -r)/source"; then |
134 | headersdir="/lib/modules/$(uname -r)/source" | |
135 | sourcelink=$(readlink -f "$headersdir") | |
136 | elif test -e "/lib/modules/$(uname -r)/build"; then | |
137 | headersdir="/lib/modules/$(uname -r)/build" | |
534c4e38 BM |
138 | sourcelink=$(readlink -f "$headersdir") |
139 | else | |
140 | sourcelink=$(ls -1d /usr/src/kernels/* \ | |
723aa3b0 | 141 | /usr/src/linux-* \ |
534c4e38 BM |
142 | 2>/dev/null | grep -v obj | tail -1) |
143 | fi | |
57d86234 | 144 | |
8fd4e3af | 145 | if test -n "$sourcelink" && test -e ${sourcelink}; then |
d4326403 | 146 | kernelsrc=`readlink -f ${sourcelink}` |
d4326403 | 147 | else |
251677e9 | 148 | kernelsrc="[Not found]" |
57d86234 | 149 | fi |
c5f70460 BB |
150 | else |
151 | if test "$kernelsrc" = "NONE"; then | |
152 | kernsrcver=NONE | |
153 | fi | |
57d86234 | 154 | fi |
155 | ||
156 | AC_MSG_RESULT([$kernelsrc]) | |
251677e9 BB |
157 | if test ! -d "$kernelsrc"; then |
158 | AC_MSG_ERROR([ | |
159 | *** Please make sure the kernel devel package for your distribution | |
160 | *** is installed then try again. If that fails you can specify the | |
161 | *** location of the kernel source with the '--with-linux=PATH' option.]) | |
162 | fi | |
163 | ||
57d86234 | 164 | AC_MSG_CHECKING([kernel build directory]) |
39a3d2a4 | 165 | if test -z "$kernelbuild"; then |
22ccfaa8 BB |
166 | if test -e "/lib/modules/$(uname -r)/build"; then |
167 | kernelbuild=`readlink -f /lib/modules/$(uname -r)/build` | |
168 | elif test -d ${kernelsrc}-obj/${target_cpu}/${target_cpu}; then | |
e2d28a37 BB |
169 | kernelbuild=${kernelsrc}-obj/${target_cpu}/${target_cpu} |
170 | elif test -d ${kernelsrc}-obj/${target_cpu}/default; then | |
171 | kernelbuild=${kernelsrc}-obj/${target_cpu}/default | |
172 | elif test -d `dirname ${kernelsrc}`/build-${target_cpu}; then | |
173 | kernelbuild=`dirname ${kernelsrc}`/build-${target_cpu} | |
39a3d2a4 BB |
174 | else |
175 | kernelbuild=${kernelsrc} | |
176 | fi | |
bf338d8d | 177 | fi |
57d86234 | 178 | AC_MSG_RESULT([$kernelbuild]) |
179 | ||
180 | AC_MSG_CHECKING([kernel source version]) | |
fd921c2e BB |
181 | utsrelease1=$kernelbuild/include/linux/version.h |
182 | utsrelease2=$kernelbuild/include/linux/utsrelease.h | |
183 | utsrelease3=$kernelbuild/include/generated/utsrelease.h | |
184 | if test -r $utsrelease1 && fgrep -q UTS_RELEASE $utsrelease1; then | |
185 | utsrelease=linux/version.h | |
186 | elif test -r $utsrelease2 && fgrep -q UTS_RELEASE $utsrelease2; then | |
187 | utsrelease=linux/utsrelease.h | |
188 | elif test -r $utsrelease3 && fgrep -q UTS_RELEASE $utsrelease3; then | |
189 | utsrelease=generated/utsrelease.h | |
190 | fi | |
57d86234 | 191 | |
fd921c2e BB |
192 | if test "$utsrelease"; then |
193 | kernsrcver=`(echo "#include <$utsrelease>"; | |
57d86234 | 194 | echo "kernsrcver=UTS_RELEASE") | |
d4326403 | 195 | cpp -I $kernelbuild/include | |
57d86234 | 196 | grep "^kernsrcver=" | cut -d \" -f 2` |
57d86234 | 197 | |
fd921c2e BB |
198 | if test -z "$kernsrcver"; then |
199 | AC_MSG_RESULT([Not found]) | |
200 | AC_MSG_ERROR([*** Cannot determine kernel version.]) | |
201 | fi | |
202 | else | |
57d86234 | 203 | AC_MSG_RESULT([Not found]) |
0408008b ED |
204 | if test "x$enable_linux_builtin" != xyes; then |
205 | AC_MSG_ERROR([*** Cannot find UTS_RELEASE definition.]) | |
206 | else | |
207 | AC_MSG_ERROR([ | |
208 | *** Cannot find UTS_RELEASE definition. | |
209 | *** Please run 'make prepare' inside the kernel source tree.]) | |
210 | fi | |
57d86234 | 211 | fi |
212 | ||
213 | AC_MSG_RESULT([$kernsrcver]) | |
214 | ||
57d86234 | 215 | LINUX=${kernelsrc} |
216 | LINUX_OBJ=${kernelbuild} | |
c5f70460 BB |
217 | LINUX_VERSION=${kernsrcver} |
218 | ||
57d86234 | 219 | AC_SUBST(LINUX) |
220 | AC_SUBST(LINUX_OBJ) | |
c5f70460 | 221 | AC_SUBST(LINUX_VERSION) |
57d86234 | 222 | |
86933a6e | 223 | SPL_AC_MODULE_SYMVERS |
2e0e7e69 BB |
224 | ]) |
225 | ||
287b2fb1 BB |
226 | dnl # |
227 | dnl # Default SPL user configuration | |
228 | dnl # | |
ad35b6a6 | 229 | AC_DEFUN([SPL_AC_CONFIG_USER], []) |
287b2fb1 BB |
230 | |
231 | dnl # | |
232 | dnl # Check for rpm+rpmbuild to build RPM packages. If these tools | |
233 | dnl # are missing it is non-fatal but you will not be able to build | |
234 | dnl # RPM packages and will be warned if you try too. | |
235 | dnl # | |
236 | AC_DEFUN([SPL_AC_RPM], [ | |
237 | RPM=rpm | |
238 | RPMBUILD=rpmbuild | |
239 | ||
240 | AC_MSG_CHECKING([whether $RPM is available]) | |
241 | AS_IF([tmp=$($RPM --version 2>/dev/null)], [ | |
242 | RPM_VERSION=$(echo $tmp | $AWK '/RPM/ { print $[3] }') | |
243 | HAVE_RPM=yes | |
244 | AC_MSG_RESULT([$HAVE_RPM ($RPM_VERSION)]) | |
245 | ],[ | |
246 | HAVE_RPM=no | |
247 | AC_MSG_RESULT([$HAVE_RPM]) | |
248 | ]) | |
249 | ||
250 | AC_MSG_CHECKING([whether $RPMBUILD is available]) | |
251 | AS_IF([tmp=$($RPMBUILD --version 2>/dev/null)], [ | |
252 | RPMBUILD_VERSION=$(echo $tmp | $AWK '/RPM/ { print $[3] }') | |
253 | HAVE_RPMBUILD=yes | |
254 | AC_MSG_RESULT([$HAVE_RPMBUILD ($RPMBUILD_VERSION)]) | |
255 | ],[ | |
256 | HAVE_RPMBUILD=no | |
257 | AC_MSG_RESULT([$HAVE_RPMBUILD]) | |
258 | ]) | |
259 | ||
260 | AC_SUBST(HAVE_RPM) | |
261 | AC_SUBST(RPM) | |
262 | AC_SUBST(RPM_VERSION) | |
263 | ||
264 | AC_SUBST(HAVE_RPMBUILD) | |
265 | AC_SUBST(RPMBUILD) | |
266 | AC_SUBST(RPMBUILD_VERSION) | |
267 | ]) | |
268 | ||
269 | dnl # | |
270 | dnl # Check for dpkg+dpkg-buildpackage to build DEB packages. If these | |
271 | dnl # tools are missing it is non-fatal but you will not be able to build | |
272 | dnl # DEB packages and will be warned if you try too. | |
273 | dnl # | |
274 | AC_DEFUN([SPL_AC_DPKG], [ | |
275 | DPKG=dpkg | |
276 | DPKGBUILD=dpkg-buildpackage | |
277 | ||
278 | AC_MSG_CHECKING([whether $DPKG is available]) | |
279 | AS_IF([tmp=$($DPKG --version 2>/dev/null)], [ | |
280 | DPKG_VERSION=$(echo $tmp | $AWK '/Debian/ { print $[7] }') | |
281 | HAVE_DPKG=yes | |
282 | AC_MSG_RESULT([$HAVE_DPKG ($DPKG_VERSION)]) | |
283 | ],[ | |
284 | HAVE_DPKG=no | |
285 | AC_MSG_RESULT([$HAVE_DPKG]) | |
286 | ]) | |
287 | ||
288 | AC_MSG_CHECKING([whether $DPKGBUILD is available]) | |
289 | AS_IF([tmp=$($DPKGBUILD --version 2>/dev/null)], [ | |
290 | DPKGBUILD_VERSION=$(echo $tmp | \ | |
291 | $AWK '/Debian/ { print $[4] }' | cut -f-4 -d'.') | |
292 | HAVE_DPKGBUILD=yes | |
293 | AC_MSG_RESULT([$HAVE_DPKGBUILD ($DPKGBUILD_VERSION)]) | |
294 | ],[ | |
295 | HAVE_DPKGBUILD=no | |
296 | AC_MSG_RESULT([$HAVE_DPKGBUILD]) | |
297 | ]) | |
298 | ||
299 | AC_SUBST(HAVE_DPKG) | |
300 | AC_SUBST(DPKG) | |
301 | AC_SUBST(DPKG_VERSION) | |
302 | ||
303 | AC_SUBST(HAVE_DPKGBUILD) | |
304 | AC_SUBST(DPKGBUILD) | |
305 | AC_SUBST(DPKGBUILD_VERSION) | |
306 | ]) | |
307 | ||
308 | dnl # | |
309 | dnl # Until native packaging for various different packing systems | |
310 | dnl # can be added the least we can do is attempt to use alien to | |
311 | dnl # convert the RPM packages to the needed package type. This is | |
312 | dnl # a hack but so far it has worked reasonable well. | |
313 | dnl # | |
314 | AC_DEFUN([SPL_AC_ALIEN], [ | |
315 | ALIEN=alien | |
316 | ||
317 | AC_MSG_CHECKING([whether $ALIEN is available]) | |
318 | AS_IF([tmp=$($ALIEN --version 2>/dev/null)], [ | |
319 | ALIEN_VERSION=$(echo $tmp | $AWK '{ print $[3] }') | |
320 | HAVE_ALIEN=yes | |
321 | AC_MSG_RESULT([$HAVE_ALIEN ($ALIEN_VERSION)]) | |
322 | ],[ | |
323 | HAVE_ALIEN=no | |
324 | AC_MSG_RESULT([$HAVE_ALIEN]) | |
325 | ]) | |
326 | ||
327 | AC_SUBST(HAVE_ALIEN) | |
328 | AC_SUBST(ALIEN) | |
329 | AC_SUBST(ALIEN_VERSION) | |
330 | ]) | |
331 | ||
332 | dnl # | |
333 | dnl # Using the VENDOR tag from config.guess set the default | |
334 | dnl # package type for 'make pkg': (rpm | deb | tgz) | |
335 | dnl # | |
336 | AC_DEFUN([SPL_AC_DEFAULT_PACKAGE], [ | |
73fc084e | 337 | AC_MSG_CHECKING([linux distribution]) |
a3a69b74 BB |
338 | if test -f /etc/toss-release ; then |
339 | VENDOR=toss ; | |
73fc084e BB |
340 | elif test -f /etc/fedora-release ; then |
341 | VENDOR=fedora ; | |
a3a69b74 BB |
342 | elif test -f /etc/redhat-release ; then |
343 | VENDOR=redhat ; | |
344 | elif test -f /etc/gentoo-release ; then | |
345 | VENDOR=gentoo ; | |
cd2817f8 PS |
346 | elif test -f /etc/arch-release ; then |
347 | VENDOR=arch ; | |
73fc084e BB |
348 | elif test -f /etc/SuSE-release ; then |
349 | VENDOR=sles ; | |
350 | elif test -f /etc/slackware-version ; then | |
351 | VENDOR=slackware ; | |
a3a69b74 BB |
352 | elif test -f /etc/lunar.release ; then |
353 | VENDOR=lunar ; | |
354 | elif test -f /etc/lsb-release ; then | |
355 | VENDOR=ubuntu ; | |
356 | elif test -f /etc/debian_version ; then | |
357 | VENDOR=debian ; | |
73fc084e BB |
358 | else |
359 | VENDOR= ; | |
360 | fi | |
361 | AC_MSG_RESULT([$VENDOR]) | |
362 | AC_SUBST(VENDOR) | |
287b2fb1 BB |
363 | |
364 | AC_MSG_CHECKING([default package type]) | |
365 | case "$VENDOR" in | |
a3a69b74 BB |
366 | toss) DEFAULT_PACKAGE=rpm ;; |
367 | redhat) DEFAULT_PACKAGE=rpm ;; | |
368 | fedora) DEFAULT_PACKAGE=rpm ;; | |
369 | gentoo) DEFAULT_PACKAGE=tgz ;; | |
5f0a4b08 | 370 | arch) DEFAULT_PACKAGE=tgz ;; |
a3a69b74 BB |
371 | sles) DEFAULT_PACKAGE=rpm ;; |
372 | slackware) DEFAULT_PACKAGE=tgz ;; | |
373 | lunar) DEFAULT_PACKAGE=tgz ;; | |
374 | ubuntu) DEFAULT_PACKAGE=deb ;; | |
375 | debian) DEFAULT_PACKAGE=deb ;; | |
376 | *) DEFAULT_PACKAGE=rpm ;; | |
287b2fb1 BB |
377 | esac |
378 | ||
379 | AC_MSG_RESULT([$DEFAULT_PACKAGE]) | |
380 | AC_SUBST(DEFAULT_PACKAGE) | |
381 | ]) | |
382 | ||
383 | dnl # | |
384 | dnl # Default SPL user configuration | |
385 | dnl # | |
386 | AC_DEFUN([SPL_AC_PACKAGE], [ | |
0b14b9f3 | 387 | SPL_AC_DEFAULT_PACKAGE |
287b2fb1 BB |
388 | SPL_AC_RPM |
389 | SPL_AC_DPKG | |
390 | SPL_AC_ALIEN | |
287b2fb1 BB |
391 | ]) |
392 | ||
6a1c3d41 | 393 | AC_DEFUN([SPL_AC_LICENSE], [ |
86933a6e BB |
394 | AC_MSG_CHECKING([spl license]) |
395 | LICENSE=GPL | |
396 | AC_MSG_RESULT([$LICENSE]) | |
6a1c3d41 | 397 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DHAVE_GPL_ONLY_SYMBOLS" |
86933a6e BB |
398 | AC_SUBST(LICENSE) |
399 | ]) | |
400 | ||
401 | AC_DEFUN([SPL_AC_CONFIG], [ | |
0408008b ED |
402 | SPL_CONFIG=all |
403 | AC_ARG_WITH([config], | |
404 | AS_HELP_STRING([--with-config=CONFIG], | |
405 | [Config file 'kernel|user|all|srpm']), | |
406 | [SPL_CONFIG="$withval"]) | |
407 | AC_ARG_ENABLE([linux-builtin], | |
408 | [AC_HELP_STRING([--enable-linux-builtin], | |
409 | [Configure for builtin in-tree kernel modules @<:@default=no@:>@])], | |
410 | [], | |
411 | [enable_linux_builtin=no]) | |
412 | ||
413 | AC_MSG_CHECKING([spl config]) | |
414 | AC_MSG_RESULT([$SPL_CONFIG]); | |
415 | AC_SUBST(SPL_CONFIG) | |
416 | ||
417 | case "$SPL_CONFIG" in | |
418 | kernel) SPL_AC_CONFIG_KERNEL ;; | |
419 | user) SPL_AC_CONFIG_USER ;; | |
420 | all) SPL_AC_CONFIG_KERNEL | |
421 | SPL_AC_CONFIG_USER ;; | |
c1541dfe | 422 | srpm) ;; |
0408008b ED |
423 | *) |
424 | AC_MSG_RESULT([Error!]) | |
425 | AC_MSG_ERROR([Bad value "$SPL_CONFIG" for --with-config, | |
426 | user kernel|user|all|srpm]) ;; | |
427 | esac | |
428 | ||
429 | AM_CONDITIONAL([CONFIG_USER], | |
430 | [test "$SPL_CONFIG" = user -o "$SPL_CONFIG" = all]) | |
431 | AM_CONDITIONAL([CONFIG_KERNEL], | |
432 | [test "$SPL_CONFIG" = kernel -o "$SPL_CONFIG" = all] && | |
433 | [test "x$enable_linux_builtin" != xyes ]) | |
6a1c3d41 | 434 | ]) |
435 | ||
055ffd98 BB |
436 | dnl # |
437 | dnl # Enable if the SPL should be compiled with internal debugging enabled. | |
438 | dnl # By default this support is disabled. | |
439 | dnl # | |
57d86234 | 440 | AC_DEFUN([SPL_AC_DEBUG], [ |
c950d148 | 441 | AC_MSG_CHECKING([whether debugging is enabled]) |
055ffd98 BB |
442 | AC_ARG_ENABLE([debug], |
443 | [AS_HELP_STRING([--enable-debug], | |
444 | [Enable generic debug support @<:@default=no@:>@])], | |
445 | [], | |
446 | [enable_debug=no]) | |
447 | ||
448 | AS_IF([test "x$enable_debug" = xyes], | |
c950d148 | 449 | [ |
c950d148 BB |
450 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG -Werror" |
451 | DEBUG_CFLAGS="-DDEBUG -Werror" | |
3c208a54 BB |
452 | DEBUG_SPL="_with_debug" |
453 | ], [ | |
c950d148 BB |
454 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG" |
455 | DEBUG_CFLAGS="-DNDEBUG" | |
3c208a54 | 456 | DEBUG_SPL="_without_debug" |
c950d148 | 457 | ]) |
055ffd98 | 458 | |
c950d148 | 459 | AC_SUBST(DEBUG_CFLAGS) |
3c208a54 | 460 | AC_SUBST(DEBUG_SPL) |
055ffd98 | 461 | AC_MSG_RESULT([$enable_debug]) |
57d86234 | 462 | ]) |
463 | ||
4b2220f0 BB |
464 | dnl # |
465 | dnl # Enabled by default it provides a basic debug log infrastructure. | |
466 | dnl # Each subsystem registers itself with a name and logs messages | |
467 | dnl # using predefined types. If the debug mask it set to allow the | |
468 | dnl # message type it will be written to the internal log. The log | |
469 | dnl # can be dumped to a file by echoing 1 to the 'dump' proc entry, | |
470 | dnl # after dumping the log it must be decoded using the spl utility. | |
471 | dnl # | |
472 | dnl # echo 1 >/proc/sys/kernel/spl/debug/dump | |
473 | dnl # spl /tmp/spl-log.xxx.yyy /tmp/spl-log.xxx.yyy.txt | |
474 | dnl # | |
475 | AC_DEFUN([SPL_AC_DEBUG_LOG], [ | |
476 | AC_ARG_ENABLE([debug-log], | |
477 | [AS_HELP_STRING([--enable-debug-log], | |
478 | [Enable basic debug logging @<:@default=yes@:>@])], | |
479 | [], | |
480 | [enable_debug_log=yes]) | |
481 | ||
482 | AS_IF([test "x$enable_debug_log" = xyes], | |
3c208a54 BB |
483 | [ |
484 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_LOG" | |
485 | DEBUG_LOG="_with_debug_log" | |
486 | AC_DEFINE([DEBUG_LOG], [1], | |
4b2220f0 | 487 | [Define to 1 to enable basic debug logging]) |
3c208a54 BB |
488 | ], [ |
489 | DEBUG_LOG="_without_debug_log" | |
490 | ]) | |
4b2220f0 | 491 | |
3c208a54 | 492 | AC_SUBST(DEBUG_LOG) |
4b2220f0 BB |
493 | AC_MSG_CHECKING([whether basic debug logging is enabled]) |
494 | AC_MSG_RESULT([$enable_debug_log]) | |
495 | ]) | |
496 | ||
055ffd98 BB |
497 | dnl # |
498 | dnl # Enabled by default it provides a minimal level of memory tracking. | |
499 | dnl # A total count of bytes allocated is kept for each alloc and free. | |
500 | dnl # Then at module unload time a report to the console will be printed | |
501 | dnl # if memory was leaked. Additionally, /proc/spl/kmem/slab will exist | |
502 | dnl # and provide an easy way to inspect the kmem based slab. | |
503 | dnl # | |
57d86234 | 504 | AC_DEFUN([SPL_AC_DEBUG_KMEM], [ |
055ffd98 BB |
505 | AC_ARG_ENABLE([debug-kmem], |
506 | [AS_HELP_STRING([--enable-debug-kmem], | |
507 | [Enable basic kmem accounting @<:@default=yes@:>@])], | |
508 | [], | |
509 | [enable_debug_kmem=yes]) | |
57d86234 | 510 | |
055ffd98 | 511 | AS_IF([test "x$enable_debug_kmem" = xyes], |
3c208a54 BB |
512 | [ |
513 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM" | |
514 | DEBUG_KMEM="_with_debug_kmem" | |
515 | AC_DEFINE([DEBUG_KMEM], [1], | |
055ffd98 | 516 | [Define to 1 to enable basic kmem accounting]) |
3c208a54 BB |
517 | ], [ |
518 | DEBUG_KMEM="_without_debug_kmem" | |
519 | ]) | |
055ffd98 | 520 | |
3c208a54 | 521 | AC_SUBST(DEBUG_KMEM) |
055ffd98 BB |
522 | AC_MSG_CHECKING([whether basic kmem accounting is enabled]) |
523 | AC_MSG_RESULT([$enable_debug_kmem]) | |
57d86234 | 524 | ]) |
525 | ||
055ffd98 BB |
526 | dnl # |
527 | dnl # Disabled by default it provides detailed memory tracking. This | |
528 | dnl # feature also requires --enable-debug-kmem to be set. When enabled | |
529 | dnl # not only will total bytes be tracked but also the location of every | |
530 | dnl # alloc and free. When the SPL module is unloaded a list of all leaked | |
531 | dnl # addresses and where they were allocated will be dumped to the console. | |
532 | dnl # Enabling this feature has a significant impact on performance but it | |
533 | dnl # makes finding memory leaks pretty straight forward. | |
534 | dnl # | |
535 | AC_DEFUN([SPL_AC_DEBUG_KMEM_TRACKING], [ | |
536 | AC_ARG_ENABLE([debug-kmem-tracking], | |
537 | [AS_HELP_STRING([--enable-debug-kmem-tracking], | |
538 | [Enable detailed kmem tracking @<:@default=no@:>@])], | |
539 | [], | |
540 | [enable_debug_kmem_tracking=no]) | |
541 | ||
542 | AS_IF([test "x$enable_debug_kmem_tracking" = xyes], | |
3c208a54 BB |
543 | [ |
544 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM_TRACKING" | |
545 | DEBUG_KMEM_TRACKING="_with_debug_kmem_tracking" | |
546 | AC_DEFINE([DEBUG_KMEM_TRACKING], [1], | |
055ffd98 | 547 | [Define to 1 to enable detailed kmem tracking]) |
3c208a54 BB |
548 | ], [ |
549 | DEBUG_KMEM_TRACKING="_without_debug_kmem_tracking" | |
550 | ]) | |
055ffd98 | 551 | |
3c208a54 | 552 | AC_SUBST(DEBUG_KMEM_TRACKING) |
055ffd98 BB |
553 | AC_MSG_CHECKING([whether detailed kmem tracking is enabled]) |
554 | AC_MSG_RESULT([$enable_debug_kmem_tracking]) | |
57d86234 | 555 | ]) |
556 | ||
557 | dnl # | |
558 | dnl # SPL_LINUX_CONFTEST | |
559 | dnl # | |
560 | AC_DEFUN([SPL_LINUX_CONFTEST], [ | |
dbe561d8 | 561 | cat confdefs.h - <<_ACEOF >conftest.c |
57d86234 | 562 | $1 |
563 | _ACEOF | |
564 | ]) | |
565 | ||
566 | dnl # | |
567 | dnl # SPL_LANG_PROGRAM(C)([PROLOGUE], [BODY]) | |
568 | dnl # | |
569 | m4_define([SPL_LANG_PROGRAM], [ | |
570 | $1 | |
571 | int | |
572 | main (void) | |
573 | { | |
574 | dnl Do *not* indent the following line: there may be CPP directives. | |
575 | dnl Don't move the `;' right after for the same reason. | |
576 | $2 | |
577 | ; | |
578 | return 0; | |
579 | } | |
580 | ]) | |
581 | ||
582 | dnl # | |
583 | dnl # SPL_LINUX_COMPILE_IFELSE / like AC_COMPILE_IFELSE | |
584 | dnl # | |
585 | AC_DEFUN([SPL_LINUX_COMPILE_IFELSE], [ | |
c5f70460 | 586 | m4_ifvaln([$1], [SPL_LINUX_CONFTEST([$1])]) |
df7cc5bc | 587 | rm -Rf build && mkdir -p build && touch build/conftest.mod.c |
c5f70460 | 588 | echo "obj-m := conftest.o" >build/Makefile |
df7cc5bc ED |
589 | modpost_flag='' |
590 | test "x$enable_linux_builtin" = xyes && modpost_flag='modpost=true' # fake modpost stage | |
c5f70460 | 591 | AS_IF( |
df7cc5bc ED |
592 | [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 $modpost_flag) >/dev/null && AC_TRY_COMMAND([$3])], |
593 | [$4], | |
594 | [_AC_MSG_LOG_CONFTEST m4_ifvaln([$5],[$5])] | |
c5f70460 BB |
595 | ) |
596 | rm -Rf build | |
57d86234 | 597 | ]) |
598 | ||
599 | dnl # | |
600 | dnl # SPL_LINUX_TRY_COMPILE like AC_TRY_COMPILE | |
601 | dnl # | |
602 | AC_DEFUN([SPL_LINUX_TRY_COMPILE], | |
603 | [SPL_LINUX_COMPILE_IFELSE( | |
d50bd9e2 | 604 | [AC_LANG_SOURCE([SPL_LANG_PROGRAM([[$1]], [[$2]])])], |
605 | [modules], | |
606 | [test -s build/conftest.o], | |
607 | [$3], [$4]) | |
57d86234 | 608 | ]) |
609 | ||
57d86234 | 610 | dnl # |
611 | dnl # SPL_CHECK_SYMBOL_EXPORT | |
612 | dnl # check symbol exported or not | |
613 | dnl # | |
723aa3b0 | 614 | AC_DEFUN([SPL_CHECK_SYMBOL_EXPORT], [ |
2e0e7e69 BB |
615 | grep -q -E '[[[:space:]]]$1[[[:space:]]]' \ |
616 | $LINUX_OBJ/Module*.symvers 2>/dev/null | |
57d86234 | 617 | rc=$? |
618 | if test $rc -ne 0; then | |
619 | export=0 | |
620 | for file in $2; do | |
2e0e7e69 BB |
621 | grep -q -E "EXPORT_SYMBOL.*($1)" \ |
622 | "$LINUX_OBJ/$file" 2>/dev/null | |
57d86234 | 623 | rc=$? |
723aa3b0 ED |
624 | if test $rc -eq 0; then |
625 | export=1 | |
626 | break; | |
627 | fi | |
57d86234 | 628 | done |
723aa3b0 | 629 | if test $export -eq 0; then : |
57d86234 | 630 | $4 |
723aa3b0 | 631 | else : |
57d86234 | 632 | $3 |
633 | fi | |
723aa3b0 | 634 | else : |
57d86234 | 635 | $3 |
636 | fi | |
637 | ]) | |
638 | ||
723aa3b0 ED |
639 | dnl # |
640 | dnl # SPL_LINUX_TRY_COMPILE_SYMBOL | |
641 | dnl # like SPL_LINUX_TRY_COMPILE, except SPL_CHECK_SYMBOL_EXPORT | |
642 | dnl # is called if not compiling for builtin | |
643 | dnl # | |
644 | AC_DEFUN([SPL_LINUX_TRY_COMPILE_SYMBOL], [ | |
645 | SPL_LINUX_TRY_COMPILE([$1], [$2], [rc=0], [rc=1]) | |
646 | if test $rc -ne 0; then : | |
647 | $6 | |
648 | else | |
649 | if test "x$enable_linux_builtin" != xyes; then | |
650 | SPL_CHECK_SYMBOL_EXPORT([$3], [$4], [rc=0], [rc=1]) | |
651 | fi | |
652 | if test $rc -ne 0; then : | |
653 | $6 | |
654 | else : | |
655 | $5 | |
656 | fi | |
657 | fi | |
658 | ]) | |
659 | ||
12ff95ff BB |
660 | dnl # |
661 | dnl # SPL_CHECK_SYMBOL_HEADER | |
662 | dnl # check if a symbol prototype is defined in listed headers. | |
663 | dnl # | |
664 | AC_DEFUN([SPL_CHECK_SYMBOL_HEADER], [ | |
665 | AC_MSG_CHECKING([whether symbol $1 exists in header]) | |
666 | header=0 | |
667 | for file in $3; do | |
668 | grep -q "$2" "$LINUX/$file" 2>/dev/null | |
669 | rc=$? | |
723aa3b0 ED |
670 | if test $rc -eq 0; then |
671 | header=1 | |
672 | break; | |
673 | fi | |
12ff95ff BB |
674 | done |
675 | if test $header -eq 0; then | |
676 | AC_MSG_RESULT([no]) | |
677 | $5 | |
678 | else | |
679 | AC_MSG_RESULT([yes]) | |
680 | $4 | |
681 | fi | |
682 | ]) | |
683 | ||
86de8532 | 684 | dnl # |
685 | dnl # SPL_CHECK_HEADER | |
686 | dnl # check whether header exists and define HAVE_$2_HEADER | |
687 | dnl # | |
688 | AC_DEFUN([SPL_CHECK_HEADER], | |
689 | [AC_MSG_CHECKING([whether header $1 exists]) | |
690 | SPL_LINUX_TRY_COMPILE([ | |
d50bd9e2 | 691 | #include <$1> |
86de8532 | 692 | ],[ |
693 | return 0; | |
694 | ],[ | |
695 | AC_DEFINE(HAVE_$2_HEADER, 1, [$1 exists]) | |
696 | AC_MSG_RESULT(yes) | |
697 | $3 | |
698 | ],[ | |
699 | AC_MSG_RESULT(no) | |
700 | $4 | |
701 | ]) | |
702 | ]) | |
6a6cafbe | 703 | |
0408008b ED |
704 | dnl # |
705 | dnl # Basic toolchain sanity check. | |
706 | dnl # | |
707 | AC_DEFUN([SPL_AC_TEST_MODULE], | |
708 | [AC_MSG_CHECKING([whether modules can be built]) | |
709 | SPL_LINUX_TRY_COMPILE([],[],[ | |
710 | AC_MSG_RESULT([yes]) | |
711 | ],[ | |
712 | AC_MSG_RESULT([no]) | |
713 | if test "x$enable_linux_builtin" != xyes; then | |
714 | AC_MSG_ERROR([*** Unable to build an empty module.]) | |
715 | else | |
716 | AC_MSG_ERROR([ | |
717 | *** Unable to build an empty module. | |
718 | *** Please run 'make scripts' inside the kernel source tree.]) | |
719 | fi | |
720 | ]) | |
721 | ]) | |
722 | ||
57d86234 | 723 | dnl # |
d04c8a56 BB |
724 | dnl # Use the atomic implemenation based on global spinlocks. This |
725 | dnl # should only be needed by 32-bit kernels which do not provide | |
726 | dnl # the atomic64_* API. It may be optionally enabled as a fallback | |
727 | dnl # if problems are observed with the direct mapping to the native | |
728 | dnl # Linux atomic operations. You may not disable atomic spinlocks | |
729 | dnl # if you kernel does not an atomic64_* API. | |
57d86234 | 730 | dnl # |
d04c8a56 BB |
731 | AC_DEFUN([SPL_AC_ATOMIC_SPINLOCK], [ |
732 | AC_ARG_ENABLE([atomic-spinlocks], | |
733 | [AS_HELP_STRING([--enable-atomic-spinlocks], | |
734 | [Atomic types use spinlocks @<:@default=check@:>@])], | |
735 | [], | |
736 | [enable_atomic_spinlocks=check]) | |
57d86234 | 737 | |
a0f6da3d | 738 | SPL_LINUX_TRY_COMPILE([ |
dd3678fc | 739 | #include <linux/fs.h> |
a0f6da3d | 740 | ],[ |
03318641 | 741 | atomic64_t *ptr __attribute__ ((unused)); |
a0f6da3d | 742 | ],[ |
d04c8a56 | 743 | have_atomic64_t=yes |
a0f6da3d | 744 | AC_DEFINE(HAVE_ATOMIC64_T, 1, |
d04c8a56 | 745 | [kernel defines atomic64_t]) |
a0f6da3d | 746 | ],[ |
d04c8a56 BB |
747 | have_atomic64_t=no |
748 | ]) | |
749 | ||
750 | AS_IF([test "x$enable_atomic_spinlocks" = xcheck], [ | |
751 | AS_IF([test "x$have_atomic64_t" = xyes], [ | |
752 | enable_atomic_spinlocks=no | |
753 | ],[ | |
754 | enable_atomic_spinlocks=yes | |
755 | ]) | |
a0f6da3d | 756 | ]) |
d04c8a56 BB |
757 | |
758 | AS_IF([test "x$enable_atomic_spinlocks" = xyes], [ | |
759 | AC_DEFINE([ATOMIC_SPINLOCK], [1], | |
760 | [Atomic types use spinlocks]) | |
761 | ],[ | |
762 | AS_IF([test "x$have_atomic64_t" = xno], [ | |
763 | AC_MSG_FAILURE( | |
764 | [--disable-atomic-spinlocks given but required atomic64 support is unavailable]) | |
765 | ]) | |
766 | ]) | |
767 | ||
768 | AC_MSG_CHECKING([whether atomic types use spinlocks]) | |
769 | AC_MSG_RESULT([$enable_atomic_spinlocks]) | |
770 | ||
771 | AC_MSG_CHECKING([whether kernel defines atomic64_t]) | |
772 | AC_MSG_RESULT([$have_atomic64_t]) | |
a0f6da3d | 773 | ]) |
774 | ||
302b88e6 BB |
775 | dnl # |
776 | dnl # 2.6.24 API change, | |
777 | dnl # check if atomic64_cmpxchg is defined | |
778 | dnl # | |
779 | AC_DEFUN([SPL_AC_TYPE_ATOMIC64_CMPXCHG], | |
780 | [AC_MSG_CHECKING([whether kernel defines atomic64_cmpxchg]) | |
781 | SPL_LINUX_TRY_COMPILE([ | |
dd3678fc | 782 | #include <linux/fs.h> |
302b88e6 BB |
783 | ],[ |
784 | atomic64_cmpxchg((atomic64_t *)NULL, 0, 0); | |
785 | ],[ | |
786 | AC_MSG_RESULT([yes]) | |
787 | AC_DEFINE(HAVE_ATOMIC64_CMPXCHG, 1, | |
788 | [kernel defines atomic64_cmpxchg]) | |
789 | ],[ | |
790 | AC_MSG_RESULT([no]) | |
791 | ]) | |
792 | ]) | |
793 | ||
794 | dnl # | |
795 | dnl # 2.6.24 API change, | |
796 | dnl # check if atomic64_xchg is defined | |
797 | dnl # | |
798 | AC_DEFUN([SPL_AC_TYPE_ATOMIC64_XCHG], | |
799 | [AC_MSG_CHECKING([whether kernel defines atomic64_xchg]) | |
800 | SPL_LINUX_TRY_COMPILE([ | |
dd3678fc | 801 | #include <linux/fs.h> |
302b88e6 BB |
802 | ],[ |
803 | atomic64_xchg((atomic64_t *)NULL, 0); | |
804 | ],[ | |
805 | AC_MSG_RESULT([yes]) | |
806 | AC_DEFINE(HAVE_ATOMIC64_XCHG, 1, | |
807 | [kernel defines atomic64_xchg]) | |
808 | ],[ | |
809 | AC_MSG_RESULT([no]) | |
810 | ]) | |
811 | ]) | |
812 | ||
d04c8a56 BB |
813 | dnl # |
814 | dnl # 2.6.24 API change, | |
815 | dnl # check if uintptr_t typedef is defined | |
816 | dnl # | |
817 | AC_DEFUN([SPL_AC_TYPE_UINTPTR_T], | |
818 | [AC_MSG_CHECKING([whether kernel defines uintptr_t]) | |
819 | SPL_LINUX_TRY_COMPILE([ | |
820 | #include <linux/types.h> | |
821 | ],[ | |
03318641 | 822 | uintptr_t *ptr __attribute__ ((unused)); |
d04c8a56 BB |
823 | ],[ |
824 | AC_MSG_RESULT([yes]) | |
825 | AC_DEFINE(HAVE_UINTPTR_T, 1, | |
826 | [kernel defines uintptr_t]) | |
827 | ],[ | |
828 | AC_MSG_RESULT([no]) | |
829 | ]) | |
830 | ]) | |
831 | ||
57d86234 | 832 | dnl # |
3d061e9d | 833 | dnl # 2.6.21 API change, |
57d86234 | 834 | dnl # 'register_sysctl_table' use only one argument instead of two |
835 | dnl # | |
836 | AC_DEFUN([SPL_AC_2ARGS_REGISTER_SYSCTL], | |
837 | [AC_MSG_CHECKING([whether register_sysctl_table() wants 2 args]) | |
838 | SPL_LINUX_TRY_COMPILE([ | |
d50bd9e2 | 839 | #include <linux/sysctl.h> |
57d86234 | 840 | ],[ |
03318641 | 841 | (void) register_sysctl_table(NULL, 0); |
57d86234 | 842 | ],[ |
d50bd9e2 | 843 | AC_MSG_RESULT(yes) |
844 | AC_DEFINE(HAVE_2ARGS_REGISTER_SYSCTL, 1, | |
845 | [register_sysctl_table() wants 2 args]) | |
57d86234 | 846 | ],[ |
d50bd9e2 | 847 | AC_MSG_RESULT(no) |
57d86234 | 848 | ]) |
849 | ]) | |
850 | ||
57d86234 | 851 | dnl # |
3d061e9d | 852 | dnl # 2.6.23 API change |
57d86234 | 853 | dnl # Old set_shrinker API replaced with register_shrinker |
854 | dnl # | |
855 | AC_DEFUN([SPL_AC_SET_SHRINKER], [ | |
856 | AC_MSG_CHECKING([whether set_shrinker() available]) | |
857 | SPL_LINUX_TRY_COMPILE([ | |
858 | #include <linux/mm.h> | |
859 | ],[ | |
860 | return set_shrinker(DEFAULT_SEEKS, NULL); | |
861 | ],[ | |
862 | AC_MSG_RESULT([yes]) | |
863 | AC_DEFINE(HAVE_SET_SHRINKER, 1, | |
864 | [set_shrinker() available]) | |
865 | ],[ | |
866 | AC_MSG_RESULT([no]) | |
867 | ]) | |
868 | ]) | |
869 | ||
23aa63cb BB |
870 | dnl # |
871 | dnl # 2.6.35 API change, | |
872 | dnl # Add context to shrinker callback | |
873 | dnl # | |
874 | AC_DEFUN([SPL_AC_3ARGS_SHRINKER_CALLBACK], | |
875 | [AC_MSG_CHECKING([whether shrinker callback wants 3 args]) | |
876 | tmp_flags="$EXTRA_KCFLAGS" | |
877 | EXTRA_KCFLAGS="-Werror" | |
878 | SPL_LINUX_TRY_COMPILE([ | |
879 | #include <linux/mm.h> | |
880 | ||
881 | int shrinker_cb(struct shrinker *, int, unsigned int); | |
882 | ],[ | |
883 | struct shrinker cache_shrinker = { | |
884 | .shrink = shrinker_cb, | |
885 | .seeks = DEFAULT_SEEKS, | |
886 | }; | |
887 | register_shrinker(&cache_shrinker); | |
888 | ],[ | |
889 | AC_MSG_RESULT(yes) | |
890 | AC_DEFINE(HAVE_3ARGS_SHRINKER_CALLBACK, 1, | |
891 | [shrinker callback wants 3 args]) | |
892 | ],[ | |
893 | AC_MSG_RESULT(no) | |
894 | ]) | |
895 | EXTRA_KCFLAGS="$tmp_flags" | |
896 | ]) | |
897 | ||
57d86234 | 898 | dnl # |
3d061e9d | 899 | dnl # 2.6.25 API change, |
57d86234 | 900 | dnl # struct path entry added to struct nameidata |
901 | dnl # | |
902 | AC_DEFUN([SPL_AC_PATH_IN_NAMEIDATA], | |
903 | [AC_MSG_CHECKING([whether struct path used in struct nameidata]) | |
904 | SPL_LINUX_TRY_COMPILE([ | |
d50bd9e2 | 905 | #include <linux/namei.h> |
57d86234 | 906 | ],[ |
03318641 | 907 | struct nameidata nd __attribute__ ((unused)); |
57d86234 | 908 | |
909 | nd.path.mnt = NULL; | |
910 | nd.path.dentry = NULL; | |
911 | ],[ | |
d50bd9e2 | 912 | AC_MSG_RESULT(yes) |
913 | AC_DEFINE(HAVE_PATH_IN_NAMEIDATA, 1, | |
914 | [struct path used in struct nameidata]) | |
57d86234 | 915 | ],[ |
d50bd9e2 | 916 | AC_MSG_RESULT(no) |
57d86234 | 917 | ]) |
918 | ]) | |
919 | ||
920 | dnl # | |
921 | dnl # Custom SPL patch may export this system it is not required | |
922 | dnl # | |
723aa3b0 ED |
923 | AC_DEFUN([SPL_AC_TASK_CURR], |
924 | [AC_MSG_CHECKING([whether task_curr() is available]) | |
925 | SPL_LINUX_TRY_COMPILE_SYMBOL([ | |
926 | #include <linux/sched.h> | |
927 | ], [ | |
928 | task_curr(NULL); | |
929 | ], [task_curr], [kernel/sched.c], [ | |
930 | AC_MSG_RESULT(yes) | |
931 | AC_DEFINE(HAVE_TASK_CURR, 1, [task_curr() is available]) | |
932 | ], [ | |
933 | AC_MSG_RESULT(no) | |
934 | ]) | |
57d86234 | 935 | ]) |
936 | ||
937 | dnl # | |
3d061e9d | 938 | dnl # 2.6.19 API change, |
57d86234 | 939 | dnl # Use CTL_UNNUMBERED when binary sysctl is not required |
940 | dnl # | |
941 | AC_DEFUN([SPL_AC_CTL_UNNUMBERED], | |
942 | [AC_MSG_CHECKING([whether unnumbered sysctl support exists]) | |
943 | SPL_LINUX_TRY_COMPILE([ | |
d50bd9e2 | 944 | #include <linux/sysctl.h> |
57d86234 | 945 | ],[ |
946 | #ifndef CTL_UNNUMBERED | |
947 | #error CTL_UNNUMBERED undefined | |
948 | #endif | |
949 | ],[ | |
d50bd9e2 | 950 | AC_MSG_RESULT(yes) |
951 | AC_DEFINE(HAVE_CTL_UNNUMBERED, 1, | |
952 | [unnumbered sysctl support exists]) | |
57d86234 | 953 | ],[ |
d50bd9e2 | 954 | AC_MSG_RESULT(no) |
57d86234 | 955 | ]) |
956 | ]) | |
877a32e9 | 957 | |
79a3bf13 BB |
958 | dnl # |
959 | dnl # 2.6.33 API change, | |
960 | dnl # Removed .ctl_name from struct ctl_table. | |
961 | dnl # | |
962 | AC_DEFUN([SPL_AC_CTL_NAME], [ | |
963 | AC_MSG_CHECKING([whether struct ctl_table has ctl_name]) | |
964 | SPL_LINUX_TRY_COMPILE([ | |
965 | #include <linux/sysctl.h> | |
966 | ],[ | |
03318641 | 967 | struct ctl_table ctl __attribute__ ((unused)); |
79a3bf13 BB |
968 | ctl.ctl_name = 0; |
969 | ],[ | |
970 | AC_MSG_RESULT(yes) | |
971 | AC_DEFINE(HAVE_CTL_NAME, 1, [struct ctl_table has ctl_name]) | |
972 | ],[ | |
973 | AC_MSG_RESULT(no) | |
974 | ]) | |
975 | ]) | |
976 | ||
877a32e9 | 977 | dnl # |
978 | dnl # 2.6.16 API change. | |
979 | dnl # Check if 'fls64()' is available | |
980 | dnl # | |
981 | AC_DEFUN([SPL_AC_FLS64], | |
6a6cafbe | 982 | [AC_MSG_CHECKING([whether fls64() is available]) |
983 | SPL_LINUX_TRY_COMPILE([ | |
984 | #include <linux/bitops.h> | |
985 | ],[ | |
986 | return fls64(0); | |
987 | ],[ | |
988 | AC_MSG_RESULT(yes) | |
989 | AC_DEFINE(HAVE_FLS64, 1, [fls64() is available]) | |
990 | ],[ | |
991 | AC_MSG_RESULT(no) | |
992 | ]) | |
877a32e9 | 993 | ]) |
46c685d0 | 994 | |
995 | dnl # | |
996 | dnl # 2.6.18 API change, check whether device_create() is available. | |
997 | dnl # Device_create() was introduced in 2.6.18 and depricated | |
998 | dnl # class_device_create() which was fully removed in 2.6.26. | |
999 | dnl # | |
723aa3b0 ED |
1000 | AC_DEFUN([SPL_AC_DEVICE_CREATE], |
1001 | [AC_MSG_CHECKING([whether device_create() is available]) | |
1002 | SPL_CHECK_SYMBOL_EXPORT([device_create], [drivers/base/core.c], [ | |
1003 | AC_MSG_RESULT(yes) | |
1004 | AC_DEFINE(HAVE_DEVICE_CREATE, 1, | |
1005 | [device_create() is available]) | |
1006 | ], [ | |
1007 | AC_MSG_RESULT(no) | |
1008 | ]) | |
46c685d0 | 1009 | ]) |
1010 | ||
8123ac4f BB |
1011 | dnl # |
1012 | dnl # 2.6.27 API change, | |
1013 | dnl # device_create() uses 5 args, new 'drvdata' argument. | |
1014 | dnl # | |
1015 | AC_DEFUN([SPL_AC_5ARGS_DEVICE_CREATE], [ | |
1016 | AC_MSG_CHECKING([whether device_create() wants 5 args]) | |
1017 | tmp_flags="$EXTRA_KCFLAGS" | |
1018 | EXTRA_KCFLAGS="-Werror" | |
1019 | SPL_LINUX_TRY_COMPILE([ | |
1020 | #include <linux/device.h> | |
1021 | ],[ | |
1022 | device_create(NULL, NULL, 0, NULL, "%d", 1); | |
1023 | ],[ | |
1024 | AC_MSG_RESULT(yes) | |
1025 | AC_DEFINE(HAVE_5ARGS_DEVICE_CREATE, 1, | |
1026 | [device_create wants 5 args]) | |
1027 | ],[ | |
1028 | AC_MSG_RESULT(no) | |
1029 | ]) | |
1030 | EXTRA_KCFLAGS="$tmp_flags" | |
1031 | ]) | |
1032 | ||
46c685d0 | 1033 | dnl # |
1034 | dnl # 2.6.13 API change, check whether class_device_create() is available. | |
1035 | dnl # Class_device_create() was introduced in 2.6.13 and depricated | |
1036 | dnl # class_simple_device_add() which was fully removed in 2.6.13. | |
1037 | dnl # | |
723aa3b0 ED |
1038 | AC_DEFUN([SPL_AC_CLASS_DEVICE_CREATE], |
1039 | [AC_MSG_CHECKING([whether class_device_create() is available]) | |
1040 | SPL_LINUX_TRY_COMPILE_SYMBOL([ | |
1041 | #include <linux/device.h> | |
1042 | ], [ | |
1043 | class_device_create(NULL, NULL, 0, NULL, NULL); | |
1044 | ], [class_device_create], [drivers/base/class.c], [ | |
1045 | AC_MSG_RESULT(yes) | |
1046 | AC_DEFINE(HAVE_CLASS_DEVICE_CREATE, 1, | |
1047 | [class_device_create() is available]) | |
1048 | ], [ | |
1049 | AC_MSG_RESULT(no) | |
1050 | ]) | |
46c685d0 | 1051 | ]) |
6a6cafbe | 1052 | |
6a6cafbe | 1053 | dnl # |
1054 | dnl # 2.6.26 API change, set_normalized_timespec() is exported. | |
1055 | dnl # | |
723aa3b0 ED |
1056 | AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_EXPORT], |
1057 | [AC_MSG_CHECKING([whether set_normalized_timespec() is available as export]) | |
1058 | SPL_LINUX_TRY_COMPILE_SYMBOL([ | |
1059 | #include <linux/time.h> | |
1060 | ], [ | |
1061 | set_normalized_timespec(NULL, 0, 0); | |
1062 | ], [set_normalized_timespec], [kernel/time.c], [ | |
1063 | AC_MSG_RESULT(yes) | |
1064 | AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_EXPORT, 1, | |
1065 | [set_normalized_timespec() is available as export]) | |
1066 | ], [ | |
1067 | AC_MSG_RESULT(no) | |
1068 | ]) | |
6a6cafbe | 1069 | ]) |
1070 | ||
1071 | dnl # | |
1072 | dnl # 2.6.16 API change, set_normalize_timespec() moved to time.c | |
1073 | dnl # previously it was available in time.h as an inline. | |
1074 | dnl # | |
86de8532 | 1075 | AC_DEFUN([SPL_AC_SET_NORMALIZED_TIMESPEC_INLINE], [ |
1076 | AC_MSG_CHECKING([whether set_normalized_timespec() is an inline]) | |
6a6cafbe | 1077 | SPL_LINUX_TRY_COMPILE([ |
1078 | #include <linux/time.h> | |
6a6cafbe | 1079 | void set_normalized_timespec(struct timespec *ts, |
25557fd8 | 1080 | time_t sec, long nsec) { } |
1081 | ], | |
1082 | [], | |
1083 | [ | |
6a6cafbe | 1084 | AC_MSG_RESULT(no) |
1085 | ],[ | |
1086 | AC_MSG_RESULT(yes) | |
1087 | AC_DEFINE(HAVE_SET_NORMALIZED_TIMESPEC_INLINE, 1, | |
1088 | [set_normalized_timespec() is available as inline]) | |
1089 | ]) | |
1090 | ]) | |
1091 | ||
1092 | dnl # | |
1093 | dnl # 2.6.18 API change, | |
1094 | dnl # timespec_sub() inline function available in linux/time.h | |
1095 | dnl # | |
86de8532 | 1096 | AC_DEFUN([SPL_AC_TIMESPEC_SUB], [ |
1097 | AC_MSG_CHECKING([whether timespec_sub() is available]) | |
6a6cafbe | 1098 | SPL_LINUX_TRY_COMPILE([ |
1099 | #include <linux/time.h> | |
1100 | ],[ | |
03318641 BB |
1101 | struct timespec a = { 0 }; |
1102 | struct timespec b = { 0 }; | |
1103 | struct timespec c __attribute__ ((unused)); | |
6a6cafbe | 1104 | c = timespec_sub(a, b); |
1105 | ],[ | |
1106 | AC_MSG_RESULT(yes) | |
1107 | AC_DEFINE(HAVE_TIMESPEC_SUB, 1, [timespec_sub() is available]) | |
1108 | ],[ | |
1109 | AC_MSG_RESULT(no) | |
1110 | ]) | |
1111 | ]) | |
1112 | ||
86de8532 | 1113 | dnl # |
3d061e9d | 1114 | dnl # 2.6.19 API change, |
1115 | dnl # check if init_utsname() is available in linux/utsname.h | |
1116 | dnl # | |
1117 | AC_DEFUN([SPL_AC_INIT_UTSNAME], [ | |
1118 | AC_MSG_CHECKING([whether init_utsname() is available]) | |
1119 | SPL_LINUX_TRY_COMPILE([ | |
1120 | #include <linux/utsname.h> | |
1121 | ],[ | |
03318641 BB |
1122 | struct new_utsname *a __attribute__ ((unused)); |
1123 | a = init_utsname(); | |
3d061e9d | 1124 | ],[ |
1125 | AC_MSG_RESULT(yes) | |
1126 | AC_DEFINE(HAVE_INIT_UTSNAME, 1, [init_utsname() is available]) | |
1127 | ],[ | |
1128 | AC_MSG_RESULT(no) | |
1129 | ]) | |
1130 | ]) | |
1131 | ||
3d061e9d | 1132 | dnl # |
1133 | dnl # 2.6.18 API change, | |
1134 | dnl # added linux/uaccess.h | |
322640b7 | 1135 | dnl # |
1136 | AC_DEFUN([SPL_AC_UACCESS_HEADER], [ | |
1137 | SPL_CHECK_HEADER([linux/uaccess.h], [UACCESS], [], []) | |
1138 | ]) | |
3d061e9d | 1139 | |
1140 | dnl # | |
1141 | dnl # 2.6.12 API change, | |
1142 | dnl # check whether 'kmalloc_node()' is available. | |
1143 | dnl # | |
1144 | AC_DEFUN([SPL_AC_KMALLOC_NODE], [ | |
1145 | AC_MSG_CHECKING([whether kmalloc_node() is available]) | |
1146 | SPL_LINUX_TRY_COMPILE([ | |
1147 | #include <linux/slab.h> | |
1148 | ],[ | |
03318641 BB |
1149 | void *a __attribute__ ((unused)); |
1150 | a = kmalloc_node(1, GFP_KERNEL, 0); | |
3d061e9d | 1151 | ],[ |
1152 | AC_MSG_RESULT(yes) | |
1153 | AC_DEFINE(HAVE_KMALLOC_NODE, 1, [kmalloc_node() is available]) | |
1154 | ],[ | |
1155 | AC_MSG_RESULT(no) | |
1156 | ]) | |
1157 | ]) | |
1158 | ||
1159 | dnl # | |
1160 | dnl # 2.6.9 API change, | |
1161 | dnl # check whether 'monotonic_clock()' is available it may | |
1162 | dnl # be available for some archs but not others. | |
1163 | dnl # | |
723aa3b0 ED |
1164 | AC_DEFUN([SPL_AC_MONOTONIC_CLOCK], |
1165 | [AC_MSG_CHECKING([whether monotonic_clock() is available]) | |
1166 | SPL_LINUX_TRY_COMPILE_SYMBOL([ | |
1167 | #include <linux/timex.h> | |
1168 | ], [ | |
1169 | monotonic_clock(); | |
1170 | ], [monotonic_clock], [], [ | |
1171 | AC_MSG_RESULT(yes) | |
1172 | AC_DEFINE(HAVE_MONOTONIC_CLOCK, 1, | |
1173 | [monotonic_clock() is available]) | |
1174 | ], [ | |
1175 | AC_MSG_RESULT(no) | |
1176 | ]) | |
3d061e9d | 1177 | ]) |
1178 | ||
1179 | dnl # | |
1180 | dnl # 2.6.16 API change, | |
1181 | dnl # check whether 'struct inode' has i_mutex | |
1182 | dnl # | |
1183 | AC_DEFUN([SPL_AC_INODE_I_MUTEX], [ | |
1184 | AC_MSG_CHECKING([whether struct inode has i_mutex]) | |
1185 | SPL_LINUX_TRY_COMPILE([ | |
1186 | #include <linux/fs.h> | |
1187 | #include <linux/mutex.h> | |
1188 | ],[ | |
1189 | struct inode i; | |
1190 | mutex_init(&i.i_mutex); | |
1191 | ],[ | |
1192 | AC_MSG_RESULT(yes) | |
1193 | AC_DEFINE(HAVE_INODE_I_MUTEX, 1, [struct inode has i_mutex]) | |
1194 | ],[ | |
1195 | AC_MSG_RESULT(no) | |
1196 | ]) | |
1197 | ]) | |
b61a6e8b | 1198 | |
4d54fdee BB |
1199 | dnl # |
1200 | dnl # 2.6.29 API change, | |
1201 | dnl # Adaptive mutexs introduced. | |
1202 | dnl # | |
1203 | AC_DEFUN([SPL_AC_MUTEX_OWNER], [ | |
1204 | AC_MSG_CHECKING([whether struct mutex has owner]) | |
1205 | SPL_LINUX_TRY_COMPILE([ | |
1206 | #include <linux/mutex.h> | |
1207 | ],[ | |
03318641 | 1208 | struct mutex mtx __attribute__ ((unused)); |
4d54fdee BB |
1209 | mtx.owner = NULL; |
1210 | ],[ | |
1211 | AC_MSG_RESULT(yes) | |
1212 | AC_DEFINE(HAVE_MUTEX_OWNER, 1, [struct mutex has owner]) | |
1213 | ],[ | |
1214 | AC_MSG_RESULT(no) | |
1215 | ]) | |
1216 | ]) | |
1217 | ||
86fd39f3 BB |
1218 | dnl # |
1219 | dnl # 2.6.39 API change, | |
1220 | dnl # Owner type change. A Linux mutex prior to 2.6.39 would store | |
1221 | dnl # the owner as a thread_info pointer when CONFIG_DEBUG_MUTEXES | |
1222 | dnl # was defined. As of 2.6.39 this was changed to a task_struct | |
1223 | dnl # pointer which frankly makes a lot more sense. | |
1224 | dnl # | |
1225 | AC_DEFUN([SPL_AC_MUTEX_OWNER_TASK_STRUCT], [ | |
1226 | AC_MSG_CHECKING([whether struct mutex owner is a task_struct]) | |
1227 | tmp_flags="$EXTRA_KCFLAGS" | |
1228 | EXTRA_KCFLAGS="-Werror" | |
1229 | SPL_LINUX_TRY_COMPILE([ | |
1230 | #include <linux/mutex.h> | |
a0625691 | 1231 | #include <linux/sched.h> |
86fd39f3 BB |
1232 | ],[ |
1233 | struct mutex mtx __attribute__ ((unused)); | |
1234 | mtx.owner = current; | |
1235 | ],[ | |
1236 | AC_MSG_RESULT(yes) | |
1237 | AC_DEFINE(HAVE_MUTEX_OWNER_TASK_STRUCT, 1, | |
1238 | [struct mutex owner is a task_struct]) | |
1239 | ],[ | |
1240 | AC_MSG_RESULT(no) | |
1241 | ]) | |
1242 | EXTRA_KCFLAGS="$tmp_flags" | |
1243 | ]) | |
1244 | ||
6c9433c1 BB |
1245 | dnl # |
1246 | dnl # 2.6.18 API change, | |
1247 | dnl # First introduced 'mutex_lock_nested()' in include/linux/mutex.h, | |
1248 | dnl # as part of the mutex validator. Fallback to using 'mutex_lock()' | |
1249 | dnl # if the mutex validator is disabled or otherwise unavailable. | |
1250 | dnl # | |
1251 | AC_DEFUN([SPL_AC_MUTEX_LOCK_NESTED], [ | |
1252 | AC_MSG_CHECKING([whether mutex_lock_nested() is available]) | |
1253 | SPL_LINUX_TRY_COMPILE([ | |
1254 | #include <linux/mutex.h> | |
1255 | ],[ | |
1256 | struct mutex mutex; | |
1257 | mutex_init(&mutex); | |
1258 | mutex_lock_nested(&mutex, 0); | |
1259 | ],[ | |
1260 | AC_MSG_RESULT(yes) | |
1261 | AC_DEFINE(HAVE_MUTEX_LOCK_NESTED, 1, | |
1262 | [mutex_lock_nested() is available]) | |
1263 | ],[ | |
1264 | AC_MSG_RESULT(no) | |
1265 | ]) | |
1266 | ]) | |
1267 | ||
31a033ec BB |
1268 | dnl # |
1269 | dnl # 2.6.27 API change, | |
1270 | dnl # on_each_cpu() uses 3 args, no 'retry' argument | |
1271 | dnl # | |
1272 | AC_DEFUN([SPL_AC_3ARGS_ON_EACH_CPU], [ | |
1273 | AC_MSG_CHECKING([whether on_each_cpu() wants 3 args]) | |
1274 | SPL_LINUX_TRY_COMPILE([ | |
050cd84e | 1275 | #include <linux/interrupt.h> |
31a033ec | 1276 | #include <linux/smp.h> |
050cd84e BB |
1277 | |
1278 | void on_each_cpu_func(void *data) { return; } | |
31a033ec | 1279 | ],[ |
050cd84e | 1280 | on_each_cpu(on_each_cpu_func, NULL, 0); |
31a033ec BB |
1281 | ],[ |
1282 | AC_MSG_RESULT(yes) | |
1283 | AC_DEFINE(HAVE_3ARGS_ON_EACH_CPU, 1, | |
1284 | [on_each_cpu wants 3 args]) | |
1285 | ],[ | |
1286 | AC_MSG_RESULT(no) | |
1287 | ]) | |
1288 | ]) | |
36b313da BB |
1289 | |
1290 | dnl # | |
d1ff2312 BB |
1291 | dnl # 2.6.18 API change, |
1292 | dnl # kallsyms_lookup_name no longer exported | |
1293 | dnl # | |
723aa3b0 ED |
1294 | AC_DEFUN([SPL_AC_KALLSYMS_LOOKUP_NAME], |
1295 | [AC_MSG_CHECKING([whether kallsyms_lookup_name() is available]) | |
1296 | SPL_LINUX_TRY_COMPILE_SYMBOL([ | |
1297 | #include <linux/kallsyms.h> | |
1298 | ], [ | |
1299 | kallsyms_lookup_name(NULL); | |
1300 | ], [kallsyms_lookup_name], [], [ | |
1301 | AC_MSG_RESULT(yes) | |
1302 | AC_DEFINE(HAVE_KALLSYMS_LOOKUP_NAME, 1, | |
1303 | [kallsyms_lookup_name() is available]) | |
1304 | ], [ | |
1305 | AC_MSG_RESULT(no) | |
1306 | ]) | |
d1ff2312 BB |
1307 | ]) |
1308 | ||
1309 | dnl # | |
e11d6c5f BB |
1310 | dnl # Proposed API change, |
1311 | dnl # This symbol is not available in stock kernels. You may build a | |
1312 | dnl # custom kernel with the *-spl-export-symbols.patch which will export | |
1313 | dnl # these symbols for use. If your already rolling a custom kernel for | |
1314 | dnl # your environment this is recommended. | |
d1ff2312 | 1315 | dnl # |
723aa3b0 ED |
1316 | AC_DEFUN([SPL_AC_GET_VMALLOC_INFO], |
1317 | [AC_MSG_CHECKING([whether get_vmalloc_info() is available]) | |
1318 | SPL_CHECK_SYMBOL_EXPORT([get_vmalloc_info], [], [ | |
1319 | AC_MSG_RESULT(yes) | |
1320 | AC_DEFINE(HAVE_GET_VMALLOC_INFO, 1, | |
1321 | [get_vmalloc_info() is available]) | |
1322 | ], [ | |
1323 | AC_MSG_RESULT(no) | |
1324 | ]) | |
d1ff2312 BB |
1325 | ]) |
1326 | ||
5232d256 BB |
1327 | dnl # |
1328 | dnl # 2.6.17 API change | |
1329 | dnl # The helper functions first_online_pgdat(), next_online_pgdat(), and | |
1330 | dnl # next_zone() are introduced to simplify for_each_zone(). These symbols | |
1331 | dnl # were exported in 2.6.17 for use by modules which was consistent with | |
1332 | dnl # the previous implementation of for_each_zone(). From 2.6.18 - 2.6.19 | |
1333 | dnl # the symbols were exported as 'unused', and by 2.6.20 they exports | |
1334 | dnl # were dropped entirely leaving modules no way to directly iterate over | |
1335 | dnl # the zone list. Because we need access to the zone helpers we check | |
1336 | dnl # if the kernel contains the old or new implementation. Then we check | |
1337 | dnl # to see if the symbols we need for each version are available. If they | |
1338 | dnl # are not, dynamically aquire the addresses with kallsyms_lookup_name(). | |
1339 | dnl # | |
1340 | AC_DEFUN([SPL_AC_PGDAT_HELPERS], [ | |
1341 | AC_MSG_CHECKING([whether symbol *_pgdat exist]) | |
1342 | grep -q -E 'first_online_pgdat' $LINUX/include/linux/mmzone.h 2>/dev/null | |
1343 | rc=$? | |
1344 | if test $rc -eq 0; then | |
1345 | AC_MSG_RESULT([yes]) | |
723aa3b0 | 1346 | AC_DEFINE(HAVE_PGDAT_HELPERS, 1, [pgdat helpers are available]) |
5232d256 BB |
1347 | else |
1348 | AC_MSG_RESULT([no]) | |
1349 | fi | |
1350 | ]) | |
1351 | ||
d1ff2312 | 1352 | dnl # |
e11d6c5f BB |
1353 | dnl # Proposed API change, |
1354 | dnl # This symbol is not available in stock kernels. You may build a | |
1355 | dnl # custom kernel with the *-spl-export-symbols.patch which will export | |
1356 | dnl # these symbols for use. If your already rolling a custom kernel for | |
1357 | dnl # your environment this is recommended. | |
36b313da | 1358 | dnl # |
723aa3b0 ED |
1359 | AC_DEFUN([SPL_AC_FIRST_ONLINE_PGDAT], |
1360 | [AC_MSG_CHECKING([whether first_online_pgdat() is available]) | |
1361 | SPL_LINUX_TRY_COMPILE_SYMBOL([ | |
1362 | #include <linux/mmzone.h> | |
1363 | ], [ | |
1364 | first_online_pgdat(); | |
1365 | ], [first_online_pgdat], [], [ | |
1366 | AC_MSG_RESULT(yes) | |
1367 | AC_DEFINE(HAVE_FIRST_ONLINE_PGDAT, 1, | |
1368 | [first_online_pgdat() is available]) | |
1369 | ], [ | |
1370 | AC_MSG_RESULT(no) | |
1371 | ]) | |
36b313da BB |
1372 | ]) |
1373 | ||
1374 | dnl # | |
e11d6c5f BB |
1375 | dnl # Proposed API change, |
1376 | dnl # This symbol is not available in stock kernels. You may build a | |
1377 | dnl # custom kernel with the *-spl-export-symbols.patch which will export | |
1378 | dnl # these symbols for use. If your already rolling a custom kernel for | |
1379 | dnl # your environment this is recommended. | |
36b313da | 1380 | dnl # |
723aa3b0 ED |
1381 | AC_DEFUN([SPL_AC_NEXT_ONLINE_PGDAT], |
1382 | [AC_MSG_CHECKING([whether next_online_pgdat() is available]) | |
1383 | SPL_LINUX_TRY_COMPILE_SYMBOL([ | |
1384 | #include <linux/mmzone.h> | |
1385 | ], [ | |
1386 | next_online_pgdat(NULL); | |
1387 | ], [next_online_pgdat], [], [ | |
1388 | AC_MSG_RESULT(yes) | |
1389 | AC_DEFINE(HAVE_NEXT_ONLINE_PGDAT, 1, | |
1390 | [next_online_pgdat() is available]) | |
1391 | ], [ | |
1392 | AC_MSG_RESULT(no) | |
1393 | ]) | |
36b313da BB |
1394 | ]) |
1395 | ||
1396 | dnl # | |
e11d6c5f BB |
1397 | dnl # Proposed API change, |
1398 | dnl # This symbol is not available in stock kernels. You may build a | |
1399 | dnl # custom kernel with the *-spl-export-symbols.patch which will export | |
1400 | dnl # these symbols for use. If your already rolling a custom kernel for | |
1401 | dnl # your environment this is recommended. | |
36b313da | 1402 | dnl # |
723aa3b0 ED |
1403 | AC_DEFUN([SPL_AC_NEXT_ZONE], |
1404 | [AC_MSG_CHECKING([whether next_zone() is available]) | |
1405 | SPL_LINUX_TRY_COMPILE_SYMBOL([ | |
1406 | #include <linux/mmzone.h> | |
1407 | ], [ | |
1408 | next_zone(NULL); | |
1409 | ], [next_zone], [], [ | |
1410 | AC_MSG_RESULT(yes) | |
1411 | AC_DEFINE(HAVE_NEXT_ZONE, 1, [next_zone() is available]) | |
1412 | ], [ | |
1413 | AC_MSG_RESULT(no) | |
1414 | ]) | |
36b313da | 1415 | ]) |
4ab13d3b | 1416 | |
5232d256 BB |
1417 | dnl # |
1418 | dnl # 2.6.17 API change, | |
1419 | dnl # See SPL_AC_PGDAT_HELPERS for details. | |
1420 | dnl # | |
723aa3b0 ED |
1421 | AC_DEFUN([SPL_AC_PGDAT_LIST], |
1422 | [AC_MSG_CHECKING([whether pgdat_list is available]) | |
1423 | SPL_LINUX_TRY_COMPILE_SYMBOL([ | |
1424 | #include <linux/topology.h> | |
1425 | pg_data_t *tmp = pgdat_list; | |
1426 | ], [], [pgdat_list], [], [ | |
1427 | AC_MSG_RESULT(yes) | |
1428 | AC_DEFINE(HAVE_PGDAT_LIST, 1, [pgdat_list is available]) | |
1429 | ], [ | |
1430 | AC_MSG_RESULT(no) | |
1431 | ]) | |
5232d256 BB |
1432 | ]) |
1433 | ||
96dded38 BB |
1434 | dnl # |
1435 | dnl # 2.6.18 API change, | |
1436 | dnl # First introduced global_page_state() support as an inline. | |
1437 | dnl # | |
1438 | AC_DEFUN([SPL_AC_GLOBAL_PAGE_STATE], [ | |
1439 | AC_MSG_CHECKING([whether global_page_state() is available]) | |
1440 | SPL_LINUX_TRY_COMPILE([ | |
6ae7fef5 | 1441 | #include <linux/mm.h> |
96dded38 | 1442 | ],[ |
03318641 | 1443 | unsigned long state __attribute__ ((unused)); |
6ae7fef5 | 1444 | state = global_page_state(0); |
96dded38 BB |
1445 | ],[ |
1446 | AC_MSG_RESULT(yes) | |
1447 | AC_DEFINE(HAVE_GLOBAL_PAGE_STATE, 1, | |
1448 | [global_page_state() is available]) | |
1449 | ],[ | |
1450 | AC_MSG_RESULT(no) | |
1451 | ]) | |
1452 | ]) | |
1453 | ||
e11d6c5f | 1454 | dnl # |
6ae7fef5 BB |
1455 | dnl # 2.6.21 API change (plus subsequent naming convention changes), |
1456 | dnl # Public global zone stats now include a free page count. However | |
1457 | dnl # the enumerated names of the counters have changed since this API | |
1458 | dnl # was introduced. We need to deduce the corrent name to use. This | |
1459 | dnl # replaces the priviate get_zone_counts() interface. | |
1460 | dnl # | |
1461 | dnl # NR_FREE_PAGES was available from 2.6.21 to current kernels, which | |
1462 | dnl # is 2.6.30 as of when this was written. | |
e11d6c5f | 1463 | dnl # |
6ae7fef5 BB |
1464 | AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_FREE], [ |
1465 | AC_MSG_CHECKING([whether page state NR_FREE_PAGES is available]) | |
e11d6c5f | 1466 | SPL_LINUX_TRY_COMPILE([ |
6ae7fef5 | 1467 | #include <linux/mm.h> |
e11d6c5f | 1468 | ],[ |
03318641 | 1469 | enum zone_stat_item zsi __attribute__ ((unused)); |
6ae7fef5 | 1470 | zsi = NR_FREE_PAGES; |
e11d6c5f BB |
1471 | ],[ |
1472 | AC_MSG_RESULT(yes) | |
6ae7fef5 BB |
1473 | AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_FREE_PAGES, 1, |
1474 | [Page state NR_FREE_PAGES is available]) | |
e11d6c5f BB |
1475 | ],[ |
1476 | AC_MSG_RESULT(no) | |
1477 | ]) | |
1478 | ]) | |
a093c6a4 | 1479 | |
6ae7fef5 BB |
1480 | dnl # |
1481 | dnl # 2.6.21 API change (plus subsequent naming convention changes), | |
1482 | dnl # Public global zone stats now include an inactive page count. However | |
1483 | dnl # the enumerated names of the counters have changed since this API | |
1484 | dnl # was introduced. We need to deduce the corrent name to use. This | |
1485 | dnl # replaces the priviate get_zone_counts() interface. | |
1486 | dnl # | |
1487 | dnl # NR_INACTIVE was available from 2.6.21 to 2.6.27 and included both | |
1488 | dnl # anonymous and file inactive pages. As of 2.6.28 it was split in | |
1489 | dnl # to NR_INACTIVE_ANON and NR_INACTIVE_FILE. | |
1490 | dnl # | |
1491 | AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_INACTIVE], [ | |
1492 | AC_MSG_CHECKING([whether page state NR_INACTIVE is available]) | |
1493 | SPL_LINUX_TRY_COMPILE([ | |
1494 | #include <linux/mm.h> | |
1495 | ],[ | |
03318641 | 1496 | enum zone_stat_item zsi __attribute__ ((unused)); |
6ae7fef5 BB |
1497 | zsi = NR_INACTIVE; |
1498 | ],[ | |
1499 | AC_MSG_RESULT(yes) | |
1500 | AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_INACTIVE, 1, | |
1501 | [Page state NR_INACTIVE is available]) | |
1502 | ],[ | |
1503 | AC_MSG_RESULT(no) | |
1504 | ]) | |
1505 | ||
1506 | AC_MSG_CHECKING([whether page state NR_INACTIVE_ANON is available]) | |
1507 | SPL_LINUX_TRY_COMPILE([ | |
1508 | #include <linux/mm.h> | |
1509 | ],[ | |
03318641 | 1510 | enum zone_stat_item zsi __attribute__ ((unused)); |
6ae7fef5 BB |
1511 | zsi = NR_INACTIVE_ANON; |
1512 | ],[ | |
1513 | AC_MSG_RESULT(yes) | |
1514 | AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_ANON, 1, | |
1515 | [Page state NR_INACTIVE_ANON is available]) | |
1516 | ],[ | |
1517 | AC_MSG_RESULT(no) | |
1518 | ]) | |
1519 | ||
1520 | AC_MSG_CHECKING([whether page state NR_INACTIVE_FILE is available]) | |
1521 | SPL_LINUX_TRY_COMPILE([ | |
1522 | #include <linux/mm.h> | |
1523 | ],[ | |
03318641 | 1524 | enum zone_stat_item zsi __attribute__ ((unused)); |
6ae7fef5 BB |
1525 | zsi = NR_INACTIVE_FILE; |
1526 | ],[ | |
1527 | AC_MSG_RESULT(yes) | |
1528 | AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_FILE, 1, | |
1529 | [Page state NR_INACTIVE_FILE is available]) | |
1530 | ],[ | |
1531 | AC_MSG_RESULT(no) | |
1532 | ]) | |
1533 | ]) | |
1534 | ||
1535 | dnl # | |
1536 | dnl # 2.6.21 API change (plus subsequent naming convention changes), | |
1537 | dnl # Public global zone stats now include an active page count. However | |
1538 | dnl # the enumerated names of the counters have changed since this API | |
1539 | dnl # was introduced. We need to deduce the corrent name to use. This | |
1540 | dnl # replaces the priviate get_zone_counts() interface. | |
1541 | dnl # | |
1542 | dnl # NR_ACTIVE was available from 2.6.21 to 2.6.27 and included both | |
1543 | dnl # anonymous and file active pages. As of 2.6.28 it was split in | |
1544 | dnl # to NR_ACTIVE_ANON and NR_ACTIVE_FILE. | |
1545 | dnl # | |
1546 | AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_ACTIVE], [ | |
1547 | AC_MSG_CHECKING([whether page state NR_ACTIVE is available]) | |
1548 | SPL_LINUX_TRY_COMPILE([ | |
1549 | #include <linux/mm.h> | |
1550 | ],[ | |
03318641 | 1551 | enum zone_stat_item zsi __attribute__ ((unused)); |
6ae7fef5 BB |
1552 | zsi = NR_ACTIVE; |
1553 | ],[ | |
1554 | AC_MSG_RESULT(yes) | |
1555 | AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_ACTIVE, 1, | |
1556 | [Page state NR_ACTIVE is available]) | |
1557 | ],[ | |
1558 | AC_MSG_RESULT(no) | |
1559 | ]) | |
1560 | ||
1561 | AC_MSG_CHECKING([whether page state NR_ACTIVE_ANON is available]) | |
1562 | SPL_LINUX_TRY_COMPILE([ | |
1563 | #include <linux/mm.h> | |
1564 | ],[ | |
03318641 | 1565 | enum zone_stat_item zsi __attribute__ ((unused)); |
6ae7fef5 BB |
1566 | zsi = NR_ACTIVE_ANON; |
1567 | ],[ | |
1568 | AC_MSG_RESULT(yes) | |
1569 | AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_ANON, 1, | |
1570 | [Page state NR_ACTIVE_ANON is available]) | |
1571 | ],[ | |
1572 | AC_MSG_RESULT(no) | |
1573 | ]) | |
1574 | ||
1575 | AC_MSG_CHECKING([whether page state NR_ACTIVE_FILE is available]) | |
1576 | SPL_LINUX_TRY_COMPILE([ | |
1577 | #include <linux/mm.h> | |
1578 | ],[ | |
03318641 | 1579 | enum zone_stat_item zsi __attribute__ ((unused)); |
6ae7fef5 BB |
1580 | zsi = NR_ACTIVE_FILE; |
1581 | ],[ | |
1582 | AC_MSG_RESULT(yes) | |
1583 | AC_DEFINE(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_FILE, 1, | |
1584 | [Page state NR_ACTIVE_FILE is available]) | |
1585 | ],[ | |
1586 | AC_MSG_RESULT(no) | |
1587 | ]) | |
1588 | ]) | |
1589 | ||
1590 | dnl # | |
1591 | dnl # Proposed API change for legacy kernels. | |
1592 | dnl # This symbol is not available in older kernels. For kernels post | |
1593 | dnl # 2.6.21 the global_page_state() API is used to get free/inactive/active | |
1594 | dnl # page state information. This symbol is only used in legacy kernels | |
1595 | dnl # any only as a last resort. | |
1596 | dnl | |
1597 | AC_DEFUN([SPL_AC_GET_ZONE_COUNTS], [ | |
1598 | AC_MSG_CHECKING([whether symbol get_zone_counts is needed]) | |
1599 | SPL_LINUX_TRY_COMPILE([ | |
1600 | ],[ | |
1601 | #if !defined(HAVE_ZONE_STAT_ITEM_NR_FREE_PAGES) | |
1602 | #error "global_page_state needs NR_FREE_PAGES" | |
1603 | #endif | |
1604 | ||
1605 | #if !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE) && \ | |
1606 | !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_ANON) && \ | |
1607 | !defined(HAVE_ZONE_STAT_ITEM_NR_ACTIVE_FILE) | |
1608 | #error "global_page_state needs NR_ACTIVE*" | |
1609 | #endif | |
1610 | ||
1611 | #if !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE) && \ | |
1612 | !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_ANON) && \ | |
1613 | !defined(HAVE_ZONE_STAT_ITEM_NR_INACTIVE_FILE) | |
1614 | #error "global_page_state needs NR_INACTIVE*" | |
1615 | #endif | |
1616 | ],[ | |
1617 | AC_MSG_RESULT(no) | |
1618 | ],[ | |
1619 | AC_MSG_RESULT(yes) | |
1620 | AC_DEFINE(NEED_GET_ZONE_COUNTS, 1, | |
1621 | [get_zone_counts() is needed]) | |
1622 | ||
723aa3b0 ED |
1623 | AC_MSG_CHECKING([whether get_zone_counts() is available]) |
1624 | SPL_LINUX_TRY_COMPILE_SYMBOL([ | |
1625 | #include <linux/mmzone.h> | |
1626 | ], [ | |
1627 | get_zone_counts(NULL, NULL, NULL); | |
1628 | ], [get_zone_counts], [], [ | |
1629 | AC_MSG_RESULT(yes) | |
1630 | AC_DEFINE(HAVE_GET_ZONE_COUNTS, 1, | |
1631 | [get_zone_counts() is available]) | |
1632 | ], [ | |
1633 | AC_MSG_RESULT(no) | |
1634 | ]) | |
6ae7fef5 BB |
1635 | ]) |
1636 | ]) | |
1637 | ||
7119bf70 BB |
1638 | dnl # |
1639 | dnl # 2.6.27 API change, | |
1640 | dnl # The user_path_dir() replaces __user_walk() | |
1641 | dnl # | |
723aa3b0 ED |
1642 | AC_DEFUN([SPL_AC_USER_PATH_DIR], |
1643 | [AC_MSG_CHECKING([whether user_path_dir() is available]) | |
1644 | SPL_LINUX_TRY_COMPILE_SYMBOL([ | |
1645 | #include <linux/fcntl.h> | |
1646 | #include <linux/namei.h> | |
1647 | ], [ | |
1648 | user_path_dir(NULL, NULL); | |
1649 | ], [user_path_at], [], [ | |
1650 | AC_MSG_RESULT(yes) | |
1651 | AC_DEFINE(HAVE_USER_PATH_DIR, 1, [user_path_dir() is available]) | |
1652 | ], [ | |
1653 | AC_MSG_RESULT(no) | |
1654 | ]) | |
7119bf70 BB |
1655 | ]) |
1656 | ||
51a727e9 BB |
1657 | dnl # |
1658 | dnl # Symbol available in RHEL kernels not in stock kernels. | |
1659 | dnl # | |
723aa3b0 ED |
1660 | AC_DEFUN([SPL_AC_SET_FS_PWD], |
1661 | [AC_MSG_CHECKING([whether set_fs_pwd() is available]) | |
1662 | SPL_LINUX_TRY_COMPILE_SYMBOL([ | |
1663 | #include <linux/spinlock.h> | |
1664 | #include <linux/fs_struct.h> | |
1665 | ], [ | |
1666 | (void) set_fs_pwd; | |
1667 | ], [set_fs_pwd], [], [ | |
1668 | AC_MSG_RESULT(yes) | |
1669 | AC_DEFINE(HAVE_SET_FS_PWD, 1, [set_fs_pwd() is available]) | |
1670 | ], [ | |
1671 | AC_MSG_RESULT(no) | |
1672 | ]) | |
51a727e9 BB |
1673 | ]) |
1674 | ||
1675 | dnl # | |
1676 | dnl # 2.6.25 API change, | |
1677 | dnl # Simplied API by replacing mnt+dentry args with a single path arg. | |
1678 | dnl # | |
1679 | AC_DEFUN([SPL_AC_2ARGS_SET_FS_PWD], | |
1680 | [AC_MSG_CHECKING([whether set_fs_pwd() wants 2 args]) | |
1681 | SPL_LINUX_TRY_COMPILE([ | |
1682 | #include <linux/sched.h> | |
baf2979e | 1683 | #include <linux/fs_struct.h> |
51a727e9 BB |
1684 | ],[ |
1685 | set_fs_pwd(NULL, NULL); | |
1686 | ],[ | |
1687 | AC_MSG_RESULT(yes) | |
1688 | AC_DEFINE(HAVE_2ARGS_SET_FS_PWD, 1, | |
1689 | [set_fs_pwd() wants 2 args]) | |
a54718cf | 1690 | HAVE_2ARGS_SET_FS_PWD=yes |
51a727e9 BB |
1691 | ],[ |
1692 | AC_MSG_RESULT(no) | |
1693 | ]) | |
1694 | ]) | |
1695 | ||
a54718cf RY |
1696 | dnl # |
1697 | dnl # 3.9 API change | |
1698 | dnl # set_fs_pwd takes const struct path * | |
1699 | dnl # | |
1700 | AC_DEFUN([SPL_AC_SET_FS_PWD_WITH_CONST], | |
1701 | if test "x$HAVE_2ARGS_SET_FS_PWD" = xyes; then | |
1702 | tmp_flags="$EXTRA_KCFLAGS" | |
1703 | EXTRA_KCFLAGS="-Werror" | |
1704 | [AC_MSG_CHECKING([whether set_fs_pwd() requires const struct path *]) | |
1705 | SPL_LINUX_TRY_COMPILE([ | |
1706 | #include <linux/spinlock.h> | |
1707 | #include <linux/fs_struct.h> | |
1708 | #include <linux/path.h> | |
1709 | void (*const set_fs_pwd_func) | |
1710 | (struct fs_struct *, const struct path *) | |
1711 | = set_fs_pwd; | |
1712 | ],[ | |
1713 | return 0; | |
1714 | ],[ | |
1715 | AC_MSG_RESULT(yes) | |
1716 | AC_DEFINE(HAVE_SET_FS_PWD_WITH_CONST, 1, | |
1717 | [set_fs_pwd() needs const path *]) | |
1718 | ],[ | |
1719 | SPL_LINUX_TRY_COMPILE([ | |
1720 | #include <linux/spinlock.h> | |
1721 | #include <linux/fs_struct.h> | |
1722 | #include <linux/path.h> | |
1723 | void (*const set_fs_pwd_func) | |
1724 | (struct fs_struct *, struct path *) | |
1725 | = set_fs_pwd; | |
1726 | ],[ | |
1727 | return 0; | |
1728 | ],[ | |
1729 | AC_MSG_RESULT(no) | |
1730 | ],[ | |
1731 | AC_MSG_ERROR(unknown) | |
1732 | ]) | |
1733 | ]) | |
1734 | EXTRA_KCFLAGS="$tmp_flags" | |
1735 | fi | |
1736 | ]) | |
1737 | ||
a093c6a4 BB |
1738 | dnl # |
1739 | dnl # SLES API change, never adopted in mainline, | |
1740 | dnl # Third 'struct vfsmount *' argument removed. | |
1741 | dnl # | |
1742 | AC_DEFUN([SPL_AC_2ARGS_VFS_UNLINK], | |
1743 | [AC_MSG_CHECKING([whether vfs_unlink() wants 2 args]) | |
1744 | SPL_LINUX_TRY_COMPILE([ | |
1745 | #include <linux/fs.h> | |
1746 | ],[ | |
1747 | vfs_unlink(NULL, NULL); | |
1748 | ],[ | |
1749 | AC_MSG_RESULT(yes) | |
1750 | AC_DEFINE(HAVE_2ARGS_VFS_UNLINK, 1, | |
1751 | [vfs_unlink() wants 2 args]) | |
1752 | ],[ | |
1753 | AC_MSG_RESULT(no) | |
1754 | ]) | |
1755 | ]) | |
1756 | ||
1757 | dnl # | |
1758 | dnl # SLES API change, never adopted in mainline, | |
1759 | dnl # Third and sixth 'struct vfsmount *' argument removed. | |
1760 | dnl # | |
1761 | AC_DEFUN([SPL_AC_4ARGS_VFS_RENAME], | |
1762 | [AC_MSG_CHECKING([whether vfs_rename() wants 4 args]) | |
1763 | SPL_LINUX_TRY_COMPILE([ | |
1764 | #include <linux/fs.h> | |
1765 | ],[ | |
1766 | vfs_rename(NULL, NULL, NULL, NULL); | |
1767 | ],[ | |
1768 | AC_MSG_RESULT(yes) | |
1769 | AC_DEFINE(HAVE_4ARGS_VFS_RENAME, 1, | |
1770 | [vfs_rename() wants 4 args]) | |
1771 | ],[ | |
1772 | AC_MSG_RESULT(no) | |
1773 | ]) | |
1774 | ]) | |
ec7d53e9 | 1775 | |
9b2048c2 BB |
1776 | dnl # |
1777 | dnl # 2.6.36 API change, | |
1778 | dnl # The 'struct fs_struct->lock' was changed from a rwlock_t to | |
1779 | dnl # a spinlock_t to improve the fastpath performance. | |
1780 | dnl # | |
1781 | AC_DEFUN([SPL_AC_FS_STRUCT_SPINLOCK], [ | |
1782 | AC_MSG_CHECKING([whether struct fs_struct uses spinlock_t]) | |
97fd6a07 BB |
1783 | tmp_flags="$EXTRA_KCFLAGS" |
1784 | EXTRA_KCFLAGS="-Werror" | |
9b2048c2 BB |
1785 | SPL_LINUX_TRY_COMPILE([ |
1786 | #include <linux/sched.h> | |
1787 | #include <linux/fs_struct.h> | |
1788 | ],[ | |
1789 | struct fs_struct fs; | |
1790 | spin_lock_init(&fs.lock); | |
1791 | ],[ | |
1792 | AC_MSG_RESULT(yes) | |
1793 | AC_DEFINE(HAVE_FS_STRUCT_SPINLOCK, 1, | |
1794 | [struct fs_struct uses spinlock_t]) | |
1795 | ],[ | |
1796 | AC_MSG_RESULT(no) | |
1797 | ]) | |
97fd6a07 | 1798 | EXTRA_KCFLAGS="$tmp_flags" |
9b2048c2 BB |
1799 | ]) |
1800 | ||
ec7d53e9 BB |
1801 | dnl # |
1802 | dnl # 2.6.29 API change, | |
1803 | dnl # check whether 'struct cred' exists | |
1804 | dnl # | |
1805 | AC_DEFUN([SPL_AC_CRED_STRUCT], [ | |
1806 | AC_MSG_CHECKING([whether struct cred exists]) | |
1807 | SPL_LINUX_TRY_COMPILE([ | |
1808 | #include <linux/cred.h> | |
1809 | ],[ | |
03318641 | 1810 | struct cred *cr __attribute__ ((unused)); |
ec7d53e9 BB |
1811 | cr = NULL; |
1812 | ],[ | |
1813 | AC_MSG_RESULT(yes) | |
1814 | AC_DEFINE(HAVE_CRED_STRUCT, 1, [struct cred exists]) | |
1815 | ],[ | |
1816 | AC_MSG_RESULT(no) | |
1817 | ]) | |
1818 | ]) | |
1819 | ||
1820 | dnl # | |
e811949a | 1821 | dnl # Custom SPL patch may export this symbol. |
ec7d53e9 | 1822 | dnl # |
723aa3b0 ED |
1823 | AC_DEFUN([SPL_AC_GROUPS_SEARCH], |
1824 | [AC_MSG_CHECKING([whether groups_search() is available]) | |
1825 | SPL_LINUX_TRY_COMPILE_SYMBOL([ | |
1826 | #include <linux/cred.h> | |
1827 | ], [ | |
1828 | groups_search(NULL, 0); | |
1829 | ], [groups_search], [], [ | |
1830 | AC_MSG_RESULT(yes) | |
1831 | AC_DEFINE(HAVE_GROUPS_SEARCH, 1, [groups_search() is available]) | |
1832 | ], [ | |
1833 | AC_MSG_RESULT(no) | |
1834 | ]) | |
ec7d53e9 | 1835 | ]) |
e811949a BB |
1836 | |
1837 | dnl # | |
1838 | dnl # 2.6.x API change, | |
1839 | dnl # __put_task_struct() was exported in RHEL5 but unavailable elsewhere. | |
1840 | dnl # | |
723aa3b0 ED |
1841 | AC_DEFUN([SPL_AC_PUT_TASK_STRUCT], |
1842 | [AC_MSG_CHECKING([whether __put_task_struct() is available]) | |
1843 | SPL_LINUX_TRY_COMPILE_SYMBOL([ | |
1844 | #include <linux/sched.h> | |
1845 | ], [ | |
1846 | __put_task_struct(NULL); | |
1847 | ], [__put_task_struct], [], [ | |
1848 | AC_MSG_RESULT(yes) | |
1849 | AC_DEFINE(HAVE_PUT_TASK_STRUCT, 1, | |
1850 | [__put_task_struct() is available]) | |
1851 | ], [ | |
1852 | AC_MSG_RESULT(no) | |
1853 | ]) | |
e811949a | 1854 | ]) |
3977f837 BB |
1855 | |
1856 | dnl # | |
1857 | dnl # 2.6.32 API change, | |
1858 | dnl # Unused 'struct file *' removed from prototype. | |
1859 | dnl # | |
1860 | AC_DEFUN([SPL_AC_5ARGS_PROC_HANDLER], [ | |
1861 | AC_MSG_CHECKING([whether proc_handler() wants 5 args]) | |
1862 | SPL_LINUX_TRY_COMPILE([ | |
1863 | #include <linux/sysctl.h> | |
1864 | ],[ | |
1865 | proc_dostring(NULL, 0, NULL, NULL, NULL); | |
1866 | ],[ | |
1867 | AC_MSG_RESULT(yes) | |
1868 | AC_DEFINE(HAVE_5ARGS_PROC_HANDLER, 1, | |
1869 | [proc_handler() wants 5 args]) | |
1870 | ],[ | |
1871 | AC_MSG_RESULT(no) | |
1872 | ]) | |
1873 | ]) | |
b868e22f BB |
1874 | |
1875 | dnl # | |
1876 | dnl # 2.6.x API change, | |
1877 | dnl # kvasprintf() function added. | |
1878 | dnl # | |
723aa3b0 ED |
1879 | AC_DEFUN([SPL_AC_KVASPRINTF], |
1880 | [AC_MSG_CHECKING([whether kvasprintf() is available]) | |
1881 | SPL_LINUX_TRY_COMPILE_SYMBOL([ | |
1882 | #include <linux/kernel.h> | |
1883 | ], [ | |
1884 | kvasprintf(0, NULL, *((va_list*)NULL)); | |
1885 | ], [kvasprintf], [], [ | |
1886 | AC_MSG_RESULT(yes) | |
1887 | AC_DEFINE(HAVE_KVASPRINTF, 1, [kvasprintf() is available]) | |
1888 | ], [ | |
1889 | AC_MSG_RESULT(no) | |
1890 | ]) | |
b868e22f | 1891 | ]) |
f0ff89fc | 1892 | |
0d0b5237 BB |
1893 | dnl # |
1894 | dnl # 2.6.29 API change, | |
1895 | dnl # vfs_fsync() funcation added, prior to this use file_fsync(). | |
1896 | dnl # | |
723aa3b0 ED |
1897 | AC_DEFUN([SPL_AC_VFS_FSYNC], |
1898 | [AC_MSG_CHECKING([whether vfs_fsync() is available]) | |
1899 | SPL_LINUX_TRY_COMPILE_SYMBOL([ | |
1900 | #include <linux/fs.h> | |
1901 | ], [ | |
1902 | (void) vfs_fsync; | |
1903 | ], [vfs_fsync], [fs/sync.c], [ | |
1904 | AC_MSG_RESULT(yes) | |
1905 | AC_DEFINE(HAVE_VFS_FSYNC, 1, [vfs_fsync() is available]) | |
1906 | ], [ | |
1907 | AC_MSG_RESULT(no) | |
1908 | ]) | |
0d0b5237 BB |
1909 | ]) |
1910 | ||
f0ff89fc BB |
1911 | dnl # |
1912 | dnl # 2.6.35 API change, | |
0d0b5237 | 1913 | dnl # Unused 'struct dentry *' removed from vfs_fsync() prototype. |
f0ff89fc | 1914 | dnl # |
0d0b5237 BB |
1915 | AC_DEFUN([SPL_AC_2ARGS_VFS_FSYNC], [ |
1916 | AC_MSG_CHECKING([whether vfs_fsync() wants 2 args]) | |
f0ff89fc | 1917 | SPL_LINUX_TRY_COMPILE([ |
0d0b5237 | 1918 | #include <linux/fs.h> |
f0ff89fc | 1919 | ],[ |
0d0b5237 | 1920 | vfs_fsync(NULL, 0); |
f0ff89fc BB |
1921 | ],[ |
1922 | AC_MSG_RESULT(yes) | |
0d0b5237 | 1923 | AC_DEFINE(HAVE_2ARGS_VFS_FSYNC, 1, [vfs_fsync() wants 2 args]) |
f0ff89fc BB |
1924 | ],[ |
1925 | AC_MSG_RESULT(no) | |
1926 | ]) | |
1927 | ]) | |
46aa7b39 | 1928 | |
bbdc6ae4 ED |
1929 | dnl # |
1930 | dnl # 3.5 API change, | |
1931 | dnl # inode_operations.truncate_range removed | |
bbdc6ae4 ED |
1932 | dnl # |
1933 | AC_DEFUN([SPL_AC_INODE_TRUNCATE_RANGE], [ | |
1934 | AC_MSG_CHECKING([whether truncate_range() inode operation is available]) | |
1935 | SPL_LINUX_TRY_COMPILE([ | |
1936 | #include <linux/fs.h> | |
1937 | ],[ | |
1938 | struct inode_operations ops; | |
1939 | ops.truncate_range = NULL; | |
1940 | ],[ | |
1941 | AC_MSG_RESULT(yes) | |
1942 | AC_DEFINE(HAVE_INODE_TRUNCATE_RANGE, 1, | |
1943 | [truncate_range() inode operation is available]) | |
1944 | ],[ | |
1945 | AC_MSG_RESULT(no) | |
1946 | ]) | |
1c7b3eaf BB |
1947 | ]) |
1948 | ||
1949 | dnl # | |
1950 | dnl # Linux 2.6.38 - 3.x API | |
1951 | dnl # | |
1952 | AC_DEFUN([SPL_AC_KERNEL_FILE_FALLOCATE], [ | |
1953 | AC_MSG_CHECKING([whether fops->fallocate() exists]) | |
1954 | SPL_LINUX_TRY_COMPILE([ | |
1955 | #include <linux/fs.h> | |
1956 | ],[ | |
1957 | long (*fallocate) (struct file *, int, loff_t, loff_t) = NULL; | |
1958 | struct file_operations fops __attribute__ ((unused)) = { | |
1959 | .fallocate = fallocate, | |
1960 | }; | |
1961 | ],[ | |
1962 | AC_MSG_RESULT(yes) | |
1963 | AC_DEFINE(HAVE_FILE_FALLOCATE, 1, [fops->fallocate() exists]) | |
1964 | ],[ | |
1965 | AC_MSG_RESULT(no) | |
1966 | ]) | |
1967 | ]) | |
1968 | ||
1969 | dnl # | |
1970 | dnl # Linux 2.6.x - 2.6.37 API | |
1971 | dnl # | |
1972 | AC_DEFUN([SPL_AC_KERNEL_INODE_FALLOCATE], [ | |
1973 | AC_MSG_CHECKING([whether iops->fallocate() exists]) | |
1974 | SPL_LINUX_TRY_COMPILE([ | |
1975 | #include <linux/fs.h> | |
1976 | ],[ | |
1977 | long (*fallocate) (struct inode *, int, loff_t, loff_t) = NULL; | |
1978 | struct inode_operations fops __attribute__ ((unused)) = { | |
1979 | .fallocate = fallocate, | |
1980 | }; | |
1981 | ],[ | |
1982 | AC_MSG_RESULT(yes) | |
1983 | AC_DEFINE(HAVE_INODE_FALLOCATE, 1, [fops->fallocate() exists]) | |
1984 | ],[ | |
1985 | AC_MSG_RESULT(no) | |
1986 | ]) | |
1987 | ]) | |
1988 | ||
1989 | dnl # | |
1990 | dnl # PaX Linux 2.6.38 - 3.x API | |
1991 | dnl # | |
1992 | AC_DEFUN([SPL_AC_PAX_KERNEL_FILE_FALLOCATE], [ | |
1993 | AC_MSG_CHECKING([whether fops->fallocate() exists]) | |
1994 | SPL_LINUX_TRY_COMPILE([ | |
1995 | #include <linux/fs.h> | |
1996 | ],[ | |
1997 | long (*fallocate) (struct file *, int, loff_t, loff_t) = NULL; | |
1998 | struct file_operations_no_const fops __attribute__ ((unused)) = { | |
1999 | .fallocate = fallocate, | |
2000 | }; | |
2001 | ],[ | |
2002 | AC_MSG_RESULT(yes) | |
2003 | AC_DEFINE(HAVE_FILE_FALLOCATE, 1, [fops->fallocate() exists]) | |
2004 | ],[ | |
2005 | AC_MSG_RESULT(no) | |
2006 | ]) | |
2007 | ]) | |
2008 | ||
2009 | dnl # | |
2010 | dnl # The fallocate callback was moved from the inode_operations | |
2011 | dnl # structure to the file_operations structure. | |
2012 | dnl # | |
2013 | AC_DEFUN([SPL_AC_KERNEL_FALLOCATE], [ | |
2014 | SPL_AC_KERNEL_FILE_FALLOCATE | |
2015 | SPL_AC_KERNEL_INODE_FALLOCATE | |
2016 | SPL_AC_PAX_KERNEL_FILE_FALLOCATE | |
2017 | ]) | |
bbdc6ae4 | 2018 | |
46aa7b39 NB |
2019 | dnl # |
2020 | dnl # 2.6.33 API change. Also backported in RHEL5 as of 2.6.18-190.el5. | |
2021 | dnl # Earlier versions of rwsem_is_locked() were inline and had a race | |
2022 | dnl # condition. The fixed version is exported as a symbol. The race | |
2023 | dnl # condition is fixed by acquiring sem->wait_lock, so we must not | |
2024 | dnl # call that version while holding sem->wait_lock. | |
2025 | dnl # | |
723aa3b0 ED |
2026 | AC_DEFUN([SPL_AC_EXPORTED_RWSEM_IS_LOCKED], |
2027 | [AC_MSG_CHECKING([whether rwsem_is_locked() acquires sem->wait_lock]) | |
2028 | SPL_LINUX_TRY_COMPILE_SYMBOL([ | |
2029 | #include <linux/rwsem.h> | |
2030 | int rwsem_is_locked(struct rw_semaphore *sem) { return 0; } | |
2031 | ], [], [rwsem_is_locked], [lib/rwsem-spinlock.c], [ | |
2032 | AC_MSG_RESULT(yes) | |
2033 | AC_DEFINE(RWSEM_IS_LOCKED_TAKES_WAIT_LOCK, 1, | |
2034 | [rwsem_is_locked() acquires sem->wait_lock]) | |
2035 | ], [ | |
2036 | AC_MSG_RESULT(no) | |
2037 | ]) | |
46aa7b39 | 2038 | ]) |
914b0631 | 2039 | |
e76f4bf1 BB |
2040 | dnl # |
2041 | dnl # 2.6.xx API compat, | |
2042 | dnl # There currently exists no exposed API to partially shrink the dcache. | |
2043 | dnl # The expected mechanism to shrink the cache is a registered shrinker | |
2044 | dnl # which is called during memory pressure. | |
2045 | dnl # | |
723aa3b0 ED |
2046 | AC_DEFUN([SPL_AC_SHRINK_DCACHE_MEMORY], |
2047 | [AC_MSG_CHECKING([whether shrink_dcache_memory() is available]) | |
2048 | SPL_LINUX_TRY_COMPILE_SYMBOL([ | |
2049 | #include <linux/dcache.h> | |
2050 | ], [ | |
2051 | shrink_dcache_memory(0, 0); | |
2052 | ], [shrink_dcache_memory], [fs/dcache.c], [ | |
2053 | AC_MSG_RESULT(yes) | |
2054 | AC_DEFINE(HAVE_SHRINK_DCACHE_MEMORY, 1, | |
2055 | [shrink_dcache_memory() is available]) | |
2056 | ], [ | |
2057 | AC_MSG_RESULT(no) | |
2058 | ]) | |
e76f4bf1 BB |
2059 | ]) |
2060 | ||
2061 | dnl # | |
2062 | dnl # 2.6.xx API compat, | |
2063 | dnl # There currently exists no exposed API to partially shrink the icache. | |
2064 | dnl # The expected mechanism to shrink the cache is a registered shrinker | |
2065 | dnl # which is called during memory pressure. | |
2066 | dnl # | |
723aa3b0 ED |
2067 | AC_DEFUN([SPL_AC_SHRINK_ICACHE_MEMORY], |
2068 | [AC_MSG_CHECKING([whether shrink_icache_memory() is available]) | |
2069 | SPL_LINUX_TRY_COMPILE_SYMBOL([ | |
2070 | #include <linux/dcache.h> | |
2071 | ], [ | |
2072 | shrink_icache_memory(0, 0); | |
2073 | ], [shrink_icache_memory], [fs/inode.c], [ | |
2074 | AC_MSG_RESULT(yes) | |
2075 | AC_DEFINE(HAVE_SHRINK_ICACHE_MEMORY, 1, | |
2076 | [shrink_icache_memory() is available]) | |
2077 | ], [ | |
2078 | AC_MSG_RESULT(no) | |
2079 | ]) | |
e76f4bf1 | 2080 | ]) |
b1cbc461 BB |
2081 | |
2082 | dnl # | |
2083 | dnl # 2.6.39 API compat, | |
2084 | dnl # The path_lookup() function has been renamed to kern_path_parent() | |
2085 | dnl # and the flags argument has been removed. The only behavior now | |
2086 | dnl # offered is that of LOOKUP_PARENT. The spl already always passed | |
2087 | dnl # this flag so dropping the flag does not impact us. | |
2088 | dnl # | |
12ff95ff BB |
2089 | AC_DEFUN([SPL_AC_KERN_PATH_PARENT_HEADER], [ |
2090 | SPL_CHECK_SYMBOL_HEADER( | |
2091 | [kern_path_parent], | |
2092 | [int kern_path_parent(const char \*, struct nameidata \*)], | |
2093 | [include/linux/namei.h], | |
2094 | [AC_DEFINE(HAVE_KERN_PATH_PARENT_HEADER, 1, | |
2095 | [kern_path_parent() is available])], | |
2096 | []) | |
2097 | ]) | |
2098 | ||
2099 | dnl # | |
2100 | dnl # 3.1 API compat, | |
2101 | dnl # The kern_path_parent() symbol is no longer exported by the kernel. | |
2102 | dnl # However, it remains the prefered interface and since we still have | |
2103 | dnl # access to the prototype we dynamically lookup the required address. | |
2104 | dnl # | |
723aa3b0 ED |
2105 | AC_DEFUN([SPL_AC_KERN_PATH_PARENT_SYMBOL], |
2106 | [AC_MSG_CHECKING([whether kern_path_parent() is available]) | |
2107 | SPL_LINUX_TRY_COMPILE_SYMBOL([ | |
2108 | #include <linux/namei.h> | |
2109 | ], [ | |
2110 | kern_path_parent(NULL, NULL); | |
2111 | ], [kern_path_parent], [fs/namei.c], [ | |
2112 | AC_MSG_RESULT(yes) | |
2113 | AC_DEFINE(HAVE_KERN_PATH_PARENT_SYMBOL, 1, | |
2114 | [kern_path_parent() is available]) | |
2115 | ], [ | |
2116 | AC_MSG_RESULT(no) | |
2117 | ]) | |
b1cbc461 | 2118 | ]) |
3dfc591a | 2119 | |
bcb15891 YS |
2120 | dnl # |
2121 | dnl # 3.6 API compat, | |
2122 | dnl # The kern_path_parent() function was replaced by the kern_path_locked() | |
2123 | dnl # function to eliminate all struct nameidata usage outside fs/namei.c. | |
2124 | dnl # | |
2125 | AC_DEFUN([SPL_AC_KERN_PATH_LOCKED], [ | |
2126 | SPL_CHECK_SYMBOL_HEADER( | |
2127 | [kern_path_locked], | |
2128 | [struct dentry \*kern_path_locked(const char \*, struct path \*)], | |
2129 | [include/linux/namei.h], | |
2130 | [AC_DEFINE(HAVE_KERN_PATH_LOCKED, 1, | |
2131 | [kern_path_locked() is available])], | |
2132 | []) | |
2133 | ]) | |
2134 | ||
de081a2a BB |
2135 | dnl # |
2136 | dnl # /proc/kallsyms support, | |
2137 | dnl # Verify the kernel has CONFIG_KALLSYMS support enabled. | |
2138 | dnl # | |
2139 | AC_DEFUN([SPL_AC_CONFIG_KALLSYMS], [ | |
2140 | AC_MSG_CHECKING([whether CONFIG_KALLSYMS is defined]) | |
2141 | SPL_LINUX_TRY_COMPILE([ | |
2142 | #if !defined(CONFIG_KALLSYMS) | |
2143 | #error CONFIG_KALLSYMS not defined | |
2144 | #endif | |
2145 | ],[ ],[ | |
2146 | AC_MSG_RESULT([yes]) | |
2147 | ],[ | |
2148 | AC_MSG_RESULT([no]) | |
2149 | AC_MSG_ERROR([ | |
2150 | *** This kernel does not include the required kallsyms support. | |
2151 | *** Rebuild the kernel with CONFIG_KALLSYMS=y set.]) | |
2152 | ]) | |
2153 | ]) | |
2154 | ||
42b3ce62 BB |
2155 | dnl # |
2156 | dnl # zlib inflate compat, | |
2157 | dnl # Verify the kernel has CONFIG_ZLIB_INFLATE support enabled. | |
2158 | dnl # | |
2159 | AC_DEFUN([SPL_AC_CONFIG_ZLIB_INFLATE], [ | |
2160 | AC_MSG_CHECKING([whether CONFIG_ZLIB_INFLATE is defined]) | |
2161 | SPL_LINUX_TRY_COMPILE([ | |
2162 | #if !defined(CONFIG_ZLIB_INFLATE) && \ | |
2163 | !defined(CONFIG_ZLIB_INFLATE_MODULE) | |
2164 | #error CONFIG_ZLIB_INFLATE not defined | |
2165 | #endif | |
2166 | ],[ ],[ | |
2167 | AC_MSG_RESULT([yes]) | |
2168 | ],[ | |
2169 | AC_MSG_RESULT([no]) | |
2170 | AC_MSG_ERROR([ | |
2171 | *** This kernel does not include the required zlib inflate support. | |
2172 | *** Rebuild the kernel with CONFIG_ZLIB_INFLATE=y|m set.]) | |
2173 | ]) | |
2174 | ]) | |
2175 | ||
2176 | dnl # | |
2177 | dnl # zlib deflate compat, | |
2178 | dnl # Verify the kernel has CONFIG_ZLIB_DEFLATE support enabled. | |
2179 | dnl # | |
2180 | AC_DEFUN([SPL_AC_CONFIG_ZLIB_DEFLATE], [ | |
2181 | AC_MSG_CHECKING([whether CONFIG_ZLIB_DEFLATE is defined]) | |
2182 | SPL_LINUX_TRY_COMPILE([ | |
2183 | #if !defined(CONFIG_ZLIB_DEFLATE) && \ | |
2184 | !defined(CONFIG_ZLIB_DEFLATE_MODULE) | |
2185 | #error CONFIG_ZLIB_DEFLATE not defined | |
2186 | #endif | |
2187 | ],[ ],[ | |
2188 | AC_MSG_RESULT([yes]) | |
2189 | ],[ | |
2190 | AC_MSG_RESULT([no]) | |
2191 | AC_MSG_ERROR([ | |
2192 | *** This kernel does not include the required zlib deflate support. | |
2193 | *** Rebuild the kernel with CONFIG_ZLIB_DEFLATE=y|m set.]) | |
2194 | ]) | |
2195 | ]) | |
2196 | ||
3dfc591a BB |
2197 | dnl # |
2198 | dnl # 2.6.39 API compat, | |
2199 | dnl # The function zlib_deflate_workspacesize() now take 2 arguments. | |
2200 | dnl # This was done to avoid always having to allocate the maximum size | |
2201 | dnl # workspace (268K). The caller can now specific the windowBits and | |
2202 | dnl # memLevel compression parameters to get a smaller workspace. | |
2203 | dnl # | |
2204 | AC_DEFUN([SPL_AC_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE], | |
2205 | [AC_MSG_CHECKING([whether zlib_deflate_workspacesize() wants 2 args]) | |
2206 | SPL_LINUX_TRY_COMPILE([ | |
2207 | #include <linux/zlib.h> | |
2208 | ],[ | |
2209 | return zlib_deflate_workspacesize(MAX_WBITS, MAX_MEM_LEVEL); | |
2210 | ],[ | |
2211 | AC_MSG_RESULT(yes) | |
2212 | AC_DEFINE(HAVE_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE, 1, | |
2213 | [zlib_deflate_workspacesize() wants 2 args]) | |
2214 | ],[ | |
2215 | AC_MSG_RESULT(no) | |
2216 | ]) | |
2217 | ]) | |
a55bcaad BB |
2218 | |
2219 | dnl # | |
2220 | dnl # 2.6.39 API change, | |
2221 | dnl # Shrinker adjust to use common shrink_control structure. | |
2222 | dnl # | |
2223 | AC_DEFUN([SPL_AC_SHRINK_CONTROL_STRUCT], [ | |
2224 | AC_MSG_CHECKING([whether struct shrink_control exists]) | |
2225 | SPL_LINUX_TRY_COMPILE([ | |
2226 | #include <linux/mm.h> | |
2227 | ],[ | |
2228 | struct shrink_control sc __attribute__ ((unused)); | |
2229 | ||
2230 | sc.nr_to_scan = 0; | |
2231 | sc.gfp_mask = GFP_KERNEL; | |
2232 | ],[ | |
2233 | AC_MSG_RESULT(yes) | |
2234 | AC_DEFINE(HAVE_SHRINK_CONTROL_STRUCT, 1, | |
2235 | [struct shrink_control exists]) | |
2236 | ],[ | |
2237 | AC_MSG_RESULT(no) | |
2238 | ]) | |
2239 | ]) | |
588d9004 DH |
2240 | |
2241 | dnl # | |
2242 | dnl # 3.1 API Change | |
2243 | dnl # | |
2244 | dnl # The rw_semaphore.wait_lock member was changed from spinlock_t to | |
2245 | dnl # raw_spinlock_t at commit ddb6c9b58a19edcfac93ac670b066c836ff729f1. | |
2246 | dnl # | |
2247 | AC_DEFUN([SPL_AC_RWSEM_SPINLOCK_IS_RAW], [ | |
2248 | AC_MSG_CHECKING([whether struct rw_semaphore member wait_lock is raw]) | |
2249 | tmp_flags="$EXTRA_KCFLAGS" | |
2250 | EXTRA_KCFLAGS="-Werror" | |
2251 | SPL_LINUX_TRY_COMPILE([ | |
2252 | #include <linux/rwsem.h> | |
2253 | ],[ | |
2254 | struct rw_semaphore dummy_semaphore __attribute__ ((unused)); | |
2255 | raw_spinlock_t dummy_lock __attribute__ ((unused)); | |
2256 | dummy_semaphore.wait_lock = dummy_lock; | |
2257 | ],[ | |
2258 | AC_MSG_RESULT(yes) | |
2259 | AC_DEFINE(RWSEM_SPINLOCK_IS_RAW, 1, | |
2260 | [struct rw_semaphore member wait_lock is raw_spinlock_t]) | |
2261 | ],[ | |
2262 | AC_MSG_RESULT(no) | |
2263 | ]) | |
2264 | EXTRA_KCFLAGS="$tmp_flags" | |
2265 | ]) | |
10087fe1 RY |
2266 | |
2267 | dnl # | |
2268 | dnl # 3.9 API change, | |
2269 | dnl # Moved things from linux/sched.h to linux/sched/rt.h | |
2270 | dnl # | |
2271 | AC_DEFUN([SPL_AC_SCHED_RT_HEADER], | |
2272 | [AC_MSG_CHECKING([whether header linux/sched/rt.h exists]) | |
2273 | SPL_LINUX_TRY_COMPILE([ | |
2274 | #include <linux/sched.h> | |
2275 | #include <linux/sched/rt.h> | |
2276 | ],[ | |
2277 | return 0; | |
2278 | ],[ | |
2279 | AC_DEFINE(HAVE_SCHED_RT_HEADER, 1, [linux/sched/rt.h exists]) | |
2280 | AC_MSG_RESULT(yes) | |
2281 | ],[ | |
2282 | AC_MSG_RESULT(no) | |
2283 | ]) | |
2284 | ]) | |
2a305c34 RY |
2285 | |
2286 | dnl # | |
2287 | dnl # 3.9 API change, | |
2288 | dnl # vfs_getattr() uses 2 args | |
2289 | dnl # It takes struct path * instead of struct vfsmount * and struct dentry * | |
2290 | dnl # | |
2291 | AC_DEFUN([SPL_AC_2ARGS_VFS_GETATTR], [ | |
2292 | AC_MSG_CHECKING([whether vfs_getattr() wants]) | |
2293 | SPL_LINUX_TRY_COMPILE([ | |
2294 | #include <linux/fs.h> | |
2295 | ],[ | |
2296 | vfs_getattr((struct path *) NULL, | |
2297 | (struct kstat *)NULL); | |
2298 | ],[ | |
2299 | AC_MSG_RESULT(2 args) | |
2300 | AC_DEFINE(HAVE_2ARGS_VFS_GETATTR, 1, | |
2301 | [vfs_getattr wants 2 args]) | |
2302 | ],[ | |
2303 | SPL_LINUX_TRY_COMPILE([ | |
2304 | #include <linux/fs.h> | |
2305 | ],[ | |
2306 | vfs_getattr((struct vfsmount *)NULL, | |
2307 | (struct dentry *)NULL, | |
2308 | (struct kstat *)NULL); | |
2309 | ],[ | |
2310 | AC_MSG_RESULT(3 args) | |
2311 | ],[ | |
2312 | AC_MSG_ERROR(unknown) | |
2313 | ]) | |
2314 | ]) | |
2315 | ]) |