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