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