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