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