4 # Wrapper for AC_CONFIG_SUBDIR
6 AC_DEFUN([LC_CONFIG_SRCDIR], [
7 AC_CONFIG_SRCDIR([lustre/obdclass/obdo.c])
14 # lustre specific paths
16 AC_DEFUN([LC_PATH_DEFAULTS], [
17 # ptlrpc kernel build requires this
25 demodir='$(docdir)/demo'
28 pkgexampledir='${pkgdatadir}/examples'
29 AC_SUBST(pkgexampledir)
35 # is the target os supported?
37 AC_DEFUN([LC_TARGET_SUPPORTED], [
46 ]) # LC_TARGET_SUPPORTED
49 # LC_GLIBC_SUPPORT_FHANDLES
51 AC_DEFUN([LC_GLIBC_SUPPORT_FHANDLES], [
52 AC_CHECK_FUNCS([name_to_handle_at],
53 [AC_DEFINE(HAVE_FHANDLE_GLIBC_SUPPORT, 1,
54 [file handle and related syscalls are supported])],
55 [AC_MSG_WARN([file handle and related syscalls are not supported])])
56 ]) # LC_GLIBC_SUPPORT_FHANDLES
59 # LC_GLIBC_SUPPORT_COPY_FILE_RANGE
61 AC_DEFUN([LC_GLIBC_SUPPORT_COPY_FILE_RANGE], [
62 AC_CHECK_FUNCS([copy_file_range],
63 [AC_DEFINE(HAVE_COPY_FILE_RANGE, 1,
64 [copy_file_range() is supported])],
65 [AC_MSG_WARN([copy_file_range() is not supported])])
66 ]) # LC_GLIBC_SUPPORT_COPY_FILE_RANGE
71 AC_DEFUN([LC_FID2PATH_ANON_UNION], [
73 CFLAGS="$CFLAGS -Werror"
74 AC_MSG_CHECKING([if 'struct getinfo_fid2path' has anonymous union])
75 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
76 #include <linux/lustre/lustre_idl.h>
79 struct getinfo_fid2path gf;
80 struct lu_fid root_fid;
82 *gf.gf_root_fid = root_fid;
86 AC_DEFINE(HAVE_FID2PATH_ANON_UNIONS, 1, [union is unnamed])
92 ]) # LC_FID2PATH_ANON_UNION
97 AC_DEFUN([LC_IOC_REMOVE_ENTRY], [
99 CFLAGS="$CFLAGS -Werror"
100 AC_MSG_CHECKING([if ioctl IOC_REMOVE_ENTRY' is supported])
101 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
102 #include <sys/ioctl.h>
103 #include <linux/lustre/lustre_ioctl.h>
106 return ioctl(0, LL_IOC_REMOVE_ENTRY, NULL);
109 AC_DEFINE(HAVE_IOC_REMOVE_ENTRY, 1,
110 [IOC_REMOVE_ENTRY ioctl exists])
115 CFLAGS="$saved_flags"
116 ]) # LC_IOC_REMOVE_ENTRY
121 # Ensure the stack size is at least 8k in Lustre server (all kernels)
123 AC_DEFUN([LC_STACK_SIZE], [
124 LB_CHECK_COMPILE([if stack size is at least 8k],
126 #include <linux/thread_info.h>
128 #if THREAD_SIZE < 8192
129 #error "stack size < 8192"
131 ], [], [AC_MSG_ERROR([
133 Lustre requires that Linux is configured with at least a 8KB stack.
140 # Allow the user to set the MDS thread upper limit
142 AC_DEFUN([LC_MDS_MAX_THREADS], [
143 AC_MSG_CHECKING([for maximum number of MDS threads])
144 AC_ARG_WITH([mds_max_threads],
145 AS_HELP_STRING([--with-mds-max-threads=count],
146 [maximum threads available on the MDS: (default=512)]),
147 [AC_DEFINE_UNQUOTED(MDS_MAX_THREADS, $with_mds_max_threads,
148 [maximum number of MDS threads])])
149 AC_MSG_RESULT([$with_mds_max_threads])
150 ]) # LC_MDS_MAX_THREADS
155 # the pinger is temporary, until we have the recovery node in place
157 AC_DEFUN([LC_CONFIG_PINGER], [
158 AC_MSG_CHECKING([whether to enable Lustre pinger support])
159 AC_ARG_ENABLE([pinger],
160 AS_HELP_STRING([--disable-pinger],
161 [disable recovery pinger support]),
162 [], [enable_pinger="yes"])
163 AC_MSG_RESULT([$enable_pinger])
164 AS_IF([test "x$enable_pinger" != xno],
165 [AC_DEFINE(CONFIG_LUSTRE_FS_PINGER, 1,[Use the Pinger])])
166 ]) # LC_CONFIG_PINGER
171 # do checksum of bulk data between client and OST
173 AC_DEFUN([LC_CONFIG_CHECKSUM], [
174 AC_MSG_CHECKING([whether to enable data checksum support])
175 AC_ARG_ENABLE([checksum],
176 AS_HELP_STRING([--disable-checksum],
177 [disable data checksum support]),
178 [], [enable_checksum="yes"])
179 AC_MSG_RESULT([$enable_checksum])
180 AS_IF([test "x$enable_checksum" != xno],
181 [AC_DEFINE(ENABLE_CHECKSUM, 1, [do data checksums])])
182 ]) # LC_CONFIG_CHECKSUM
187 # enable distributed flock by default
189 AC_DEFUN([LC_CONFIG_FLOCK], [
190 AC_MSG_CHECKING([whether to enable flock by default])
191 AC_ARG_ENABLE([flock],
192 AS_HELP_STRING([--disable-flock],
193 [disable flock by default]),
194 [], [enable_flock="yes"])
195 AC_MSG_RESULT([$enable_flock])
196 AS_IF([test "x$enable_flock" != xno],
197 [AC_DEFINE(ENABLE_FLOCK, 1, [enable flock by default])])
201 # LC_CONFIG_HEALTH_CHECK_WRITE
203 # Turn off the actual write to the disk
205 AC_DEFUN([LC_CONFIG_HEALTH_CHECK_WRITE], [
206 AC_MSG_CHECKING([whether to enable a write with the health check])
207 AC_ARG_ENABLE([health_write],
208 AS_HELP_STRING([--enable-health_write],
209 [enable disk writes when doing health check]),
210 [], [enable_health_write="no"])
211 AC_MSG_RESULT([$enable_health_write])
212 AS_IF([test "x$enable_health_write" != xno],
213 [AC_DEFINE(USE_HEALTH_CHECK_WRITE, 1, [Write when Checking Health])])
214 ]) # LC_CONFIG_HEALTH_CHECK_WRITE
217 # LC_CONFIG_LRU_RESIZE
219 AC_DEFUN([LC_CONFIG_LRU_RESIZE], [
220 AC_MSG_CHECKING([whether to enable lru self-adjusting])
221 AC_ARG_ENABLE([lru_resize],
222 AS_HELP_STRING([--enable-lru-resize],
223 [enable lru resize support]),
224 [], [enable_lru_resize="yes"])
225 AC_MSG_RESULT([$enable_lru_resize])
226 AS_IF([test "x$enable_lru_resize" != xno],
227 [AC_DEFINE(HAVE_LRU_RESIZE_SUPPORT, 1, [Enable lru resize support])])
228 ]) # LC_CONFIG_LRU_RESIZE
233 # Quota support. The kernel must support CONFIG_QUOTA.
235 AC_DEFUN([LC_QUOTA_CONFIG], [
236 LB_CHECK_CONFIG_IM([QUOTA], [],
239 Lustre quota requires that CONFIG_QUOTA is enabled in your kernel.
246 # fhandle kernel support for open_by_handle_at() and name_to_handle_at()
247 # system calls. The kernel must support CONFIG_FHANDLE.
249 AC_DEFUN([LC_CONFIG_FHANDLE], [
250 LB_CHECK_CONFIG_IM([FHANDLE], [],
253 Lustre fid handling requires that CONFIG_FHANDLE is enabled in your kernel.
255 ]) # LC_CONFIG_FHANDLE
258 # LC_POSIX_ACL_CONFIG
262 AC_DEFUN([LC_POSIX_ACL_CONFIG], [
263 LB_CHECK_CONFIG_IM([FS_POSIX_ACL],
264 [AC_DEFINE(CONFIG_LUSTRE_FS_POSIX_ACL, 1, [Enable POSIX acl])
266 ]) # LC_POSIX_ACL_CONFIG
268 LB_CHECK_CONFIG_IM([CRYPTO_MD5], [],
269 [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
272 # LC_CONFIG_GSS_KEYRING
274 # default 'auto', tests for dependencies, if found, enables;
275 # only called if gss is enabled
277 AC_DEFUN([LC_CONFIG_GSS_KEYRING], [
278 AC_MSG_CHECKING([whether to enable gss keyring backend])
279 AC_ARG_ENABLE([gss_keyring],
280 [AS_HELP_STRING([--disable-gss-keyring],
281 [disable gss keyring backend])],
282 [], [AS_IF([test "x$enable_gss" != xno], [
283 enable_gss_keyring="yes"], [
284 enable_gss_keyring="auto"])])
285 AC_MSG_RESULT([$enable_gss_keyring])
286 AS_IF([test "x$enable_gss_keyring" != xno], [
287 LB_CHECK_CONFIG_IM([KEYS], [], [
288 gss_keyring_conf_test="fail"
289 AC_MSG_WARN([GSS keyring backend requires that CONFIG_KEYS be enabled in your kernel.])])
291 AC_CHECK_LIB([keyutils], [keyctl_search], [], [
292 gss_keyring_conf_test="fail"
293 AC_MSG_WARN([GSS keyring backend requires libkeyutils])])
295 AS_IF([test "x$gss_keyring_conf_test" != xfail], [
296 AC_DEFINE([HAVE_GSS_KEYRING], [1],
297 [Define this if you enable gss keyring backend])
298 enable_gss_keyring="yes"
300 AS_IF([test "x$enable_gss_keyring" = xyes], [
301 AC_MSG_ERROR([Cannot enable gss_keyring. See above for details.])
308 ]) # LC_CONFIG_GSS_KEYRING
311 # LC_KEY_TYPE_INSTANTIATE_2ARGS
313 # rhel7 key_type->instantiate takes 2 args (struct key, struct key_preparsed_payload)
315 AC_DEFUN([LC_KEY_TYPE_INSTANTIATE_2ARGS], [
316 LB_CHECK_COMPILE([if 'key_type->instantiate' has two args],
317 key_type_instantiate_2args, [
318 #include <linux/key-type.h>
320 ((struct key_type *)0)->instantiate(0, NULL);
322 AC_DEFINE(HAVE_KEY_TYPE_INSTANTIATE_2ARGS, 1,
323 [key_type->instantiate has two args])
325 ]) # LC_KEY_TYPE_INSTANTIATE_2ARGS
330 AC_DEFUN([LC_CONFIG_SUNRPC], [
331 LB_CHECK_CONFIG_IM([SUNRPC], [], [
332 AS_IF([test "x$sunrpc_required" = xyes], [
335 kernel SUNRPC support is required by using GSS.
338 ]) # LC_CONFIG_SUNRPC
341 # LC_CONFIG_GSS (default 'auto' (tests for dependencies, if found, enables))
343 # Build gss and related tools of Lustre. Currently both kernel and user space
344 # parts are depend on linux platform.
346 AC_DEFUN([LC_CONFIG_GSS], [
347 AC_MSG_CHECKING([whether to enable gss support])
349 [AS_HELP_STRING([--enable-gss], [enable gss support])],
350 [], [enable_gss="auto"])
351 AC_MSG_RESULT([$enable_gss])
353 AC_ARG_VAR([TEST_JOBS],
354 [simultaneous jobs during configure (defaults to $(nproc))])
355 if test "x$ac_cv_env_TEST_JOBS_set" != "xset"; then
356 TEST_JOBS=${TEST_JOBS:-$(nproc)}
360 AC_ARG_VAR([TEST_DIR],
361 [location of temporary parallel configure tests (defaults to $PWD/lb2)])
362 TEST_DIR=${TEST_DIR:-$PWD/_lpb}
365 AS_IF([test "x$enable_gss" != xno], [
366 LC_CONFIG_GSS_KEYRING
367 LC_KEY_TYPE_INSTANTIATE_2ARGS
368 sunrpc_required=$enable_gss
372 LB_CHECK_CONFIG_IM([CRYPTO_MD5], [],
373 [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
374 LB_CHECK_CONFIG_IM([CRYPTO_SHA1], [],
375 [AC_MSG_WARN([kernel SHA1 support is recommended by using GSS.])])
376 LB_CHECK_CONFIG_IM([CRYPTO_SHA256], [],
377 [AC_MSG_WARN([kernel SHA256 support is recommended by using GSS.])])
378 LB_CHECK_CONFIG_IM([CRYPTO_SHA512], [],
379 [AC_MSG_WARN([kernel SHA512 support is recommended by using GSS.])])
381 require_krb5=$enable_gss
385 AS_IF([test -n "$KRBDIR"], [
386 gss_conf_test="success"
388 gss_conf_test="failure"
391 AS_IF([test "x$gss_conf_test" = xsuccess && test "x$enable_gss" != xno], [
392 AC_DEFINE([HAVE_GSS], [1], [Define this is if you enable gss])
395 enable_gss_keyring="no"
399 AS_IF([test "x$enable_ssk" != xno], [
400 enable_ssk=$enable_gss
403 enable_gss_keyring="no"
409 # OpenSSL 1.0+ return int for HMAC functions but older SLES11 versions do not
410 AC_DEFUN([LC_OPENSSL_HMAC], [
411 has_hmac_functions="no"
412 saved_flags="$CFLAGS"
413 CFLAGS="$CFLAGS -Werror"
414 AC_MSG_CHECKING([whether OpenSSL has HMAC_Init_ex])
415 AS_IF([test "x$enable_ssk" != xno], [
416 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
417 #include <openssl/hmac.h>
418 #include <openssl/evp.h>
422 rc = HMAC_Init_ex(NULL, "test", 4, EVP_md_null(), NULL);
425 has_hmac_functions="yes"
428 AC_MSG_RESULT([$has_hmac_functions])
429 CFLAGS="$saved_flags"
432 # LC_OPENSSL_EVP_PKEY
434 # OpenSSL 3.0 introduces EVP_PKEY_get_params
435 AC_DEFUN([LC_OPENSSL_EVP_PKEY], [
437 saved_flags="$CFLAGS"
438 CFLAGS="$CFLAGS -Werror"
439 AC_MSG_CHECKING([whether OpenSSL has EVP_PKEY_get_params])
440 AS_IF([test "x$enable_ssk" != xno], [
441 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
442 #include <openssl/evp.h>
447 int rc = EVP_PKEY_get_params(NULL, params);
450 AC_DEFINE(HAVE_OPENSSL_EVP_PKEY, 1, [OpenSSL EVP_PKEY_get_params])
454 CFLAGS="$saved_flags"
455 AC_MSG_RESULT([$has_evp_pkey])
456 ]) # LC_OPENSSL_EVP_PKEY
461 # Check whether to enable Lustre client crypto
463 AC_DEFUN([LC_OPENSSL_SSK], [
464 AC_MSG_CHECKING([whether OpenSSL has functions needed for SSK])
465 AS_IF([test "x$enable_ssk" != xno], [
471 AS_IF([test "x$has_hmac_functions" = xyes -o "x$has_evp_pkey" = xyes], [
472 AC_DEFINE(HAVE_OPENSSL_SSK, 1, [OpenSSL HMAC functions needed for SSK])
476 AC_MSG_RESULT([$enable_ssk])
479 # LC_OPENSSL_GETSEPOL
481 # OpenSSL is needed for l_getsepol
482 AC_DEFUN([LC_OPENSSL_GETSEPOL], [
483 saved_flags="$CFLAGS"
484 CFLAGS="$CFLAGS -Werror"
485 AC_MSG_CHECKING([whether openssl-devel is present])
486 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
487 #include <openssl/evp.h>
490 EVP_MD_CTX *mdctx = EVP_MD_CTX_create();
493 AC_DEFINE(HAVE_OPENSSL_GETSEPOL, 1, [openssl-devel is present])
494 enable_getsepol="yes"
500 No openssl-devel headers found, unable to build l_getsepol and SELinux status checking
503 AC_MSG_RESULT([$enable_getsepol])
504 CFLAGS="$saved_flags"
505 ]) # LC_OPENSSL_GETSEPOL
508 AC_DEFUN([LC_HAVE_LIBAIO], [
509 AC_CHECK_HEADER([libaio.h],
511 AC_MSG_WARN([libaio is not installed in the system]))
515 # LC_INVALIDATE_RANGE
517 # 3.11 invalidatepage requires the length of the range to invalidate
519 AC_DEFUN([LC_INVALIDATE_RANGE], [
520 LB_CHECK_COMPILE([if 'address_space_operations.invalidatepage' requires 3 arguments],
521 address_space_ops_invalidatepage_3args, [
522 #include <linux/fs.h>
524 struct address_space_operations a_ops;
525 a_ops.invalidatepage(NULL, 0, 0);
527 AC_DEFINE(HAVE_INVALIDATE_RANGE, 1,
528 [address_space_operations.invalidatepage needs 3 arguments])
530 ]) # LC_INVALIDATE_RANGE
533 # LC_HAVE_DIR_CONTEXT
535 # 3.11 readdir now takes the new struct dir_context
537 AC_DEFUN([LC_HAVE_DIR_CONTEXT], [
538 LB_CHECK_COMPILE([if 'dir_context' exist],
540 #include <linux/fs.h>
542 #ifdef FMODE_KABI_ITERATE
543 #error "back to use readdir in kabi_extand mode"
545 struct dir_context ctx;
550 AC_DEFINE(HAVE_DIR_CONTEXT, 1,
553 ]) # LC_HAVE_DIR_CONTEXT
558 # 3.11 dentry_operations.d_compare() taken 5 arguments.
560 AC_DEFUN([LC_D_COMPARE_5ARGS], [
561 LB_CHECK_COMPILE([if 'd_compare' taken 5 arguments],
563 #include <linux/dcache.h>
565 ((struct dentry_operations*)0)->d_compare(NULL,NULL,0,NULL,NULL);
567 AC_DEFINE(HAVE_D_COMPARE_5ARGS, 1,
568 [d_compare need 5 arguments])
570 ]) # LC_D_COMPARE_5ARGS
575 # 3.11 need to access d_count to get dentry reference count
577 AC_DEFUN([LC_HAVE_DCOUNT], [
578 LB_CHECK_COMPILE([if 'd_count' exists],
580 #include <linux/dcache.h>
582 struct dentry de = { };
585 count = d_count(&de);
587 AC_DEFINE(HAVE_D_COUNT, 1,
593 # LC_PID_NS_FOR_CHILDREN
595 # 3.11 replaces pid_ns by pid_ns_for_children in struct nsproxy
597 AC_DEFUN([LC_PID_NS_FOR_CHILDREN], [
598 LB_CHECK_COMPILE([if 'struct nsproxy' has 'pid_ns_for_children'],
599 pid_ns_for_children, [
600 #include <linux/nsproxy.h>
603 ns.pid_ns_for_children = NULL;
605 AC_DEFINE(HAVE_PID_NS_FOR_CHILDREN, 1,
606 ['struct nsproxy' has 'pid_ns_for_children'])
608 ]) # LC_PID_NS_FOR_CHILDREN
611 # LC_OLDSIZE_TRUNCATE_PAGECACHE
613 # 3.12 truncate_pagecache without oldsize parameter
615 AC_DEFUN([LC_OLDSIZE_TRUNCATE_PAGECACHE], [
616 LB_CHECK_COMPILE([if 'truncate_pagecache' with 'old_size' parameter],
617 truncate_pagecache_old_size, [
618 #include <linux/mm.h>
620 truncate_pagecache(NULL, 0, 0);
622 AC_DEFINE(HAVE_OLDSIZE_TRUNCATE_PAGECACHE, 1,
625 ]) # LC_OLDSIZE_TRUNCATE_PAGECACHE
630 # For some reason SLES11SP4 is missing the PTR_ERR_OR_ZERO macro
631 # It was added to linux kernel 3.12
633 AC_DEFUN([LC_PTR_ERR_OR_ZERO_MISSING], [
634 LB_CHECK_COMPILE([if 'PTR_ERR_OR_ZERO' is missing],
636 #include <linux/err.h>
638 if (PTR_ERR_OR_ZERO(NULL)) return 0;
640 AC_DEFINE(HAVE_PTR_ERR_OR_ZERO, 1,
641 ['PTR_ERR_OR_ZERO' exist])
643 ]) # LC_PTR_ERR_OR_ZERO_MISSING
646 # LC_HAVE_DENTRY_D_U_D_ALIAS
648 # 3.11 kernel moved d_alias to the union d_u in struct dentry
650 # Some distros move d_alias to d_u but it is still a struct list
652 AC_DEFUN([LC_HAVE_DENTRY_D_U_D_ALIAS], [
653 AS_IF([test "x$lb_cv_compile_i_dentry_d_alias_list" = xyes], [
654 LB_CHECK_COMPILE([if list 'dentry.d_u.d_alias' exist],
656 #include <linux/list.h>
657 #include <linux/dcache.h>
660 INIT_LIST_HEAD(&de.d_u.d_alias);
662 AC_DEFINE(HAVE_DENTRY_D_U_D_ALIAS, 1,
663 [list dentry.d_u.d_alias exist])
666 LB_CHECK_COMPILE([if hlist 'dentry.d_u.d_alias' exist],
668 #include <linux/list.h>
669 #include <linux/dcache.h>
672 INIT_HLIST_NODE(&de.d_u.d_alias);
674 AC_DEFINE(HAVE_DENTRY_D_U_D_ALIAS, 1,
675 [hlist dentry.d_u.d_alias exist])
678 ]) # LC_HAVE_DENTRY_D_U_D_ALIAS
681 # LC_HAVE_DENTRY_D_CHILD
683 # 3.11 kernel d_child has been moved out of the union d_u
686 AC_DEFUN([LC_HAVE_DENTRY_D_CHILD], [
687 LB_CHECK_COMPILE([if 'dentry.d_child' exist],
689 #include <linux/list.h>
690 #include <linux/dcache.h>
693 INIT_LIST_HEAD(&de.d_child);
695 AC_DEFINE(HAVE_DENTRY_D_CHILD, 1,
696 [dentry.d_child exist])
698 ]) # LC_HAVE_DENTRY_D_CHILD
703 # 3.12 ki_left removed from struct kiocb
705 AC_DEFUN([LC_KIOCB_KI_LEFT], [
706 LB_CHECK_COMPILE([if 'struct kiocb' with 'ki_left' member],
708 #include <linux/aio.h>
710 ((struct kiocb*)0)->ki_left = 0;
712 AC_DEFINE(HAVE_KIOCB_KI_LEFT, 1,
715 ]) # LC_KIOCB_KI_LEFT
718 # LC_REGISTER_SHRINKER_RET
720 # v3.11-8748-g1d3d4437eae1 register_shrinker returns a status
722 AC_DEFUN([LC_REGISTER_SHRINKER_RET], [
723 LB_CHECK_COMPILE([if register_shrinker() returns status],
724 register_shrinker_ret, [
725 #include <linux/mm.h>
727 if (register_shrinker(NULL))
728 unregister_shrinker(NULL);
730 AC_DEFINE(HAVE_REGISTER_SHRINKER_RET, 1,
731 [register_shrinker() returns status])
733 ]) # LC_REGISTER_SHRINKER_RET
736 # LC_VFS_RENAME_5ARGS
738 # 3.13 has vfs_rename with 5 args
740 AC_DEFUN([LC_VFS_RENAME_5ARGS], [
741 LB_CHECK_COMPILE([if Linux kernel has 'vfs_rename' with 5 args],
743 #include <linux/fs.h>
745 vfs_rename(NULL, NULL, NULL, NULL, NULL);
747 AC_DEFINE(HAVE_VFS_RENAME_5ARGS, 1,
748 [kernel has vfs_rename with 5 args])
750 ]) # LC_VFS_RENAME_5ARGS
753 # LC_VFS_UNLINK_3ARGS
755 # 3.13 has vfs_unlink with 3 args
757 AC_DEFUN([LC_VFS_UNLINK_3ARGS], [
758 LB_CHECK_COMPILE([if Linux kernel has 'vfs_unlink' with 3 args],
760 #include <linux/fs.h>
762 vfs_unlink(NULL, NULL, NULL);
764 AC_DEFINE(HAVE_VFS_UNLINK_3ARGS, 1,
765 [kernel has vfs_unlink with 3 args])
767 ]) # LC_VFS_UNLINK_3ARGS
769 # LC_HAVE_D_IS_POSITIVE
771 # Kernel version 3.13 b18825a7c8e37a7cf6abb97a12a6ad71af160de7
772 # d_is_positive is added
774 AC_DEFUN([LC_HAVE_D_IS_POSITIVE], [
775 LB_CHECK_COMPILE([if 'd_is_positive' exist],
777 #include <linux/dcache.h>
781 AC_DEFINE(HAVE_D_IS_POSITIVE, 1,
782 ['d_is_positive' is available])
784 ]) # LC_HAVE_D_IS_POSITIVE
789 # 3.14 move some of its data in struct bio into the new
792 AC_DEFUN([LC_HAVE_BVEC_ITER], [
793 LB_CHECK_COMPILE([if Linux kernel has struct bvec_iter],
795 #include <linux/bio.h>
797 struct bvec_iter iter;
799 iter.bi_bvec_done = 0;
801 AC_DEFINE(HAVE_BVEC_ITER, 1,
802 [kernel has struct bvec_iter])
804 ]) # LC_HAVE_BVEC_ITER
809 # 3.14 adds set_acl method to inode_operations
810 # see kernel commit 893d46e443346370cd4ea81d9d35f72952c62a37
812 AC_DEFUN([LC_IOP_SET_ACL], [
813 LB_CHECK_COMPILE([if 'inode_operations' has '.set_acl' member function],
815 #include <linux/fs.h>
817 struct inode_operations iop;
820 AC_DEFINE(HAVE_IOP_SET_ACL, 1,
821 [inode_operations has .set_acl member function])
826 # LC_HAVE_TRUNCATE_IPAGE_FINAL
828 # 3.14 bring truncate_inode_pages_final for evict_inode
830 AC_DEFUN([LC_HAVE_TRUNCATE_IPAGES_FINAL], [
831 LB_CHECK_COMPILE([if Linux kernel has truncate_inode_pages_final],
832 truncate_ipages_final, [
833 #include <linux/mm.h>
835 truncate_inode_pages_final(NULL);
837 AC_DEFINE(HAVE_TRUNCATE_INODE_PAGES_FINAL, 1,
838 [kernel has truncate_inode_pages_final])
840 ]) # LC_HAVE_TRUNCATE_IPAGES_FINAL
843 # LC_IOPS_RENAME_WITH_FLAGS
845 # 3.14 has inode_operations->rename with 5 args
846 # commit 520c8b16505236fc82daa352e6c5e73cd9870cff
848 AC_DEFUN([LC_IOPS_RENAME_WITH_FLAGS], [
849 LB_CHECK_COMPILE([if 'inode_operations->rename' taken flags as argument],
850 iops_rename_with_flags, [
851 #include <linux/fs.h>
853 struct inode *i1 = NULL, *i2 = NULL;
854 struct dentry *d1 = NULL, *d2 = NULL;
856 rc = ((struct inode_operations *)0)->rename(i1, d1, i2, d2, 0);
858 AC_DEFINE(HAVE_IOPS_RENAME_WITH_FLAGS, 1,
859 [inode_operations->rename need flags as argument])
861 ]) # LC_IOPS_RENAME_WITH_FLAGS
864 # LC_VFS_RENAME_6ARGS
866 # 3.15 has vfs_rename with 6 args
868 AC_DEFUN([LC_VFS_RENAME_6ARGS], [
869 LB_CHECK_COMPILE([if Linux kernel has 'vfs_rename' with 6 args],
871 #include <linux/fs.h>
873 vfs_rename(NULL, NULL, NULL, NULL, NULL, NULL);
875 AC_DEFINE(HAVE_VFS_RENAME_6ARGS, 1,
876 [kernel has vfs_rename with 6 args])
878 ]) # LC_VFS_RENAME_6ARGS
881 # LC_DIRECTIO_USE_ITER
883 # 3.16 kernel changes direct IO to use iov_iter
885 AC_DEFUN([LC_DIRECTIO_USE_ITER], [
886 LB_CHECK_COMPILE([if direct IO uses iov_iter],
888 #include <linux/fs.h>
890 struct address_space_operations ops = { };
891 struct iov_iter *iter = NULL;
894 ops.direct_IO(0, NULL, iter, offset);
896 AC_DEFINE(HAVE_DIRECTIO_ITER, 1,
897 [direct IO uses iov_iter])
899 ]) # LC_DIRECTIO_USE_ITER
902 # LC_HAVE_IOV_ITER_INIT_DIRECTION
905 # 3.16 linux commit 71d8e532b1549a478e6a6a8a44f309d050294d00
906 # changed iov_iter_init api to start accepting a tag
907 # that defines if its a read or write operation
909 AC_DEFUN([LC_HAVE_IOV_ITER_INIT_DIRECTION], [
910 tmp_flags="$EXTRA_KCFLAGS"
911 EXTRA_KCFLAGS="-Werror"
912 LB_CHECK_COMPILE([if 'iov_iter_init' takes a tag],
914 #include <linux/uio.h>
915 #include <linux/fs.h>
917 const struct iovec *iov = NULL;
919 iov_iter_init(NULL, READ, iov, 1, 0);
921 AC_DEFINE(HAVE_IOV_ITER_INIT_DIRECTION, 1,
922 [iov_iter_init handles directional tag])
924 EXTRA_KCFLAGS="$tmp_flags"
925 ]) # LC_HAVE_IOV_ITER_INIT_DIRECTION
928 # LC_HAVE_IOV_ITER_TRUNCATE
931 # 3.16 introduces a new API iov_iter_truncate()
933 AC_DEFUN([LC_HAVE_IOV_ITER_TRUNCATE], [
934 tmp_flags="$EXTRA_KCFLAGS"
935 EXTRA_KCFLAGS="-Werror"
936 LB_CHECK_COMPILE([if 'iov_iter_truncate' exists ],
938 #include <linux/uio.h>
939 #include <linux/fs.h>
941 struct iov_iter *i = NULL;
943 iov_iter_truncate(i, 0);
945 AC_DEFINE(HAVE_IOV_ITER_TRUNCATE, 1, [iov_iter_truncate exists])
947 EXTRA_KCFLAGS="$tmp_flags"
948 ]) # LC_HAVE_IOV_ITER_TRUNCATE
951 # LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER
953 # 3.16 introduces [read|write]_iter to struct file_operations
955 AC_DEFUN([LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER], [
956 LB_CHECK_COMPILE([if 'file_operations.[read|write]_iter' exist],
957 file_function_iter, [
958 #include <linux/fs.h>
960 ((struct file_operations *)NULL)->read_iter(NULL, NULL);
961 ((struct file_operations *)NULL)->write_iter(NULL, NULL);
963 AC_DEFINE(HAVE_FILE_OPERATIONS_READ_WRITE_ITER, 1,
964 [file_operations.[read|write]_iter functions exist])
966 ]) # LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER
969 # LC_HAVE_INTERVAL_BLK_INTEGRITY
971 # 3.17 replace sector_size with interval in struct blk_integrity
973 AC_DEFUN([LC_HAVE_INTERVAL_BLK_INTEGRITY], [
974 LB_CHECK_COMPILE([if 'blk_integrity.interval' exist],
975 interval_blk_integrity, [
976 #include <linux/blkdev.h>
978 ((struct blk_integrity *)0)->interval = 0;
980 AC_DEFINE(HAVE_INTERVAL_BLK_INTEGRITY, 1,
981 [blk_integrity.interval exist])
983 ]) # LC_HAVE_INTERVAL_BLK_INTEGRITY
988 # 3.17 replaces key_type::match with match_preparse
989 # and has new struct key_match_data
991 AC_DEFUN([LC_KEY_MATCH_DATA], [
992 LB_CHECK_COMPILE([if struct key_match field exist],
994 #include <linux/key-type.h>
996 struct key_match_data data;
998 data.raw_data = NULL;
1000 AC_DEFINE(HAVE_KEY_MATCH_DATA, 1,
1001 [struct key_match_data exist])
1003 ]) # LC_KEY_MATCH_DATA
1006 # LC_NFS_FILLDIR_USE_CTX
1008 # 3.18 kernel moved from void cookie to struct dir_context
1010 AC_DEFUN([LC_NFS_FILLDIR_USE_CTX], [
1011 tmp_flags="$EXTRA_KCFLAGS"
1012 EXTRA_KCFLAGS="-Werror"
1013 LB_CHECK_COMPILE([if filldir_t uses struct dir_context],
1015 #include <linux/fs.h>
1017 int filldir(struct dir_context *ctx, const char* name,
1018 int i, loff_t off, u64 tmp, unsigned temp)
1023 struct dir_context ctx = {
1027 ctx.actor(NULL, "test", 0, (loff_t) 0, 0, 0);
1029 AC_DEFINE(HAVE_FILLDIR_USE_CTX, 1,
1030 [filldir_t needs struct dir_context as argument])
1032 EXTRA_KCFLAGS="$tmp_flags"
1033 ]) # LC_NFS_FILLDIR_USE_CTX
1036 # LC_PERCPU_COUNTER_INIT
1038 # 3.18 For kernels 3.18 and after percpu_counter_init starts
1039 # to pass a GFP_* memory allocation flag for internal
1040 # memory allocation purposes.
1042 AC_DEFUN([LC_PERCPU_COUNTER_INIT], [
1043 LB_CHECK_COMPILE([if percpu_counter_init uses GFP_* flag as argument],
1044 percpu_counter_init, [
1045 #include <linux/percpu_counter.h>
1047 percpu_counter_init(NULL, 0, GFP_KERNEL);
1049 AC_DEFINE(HAVE_PERCPU_COUNTER_INIT_GFP_FLAG, 1,
1050 [percpu_counter_init uses GFP_* flag])
1052 ]) # LC_PERCPU_COUNTER_INIT
1055 # LC_KIOCB_HAS_NBYTES
1057 # 3.19 kernel removed ki_nbytes from struct kiocb
1059 AC_DEFUN([LC_KIOCB_HAS_NBYTES], [
1060 LB_CHECK_COMPILE([if struct kiocb has ki_nbytes field],
1062 #include <linux/fs.h>
1064 struct kiocb iocb = { };
1068 AC_DEFINE(HAVE_KI_NBYTES, 1, [ki_nbytes field exist])
1070 ]) # LC_KIOCB_HAS_NBYTES
1073 # LC_HAVE_DQUOT_QC_DQBLK
1075 # 3.19 has quotactl_ops->[sg]et_dqblk that take struct kqid and qc_dqblk
1076 # Added in commit 14bf61ffe
1078 AC_DEFUN([LC_HAVE_DQUOT_QC_DQBLK], [
1079 tmp_flags="$EXTRA_KCFLAGS"
1080 EXTRA_KCFLAGS="-Werror"
1081 LB_CHECK_COMPILE([if 'quotactl_ops.set_dqblk' takes struct qc_dqblk],
1083 #include <linux/fs.h>
1084 #include <linux/quota.h>
1086 ((struct quotactl_ops *)0)->set_dqblk(NULL, *((struct kqid*)0), (struct qc_dqblk*)0);
1088 AC_DEFINE(HAVE_DQUOT_QC_DQBLK, 1,
1089 [quotactl_ops.set_dqblk takes struct qc_dqblk])
1090 AC_DEFINE(HAVE_DQUOT_KQID, 1,
1091 [quotactl_ops.set_dqblk takes struct kqid])
1093 EXTRA_KCFLAGS="$tmp_flags"
1094 ]) # LC_HAVE_DQUOT_QC_DQBLK
1097 # LC_HAVE_AIO_COMPLETE
1099 # 3.19 kernel makes aio_complete() static
1101 AC_DEFUN([LC_HAVE_AIO_COMPLETE], [
1102 LB_CHECK_COMPILE([if kernel has exported aio_complete() ],
1104 #include <linux/aio.h>
1106 aio_complete(NULL, 0, 0);
1108 AC_DEFINE(HAVE_AIO_COMPLETE, 1, [aio_complete defined])
1110 ]) # LC_HAVE_AIO_COMPLETE
1113 # LC_HAVE_IS_ROOT_INODE
1115 # 3.19 kernel adds is_root_inode()
1116 # Commit a7400222e3eb ("new helper: is_root_inode()")
1118 AC_DEFUN([LC_HAVE_IS_ROOT_INODE], [
1119 LB_CHECK_COMPILE([if kernel has is_root_inode() ],
1121 #include <linux/fs.h>
1123 is_root_inode(NULL);
1125 AC_DEFINE(HAVE_IS_ROOT_INODE, 1, [is_root_inode defined])
1127 ]) # LC_HAVE_IS_ROOT_INODE
1130 # LC_BACKING_DEV_INFO_REMOVAL
1132 # 3.20 kernel removed backing_dev_info from address_space
1134 AC_DEFUN([LC_BACKING_DEV_INFO_REMOVAL], [
1135 LB_CHECK_COMPILE([if struct address_space has backing_dev_info],
1137 #include <linux/fs.h>
1139 struct address_space mapping;
1141 mapping.backing_dev_info = NULL;
1143 AC_DEFINE(HAVE_BACKING_DEV_INFO, 1, [backing_dev_info exist])
1145 ]) # LC_BACKING_DEV_INFO_REMOVAL
1148 # LC_HAVE_BDI_CAP_MAP_COPY
1150 # 3.20 removed mmap handling for backing devices since
1151 # it breaks on non-MMU systems. See kernel commit
1152 # b4caecd48005fbed3949dde6c1cb233142fd69e9
1154 AC_DEFUN([LC_HAVE_BDI_CAP_MAP_COPY], [
1155 LB_CHECK_COMPILE([if have 'BDI_CAP_MAP_COPY'],
1157 #include <linux/backing-dev.h>
1159 struct backing_dev_info info;
1161 info.capabilities = BDI_CAP_MAP_COPY;
1163 AC_DEFINE(HAVE_BDI_CAP_MAP_COPY, 1,
1164 [BDI_CAP_MAP_COPY exist])
1166 ]) # LC_HAVE_BDI_CAP_MAP_COPY
1169 # LC_HAVE_PROJECT_QUOTA
1171 # Kernel version v4.0-rc1-197-g847aac644e92
1173 AC_DEFUN([LC_HAVE_PROJECT_QUOTA], [
1174 LB_CHECK_COMPILE([if get_projid exists],
1177 #include <linux/quota.h>
1179 struct dquot_operations ops = { };
1181 ops.get_projid(NULL, NULL);
1183 AC_DEFINE(HAVE_PROJECT_QUOTA, 1,
1184 [get_projid function exists])
1186 ]) # LC_HAVE_PROJECT_QUOTA
1191 # 4.1 kernel has iov_iter_rw
1193 AC_DEFUN([LC_IOV_ITER_RW], [
1194 LB_CHECK_COMPILE([if iov_iter_rw exist],
1196 #include <linux/fs.h>
1197 #include <linux/uio.h>
1199 struct iov_iter *iter = NULL;
1203 AC_DEFINE(HAVE_IOV_ITER_RW, 1,
1204 [iov_iter_rw exist])
1209 # LC_HAVE_SYNC_READ_WRITE
1211 # 4.1 new_sync_[read|write] no longer exported
1213 AC_DEFUN([LC_HAVE_SYNC_READ_WRITE], [
1214 LB_CHECK_EXPORT([new_sync_read], [fs/read_write.c],
1215 [AC_DEFINE(HAVE_SYNC_READ_WRITE, 1,
1216 [new_sync_[read|write] is exported by the kernel])])
1217 ]) # LC_HAVE_SYNC_READ_WRITE
1222 # 4.1 redefined bi_cnt as __bi_cnt in commit dac56212e8127dbc0
1224 AC_DEFUN([LC_HAVE___BI_CNT], [
1225 LB_CHECK_COMPILE([if Linux kernel has __bi_cnt in struct bio],
1227 #include <asm/atomic.h>
1228 #include <linux/bio.h>
1229 #include <linux/blk_types.h>
1231 struct bio bio = { };
1233 cnt = atomic_read(&bio.__bi_cnt);
1235 AC_DEFINE(HAVE___BI_CNT, 1,
1236 [struct bio has __bi_cnt])
1238 ]) # LC_HAVE___BI_CNT
1241 # LC_SYMLINK_OPS_USE_NAMEIDATA
1243 # For the 4.2+ kernels the file system internal symlink api no
1244 # longer uses struct nameidata as a argument
1246 AC_DEFUN([LC_SYMLINK_OPS_USE_NAMEIDATA], [
1247 LB_CHECK_COMPILE([if symlink inode operations have struct nameidata argument],
1248 symlink_use_nameidata, [
1249 #include <linux/namei.h>
1250 #include <linux/fs.h>
1252 struct nameidata *nd = NULL;
1254 ((struct inode_operations *)0)->follow_link(NULL, nd);
1255 ((struct inode_operations *)0)->put_link(NULL, nd, NULL);
1257 AC_DEFINE(HAVE_SYMLINK_OPS_USE_NAMEIDATA, 1,
1258 [symlink inode operations need struct nameidata argument])
1260 ]) # LC_SYMLINK_OPS_USE_NAMEIDATA
1263 # LC_BIO_ENDIO_USES_ONE_ARG
1265 # 4.2 kernel bio_endio now only takes one argument
1267 AC_DEFUN([LC_BIO_ENDIO_USES_ONE_ARG], [
1268 LB_CHECK_COMPILE([if 'bio_endio' with one argument exist],
1270 #include <linux/bio.h>
1274 AC_DEFINE(HAVE_BIO_ENDIO_USES_ONE_ARG, 1,
1275 [bio_endio takes only one argument])
1277 ]) # LC_BIO_ENDIO_USES_ONE_ARG
1280 # LC_ACCOUNT_PAGE_DIRTIED_3ARGS
1282 # 4.2 [to 4.5] kernel page dirtied takes 3 arguments
1284 AC_DEFUN([LC_ACCOUNT_PAGE_DIRTIED_3ARGS], [
1285 LB_CHECK_COMPILE([if 'account_page_dirtied' with 3 args exists],
1286 account_page_dirtied, [
1287 #include <linux/mm.h>
1289 account_page_dirtied(NULL, NULL, NULL);
1291 AC_DEFINE(HAVE_ACCOUNT_PAGE_DIRTIED_3ARGS, 1,
1292 [account_page_dirtied takes three arguments])
1294 ]) # LC_ACCOUNT_PAGE_DIRTIED_3ARGS
1297 # LC_HAVE_CRYPTO_ALLOC_SKCIPHER
1299 # Kernel version 4.12 commit 7a7ffe65c8c5
1300 # introduced crypto_alloc_skcipher().
1302 AC_DEFUN([LC_HAVE_CRYPTO_ALLOC_SKCIPHER], [
1303 LB_CHECK_COMPILE([if crypto_alloc_skcipher is defined],
1304 crypto_alloc_skcipher, [
1305 #include <crypto/skcipher.h>
1307 crypto_alloc_skcipher(NULL, 0, 0);
1309 AC_DEFINE(HAVE_CRYPTO_ALLOC_SKCIPHER, 1,
1310 [crypto_alloc_skcipher is defined])
1312 ]) # LC_HAVE_CRYPTO_ALLOC_SKCIPHER
1315 # LC_HAVE_INTERVAL_EXP_BLK_INTEGRITY
1317 # 4.3 replace interval with interval_exp in 'struct blk_integrity'
1318 # 'struct blk_integrity_profile' is also added in this version,
1319 # thus use this to determine whether 'struct blk_integrity' has profile
1321 AC_DEFUN([LC_HAVE_INTERVAL_EXP_BLK_INTEGRITY], [
1322 LB_CHECK_COMPILE([if 'blk_integrity.interval_exp' exist],
1323 blk_integrity_interval_exp, [
1324 #include <linux/blkdev.h>
1326 ((struct blk_integrity *)0)->interval_exp = 0;
1328 AC_DEFINE(HAVE_INTERVAL_EXP_BLK_INTEGRITY, 1,
1329 [blk_integrity.interval_exp exist])
1331 ]) # LC_HAVE_INTERVAL_EXP_BLK_INTEGRITY
1334 # LC_HAVE_CACHE_HEAD_HLIST
1336 # 4.3 kernel swiched to hlist for cache_head
1338 AC_DEFUN([LC_HAVE_CACHE_HEAD_HLIST], [
1339 LB_CHECK_COMPILE([if 'struct cache_head' has 'cache_list' field],
1340 cache_head_has_hlist, [
1341 #include <linux/sunrpc/cache.h>
1343 do {} while(sizeof(((struct cache_head *)0)->cache_list));
1345 AC_DEFINE(HAVE_CACHE_HEAD_HLIST, 1,
1346 [cache_head has hlist cache_list])
1348 ]) # LC_HAVE_CACHE_HEAD_HLIST
1351 # LC_HAVE_XATTR_HANDLER_SIMPLIFIED
1353 # Kernel version 4.3 commit e409de992e3ea3674393465f07cc71c948edd87a
1354 # simplified xattr_handler handling by passing in the handler pointer
1356 AC_DEFUN([LC_HAVE_XATTR_HANDLER_SIMPLIFIED], [
1357 tmp_flags="$EXTRA_KCFLAGS"
1358 EXTRA_KCFLAGS="-Werror"
1359 LB_CHECK_COMPILE([if 'struct xattr_handler' functions pass in handler pointer],
1360 xattr_handler_simplified, [
1361 #include <linux/xattr.h>
1363 struct xattr_handler handler;
1365 ((struct xattr_handler *)0)->get(&handler, NULL, NULL, NULL, 0);
1366 ((struct xattr_handler *)0)->set(&handler, NULL, NULL, NULL, 0, 0);
1368 AC_DEFINE(HAVE_XATTR_HANDLER_SIMPLIFIED, 1, [handler pointer is parameter])
1370 EXTRA_KCFLAGS="$tmp_flags"
1371 ]) # LC_HAVE_XATTR_HANDLER_SIMPLIFIED
1374 # LC_HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD
1376 # 4.3 replace interval with interval_exp in 'struct blk_integrity'.
1378 AC_DEFUN([LC_HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD], [
1379 LB_CHECK_COMPILE([if 'bio_integrity_payload.bip_iter' exist],
1380 bio_integrity_payload_bip_iter, [
1381 #include <linux/bio.h>
1383 ((struct bio_integrity_payload *)0)->bip_iter.bi_size = 0;
1385 AC_DEFINE(HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD, 1,
1386 [bio_integrity_payload.bip_iter exist])
1388 ]) # LC_HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD
1391 # LC_BIO_INTEGRITY_PREP_FN
1393 # Lustre kernel patch extents bio_integrity_prep to accept optional
1394 # generate/verify_fn as extra args.
1396 AC_DEFUN([LC_BIO_INTEGRITY_PREP_FN], [
1397 LB_CHECK_COMPILE([if 'bio_integrity_prep_fn' exists],
1398 bio_integrity_prep_fn, [
1399 #include <linux/bio.h>
1401 bio_integrity_prep_fn(NULL, NULL, NULL);
1403 AC_DEFINE(HAVE_BIO_INTEGRITY_PREP_FN, 1,
1404 [kernel has bio_integrity_prep_fn])
1405 AC_SUBST(PATCHED_INTEGRITY_INTF)
1407 AC_SUBST(PATCHED_INTEGRITY_INTF, [#])
1409 ]) # LC_BIO_INTEGRITY_PREP_FN
1411 # LC_BIO_INTEGRITY_PREP_FN_RETURNS_BOOL
1413 # 13 kernel integrity API has changed and in 4.13+
1414 # (as well as in rhel 8.4) bio_integrity_prep() returns boolean true
1417 AC_DEFUN([LC_BIO_INTEGRITY_PREP_FN_RETURNS_BOOL], [
1418 LB_CHECK_COMPILE([if 'bio_integrity_prep_fn' returns bool],
1419 bio_integrity_prep, [
1420 #include <linux/bio.h>
1421 #include <linux/typecheck.h>
1423 #pragma GCC diagnostic warning "-Werror"
1424 typedef bool (*bio_integrity_prep_type)(struct bio *bio) ;
1426 typecheck_fn(bio_integrity_prep_type, bio_integrity_prep);
1428 AC_DEFINE(HAVE_BIO_INTEGRITY_PREP_FN_RETURNS_BOOL, 1,
1429 [bio_integrity_prep_fn returns bool])
1431 ]) # LC_BIO_INTEGRITY_PREP_FN_RETURNS_BOOL
1436 # 4.4/4.8 redefined bi_rw as bi_opf (SLES12/kernel commit 4382e33ad37486)
1438 AC_DEFUN([LC_HAVE_BI_OPF], [
1439 LB_CHECK_COMPILE([if Linux kernel has bi_opf in struct bio],
1441 #include <linux/bio.h>
1447 AC_DEFINE(HAVE_BI_OPF, 1,
1448 [struct bio has bi_opf])
1453 # LC_HAVE_SUBMIT_BIO_2ARGS
1455 # 4.4 removed an argument from submit_bio
1457 AC_DEFUN([LC_HAVE_SUBMIT_BIO_2ARGS], [
1458 LB_CHECK_COMPILE([if submit_bio takes two arguments],
1459 have_submit_bio_2args, [
1460 #include <linux/bio.h>
1463 submit_bio(READ, &bio);
1465 AC_DEFINE(HAVE_SUBMIT_BIO_2ARGS, 1,
1466 [submit_bio takes two arguments])
1468 ]) # LC_HAVE_SUBMIT_BIO_2_ARGS
1471 # LC_HAVE_CLEAN_BDEV_ALIASES
1473 # 4.4/4.9 unmap_underlying_metadata was replaced by clean_bdev_aliases
1474 # (SLES12/kernel commit 29f3ad7d8380364c)
1476 AC_DEFUN([LC_HAVE_CLEAN_BDEV_ALIASES], [
1477 LB_CHECK_COMPILE([if kernel has clean_bdev_aliases],
1478 have_clean_bdev_aliases, [
1479 #include <linux/buffer_head.h>
1481 clean_bdev_aliases(NULL,1,1);
1483 AC_DEFINE(HAVE_CLEAN_BDEV_ALIASES, 1,
1484 [kernel has clean_bdev_aliases])
1486 ]) # LC_HAVE_CLEAN_BDEV_ALIASES
1489 # LC_HAVE_LOCKS_LOCK_FILE_WAIT
1491 # 4.4 kernel have moved locks API users to
1492 # locks_lock_inode_wait()
1494 AC_DEFUN([LC_HAVE_LOCKS_LOCK_FILE_WAIT], [
1495 LB_CHECK_COMPILE([if 'locks_lock_file_wait' exists],
1496 locks_lock_file_wait, [
1497 #include <linux/fs.h>
1499 locks_lock_file_wait(NULL, NULL);
1501 AC_DEFINE(HAVE_LOCKS_LOCK_FILE_WAIT, 1,
1502 [kernel has locks_lock_file_wait])
1504 ]) # LC_HAVE_LOCKS_LOCK_FILE_WAIT
1507 # LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
1509 # 4.4 kernel merged type-specific data with the payload data for keys
1511 AC_DEFUN([LC_HAVE_KEY_PAYLOAD_DATA_ARRAY], [
1512 LB_CHECK_COMPILE([if 'struct key' has 'payload.data' as an array],
1513 key_payload_data_array, [
1514 #include <linux/key.h>
1516 struct key key = { };
1518 key.payload.data[0] = NULL;
1520 AC_DEFINE(HAVE_KEY_PAYLOAD_DATA_ARRAY, 1, [payload.data is an array])
1522 ]) #LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
1525 # LC_HAVE_XATTR_HANDLER_NAME
1527 # Kernel version 4.4 commit 98e9cb5711c68223f0e4d5201b9a6add255ec550
1528 # add a name member to struct xattr_handler
1530 AC_DEFUN([LC_HAVE_XATTR_HANDLER_NAME], [
1531 tmp_flags="$EXTRA_KCFLAGS"
1532 EXTRA_KCFLAGS="-Werror"
1533 LB_CHECK_COMPILE([if 'struct xattr_handler' has a name member],
1534 xattr_handler_name, [
1535 #include <linux/xattr.h>
1537 ((struct xattr_handler *)NULL)->name = NULL;
1539 AC_DEFINE(HAVE_XATTR_HANDLER_NAME, 1, [xattr_handler has a name member])
1541 EXTRA_KCFLAGS="$tmp_flags"
1542 ]) # LC_HAVE_XATTR_HANDLER_NAME
1545 # LC_HAVE_FILE_DENTRY
1547 # 4.5 adds wrapper file_dentry
1549 AC_DEFUN([LC_HAVE_FILE_DENTRY], [
1550 LB_CHECK_COMPILE([if Linux kernel has 'file_dentry'],
1552 #include <linux/fs.h>
1556 AC_DEFINE(HAVE_FILE_DENTRY, 1,
1557 [kernel has file_dentry])
1559 ]) # LC_HAVE_FILE_DENTRY
1562 # LC_HAVE_INODE_LOCK
1564 # 4.5 introduced inode_lock
1566 AC_DEFUN([LC_HAVE_INODE_LOCK], [
1567 LB_CHECK_COMPILE([if 'inode_lock' is defined],
1569 #include <linux/fs.h>
1573 AC_DEFINE(HAVE_INODE_LOCK, 1,
1574 [inode_lock is defined])
1576 ]) # LC_HAVE_INODE_LOCK
1579 # LC_HAVE_IOP_GET_LINK
1581 # 4.5 vfs replaced iop->follow_link with
1584 AC_DEFUN([LC_HAVE_IOP_GET_LINK], [
1585 LB_CHECK_COMPILE([if 'iop' has 'get_link'],
1586 inode_ops_get_link, [
1587 #include <linux/fs.h>
1589 struct inode_operations iop;
1590 iop.get_link = NULL;
1592 AC_DEFINE(HAVE_IOP_GET_LINK, 1,
1593 [have iop get_link])
1595 ]) # LC_HAVE_IOP_GET_LINK
1598 # LC_HAVE_IN_COMPAT_SYSCALL
1600 # 4.6 renamed is_compat_task to in_compat_syscall
1602 AC_DEFUN([LC_HAVE_IN_COMPAT_SYSCALL], [
1603 LB_CHECK_COMPILE([if 'in_compat_syscall' is defined],
1604 in_compat_syscall, [
1605 #include <linux/compat.h>
1607 in_compat_syscall();
1609 AC_DEFINE(HAVE_IN_COMPAT_SYSCALL, 1,
1610 [have in_compat_syscall])
1612 ]) # LC_HAVE_IN_COMPAT_SYSCALL
1615 # LC_HAVE_XATTR_HANDLER_INODE_PARAM
1617 # Kernel version 4.6 commit b296821a7c42fa58baa17513b2b7b30ae66f3336
1618 # and commit 5930122683dff58f0846b0f0405b4bd598a3ba6a added inode parameter
1619 # to xattr_handler functions
1621 AC_DEFUN([LC_HAVE_XATTR_HANDLER_INODE_PARAM], [
1622 tmp_flags="$EXTRA_KCFLAGS"
1623 EXTRA_KCFLAGS="-Werror"
1624 LB_CHECK_COMPILE([if 'struct xattr_handler' functions have inode parameter],
1625 xattr_handler_inode_param, [
1626 #include <linux/xattr.h>
1628 const struct xattr_handler handler;
1630 ((struct xattr_handler *)0)->get(&handler, NULL, NULL, NULL, NULL, 0);
1631 ((struct xattr_handler *)0)->set(&handler, NULL, NULL, NULL, NULL, 0, 0);
1633 AC_DEFINE(HAVE_XATTR_HANDLER_INODE_PARAM, 1, [needs inode parameter])
1635 EXTRA_KCFLAGS="$tmp_flags"
1636 ]) # LC_HAVE_XATTR_HANDLER_INODE_PARAM
1641 # Kernel version 4.6 commit 85c7f81041d57cfe9dc97f4680d5586b54534a39
1642 # introduced parallel lookups in the VFS layer. The inline function
1643 # d_in_lookup was added to notify when the same item was being queried
1646 AC_DEFUN([LC_D_IN_LOOKUP], [
1647 tmp_flags="$EXTRA_KCFLAGS"
1648 EXTRA_KCFLAGS="-Werror"
1649 LB_CHECK_COMPILE([if 'd_in_lookup' is defined],
1651 #include <linux/dcache.h>
1655 AC_DEFINE(HAVE_D_IN_LOOKUP, 1, [d_in_lookup is defined])
1657 EXTRA_KCFLAGS="$tmp_flags"
1661 # LC_LOCK_PAGE_MEMCG
1663 # Kernel version 4.6 adds lock_page_memcg
1665 AC_DEFUN([LC_LOCK_PAGE_MEMCG], [
1666 LB_CHECK_COMPILE([if 'lock_page_memcg' is defined],
1668 #include <linux/memcontrol.h>
1670 lock_page_memcg(NULL);
1672 AC_DEFINE(HAVE_LOCK_PAGE_MEMCG, 1,
1673 [lock_page_memcg is defined])
1675 ]) # LC_LOCK_PAGE_MEMCG
1678 # LC_HAVE_DOWN_WRITE_KILLABLE
1680 # Kernel version v4.6-rc3-28-g916633a40370
1682 AC_DEFUN([LC_HAVE_DOWN_WRITE_KILLABLE], [
1683 LB_CHECK_COMPILE([if down_write_killable exists],
1684 down_write_killable, [
1685 struct rw_semaphore sem;
1686 #include <linux/rwsem.h>
1690 rc = down_write_killable(&sem);
1692 AC_DEFINE(HAVE_DOWN_WRITE_KILLABLE, 1,
1693 [down_write_killable function exists])
1695 ]) # LC_HAVE_DOWN_WRITE_KILLABLE
1700 # Kernel version 4.7-rc5 commit 285b102d3b745f3c2c110c9c327741d87e64aacc
1701 # add new d_init to initialize dentry at allocation time
1703 AC_DEFUN([LC_D_INIT], [
1704 LB_CHECK_COMPILE([if dentry operations supports 'd_init'],
1706 #include <linux/dcache.h>
1708 struct dentry_operations ops = { };
1711 rc = ops.d_init(NULL);
1713 AC_DEFINE(HAVE_D_INIT, 1, ['d_init' exists])
1720 # Kernel version 4.7 commit c8b8e32d700fe943a935e435ae251364d016c497
1721 # direct-io: eliminate the offset argument to ->direct_IO
1723 AC_DEFUN([LC_DIRECTIO_2ARGS], [
1724 LB_CHECK_COMPILE([if '->direct_IO()' taken 2 arguments],
1726 #include <linux/fs.h>
1728 struct address_space_operations ops = { };
1729 struct iov_iter *iter = NULL;
1730 struct kiocb *iocb = NULL;
1733 rc = ops.direct_IO(iocb, iter);
1735 AC_DEFINE(HAVE_DIRECTIO_2ARGS, 1,
1736 [direct_IO need 2 arguments])
1738 ]) # LC_DIRECTIO_2ARGS
1741 # LC_GENERIC_WRITE_SYNC_2ARGS
1743 # Kernel version 4.7 commit dde0c2e79848298cc25621ad080d47f94dbd7cce
1744 # fs: add IOCB_SYNC and IOCB_DSYNC
1746 AC_DEFUN([LC_GENERIC_WRITE_SYNC_2ARGS], [
1747 LB_CHECK_COMPILE([if 'generic_write_sync()' taken 2 arguments],
1748 generic_write_sync_2args, [
1749 #include <linux/fs.h>
1751 struct kiocb *iocb = NULL;
1754 rc = generic_write_sync(iocb, 0);
1756 AC_DEFINE(HAVE_GENERIC_WRITE_SYNC_2ARGS, 1,
1757 [generic_write_sync need 2 arguments])
1759 ]) # LC_GENERIC_WRITE_SYNC_2ARGS
1762 # LC_FOP_ITERATE_SHARED
1764 # Kernel v4.6-rc3-29-g6192269 adds iterate_shared method to file_operations
1766 AC_DEFUN([LC_FOP_ITERATE_SHARED], [
1767 LB_CHECK_COMPILE([if 'file_operations' has 'iterate_shared'],
1768 fop_iterate_shared, [
1769 #include <linux/fs.h>
1771 struct file_operations fop;
1772 fop.iterate_shared = NULL;
1774 AC_DEFINE(HAVE_FOP_ITERATE_SHARED, 1,
1775 [file_operations has iterate_shared])
1777 ]) # LC_FOP_ITERATE_SHARED
1780 # LC_EXPORT_DEFAULT_FILE_SPLICE_READ
1782 # 4.8-rc8 commit 82c156f853840645604acd7c2cebcb75ed1b6652 switched
1783 # generic_file_splice_read() to using ->read_iter. We can test this
1784 # change since default_file_splice_read() is no longer exported.
1786 AC_DEFUN([LC_EXPORT_DEFAULT_FILE_SPLICE_READ], [
1787 LB_CHECK_EXPORT([default_file_splice_read], [fs/splice.c],
1788 [AC_DEFINE(HAVE_DEFAULT_FILE_SPLICE_READ_EXPORT, 1,
1789 [default_file_splice_read is exported])])
1790 ]) # LC_EXPORT_DEFAULT_FILE_SPLCE_READ
1793 # LC_HAVE_POSIX_ACL_VALID_USER_NS
1795 # 4.8 posix_acl_valid takes struct user_namespace
1797 AC_DEFUN([LC_HAVE_POSIX_ACL_VALID_USER_NS], [
1798 LB_CHECK_COMPILE([if 'posix_acl_valid' takes 'struct user_namespace'],
1800 #include <linux/fs.h>
1801 #include <linux/posix_acl.h>
1803 posix_acl_valid((struct user_namespace*)NULL, (const struct posix_acl*)NULL);
1805 AC_DEFINE(HAVE_POSIX_ACL_VALID_USER_NS, 1,
1806 [posix_acl_valid takes struct user_namespace])
1808 ]) # LC_HAVE_POSIX_ACL_VALID_USER_NS
1811 # LC_D_COMPARE_4ARGS
1813 # Kernel version 4.8 commit 6fa67e707559303e086303aeecc9e8b91ef497d5
1814 # get rid of 'parent' argument of ->d_compare()
1816 AC_DEFUN([LC_D_COMPARE_4ARGS], [
1817 LB_CHECK_COMPILE([if 'd_compare' taken 4 arguments],
1819 #include <linux/dcache.h>
1821 ((struct dentry_operations*)0)->d_compare(NULL,0,NULL,NULL);
1823 AC_DEFINE(HAVE_D_COMPARE_4ARGS, 1,
1824 [d_compare need 4 arguments])
1826 ]) # LC_D_COMPARE_4ARGS
1829 # LC_FULL_NAME_HASH_3ARGS
1831 # Kernel version 4.8 commit 8387ff2577eb9ed245df9a39947f66976c6bcd02
1832 # vfs: make the string hashes salt the hash
1834 AC_DEFUN([LC_FULL_NAME_HASH_3ARGS], [
1835 LB_CHECK_COMPILE([if 'full_name_hash' taken 3 arguments],
1836 full_name_hash_3args, [
1837 #include <linux/stringhash.h>
1840 hash = full_name_hash(NULL,NULL,0);
1842 AC_DEFINE(HAVE_FULL_NAME_HASH_3ARGS, 1,
1843 [full_name_hash need 3 arguments])
1845 ]) # LC_FULL_NAME_HASH_3ARGS
1848 # LC_STRUCT_POSIX_ACL_XATTR
1850 # Kernel version 4.8 commit 2211d5ba5c6c4e972ba6dbc912b2897425ea6621
1851 # posix_acl: xattr representation cleanups
1853 AC_DEFUN([LC_STRUCT_POSIX_ACL_XATTR], [
1854 LB_CHECK_COMPILE([if 'struct posix_acl_xattr_{header,entry}' defined],
1855 struct_posix_acl_xattr, [
1856 #include <linux/fs.h>
1857 #include <linux/posix_acl_xattr.h>
1859 struct posix_acl_xattr_header *h = NULL;
1860 struct posix_acl_xattr_entry *e;
1861 e = (void *)(h + 1);
1863 AC_DEFINE(HAVE_STRUCT_POSIX_ACL_XATTR, 1,
1864 [struct posix_acl_xattr_{header,entry} defined])
1866 ]) # LC_STRUCT_POSIX_ACL_XATTR
1871 # Kernel version 4.8 commit fd50ecaddf8372a1d96e0daeaac0f93cf04e4d42
1872 # removed {get,set,remove}xattr inode operations
1874 AC_DEFUN([LC_IOP_XATTR], [
1875 LB_CHECK_COMPILE([if 'inode_operations' has {get,set,remove}xattr members],
1877 #include <linux/fs.h>
1879 struct inode_operations iop;
1880 iop.setxattr = NULL;
1881 iop.getxattr = NULL;
1882 iop.removexattr = NULL;
1884 AC_DEFINE(HAVE_IOP_XATTR, 1,
1885 [inode_operations has {get,set,remove}xattr members])
1892 # Kernel version 4.9 commit 81243eacfa400f5f7b89f4c2323d0de9982bb0fb
1893 # cred: simpler, 1D supplementary groups
1895 AC_DEFUN([LC_GROUP_INFO_GID], [
1896 LB_CHECK_COMPILE([if 'struct group_info' has member 'gid'],
1898 #include <linux/cred.h>
1901 p = ((struct group_info *)0)->gid;
1903 AC_DEFINE(HAVE_GROUP_INFO_GID, 1,
1904 [struct group_info has member gid])
1906 ]) # LC_GROUP_INFO_GID
1911 # Kernel version 4.9 commit 5d6c31910bc0713e37628dc0ce677dcb13c8ccf4
1912 # added __vfs_{get,set,remove}xattr helpers
1914 AC_DEFUN([LC_VFS_SETXATTR], [
1915 LB_CHECK_COMPILE([if '__vfs_setxattr' helper is available],
1917 #include <linux/xattr.h>
1919 __vfs_setxattr(NULL, NULL, NULL, NULL, 0, 0);
1921 AC_DEFINE(HAVE_VFS_SETXATTR, 1,
1922 ['__vfs_setxattr' is available])
1924 ]) # LC_VFS_SETXATTR
1927 # LC_POSIX_ACL_UPDATE_MODE
1929 # Kernel version 4.9 commit 073931017b49d9458aa351605b43a7e34598caef
1930 # posix_acl: Clear SGID bit when setting file permissions
1932 AC_DEFUN([LC_POSIX_ACL_UPDATE_MODE], [
1933 LB_CHECK_COMPILE([if 'posix_acl_update_mode' exists],
1934 posix_acl_update_mode, [
1935 #include <linux/fs.h>
1936 #include <linux/posix_acl.h>
1938 posix_acl_update_mode(NULL, NULL, NULL);
1940 AC_DEFINE(HAVE_POSIX_ACL_UPDATE_MODE, 1,
1941 ['posix_acl_update_mode' is available])
1943 ]) # LC_POSIX_ACL_UPDATE_MODE
1946 # LC_HAVE_BDI_IO_PAGES
1948 # Kernel version 4.9 commit 9491ae4aade6814afcfa67f4eb3e3342c2b39750
1949 # mm: don't cap request size based on read-ahead setting
1950 # This patch introduces a bdi hint, io_pages.
1952 AC_DEFUN([LC_HAVE_BDI_IO_PAGES], [
1953 LB_CHECK_COMPILE([if 'struct backing_dev_info' has 'io_pages' field],
1955 #include <linux/backing-dev.h>
1957 struct backing_dev_info info;
1961 AC_DEFINE(HAVE_BDI_IO_PAGES, 1,
1962 [backing_dev_info has io_pages])
1964 ]) # LC_HAVE_BDI_IO_PAGES
1967 # LC_IOP_GENERIC_READLINK
1969 # Kernel version 4.10 commit dfeef68862edd7d4bafe68ef7aeb5f658ef24bb5
1970 # removed generic_readlink from individual file systems
1972 AC_DEFUN([LC_IOP_GENERIC_READLINK], [
1973 LB_CHECK_COMPILE([if 'generic_readlink' still exist],
1974 inode_ops_readlink, [
1975 #include <linux/fs.h>
1977 struct inode_operations iop;
1978 iop.readlink = generic_readlink;
1980 AC_DEFINE(HAVE_IOP_GENERIC_READLINK, 1,
1981 [generic_readlink has been removed])
1983 ]) # LC_IOP_GENERIC_READLINK
1986 # LC_HAVE_VM_FAULT_ADDRESS
1988 # Kernel version 4.10 commit 1a29d85eb0f19b7d8271923d8917d7b4f5540b3e
1989 # removed virtual_address field. Need to use address field instead
1991 AC_DEFUN([LC_HAVE_VM_FAULT_ADDRESS], [
1992 LB_CHECK_COMPILE([if 'struct vm_fault' replaced virtual_address with address field],
1994 #include <linux/mm.h>
1996 unsigned long vaddr = ((struct vm_fault *)0)->address;
1999 AC_DEFINE(HAVE_VM_FAULT_ADDRESS, 1,
2000 [virtual_address has been replaced by address field])
2002 ]) # LC_HAVE_VM_FAULT_ADDRESS
2005 # LC_INODEOPS_ENHANCED_GETATTR
2007 # Kernel version 4.11 commit a528d35e8bfcc521d7cb70aaf03e1bd296c8493f
2008 # expanded getattr to be able to get more stat information.
2010 AC_DEFUN([LC_INODEOPS_ENHANCED_GETATTR], [
2011 LB_CHECK_COMPILE([if 'inode_operations' getattr member can gather advance stats],
2013 #include <linux/fs.h>
2017 ((struct inode_operations *)1)->getattr(&path, NULL, 0, 0);
2019 AC_DEFINE(HAVE_INODEOPS_ENHANCED_GETATTR, 1,
2020 [inode_operations .getattr member function can gather advance stats])
2022 ]) # LC_INODEOPS_ENHANCED_GETATTR
2025 # LC_VM_OPERATIONS_REMOVE_VMF_ARG
2027 # Kernel version 4.11 commit 11bac80004499ea59f361ef2a5516c84b6eab675
2028 # removed struct vm_area_struct as an argument for vm_operations since
2029 # in the same kernel version struct vma_area_struct was folded into
2032 AC_DEFUN([LC_VM_OPERATIONS_REMOVE_VMF_ARG], [
2033 LB_CHECK_COMPILE([if 'struct vm_operations' removed struct vm_area_struct],
2034 vm_operations_no_vm_area_struct, [
2035 #include <linux/mm.h>
2037 struct vm_fault vmf;
2039 ((struct vm_operations_struct *)0)->fault(&vmf);
2040 ((struct vm_operations_struct *)0)->page_mkwrite(&vmf);
2042 AC_DEFINE(HAVE_VM_OPS_USE_VM_FAULT_ONLY, 1,
2043 ['struct vm_operations' remove struct vm_area_struct argument])
2045 ]) # LC_VM_OPERATIONS_REMOVE_VMF_ARG
2048 # LC_HAVE_KEY_USAGE_REFCOUNT
2050 # Kernel version 4.11 commit fff292914d3a2f1efd05ca71c2ba72a3c663201e
2051 # converted key.usage from atomic_t to refcount_t.
2053 AC_DEFUN([LC_HAVE_KEY_USAGE_REFCOUNT], [
2054 LB_CHECK_COMPILE([if 'key.usage' is refcount_t],
2055 key_usage_refcount, [
2056 #include <linux/key.h>
2058 struct key key = { };
2060 refcount_read(&key.usage);
2062 AC_DEFINE(HAVE_KEY_USAGE_REFCOUNT, 1, [key.usage is of type refcount_t])
2064 ]) #LC_HAVE_KEY_USAGE_REFCOUNT
2067 # LC_HAVE_CRYPTO_MAX_ALG_NAME_128
2069 # Kernel version 4.11 commit f437a3f477cce402dbec6537b29e9e33962c9f73
2070 # switched CRYPTO_MAX_ALG_NAME from 64 to 128.
2072 AC_DEFUN([LC_HAVE_CRYPTO_MAX_ALG_NAME_128], [
2073 LB_CHECK_COMPILE([if 'CRYPTO_MAX_ALG_NAME' is 128],
2074 crypto_max_alg_name, [
2075 #include <linux/crypto.h>
2077 #if CRYPTO_MAX_ALG_NAME != 128
2081 AC_DEFINE(HAVE_CRYPTO_MAX_ALG_NAME_128, 1,
2082 ['CRYPTO_MAX_ALG_NAME' is 128])
2084 ]) # LC_HAVE_CRYPTO_MAX_ALG_NAME_128
2087 # Kernel version 4.12 commit 47f38c539e9a42344ff5a664942075bd4df93876
2088 # CURRENT_TIME is not 64 bit time safe so it was replaced with
2091 AC_DEFUN([LC_CURRENT_TIME], [
2092 LB_CHECK_COMPILE([if CURRENT_TIME has been replaced with current_time],
2094 #include <linux/fs.h>
2098 attr.ia_atime = current_time(NULL);
2100 AC_DEFINE(HAVE_CURRENT_TIME, 1,
2101 [current_time() has replaced CURRENT_TIME])
2103 ]) # LIBCFS_CURRENT_TIME
2106 # LC_HAVE_GET_INODE_USAGE
2108 # Kernel version v4.12-rc2-43-g7a9ca53aea10
2110 AC_DEFUN([LC_HAVE_GET_INODE_USAGE], [
2111 LB_CHECK_COMPILE([if get_inode_usage exists],
2114 #include <linux/quota.h>
2116 struct dquot_operations ops = { };
2118 ops.get_inode_usage(NULL, NULL);
2120 AC_DEFINE(HAVE_GET_INODE_USAGE, 1,
2121 [get_inode_usage function exists])
2123 ]) # LC_HAVE_GET_INODE_USAGE
2127 # Kernel version 4.12-rc3 85787090a21eb749d8b347eaf9ff1a455637473c
2128 # changed struct super_block s_uuid into a proper uuid_t
2130 AC_DEFUN([LC_SUPER_BLOCK_S_UUID], [
2131 LB_CHECK_COMPILE([if 'struct super_block' s_uuid is uuid_t],
2132 super_block_s_uuid, [
2133 #include <linux/fs.h>
2135 struct super_block sb;
2137 uuid_parse(NULL, &sb.s_uuid);
2139 AC_DEFINE(HAVE_S_UUID_AS_UUID_T, 1, ['s_uuid' is an uuid_t])
2141 ]) # LC_SUPER_BLOCK_S_UUID
2144 # LC_SUPER_SETUP_BDI_NAME
2146 # Kernel version 4.12 commit 9594caf216dc0fe3e318b34af0127276db661241
2147 # unified bdi handling
2149 AC_DEFUN([LC_SUPER_SETUP_BDI_NAME], [
2150 LB_CHECK_COMPILE([if 'super_setup_bdi_name' exist],
2151 super_setup_bdi_name, [
2152 #include <linux/fs.h>
2154 super_setup_bdi_name(NULL, "lustre");
2156 AC_DEFINE(HAVE_SUPER_SETUP_BDI_NAME, 1,
2157 ['super_setup_bdi_name' is available])
2159 ]) # LC_SUPER_SETUP_BDI_NAME
2164 # 4.12 replace bi_error to bi_status
2166 AC_DEFUN([LC_BI_STATUS], [
2167 LB_CHECK_COMPILE([if 'bi_status' exist],
2169 #include <linux/blk_types.h>
2171 ((struct bio *)0)->bi_status = 0;
2173 AC_DEFINE(HAVE_BI_STATUS, 1,
2174 ['bi_status' is available])
2179 # LC_BIO_INTEGRITY_ENABLED
2181 # 4.13 removed bio_integrity_enabled
2183 AC_DEFUN([LC_BIO_INTEGRITY_ENABLED], [
2184 LB_CHECK_COMPILE([if 'bio_integrity_enabled' exist],
2185 bio_integrity_enabled, [
2186 #include <linux/bio.h>
2188 bio_integrity_enabled(NULL);
2190 AC_DEFINE(HAVE_BIO_INTEGRITY_ENABLED, 1,
2191 ['bio_integrity_enabled' is available])
2193 ]) # LC_BIO_INTEGRITY_ENABLED
2196 # LC_PAGEVEC_INIT_ONE_PARAM
2198 # 4.14 pagevec_init takes one parameter
2200 AC_DEFUN([LC_PAGEVEC_INIT_ONE_PARAM], [
2201 LB_CHECK_COMPILE([if 'pagevec_init' takes one parameter],
2203 #include <linux/pagevec.h>
2207 AC_DEFINE(HAVE_PAGEVEC_INIT_ONE_PARAM, 1,
2208 ['pagevec_init' takes one parameter])
2210 ]) # LC_PAGEVEC_INIT_ONE_PARAM
2215 # 4.14 replaced bi_bdev to bi_disk
2217 AC_DEFUN([LC_BI_BDEV], [
2218 LB_CHECK_COMPILE([if 'bi_bdev' exist],
2220 #include <linux/bio.h>
2222 ((struct bio *)0)->bi_bdev = NULL;
2224 AC_DEFINE(HAVE_BI_BDEV, 1,
2225 ['bi_bdev' is available])
2230 # LC_INTERVAL_TREE_CACHED
2232 # 4.14 f808c13fd3738948e10196496959871130612b61
2233 # switched INTERVAL_TREE_DEFINE to use cached RB_Trees.
2235 AC_DEFUN([LC_INTERVAL_TREE_CACHED], [
2236 tmp_flags="$EXTRA_KCFLAGS"
2237 EXTRA_KCFLAGS="-Werror"
2238 LB_CHECK_COMPILE([if interval_trees use rb_tree_cached],
2240 #include <linux/interval_tree_generic.h>
2241 struct foo { struct rb_node rb; int last; int a,b;};
2242 #define START(n) ((n)->a)
2243 #define LAST(n) ((n)->b)
2244 struct rb_root_cached tree;
2245 INTERVAL_TREE_DEFINE(struct foo, rb, int, last,
2246 START, LAST, , foo);
2248 foo_insert(NULL, &tree);
2250 AC_DEFINE(HAVE_INTERVAL_TREE_CACHED, 1,
2251 [interval trees use rb_tree_cached])
2253 EXTRA_KCFLAGS="$tmp_flags"
2254 ]) # LC_INTERVAL_TREE_CACHED
2259 # 4.14 introduced IS_ENCRYPTED and S_ENCRYPTED
2261 AC_DEFUN([LC_IS_ENCRYPTED], [
2262 LB_CHECK_COMPILE([if IS_ENCRYPTED is defined],
2264 #include <linux/fs.h>
2266 IS_ENCRYPTED((struct inode *)0);
2268 has_is_encrypted="yes"
2270 ]) # LC_IS_ENCRYPTED
2275 # kernel 4.17 commit b93b016313b3ba8003c3b8bb71f569af91f19fc7
2277 AC_DEFUN([LC_I_PAGES], [
2278 LB_CHECK_COMPILE([if struct address_space has i_pages],
2280 #include <linux/fs.h>
2282 struct address_space mapping = {};
2285 i_pages = &mapping.i_pages;
2287 AC_DEFINE(HAVE_I_PAGES, 1,
2288 [struct address_space has i_pages])
2295 # kernel 4.17 commit 3d3539018d2cbd12e5af4a132636ee7fd8d43ef0
2296 # mm: create the new vm_fault_t type
2298 AC_DEFUN([LC_VM_FAULT_T], [
2299 LB_CHECK_COMPILE([if vm_fault_t type exists],
2301 #include <linux/mm_types.h>
2303 vm_fault_t x = VM_FAULT_SIGBUS;
2306 AC_DEFINE(HAVE_VM_FAULT_T, 1,
2307 [if vm_fault_t type exists])
2314 # kernel 4.17 commit 3d3539018d2cbd12e5af4a132636ee7fd8d43ef0
2315 # mm: VM_FAULT_RETRY is defined in enum vm_fault_reason
2317 AC_DEFUN([LC_VM_FAULT_RETRY], [
2318 LB_CHECK_COMPILE([if VM_FAULT_RETRY is defined],
2320 #include <linux/mm.h>
2322 #ifndef VM_FAULT_RETRY
2327 AC_DEFINE(HAVE_VM_FAULT_RETRY, 1,
2328 [if VM_FAULT_RETRY is defined])
2330 ]) # LC_VM_FAULT_RETRY
2333 # LC_ALLOC_FILE_PSEUDO
2335 # kernel 4.18-rc1 commit d93aa9d82aea80b80f225dbf9c7986df444d8106
2336 # new wrapper: alloc_file_pseudo()
2338 AC_DEFUN([LC_ALLOC_FILE_PSEUDO], [
2339 LB_CHECK_COMPILE([if 'alloc_file_pseudo' is defined],
2340 alloc_file_pseudo, [
2341 #include <linux/file.h>
2344 file = alloc_file_pseudo(NULL, NULL, "[test]",
2347 AC_DEFINE(HAVE_ALLOC_FILE_PSEUDO, 1,
2348 ['alloc_file_pseudo' exist])
2350 ]) # LC_ALLOC_FILE_PSEUDO
2353 # LC_INODE_TIMESPEC64
2355 # kernel 4.17-rc7 commit 8efd6894ff089adeeac7cb9f32125b85d963d1bc
2356 # fs: add timespec64_truncate()
2357 # kernel 4.18 commit 95582b00838837fc07e042979320caf917ce3fe6
2358 # inode timestamps switched to timespec64
2359 # kernel 4.19-rc2 commit 976516404ff3fab2a8caa8bd6f5efc1437fed0b8
2360 # y2038: remove unused time interfaces
2364 # When inode times are timespec64 stop using the deprecated
2367 # kernel v5.5-rc1-6-gba70609d5ec6 ba70609d5ec664a8f36ba1c857fcd97a478adf79
2368 # fs: Delete timespec64_trunc()
2370 AC_DEFUN([LC_INODE_TIMESPEC64], [
2371 tmp_flags="$EXTRA_KCFLAGS"
2372 EXTRA_KCFLAGS="-Werror"
2373 LB_CHECK_COMPILE([if inode timestamps are struct timespec64],
2375 #include <linux/fs.h>
2377 struct inode *inode = NULL;
2378 struct timespec64 ts = {0, 1};
2380 inode->i_atime = ts;
2383 AC_DEFINE(HAVE_INODE_TIMESPEC64, 1,
2384 [inode times are using timespec64])
2386 EXTRA_KCFLAGS="$tmp_flags"
2387 ]) # LC_INODE_TIMESPEC64
2390 # LC_RADIX_TREE_TAG_SET
2392 # kernel 4.20 commit v4.19-rc5-248-g9b89a0355144
2393 # xarray: Add XArray marks - replaced radix_tree_tag_set
2395 AC_DEFUN([LC_RADIX_TREE_TAG_SET], [
2396 tmp_flags="$EXTRA_KCFLAGS"
2397 EXTRA_KCFLAGS="-Werror"
2398 LB_CHECK_COMPILE([if 'radix_tree_tag_set' exists],
2399 radix_tree_tag_set, [
2400 #include <linux/fs.h>
2401 #include <linux/radix-tree.h>
2403 radix_tree_tag_set(NULL, 0, PAGECACHE_TAG_DIRTY);
2405 AC_DEFINE(HAVE_RADIX_TREE_TAG_SET, 1,
2406 [radix_tree_tag_set exists])
2408 EXTRA_KCFLAGS="$tmp_flags"
2409 ]) # LC_RADIX_TREE_TAG_SET
2412 # LC_UAPI_LINUX_MOUNT_H
2414 # kernel 4.20 commit e262e32d6bde0f77fb0c95d977482fc872c51996
2415 # vfs: Suppress MS_* flag defs within the kernel ...
2417 AC_DEFUN([LC_UAPI_LINUX_MOUNT_H], [
2418 tmp_flags="$EXTRA_KCFLAGS"
2419 EXTRA_KCFLAGS="-Werror"
2420 LB_CHECK_COMPILE([if MS_RDONLY was moved to uapi/linux/mount.h],
2422 #include <uapi/linux/mount.h>
2427 AC_DEFINE(HAVE_UAPI_LINUX_MOUNT_H, 1,
2428 [if MS_RDONLY was moved to uapi/linux/mount.h])
2430 EXTRA_KCFLAGS="$tmp_flags"
2431 ]) # LC_UAPI_LINUX_MOUNT_H
2434 # LC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK
2436 # kernel 4.20 commit 1863d77f15da0addcd293a1719fa5d3ef8cde3ca
2437 # SUNRPC: Replace the cache_detail->hash_lock with a regular spinlock
2439 # Now that the reader functions are all RCU protected, use a regular
2440 # spinlock rather than a reader/writer lock.
2442 AC_DEFUN([LC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK], [
2443 tmp_flags="$EXTRA_KCFLAGS"
2444 EXTRA_KCFLAGS="-Werror"
2445 LB_CHECK_COMPILE([if cache_detail->hash_lock is a spinlock],
2446 hash_lock_isa_spinlock_t, [
2447 #include <linux/sunrpc/cache.h>
2449 spinlock_t *lock = &(((struct cache_detail *)0)->hash_lock);
2452 AC_DEFINE(HAVE_CACHE_HASH_SPINLOCK, 1,
2453 [if cache_detail->hash_lock is a spinlock])
2455 EXTRA_KCFLAGS="$tmp_flags"
2456 ]) # LC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK
2459 # LC_HAS_LINUX_SELINUX_ENABLED
2461 # kernel 5.1 commit 3d252529480c68bfd6a6774652df7c8968b28e41
2462 # SELinux: Remove unused selinux_is_enabled
2464 AC_DEFUN([LC_HAS_LINUX_SELINUX_ENABLED], [
2465 tmp_flags="$EXTRA_KCFLAGS"
2466 EXTRA_KCFLAGS="-Werror"
2467 LB_CHECK_COMPILE([if linux/selinux.h exists],
2468 selinux_is_enabled, [
2469 #include <linux/selinux.h>
2471 bool has_selinux = selinux_is_enabled();
2474 AC_DEFINE(HAVE_LINUX_SELINUX_IS_ENABLED, 1,
2475 [if linux/selinux.h exists])
2477 EXTRA_KCFLAGS="$tmp_flags"
2478 ]) # LC_HAS_LINUX_SELINUX_ENABLED
2481 # LB_HAVE_BVEC_ITER_ALL
2483 # kernel 5.1 commit 6dc4f100c175dd0511ae8674786e7c9006cdfbfa
2484 # block: allow bio_for_each_segment_all() to iterate over multi-page bvec
2486 AC_DEFUN([LB_HAVE_BVEC_ITER_ALL], [
2487 tmp_flags="$EXTRA_KCFLAGS"
2488 EXTRA_KCFLAGS="-Werror"
2489 LB_CHECK_COMPILE([if bvec_iter_all exists for multi-page bvec iternation],
2491 #include <linux/bvec.h>
2493 struct bvec_iter_all iter;
2496 AC_DEFINE(HAVE_BVEC_ITER_ALL, 1,
2497 [if bvec_iter_all exists for multi-page bvec iternation])
2499 EXTRA_KCFLAGS="$tmp_flags"
2500 ]) # LB_HAVE_BVEC_ITER_ALL
2503 # LC_ACCOUNT_PAGE_DIRTIED
2505 # After 5.2 kernel page dirtied is not exported
2507 AC_DEFUN([LC_ACCOUNT_PAGE_DIRTIED], [
2508 LB_CHECK_EXPORT([account_page_dirtied], [mm/page-writeback.c],
2509 [AC_DEFINE(HAVE_ACCOUNT_PAGE_DIRTIED_EXPORT, 1,
2510 [account_page_dirtied is exported])])
2511 ]) # LC_ACCOUNT_PAGE_DIRTIED
2514 # LC_KEYRING_SEARCH_4ARGS
2516 # Kernel 5.2 commit dcf49dbc8077
2517 # keys: Add a 'recurse' flag for keyring searches
2519 AC_DEFUN([LC_KEYRING_SEARCH_4ARGS], [
2520 LB_CHECK_COMPILE([if 'keyring_search' has 4 args],
2521 keyring_search_4args, [
2522 #include <linux/key.h>
2525 keyring_search(keyring, NULL, NULL, false);
2527 AC_DEFINE(HAVE_KEYRING_SEARCH_4ARGS, 1,
2528 [keyring_search has 4 args])
2530 ]) # LC_KEYRING_SEARCH_4ARGS
2533 # LC_BIO_BI_PHYS_SEGMENTS
2535 # kernel 5.3-rc1 commit 14ccb66b3f585b2bc21e7256c96090abed5a512c
2536 # block: remove the bi_phys_segments field in struct bio
2538 AC_DEFUN([LC_BIO_BI_PHYS_SEGMENTS], [
2539 tmp_flags="$EXTRA_KCFLAGS"
2540 EXTRA_KCFLAGS="-Werror"
2541 LB_CHECK_COMPILE([if struct bio has bi_phys_segments member],
2542 bye_bio_bi_phys_segments, [
2543 #include <linux/bio.h>
2545 struct bio *bio = NULL;
2546 bio->bi_phys_segments++;
2548 AC_DEFINE(HAVE_BIO_BI_PHYS_SEGMENTS, 1,
2549 [struct bio has bi_phys_segments member])
2551 EXTRA_KCFLAGS="$tmp_flags"
2552 ]) # LC_BIO_BI_PHYS_SEGMENTS
2555 # LC_LM_COMPARE_OWNER_EXISTS
2557 # kernel 5.3-rc3 commit f85d93385e9fe6886a751f647f6812a89bf6bee3
2558 # locks: Cleanup lm_compare_owner and lm_owner_key
2559 # removed lm_compare_owner
2561 AC_DEFUN([LC_LM_COMPARE_OWNER_EXISTS], [
2562 tmp_flags="$EXTRA_KCFLAGS"
2563 EXTRA_KCFLAGS="-Werror"
2564 LB_CHECK_COMPILE([if lock_manager_operations has lm_compare_owner],
2565 lock_manager_ops_lm_compare_owner, [
2566 #include <linux/fs.h>
2568 struct lock_manager_operations lm_ops;
2569 lm_ops.lm_compare_owner = NULL;
2571 AC_DEFINE(HAVE_LM_COMPARE_OWNER, 1,
2572 [lock_manager_operations has lm_compare_owner])
2574 EXTRA_KCFLAGS="$tmp_flags"
2575 ]) # LC_LM_COMPARE_OWNER_EXISTS
2578 # LC_FSCRYPT_SUPPORT
2580 # 5.4 introduced fscrypt encryption policies v2
2582 AC_DEFUN([LC_FSCRYPT_SUPPORT], [
2583 LB_CHECK_COMPILE([for fscrypt in-kernel support],
2585 #define __FS_HAS_ENCRYPTION 0
2586 #include <linux/fscrypt.h>
2588 fscrypt_ioctl_get_policy_ex(NULL, NULL);
2590 has_fscrypt_support="yes"
2592 ]) # LC_FSCRYPT_SUPPORT
2595 # LC_FSCRYPT_DIGESTED_NAME
2597 # Kernel 5.5-rc4 edc440e3d27fb31e6f9663cf413fad97d714c060
2598 # improved the format of no-key names. This results in the
2599 # removal of FSCRYPT_FNAME_DIGEST and FSCRYPT_FNAME_DIGEST_SIZE.
2601 AC_DEFUN([LC_FSCRYPT_DIGESTED_NAME], [
2602 tmp_flags="$EXTRA_KCFLAGS"
2603 EXTRA_KCFLAGS="-Werror"
2604 LB_CHECK_COMPILE([if fscrypt has 'struct fscrypt_digested_name'],
2605 fscrypt_digested_name, [
2606 #include <linux/fscrypt.h>
2608 struct fscrypt_digested_name fname;
2612 AC_DEFINE(HAVE_FSCRYPT_DIGESTED_NAME, 1,
2613 ['struct fscrypt_digested_name' exists])
2615 EXTRA_KCFLAGS="$tmp_flags"
2616 ]) # LC_FSCRYPT_DIGESTED_NAME
2619 # LC_FSCRYPT_DUMMY_CONTEXT_ENABLED
2621 # Kernel 5.7-rc7 ed318a6cc0b620440e65f48eb527dc3df7269ce4
2622 # replaces fscrypt_dummy_context_enabled() with
2623 # fscrypt_get_dummy_context(). Later kernels rename
2624 # fscrypt_get_dummy_context() to fscrypt_get_dummy_policy()
2625 # which is why we test fscrypt_dummy_context_enabled().
2627 AC_DEFUN([LC_FSCRYPT_DUMMY_CONTEXT_ENABLED], [
2628 tmp_flags="$EXTRA_KCFLAGS"
2629 EXTRA_KCFLAGS="-Werror"
2630 LB_CHECK_COMPILE([if fscrypt_dummy_context_enabled() exists],
2631 fscrypt_dummy_context_enabled, [
2632 #include <linux/fscrypt.h>
2634 fscrypt_dummy_context_enabled(NULL);
2636 AC_DEFINE(HAVE_FSCRYPT_DUMMY_CONTEXT_ENABLED, 1,
2637 [fscrypt_dummy_context_enabled() exists])
2639 EXTRA_KCFLAGS="$tmp_flags"
2640 ]) # LC_FSCRYPT_DUMMY_CONTEXT_ENABLED
2643 # LC_HAVE_ITER_FILE_SPLICE_WRITE
2645 # Linux commit v5.9-rc1-6-g36e2c7421f02
2646 # fs: don't allow splice read/write without explicit ops
2648 AC_DEFUN([LC_HAVE_ITER_FILE_SPLICE_WRITE], [
2649 tmp_flags="$EXTRA_KCFLAGS"
2650 EXTRA_KCFLAGS="-Werror"
2651 LB_CHECK_COMPILE([if 'iter_file_splice_write' exists],
2652 iter_file_splice_write, [
2653 #include <linux/fs.h>
2655 (void)iter_file_splice_write(NULL, NULL, NULL, 1, 0);
2657 AC_DEFINE(HAVE_ITER_FILE_SPLICE_WRITE, 1,
2658 ['iter_file_splice_write' exists])
2660 EXTRA_KCFLAGS="$tmp_flags"
2661 ]) # LC_HAVE_ITER_FILE_SPLICE_WRITE
2664 # LC_FSCRYPT_IS_NOKEY_NAME
2666 # Kernel 5.10-rc4 159e1de201b6fca10bfec50405a3b53a561096a8
2667 # introduced fscrypt_is_nokey_name() inline macro. While
2668 # introduced for 5.10 kernels it was backported to earlier
2669 # Ubuntu kernels. Also it hides the change introduced due
2670 # to git commit 501e43fbe for kernel 5.9 which also was
2671 # backported to earlier Ubuntu kernels.
2673 AC_DEFUN([LC_FSCRYPT_IS_NOKEY_NAME], [
2674 tmp_flags="$EXTRA_KCFLAGS"
2675 EXTRA_KCFLAGS="-Werror"
2676 LB_CHECK_COMPILE([if fscrypt_is_nokey_name() exists],
2677 fscrypt_is_no_key_name, [
2678 #include <linux/fscrypt.h>
2680 fscrypt_is_nokey_name(NULL);
2682 AC_DEFINE(HAVE_FSCRYPT_IS_NOKEY_NAME, 1,
2683 [fscrypt_is_nokey_name() exists])
2685 EXTRA_KCFLAGS="$tmp_flags"
2686 ]) # LC_FSCRYPT_IS_NOKEY_NAME
2689 # LC_HAVE_USER_NAMESPACE_ARG
2691 # kernel 5.12 commit 549c7297717c32ee53f156cd949e055e601f67bb
2692 # fs: make helpers idmap mount aware
2693 # Extend some inode methods with an additional user namespace argument.
2695 AC_DEFUN([LC_HAVE_USER_NAMESPACE_ARG], [
2696 tmp_flags="$EXTRA_KCFLAGS"
2697 EXTRA_KCFLAGS="-Werror"
2698 LB_CHECK_COMPILE([if 'inode_operations' members have user namespace argument],
2699 user_namespace_argument, [
2700 #include <linux/fs.h>
2702 ((struct inode_operations *)1)->getattr((struct user_namespace *)NULL,
2705 AC_DEFINE(HAVE_USER_NAMESPACE_ARG, 1,
2706 ['inode_operations' members have user namespace argument])
2708 EXTRA_KCFLAGS="$tmp_flags"
2709 ]) # LC_HAVE_USER_NAMESPACE_ARG
2712 # LC_HAVE_GET_ACL_RCU_ARG
2714 # kernel 5.15 commit 0cad6246621b5887d5b33fea84219d2a71f2f99a
2715 # vfs: add rcu argument to ->get_acl() callback
2716 # Add a rcu argument to the ->get_acl() callback to allow
2717 # get_cached_acl_rcu() to call the ->get_acl() method.
2719 AC_DEFUN([LC_HAVE_GET_ACL_RCU_ARG], [
2720 tmp_flags="$EXTRA_KCFLAGS"
2721 EXTRA_KCFLAGS="-Werror"
2722 LB_CHECK_COMPILE([if 'get_acl' has a rcu argument],
2723 get_acl_rcu_argument, [
2724 #include <linux/fs.h>
2726 ((struct inode_operations *)1)->get_acl((struct inode *)NULL, 0, false);
2728 AC_DEFINE(HAVE_GET_ACL_RCU_ARG, 1,
2729 ['get_acl' has a rcu argument])
2731 EXTRA_KCFLAGS="$tmp_flags"
2732 ]) # LC_HAVE_GET_ACL_RCU_ARG
2734 AC_DEFUN([LC_PROG_LINUX_SRC], [])
2735 AC_DEFUN([LC_PROG_LINUX_RESULTS], [])
2740 # Lustre linux kernel checks
2742 AC_DEFUN([LC_PROG_LINUX], [
2743 AC_MSG_NOTICE([Lustre kernel checks
2744 ==============================================================================])
2749 LC_CONFIG_HEALTH_CHECK_WRITE
2750 LC_CONFIG_LRU_RESIZE
2755 LC_HAVE_PROJECT_QUOTA
2762 LC_HAVE_DENTRY_D_U_D_ALIAS
2763 LC_HAVE_DENTRY_D_CHILD
2764 LC_PID_NS_FOR_CHILDREN
2767 LC_OLDSIZE_TRUNCATE_PAGECACHE
2768 LC_PTR_ERR_OR_ZERO_MISSING
2770 LC_REGISTER_SHRINKER_RET
2775 LC_HAVE_D_IS_POSITIVE
2779 LC_HAVE_TRUNCATE_IPAGES_FINAL
2780 LC_IOPS_RENAME_WITH_FLAGS
2787 LC_DIRECTIO_USE_ITER
2788 LC_HAVE_IOV_ITER_INIT_DIRECTION
2789 LC_HAVE_IOV_ITER_TRUNCATE
2790 LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER
2793 LC_HAVE_INTERVAL_BLK_INTEGRITY
2797 LC_PERCPU_COUNTER_INIT
2798 LC_NFS_FILLDIR_USE_CTX
2802 LC_HAVE_DQUOT_QC_DQBLK
2803 LC_HAVE_AIO_COMPLETE
2804 LC_HAVE_IS_ROOT_INODE
2807 LC_BACKING_DEV_INFO_REMOVAL
2808 LC_HAVE_BDI_CAP_MAP_COPY
2812 LC_HAVE_SYNC_READ_WRITE
2816 LC_BIO_ENDIO_USES_ONE_ARG
2817 LC_SYMLINK_OPS_USE_NAMEIDATA
2818 LC_ACCOUNT_PAGE_DIRTIED_3ARGS
2819 LC_HAVE_CRYPTO_ALLOC_SKCIPHER
2822 LC_HAVE_INTERVAL_EXP_BLK_INTEGRITY
2823 LC_HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD
2824 LC_HAVE_CACHE_HEAD_HLIST
2825 LC_HAVE_XATTR_HANDLER_SIMPLIFIED
2828 LC_HAVE_LOCKS_LOCK_FILE_WAIT
2829 LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
2830 LC_HAVE_XATTR_HANDLER_NAME
2832 LC_HAVE_SUBMIT_BIO_2ARGS
2833 LC_HAVE_CLEAN_BDEV_ALIASES
2840 LC_HAVE_IOP_GET_LINK
2843 LC_HAVE_IN_COMPAT_SYSCALL
2844 LC_HAVE_XATTR_HANDLER_INODE_PARAM
2846 LC_HAVE_DOWN_WRITE_KILLABLE
2852 LC_GENERIC_WRITE_SYNC_2ARGS
2853 LC_FOP_ITERATE_SHARED
2856 LC_EXPORT_DEFAULT_FILE_SPLICE_READ
2857 LC_HAVE_POSIX_ACL_VALID_USER_NS
2859 LC_FULL_NAME_HASH_3ARGS
2860 LC_STRUCT_POSIX_ACL_XATTR
2866 LC_POSIX_ACL_UPDATE_MODE
2867 LC_HAVE_BDI_IO_PAGES
2870 LC_IOP_GENERIC_READLINK
2871 LC_HAVE_VM_FAULT_ADDRESS
2874 LC_INODEOPS_ENHANCED_GETATTR
2875 LC_VM_OPERATIONS_REMOVE_VMF_ARG
2876 LC_HAVE_KEY_USAGE_REFCOUNT
2877 LC_HAVE_CRYPTO_MAX_ALG_NAME_128
2881 LC_SUPER_BLOCK_S_UUID
2882 LC_SUPER_SETUP_BDI_NAME
2886 LC_BIO_INTEGRITY_ENABLED
2887 LC_BIO_INTEGRITY_PREP_FN_RETURNS_BOOL
2888 LC_HAVE_GET_INODE_USAGE
2891 LC_PAGEVEC_INIT_ONE_PARAM
2893 LC_INTERVAL_TREE_CACHED
2901 LC_ALLOC_FILE_PSEUDO
2905 LC_RADIX_TREE_TAG_SET
2906 LC_UAPI_LINUX_MOUNT_H
2907 LC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK
2910 LC_HAS_LINUX_SELINUX_ENABLED
2911 LB_HAVE_BVEC_ITER_ALL
2914 LC_ACCOUNT_PAGE_DIRTIED
2915 LC_KEYRING_SEARCH_4ARGS
2918 LC_BIO_BI_PHYS_SEGMENTS
2919 LC_LM_COMPARE_OWNER_EXISTS
2922 LC_FSCRYPT_DIGESTED_NAME
2925 LC_FSCRYPT_DUMMY_CONTEXT_ENABLED
2928 LC_FSCRYPT_IS_NOKEY_NAME
2931 LC_HAVE_ITER_FILE_SPLICE_WRITE
2934 LC_HAVE_USER_NAMESPACE_ARG
2937 LC_HAVE_GET_ACL_RCU_ARG
2939 # kernel patch to extend integrity interface
2940 LC_BIO_INTEGRITY_PREP_FN
2943 AS_IF([test "x$enable_server" != xno], [
2953 # Check whether to build the client side of Lustre
2955 AC_DEFUN([LC_CONFIG_CLIENT], [
2956 AC_MSG_CHECKING([whether to build Lustre client support])
2957 AC_ARG_ENABLE([client],
2958 AS_HELP_STRING([--disable-client],
2959 [disable Lustre client support]),
2960 [], [enable_client="yes"])
2961 AC_MSG_RESULT([$enable_client])
2962 ]) # LC_CONFIG_CLIENT
2967 AC_DEFUN([LB_CONFIG_MPITESTS], [
2968 AC_ARG_ENABLE([mpitests],
2969 AS_HELP_STRING([--enable-mpitests=<yes|no|mpicc wrapper>],
2970 [include mpi tests]), [
2971 enable_mpitests="yes"
2974 MPICC_WRAPPER="mpicc"
2975 MPI_BIN=$(eval which $MPICC_WRAPPER | xargs dirname)
2978 enable_mpitests="no"
2982 MPICC_WRAPPER=$enableval
2983 MPI_BIN=$(eval echo $MPICC_WRAPPER | xargs dirname)
2987 enable_mpitests="yes"
2988 MPICC_WRAPPER="mpicc"
2989 MPI_BIN=$(eval which $MPICC_WRAPPER | xargs dirname)
2992 if test "x$enable_mpitests" != "xno"; then
2995 AC_CACHE_CHECK([whether mpitests can be built],
2996 lb_cv_mpi_tests, [AC_COMPILE_IFELSE([AC_LANG_SOURCE([
3000 MPI_Initialized(&flag);
3003 ])], [lb_cv_mpi_tests="yes"], [lb_cv_mpi_tests="no"])
3005 enable_mpitests=$lb_cv_mpi_tests
3009 AC_SUBST(MPICC_WRAPPER)
3010 ]) # LB_CONFIG_MPITESTS
3015 # whether to enable quota support global control
3017 AC_DEFUN([LC_CONFIG_QUOTA], [
3018 AC_MSG_CHECKING([whether to enable quota support global control])
3019 AC_ARG_ENABLE([quota],
3020 AS_HELP_STRING([--enable-quota],
3021 [enable quota support]),
3022 [], [enable_quota="yes"])
3023 AS_IF([test "x$enable_quota" = xyes],
3024 [AC_MSG_RESULT([yes])],
3025 [AC_MSG_RESULT([no])])
3026 ]) # LC_CONFIG_QUOTA
3031 AC_DEFUN([LC_QUOTA], [
3035 AS_IF([test "x$enable_quota" != xno -a "x$enable_utils" != xno], [
3036 AC_CHECK_HEADER([sys/quota.h],
3037 [AC_DEFINE(HAVE_SYS_QUOTA_H, 1,
3038 [Define to 1 if you have <sys/quota.h>.])],
3039 [AC_MSG_ERROR([don't find <sys/quota.h> in your system])])
3046 # configure support for optional OSD implementation
3048 AC_DEFUN([LC_OSD_ADDON], [
3049 AC_MSG_CHECKING([whether to use OSD addon])
3051 AS_HELP_STRING([--with-osd=path],
3052 [set path to optional osd]),
3059 OSDADDON="$with_osd"
3066 AS_IF([test $ENABLEOSDADDON -eq 0], [
3070 OSDMODNAME=$(basename $OSDADDON)
3071 AS_IF([test -e $LUSTRE/$OSDMODNAME], [
3072 AC_MSG_RESULT([can't link])
3074 ], [ln -s $OSDADDON $LUSTRE/$OSDMODNAME], [
3075 AC_MSG_RESULT([$OSDMODNAME])
3076 OSDADDON="obj-m += $OSDMODNAME/"
3078 AC_MSG_RESULT([can't link])
3088 # Check whether to enable Lustre client crypto
3090 AC_DEFUN([LC_CONFIG_CRYPTO], [
3091 AC_MSG_CHECKING([whether to enable Lustre client crypto])
3092 AC_ARG_ENABLE([crypto],
3093 AS_HELP_STRING([--enable-crypto=yes|no|in-kernel],
3094 [enable Lustre client crypto (default is yes), use 'in-kernel' to force use of in-kernel fscrypt instead of embedded llcrypt]),
3095 [], [enable_crypto="auto"])
3096 AS_IF([test "x$enable_crypto" != xno -a "x$enable_dist" = xno], [
3100 LC_FSCRYPT_SUPPORT])
3101 AS_IF([test "x$enable_crypto" = xin-kernel], [
3102 AS_IF([test "x$has_fscrypt_support" = xyes], [
3103 AC_DEFINE(HAVE_LUSTRE_CRYPTO, 1, [Enable Lustre client crypto via in-kernel fscrypt])], [
3104 AC_MSG_ERROR([Lustre client crypto cannot be enabled via in-kernel fscrypt.])
3105 enable_crypto=no])],
3106 [AS_IF([test "x$has_is_encrypted" = xyes], [
3107 AC_DEFINE(HAVE_LUSTRE_CRYPTO, 1, [Enable Lustre client crypto via embedded llcrypt])
3108 AC_DEFINE(CONFIG_LL_ENCRYPTION, 1, [embedded llcrypt])
3109 AC_DEFINE(HAVE_FSCRYPT_DUMMY_CONTEXT_ENABLED, 1, [embedded llcrypt uses llcrypt_dummy_context_enabled()])
3110 enable_crypto="embedded llcrypt"
3111 enable_llcrypt=yes], [
3112 AS_IF([test "x$enable_crypto" = xyes],
3113 [AC_MSG_ERROR([Lustre client crypto cannot be enabled because of lack of encryption support in your kernel.])])
3114 AS_IF([test "x$enable_crypto" != xno -a "x$enable_dist" = xno],
3115 [AC_MSG_WARN(Lustre client crypto cannot be enabled because of lack of encryption support in your kernel.)])
3116 enable_crypto=no])])
3117 AS_IF([test "x$enable_dist" != xno], [
3119 enable_llcrypt=yes])
3120 AC_MSG_RESULT([$enable_crypto])
3121 ]) # LC_CONFIG_CRYPTO
3126 # other configure checks
3128 AC_DEFUN([LC_CONFIGURE], [
3129 AC_MSG_NOTICE([Lustre core checks
3130 ==============================================================================])
3132 AS_IF([test $target_cpu == "i686" -o $target_cpu == "x86_64"],
3133 [CFLAGS="$CFLAGS -Wall -Werror"])
3135 # maximum MDS thread count
3138 # lustre/utils/gss/gss_util.c
3139 # lustre/utils/gss/gssd_proc.c
3140 # lustre/utils/gss/krb5_util.c
3141 # lustre/utils/llog_reader.c
3142 # lustre/utils/create_iam.c
3143 # lustre/utils/libiam.c
3144 AC_CHECK_HEADERS([netdb.h endian.h])
3145 AC_CHECK_FUNCS([gethostbyname])
3147 # lustre/utils/llverfs.c lustre/utils/libmount_utils_ldiskfs.c
3148 AC_CHECK_HEADERS([ext2fs/ext2fs.h], [], [
3149 AS_IF([test "x$enable_utils" = xyes -a "x$enable_ldiskfs" = xyes], [
3151 ext2fs.h not found. Please install e2fsprogs development package.
3156 # lustre/tests/statx_test.c
3157 AC_CHECK_FUNCS([statx])
3159 # lustre/utils/lfs.c
3160 AS_IF([test "$enable_dist" = "no"], [
3161 AC_CHECK_LIB([z], [crc32], [
3162 AC_CHECK_HEADER([zlib.h], [], [
3163 AC_MSG_ERROR([zlib.h not found.])])
3166 zlib library not found. Please install zlib development package.])
3172 AC_CHECK_LIB([selinux], [is_selinux_enabled],
3173 [AC_CHECK_HEADERS([selinux/selinux.h],
3174 [SELINUX="-lselinux"
3175 AC_DEFINE([HAVE_SELINUX], 1,
3176 [support for selinux ])],
3179 No libselinux-devel package found, unable to build selinux enabled tools
3184 No selinux package found, unable to build selinux enabled tools
3189 AC_CHECK_LIB([keyutils], [add_key])
3192 AC_MSG_CHECKING([whether to report minimum OST free space])
3193 AC_ARG_ENABLE([mindf],
3194 AS_HELP_STRING([--enable-mindf],
3195 [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
3196 [], [enable_mindf="no"])
3197 AC_MSG_RESULT([$enable_mindf])
3198 AS_IF([test "$enable_mindf" = "yes"],
3199 [AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])])
3201 AC_MSG_CHECKING([whether to randomly failing memory alloc])
3202 AC_ARG_ENABLE([fail_alloc],
3203 AS_HELP_STRING([--disable-fail-alloc],
3204 [disable randomly alloc failure]),
3205 [], [enable_fail_alloc="yes"])
3206 AC_MSG_RESULT([$enable_fail_alloc])
3207 AS_IF([test "x$enable_fail_alloc" != xno],
3208 [AC_DEFINE([RANDOM_FAIL_ALLOC], 1,
3209 [enable randomly alloc failure])])
3211 AC_MSG_CHECKING([whether to check invariants (expensive cpu-wise)])
3212 AC_ARG_ENABLE([invariants],
3213 AS_HELP_STRING([--enable-invariants],
3214 [enable invariant checking (cpu intensive)]),
3215 [], [enable_invariants="no"])
3216 AC_MSG_RESULT([$enable_invariants])
3217 AS_IF([test "x$enable_invariants" = xyes],
3218 [AC_DEFINE([CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK], 1,
3219 [enable invariant checking])])
3221 AC_MSG_CHECKING([whether to track references with lu_ref])
3222 AC_ARG_ENABLE([lu_ref],
3223 AS_HELP_STRING([--enable-lu_ref],
3224 [enable lu_ref reference tracking code]),
3225 [], [enable_lu_ref="no"])
3226 AC_MSG_RESULT([$enable_lu_ref])
3227 AS_IF([test "x$enable_lu_ref" = xyes],
3228 [AC_DEFINE([CONFIG_LUSTRE_DEBUG_LU_REF], 1,
3229 [enable lu_ref reference tracking code])])
3231 AC_MSG_CHECKING([whether to enable page state tracking])
3232 AC_ARG_ENABLE([pgstate-track],
3233 AS_HELP_STRING([--enable-pgstate-track],
3234 [enable page state tracking]),
3235 [], [enable_pgstat_track="no"])
3236 AC_MSG_RESULT([$enable_pgstat_track])
3237 AS_IF([test "x$enable_pgstat_track" = xyes],
3238 [AC_DEFINE([CONFIG_DEBUG_PAGESTATE_TRACKING], 1,
3239 [enable page state tracking code])])
3242 AC_MSG_CHECKING([systemd unit file directory])
3243 AC_ARG_WITH([systemdsystemunitdir],
3244 [AS_HELP_STRING([--with-systemdsystemunitdir=DIR],
3245 [Directory for systemd service files])],
3246 [], [with_systemdsystemunitdir=auto])
3247 AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"],
3248 [def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
3249 AS_IF([test "x$def_systemdsystemunitdir" = "x"],
3250 [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
3251 [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
3252 with_systemdsystemunitdir=no],
3253 [with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
3254 AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
3255 [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
3256 AC_MSG_RESULT([$with_systemdsystemunitdir])
3258 AC_MSG_CHECKING([bash-completion directory])
3259 AC_ARG_WITH([bash-completion-dir],
3260 AS_HELP_STRING([--with-bash-completion-dir[=PATH]],
3261 [Install the bash auto-completion script in this directory.]),
3263 [with_bash_completion_dir=yes])
3264 AS_IF([test "x$with_bash_completion_dir" = "xyes"], [
3265 BASH_COMPLETION_DIR="`pkg-config --variable=completionsdir bash-completion`"
3266 AS_IF([test "x$BASH_COMPLETION_DIR" = "x"], [
3267 [BASH_COMPLETION_DIR="/usr/share/bash-completion/completions"]
3270 BASH_COMPLETION_DIR="$with_bash_completion_dir"
3272 AC_SUBST([BASH_COMPLETION_DIR])
3273 AC_MSG_RESULT([$BASH_COMPLETION_DIR])
3279 # AM_CONDITIONALS for lustre
3281 AC_DEFUN([LC_CONDITIONALS], [
3282 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
3283 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
3284 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
3285 AM_CONDITIONAL(SPLIT, test x$enable_split = xyes)
3286 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
3287 AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
3288 AM_CONDITIONAL(GSS_KEYRING, test x$enable_gss_keyring = xyes)
3289 AM_CONDITIONAL(GSS_PIPEFS, test x$enable_gss_pipefs = xyes)
3290 AM_CONDITIONAL(GSS_SSK, test x$enable_ssk = xyes)
3291 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
3292 AM_CONDITIONAL(HAVE_SYSTEMD, test "x$with_systemdsystemunitdir" != "xno")
3293 AM_CONDITIONAL(ENABLE_BASH_COMPLETION, test "x$with_bash_completion_dir" != "xno")
3294 AM_CONDITIONAL(XATTR_HANDLER, test "x$lb_cv_compile_xattr_handler_flags" = xyes)
3295 AM_CONDITIONAL(SELINUX, test "$SELINUX" = "-lselinux")
3296 AM_CONDITIONAL(GETSEPOL, test x$enable_getsepol = xyes)
3297 AM_CONDITIONAL(LLCRYPT, test x$enable_llcrypt = xyes)
3298 AM_CONDITIONAL(LIBAIO, test x$enable_libaio = xyes)
3299 ]) # LC_CONDITIONALS
3304 # files that should be generated with AC_OUTPUT
3306 AC_DEFUN([LC_CONFIG_FILES],
3310 lustre/autoconf/Makefile
3311 lustre/conf/Makefile
3312 lustre/conf/resource/Makefile
3313 lustre/contrib/Makefile
3315 lustre/include/Makefile
3316 lustre/include/lustre/Makefile
3317 lustre/include/uapi/linux/lustre/Makefile
3318 lustre/kernel_patches/targets/5.14-rhel9.0.target
3319 lustre/kernel_patches/targets/4.18-rhel8.6.target
3320 lustre/kernel_patches/targets/4.18-rhel8.5.target
3321 lustre/kernel_patches/targets/4.18-rhel8.4.target
3322 lustre/kernel_patches/targets/4.18-rhel8.3.target
3323 lustre/kernel_patches/targets/4.18-rhel8.2.target
3324 lustre/kernel_patches/targets/4.18-rhel8.1.target
3325 lustre/kernel_patches/targets/4.18-rhel8.target
3326 lustre/kernel_patches/targets/3.10-rhel7.9.target
3327 lustre/kernel_patches/targets/3.10-rhel7.8.target
3328 lustre/kernel_patches/targets/3.10-rhel7.7.target
3329 lustre/kernel_patches/targets/3.10-rhel7.6.target
3330 lustre/kernel_patches/targets/3.10-rhel7.5.target
3331 lustre/kernel_patches/targets/4.14-rhel7.5.target
3332 lustre/kernel_patches/targets/4.14-rhel7.6.target
3333 lustre/kernel_patches/targets/4.12-sles12sp4.target
3334 lustre/kernel_patches/targets/4.12-sles12sp5.target
3335 lustre/kernel_patches/targets/4.12-sles15sp1.target
3336 lustre/kernel_patches/targets/5.3-sles15sp2.target
3337 lustre/kernel_patches/targets/5.3-sles15sp3.target
3338 lustre/kernel_patches/targets/5.14-sles15sp4.target
3339 lustre/kernel_patches/targets/3.x-fc18.target
3340 lustre/ldlm/Makefile
3341 lustre/ec/autoMakefile
3344 lustre/fid/autoMakefile
3345 lustre/llite/Makefile
3346 lustre/llite/autoMakefile
3348 lustre/lov/autoMakefile
3350 lustre/mdc/autoMakefile
3352 lustre/lmv/autoMakefile
3353 lustre/lfsck/Makefile
3354 lustre/lfsck/autoMakefile
3356 lustre/mdt/autoMakefile
3358 lustre/mdd/autoMakefile
3360 lustre/fld/autoMakefile
3361 lustre/obdclass/Makefile
3362 lustre/obdclass/autoMakefile
3363 lustre/obdecho/Makefile
3364 lustre/obdecho/autoMakefile
3366 lustre/ofd/autoMakefile
3368 lustre/osc/autoMakefile
3370 lustre/ost/autoMakefile
3371 lustre/osd-ldiskfs/Makefile
3372 lustre/osd-ldiskfs/autoMakefile
3373 lustre/osd-zfs/Makefile
3374 lustre/osd-zfs/autoMakefile
3376 lustre/mgc/autoMakefile
3378 lustre/mgs/autoMakefile
3379 lustre/target/Makefile
3380 lustre/ptlrpc/Makefile
3381 lustre/ptlrpc/autoMakefile
3382 lustre/ptlrpc/gss/Makefile
3383 lustre/ptlrpc/gss/autoMakefile
3384 lustre/quota/Makefile
3385 lustre/quota/autoMakefile
3386 lustre/scripts/Makefile
3387 lustre/scripts/systemd/Makefile
3388 lustre/tests/Makefile
3389 lustre/tests/mpi/Makefile
3390 lustre/tests/iabf/Makefile
3391 lustre/tests/lutf/Makefile
3392 lustre/tests/lutf/src/Makefile
3393 lustre/tests/kernel/Makefile
3394 lustre/tests/kernel/autoMakefile
3395 lustre/utils/Makefile
3396 lustre/utils/gss/Makefile
3398 lustre/osp/autoMakefile
3400 lustre/lod/autoMakefile
3402 ]) # LC_CONFIG_FILES