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