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