Whamcloud - gitweb
2977a4a78e3b891498e8c895bb1f31553c97dbca
[fs/lustre-release.git] / lustre / autoconf / lustre-core.m4
1 #
2 # LC_CONFIG_SRCDIR
3 #
4 # Wrapper for AC_CONFIG_SUBDIR
5 #
6 AC_DEFUN([LC_CONFIG_SRCDIR], [
7 AC_CONFIG_SRCDIR([lustre/obdclass/obdo.c])
8 ldiskfs_is_ext4="yes"
9 ])
10
11 #
12 # LC_PATH_DEFAULTS
13 #
14 # lustre specific paths
15 #
16 AC_DEFUN([LC_PATH_DEFAULTS], [
17 # ptlrpc kernel build requires this
18 LUSTRE="$PWD/lustre"
19 AC_SUBST(LUSTRE)
20
21 # mount.lustre
22 rootsbindir='/sbin'
23 AC_SUBST(rootsbindir)
24
25 demodir='$(docdir)/demo'
26 AC_SUBST(demodir)
27
28 pkgexampledir='${pkgdatadir}/examples'
29 AC_SUBST(pkgexampledir)
30 ]) # LC_PATH_DEFAULTS
31
32 #
33 # LC_TARGET_SUPPORTED
34 #
35 # is the target os supported?
36 #
37 AC_DEFUN([LC_TARGET_SUPPORTED], [
38 case $target_os in
39         linux*)
40 $1
41                 ;;
42         *)
43 $2
44                 ;;
45 esac
46 ]) # LC_TARGET_SUPPORTED
47
48 #
49 # LC_GLIBC_SUPPORT_FHANDLES
50 #
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
57
58 #
59 # LC_GLIBC_SUPPORT_COPY_FILE_RANGE
60 #
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
67
68 #
69 # LC_FID2PATH_UNION
70 #
71 AC_DEFUN([LC_FID2PATH_ANON_UNION], [
72 saved_flags="$CFLAGS"
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>
77
78         int main(void) {
79                 struct getinfo_fid2path gf;
80                 struct lu_fid root_fid;
81
82                 *gf.gf_root_fid = root_fid;
83                 return 0;
84         }
85 ])],[
86         AC_DEFINE(HAVE_FID2PATH_ANON_UNIONS, 1, [union is unnamed])
87         AC_MSG_RESULT([yes])
88 ],[
89         AC_MSG_RESULT([no])
90 ])
91 CFLAGS="$saved_flags"
92 ]) # LC_FID2PATH_ANON_UNION
93
94 #
95 # LC_STACK_SIZE
96 #
97 # Ensure the stack size is at least 8k in Lustre server (all kernels)
98 #
99 AC_DEFUN([LC_STACK_SIZE], [
100 LB_CHECK_COMPILE([if stack size is at least 8k],
101 stack_size_8k, [
102         #include <linux/thread_info.h>
103 ], [
104         #if THREAD_SIZE < 8192
105         #error "stack size < 8192"
106         #endif
107 ], [], [AC_MSG_ERROR([
108
109 Lustre requires that Linux is configured with at least a 8KB stack.
110 ])])
111 ]) # LC_STACK_SIZE
112
113 #
114 # LC_MDS_MAX_THREADS
115 #
116 # Allow the user to set the MDS thread upper limit
117 #
118 AC_DEFUN([LC_MDS_MAX_THREADS], [
119 AC_MSG_CHECKING([for maximum number of MDS threads])
120 AC_ARG_WITH([mds_max_threads],
121         AS_HELP_STRING([--with-mds-max-threads=count],
122                 [maximum threads available on the MDS: (default=512)]),
123         [AC_DEFINE_UNQUOTED(MDS_MAX_THREADS, $with_mds_max_threads,
124                 [maximum number of MDS threads])])
125 AC_MSG_RESULT([$with_mds_max_threads])
126 ]) # LC_MDS_MAX_THREADS
127
128 #
129 # LC_CONFIG_PINGER
130 #
131 # the pinger is temporary, until we have the recovery node in place
132 #
133 AC_DEFUN([LC_CONFIG_PINGER], [
134 AC_MSG_CHECKING([whether to enable Lustre pinger support])
135 AC_ARG_ENABLE([pinger],
136         AS_HELP_STRING([--disable-pinger],
137                 [disable recovery pinger support]),
138         [], [enable_pinger="yes"])
139 AC_MSG_RESULT([$enable_pinger])
140 AS_IF([test "x$enable_pinger" != xno],
141         [AC_DEFINE(CONFIG_LUSTRE_FS_PINGER, 1,[Use the Pinger])])
142 ]) # LC_CONFIG_PINGER
143
144 #
145 # LC_CONFIG_CHECKSUM
146 #
147 # do checksum of bulk data between client and OST
148 #
149 AC_DEFUN([LC_CONFIG_CHECKSUM], [
150 AC_MSG_CHECKING([whether to enable data checksum support])
151 AC_ARG_ENABLE([checksum],
152         AS_HELP_STRING([--disable-checksum],
153                 [disable data checksum support]),
154         [], [enable_checksum="yes"])
155 AC_MSG_RESULT([$enable_checksum])
156 AS_IF([test "x$enable_checksum" != xno],
157         [AC_DEFINE(ENABLE_CHECKSUM, 1, [do data checksums])])
158 ]) # LC_CONFIG_CHECKSUM
159
160 #
161 # LC_CONFIG_FLOCK
162 #
163 # enable distributed flock by default
164 #
165 AC_DEFUN([LC_CONFIG_FLOCK], [
166 AC_MSG_CHECKING([whether to enable flock by default])
167 AC_ARG_ENABLE([flock],
168         AS_HELP_STRING([--disable-flock],
169                 [disable flock by default]),
170         [], [enable_flock="yes"])
171 AC_MSG_RESULT([$enable_flock])
172 AS_IF([test "x$enable_flock" != xno],
173         [AC_DEFINE(ENABLE_FLOCK, 1, [enable flock by default])])
174 ]) # LC_CONFIG_FLOCK
175
176 #
177 # LC_CONFIG_HEALTH_CHECK_WRITE
178 #
179 # Turn off the actual write to the disk
180 #
181 AC_DEFUN([LC_CONFIG_HEALTH_CHECK_WRITE], [
182 AC_MSG_CHECKING([whether to enable a write with the health check])
183 AC_ARG_ENABLE([health_write],
184         AS_HELP_STRING([--enable-health_write],
185                 [enable disk writes when doing health check]),
186         [], [enable_health_write="no"])
187 AC_MSG_RESULT([$enable_health_write])
188 AS_IF([test "x$enable_health_write" != xno],
189         [AC_DEFINE(USE_HEALTH_CHECK_WRITE, 1, [Write when Checking Health])])
190 ]) # LC_CONFIG_HEALTH_CHECK_WRITE
191
192 #
193 # LC_CONFIG_LRU_RESIZE
194 #
195 AC_DEFUN([LC_CONFIG_LRU_RESIZE], [
196 AC_MSG_CHECKING([whether to enable lru self-adjusting])
197 AC_ARG_ENABLE([lru_resize],
198         AS_HELP_STRING([--enable-lru-resize],
199                 [enable lru resize support]),
200         [], [enable_lru_resize="yes"])
201 AC_MSG_RESULT([$enable_lru_resize])
202 AS_IF([test "x$enable_lru_resize" != xno],
203         [AC_DEFINE(HAVE_LRU_RESIZE_SUPPORT, 1, [Enable lru resize support])])
204 ]) # LC_CONFIG_LRU_RESIZE
205
206 #
207 # LC_QUOTA_CONFIG
208 #
209 # Quota support. The kernel must support CONFIG_QUOTA.
210 #
211 AC_DEFUN([LC_QUOTA_CONFIG], [
212 LB_CHECK_CONFIG_IM([QUOTA], [],
213         [AC_MSG_ERROR([
214
215 Lustre quota requires that CONFIG_QUOTA is enabled in your kernel.
216 ])])
217 ]) # LC_QUOTA_CONFIG
218
219 #
220 # LC_CONFIG_FHANDLE
221 #
222 # fhandle kernel support for open_by_handle_at() and name_to_handle_at()
223 # system calls. The kernel must support CONFIG_FHANDLE.
224 #
225 AC_DEFUN([LC_CONFIG_FHANDLE], [
226 LB_CHECK_CONFIG_IM([FHANDLE], [],
227         [AC_MSG_ERROR([
228
229 Lustre fid handling requires that CONFIG_FHANDLE is enabled in your kernel.
230 ])])
231 ]) # LC_CONFIG_FHANDLE
232
233 #
234 # LC_POSIX_ACL_CONFIG
235 #
236 # POSIX ACL support.
237 #
238 AC_DEFUN([LC_POSIX_ACL_CONFIG], [
239 LB_CHECK_CONFIG_IM([FS_POSIX_ACL],
240         [AC_DEFINE(CONFIG_LUSTRE_FS_POSIX_ACL, 1, [Enable POSIX acl])
241 ], [ ])
242 ]) # LC_POSIX_ACL_CONFIG
243
244 LB_CHECK_CONFIG_IM([CRYPTO_MD5], [],
245                 [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
246
247 #
248 # LC_CONFIG_GSS_KEYRING
249 #
250 # default 'auto', tests for dependencies, if found, enables;
251 # only called if gss is enabled
252 #
253 AC_DEFUN([LC_CONFIG_GSS_KEYRING], [
254 AC_MSG_CHECKING([whether to enable gss keyring backend])
255 AC_ARG_ENABLE([gss_keyring],
256         [AS_HELP_STRING([--disable-gss-keyring],
257                 [disable gss keyring backend])],
258         [], [AS_IF([test "x$enable_gss" != xno], [
259                         enable_gss_keyring="yes"], [
260                         enable_gss_keyring="auto"])])
261 AC_MSG_RESULT([$enable_gss_keyring])
262 AS_IF([test "x$enable_gss_keyring" != xno], [
263         LB_CHECK_CONFIG_IM([KEYS], [], [
264                 gss_keyring_conf_test="fail"
265                 AC_MSG_WARN([GSS keyring backend requires that CONFIG_KEYS be enabled in your kernel.])])
266
267         AC_CHECK_LIB([keyutils], [keyctl_search], [], [
268                 gss_keyring_conf_test="fail"
269                 AC_MSG_WARN([GSS keyring backend requires libkeyutils])])
270
271         AS_IF([test "x$gss_keyring_conf_test" != xfail], [
272                 AC_DEFINE([HAVE_GSS_KEYRING], [1],
273                         [Define this if you enable gss keyring backend])
274                 enable_gss_keyring="yes"
275         ], [
276                 AS_IF([test "x$enable_gss_keyring" = xyes], [
277                         AC_MSG_ERROR([Cannot enable gss_keyring. See above for details.])
278                 ])
279                 enable_ssk="no"
280         ])
281 ], [
282         enable_ssk="no"
283 ])
284 ]) # LC_CONFIG_GSS_KEYRING
285
286 #
287 # LC_KEY_TYPE_INSTANTIATE_2ARGS
288 #
289 # rhel7 key_type->instantiate takes 2 args (struct key, struct key_preparsed_payload)
290 #
291 AC_DEFUN([LC_KEY_TYPE_INSTANTIATE_2ARGS], [
292 LB_CHECK_COMPILE([if 'key_type->instantiate' has two args],
293 key_type_instantiate_2args, [
294         #include <linux/key-type.h>
295 ],[
296         ((struct key_type *)0)->instantiate(0, NULL);
297 ],[
298         AC_DEFINE(HAVE_KEY_TYPE_INSTANTIATE_2ARGS, 1,
299                 [key_type->instantiate has two args])
300 ])
301 ]) # LC_KEY_TYPE_INSTANTIATE_2ARGS
302
303 #
304 # LC_CONFIG_SUNRPC
305 #
306 AC_DEFUN([LC_CONFIG_SUNRPC], [
307 LB_CHECK_CONFIG_IM([SUNRPC], [], [
308         AS_IF([test "x$sunrpc_required" = xyes], [
309                 AC_MSG_ERROR([
310
311 kernel SUNRPC support is required by using GSS.
312 ])
313         ])])
314 ]) # LC_CONFIG_SUNRPC
315
316 #
317 # LC_CONFIG_GSS (default 'auto' (tests for dependencies, if found, enables))
318 #
319 # Build gss and related tools of Lustre. Currently both kernel and user space
320 # parts are depend on linux platform.
321 #
322 AC_DEFUN([LC_CONFIG_GSS], [
323 AC_MSG_CHECKING([whether to enable gss support])
324 AC_ARG_ENABLE([gss],
325         [AS_HELP_STRING([--enable-gss], [enable gss support])],
326         [], [enable_gss="auto"])
327 AC_MSG_RESULT([$enable_gss])
328
329 AC_ARG_VAR([TEST_JOBS],
330     [simultaneous jobs during configure (defaults to $(nproc))])
331 if test "x$ac_cv_env_TEST_JOBS_set" != "xset"; then
332         TEST_JOBS=${TEST_JOBS:-$(nproc)}
333 fi
334 AC_SUBST(TEST_JOBS)
335
336 AC_ARG_VAR([TEST_DIR],
337     [location of temporary parallel configure tests (defaults to $PWD/lb2)])
338         TEST_DIR=${TEST_DIR:-${ac_pwd}/_lpb}
339 AC_SUBST(TEST_DIR)
340
341 AS_IF([test "x$enable_gss" != xno], [
342         LC_CONFIG_GSS_KEYRING
343         LC_KEY_TYPE_INSTANTIATE_2ARGS
344         sunrpc_required=$enable_gss
345         LC_CONFIG_SUNRPC
346         sunrpc_required="no"
347
348         LB_CHECK_CONFIG_IM([CRYPTO_MD5], [],
349                 [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
350         LB_CHECK_CONFIG_IM([CRYPTO_SHA1], [],
351                 [AC_MSG_WARN([kernel SHA1 support is recommended by using GSS.])])
352         LB_CHECK_CONFIG_IM([CRYPTO_SHA256], [],
353                 [AC_MSG_WARN([kernel SHA256 support is recommended by using GSS.])])
354         LB_CHECK_CONFIG_IM([CRYPTO_SHA512], [],
355                 [AC_MSG_WARN([kernel SHA512 support is recommended by using GSS.])])
356
357         require_krb5=$enable_gss
358         AC_KERBEROS_V5
359         require_krb5="no"
360
361         AS_IF([test -n "$KRBDIR"], [
362                 gss_conf_test="success"
363         ], [
364                 gss_conf_test="failure"
365         ])
366
367         AS_IF([test "x$gss_conf_test" = xsuccess && test "x$enable_gss" != xno], [
368                 AC_DEFINE([HAVE_GSS], [1], [Define this is if you enable gss])
369                 enable_gss="yes"
370         ], [
371                 enable_gss_keyring="no"
372                 enable_gss="no"
373         ])
374
375         AS_IF([test "x$enable_ssk" != xno], [
376                 enable_ssk=$enable_gss
377         ])
378 ], [
379         enable_gss_keyring="no"
380 ])
381 ]) # LC_CONFIG_GSS
382
383 # LC_OPENSSL_HMAC
384 #
385 # OpenSSL 1.0+ return int for HMAC functions but older SLES11 versions do not
386 AC_DEFUN([LC_OPENSSL_HMAC], [
387 has_hmac_functions="no"
388 saved_flags="$CFLAGS"
389 CFLAGS="$CFLAGS -Werror"
390 AC_MSG_CHECKING([whether OpenSSL has HMAC_Init_ex])
391 AS_IF([test "x$enable_ssk" != xno], [
392 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
393         #include <openssl/hmac.h>
394         #include <openssl/evp.h>
395
396         int main(void) {
397                 int rc;
398                 rc = HMAC_Init_ex(NULL, "test", 4, EVP_md_null(), NULL);
399         }
400 ])],[
401         has_hmac_functions="yes"
402 ])
403 ])
404 AC_MSG_RESULT([$has_hmac_functions])
405 CFLAGS="$saved_flags"
406 ]) # LC_OPENSSL_HMAC
407
408 # LC_OPENSSL_EVP_PKEY
409 #
410 # OpenSSL 3.0 introduces EVP_PKEY_get_params
411 AC_DEFUN([LC_OPENSSL_EVP_PKEY], [
412 has_evp_pkey="no"
413 saved_flags="$CFLAGS"
414 CFLAGS="$CFLAGS -Werror"
415 AC_MSG_CHECKING([whether OpenSSL has EVP_PKEY_get_params])
416 AS_IF([test "x$enable_ssk" != xno], [
417 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
418         #include <openssl/evp.h>
419
420         int main(void) {
421                 OSSL_PARAM *params;
422
423                 int rc = EVP_PKEY_get_params(NULL, params);
424         }
425 ])],[
426         AC_DEFINE(HAVE_OPENSSL_EVP_PKEY, 1, [OpenSSL EVP_PKEY_get_params])
427         has_evp_pkey="yes"
428 ])
429 ])
430 CFLAGS="$saved_flags"
431 AC_MSG_RESULT([$has_evp_pkey])
432 ]) # LC_OPENSSL_EVP_PKEY
433
434 #
435 # LC_OPENSSL_SSK
436 #
437 # Check whether to enable Lustre client crypto
438 #
439 AC_DEFUN([LC_OPENSSL_SSK], [
440 AC_MSG_CHECKING([whether OpenSSL has functions needed for SSK])
441 AS_IF([test "x$enable_ssk" != xno], [
442         AC_MSG_RESULT(
443         )
444         LC_OPENSSL_HMAC
445         LC_OPENSSL_EVP_PKEY
446 ])
447 AS_IF([test "x$has_hmac_functions" = xyes -o "x$has_evp_pkey" = xyes], [
448         AC_DEFINE(HAVE_OPENSSL_SSK, 1, [OpenSSL HMAC functions needed for SSK])
449 ], [
450         enable_ssk="no"
451 ])
452 AC_MSG_RESULT([$enable_ssk])
453 ]) # LC_OPENSSL_SSK
454
455 # LC_OPENSSL_GETSEPOL
456 #
457 # OpenSSL is needed for l_getsepol
458 AC_DEFUN([LC_OPENSSL_GETSEPOL], [
459 saved_flags="$CFLAGS"
460 CFLAGS="$CFLAGS -Werror"
461 AC_MSG_CHECKING([whether openssl-devel is present])
462 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
463         #include <openssl/evp.h>
464
465         int main(void) {
466                 EVP_MD_CTX *mdctx = EVP_MD_CTX_create();
467         }
468 ])],[
469         AC_DEFINE(HAVE_OPENSSL_GETSEPOL, 1, [openssl-devel is present])
470         enable_getsepol="yes"
471
472 ],[
473         enable_getsepol="no"
474         AC_MSG_WARN([
475
476 No openssl-devel headers found, unable to build l_getsepol and SELinux status checking
477 ])
478 ])
479 AC_MSG_RESULT([$enable_getsepol])
480 CFLAGS="$saved_flags"
481 ]) # LC_OPENSSL_GETSEPOL
482
483 # LC_HAVE_LIBAIO
484 AC_DEFUN([LC_HAVE_LIBAIO], [
485         AC_CHECK_HEADER([libaio.h],
486                 enable_libaio="yes",
487                 AC_MSG_WARN([libaio is not installed in the system]))
488 ]) # LC_HAVE_LIBAIO
489
490 #
491 # LC_INVALIDATE_RANGE
492 #
493 # 3.11 invalidatepage requires the length of the range to invalidate
494 #
495 AC_DEFUN([LC_INVALIDATE_RANGE], [
496 LB_CHECK_COMPILE([if 'address_space_operations.invalidatepage' requires 3 arguments],
497 address_space_ops_invalidatepage_3args, [
498         #include <linux/fs.h>
499 ],[
500         struct address_space_operations a_ops;
501         a_ops.invalidatepage(NULL, 0, 0);
502 ],[
503         AC_DEFINE(HAVE_INVALIDATE_RANGE, 1,
504                 [address_space_operations.invalidatepage needs 3 arguments])
505 ])
506 ]) # LC_INVALIDATE_RANGE
507
508 #
509 # LC_HAVE_DIR_CONTEXT
510 #
511 # 3.11 readdir now takes the new struct dir_context
512 #
513 AC_DEFUN([LC_HAVE_DIR_CONTEXT], [
514 LB_CHECK_COMPILE([if 'dir_context' exist],
515 dir_context, [
516         #include <linux/fs.h>
517 ],[
518 #ifdef FMODE_KABI_ITERATE
519 #error "back to use readdir in kabi_extand mode"
520 #else
521         struct dir_context ctx;
522
523         ctx.pos = 0;
524 #endif
525 ],[
526         AC_DEFINE(HAVE_DIR_CONTEXT, 1,
527                 [dir_context exist])
528 ])
529 ]) # LC_HAVE_DIR_CONTEXT
530
531 #
532 # LC_D_COMPARE_5ARGS
533 #
534 # 3.11 dentry_operations.d_compare() taken 5 arguments.
535 #
536 AC_DEFUN([LC_D_COMPARE_5ARGS], [
537 LB_CHECK_COMPILE([if 'd_compare' taken 5 arguments],
538 d_compare_5args, [
539         #include <linux/dcache.h>
540 ],[
541         ((struct dentry_operations*)0)->d_compare(NULL,NULL,0,NULL,NULL);
542 ],[
543         AC_DEFINE(HAVE_D_COMPARE_5ARGS, 1,
544                 [d_compare need 5 arguments])
545 ])
546 ]) # LC_D_COMPARE_5ARGS
547
548 #
549 # LC_HAVE_DCOUNT
550 #
551 # 3.11 need to access d_count to get dentry reference count
552 #
553 AC_DEFUN([LC_HAVE_DCOUNT], [
554 LB_CHECK_COMPILE([if 'd_count' exists],
555 d_count, [
556         #include <linux/dcache.h>
557 ],[
558         struct dentry de = { };
559         int count;
560
561         count = d_count(&de);
562 ],[
563         AC_DEFINE(HAVE_D_COUNT, 1,
564                 [d_count exist])
565 ])
566 ]) # LC_HAVE_DCOUNT
567
568 #
569 # LC_PID_NS_FOR_CHILDREN
570 #
571 # 3.11 replaces pid_ns by pid_ns_for_children in struct nsproxy
572 #
573 AC_DEFUN([LC_PID_NS_FOR_CHILDREN], [
574 LB_CHECK_COMPILE([if 'struct nsproxy' has 'pid_ns_for_children'],
575 pid_ns_for_children, [
576         #include <linux/nsproxy.h>
577 ],[
578         struct nsproxy ns;
579         ns.pid_ns_for_children = NULL;
580 ],[
581         AC_DEFINE(HAVE_PID_NS_FOR_CHILDREN, 1,
582                   ['struct nsproxy' has 'pid_ns_for_children'])
583 ])
584 ]) # LC_PID_NS_FOR_CHILDREN
585
586 #
587 # LC_OLDSIZE_TRUNCATE_PAGECACHE
588 #
589 # 3.12 truncate_pagecache without oldsize parameter
590 #
591 AC_DEFUN([LC_OLDSIZE_TRUNCATE_PAGECACHE], [
592 LB_CHECK_COMPILE([if 'truncate_pagecache' with 'old_size' parameter],
593 truncate_pagecache_old_size, [
594         #include <linux/mm.h>
595 ],[
596         truncate_pagecache(NULL, 0, 0);
597 ],[
598         AC_DEFINE(HAVE_OLDSIZE_TRUNCATE_PAGECACHE, 1,
599                 [with oldsize])
600 ])
601 ]) # LC_OLDSIZE_TRUNCATE_PAGECACHE
602
603 #
604 # LC_PTR_ERR_OR_ZERO
605 #
606 # For some reason SLES11SP4 is missing the PTR_ERR_OR_ZERO macro
607 # It was added to linux kernel 3.12
608 #
609 AC_DEFUN([LC_PTR_ERR_OR_ZERO_MISSING], [
610 LB_CHECK_COMPILE([if 'PTR_ERR_OR_ZERO' is missing],
611 is_err_or_null, [
612         #include <linux/err.h>
613 ],[
614         if (PTR_ERR_OR_ZERO(NULL)) return 0;
615 ],[
616         AC_DEFINE(HAVE_PTR_ERR_OR_ZERO, 1,
617                 ['PTR_ERR_OR_ZERO' exist])
618 ])
619 ]) # LC_PTR_ERR_OR_ZERO_MISSING
620
621 #
622 # LC_HAVE_DENTRY_D_U_D_ALIAS
623 #
624 # 3.11 kernel moved d_alias to the union d_u in struct dentry
625 #
626 # Some distros move d_alias to d_u but it is still a struct list
627 #
628 AC_DEFUN([LC_HAVE_DENTRY_D_U_D_ALIAS], [
629 AS_IF([test "x$lb_cv_compile_i_dentry_d_alias_list" = xyes], [
630         LB_CHECK_COMPILE([if list 'dentry.d_u.d_alias' exist],
631         d_alias, [
632                 #include <linux/list.h>
633                 #include <linux/dcache.h>
634         ],[
635                 struct dentry de;
636                 INIT_LIST_HEAD(&de.d_u.d_alias);
637         ],[
638                 AC_DEFINE(HAVE_DENTRY_D_U_D_ALIAS, 1,
639                         [list dentry.d_u.d_alias exist])
640         ])
641 ],[
642         LB_CHECK_COMPILE([if hlist 'dentry.d_u.d_alias' exist],
643         d_alias, [
644                 #include <linux/list.h>
645                 #include <linux/dcache.h>
646         ],[
647                 struct dentry de;
648                 INIT_HLIST_NODE(&de.d_u.d_alias);
649         ],[
650                 AC_DEFINE(HAVE_DENTRY_D_U_D_ALIAS, 1,
651                         [hlist dentry.d_u.d_alias exist])
652         ])
653 ])
654 ]) # LC_HAVE_DENTRY_D_U_D_ALIAS
655
656 #
657 # LC_HAVE_DENTRY_D_CHILD
658 #
659 # 3.11 kernel d_child has been moved out of the union d_u
660 # in struct dentry
661 #
662 AC_DEFUN([LC_HAVE_DENTRY_D_CHILD], [
663 LB_CHECK_COMPILE([if 'dentry.d_child' exist],
664 d_child, [
665         #include <linux/list.h>
666         #include <linux/dcache.h>
667 ],[
668         struct dentry de;
669         INIT_LIST_HEAD(&de.d_child);
670 ],[
671         AC_DEFINE(HAVE_DENTRY_D_CHILD, 1,
672                 [dentry.d_child exist])
673 ])
674 ]) # LC_HAVE_DENTRY_D_CHILD
675
676 #
677 # LC_KIOCB_KI_LEFT
678 #
679 # 3.12 ki_left removed from struct kiocb
680 #
681 AC_DEFUN([LC_KIOCB_KI_LEFT], [
682 LB_CHECK_COMPILE([if 'struct kiocb' with 'ki_left' member],
683 kiocb_ki_left, [
684         #include <linux/aio.h>
685 ],[
686         ((struct kiocb*)0)->ki_left = 0;
687 ],[
688         AC_DEFINE(HAVE_KIOCB_KI_LEFT, 1,
689                 [ki_left exist])
690 ])
691 ]) # LC_KIOCB_KI_LEFT
692
693 #
694 # LC_REGISTER_SHRINKER_RET
695 #
696 # v3.11-8748-g1d3d4437eae1 register_shrinker returns a status
697 #
698 AC_DEFUN([LC_REGISTER_SHRINKER_RET], [
699 LB_CHECK_COMPILE([if register_shrinker() returns status],
700 register_shrinker_ret, [
701         #include <linux/mm.h>
702 ],[
703         if (register_shrinker(NULL))
704                 unregister_shrinker(NULL);
705 ],[
706         AC_DEFINE(HAVE_REGISTER_SHRINKER_RET, 1,
707                 [register_shrinker() returns status])
708 ])
709 ]) # LC_REGISTER_SHRINKER_RET
710
711 #
712 # LC_VFS_RENAME_5ARGS
713 #
714 # 3.13 has vfs_rename with 5 args
715 #
716 AC_DEFUN([LC_VFS_RENAME_5ARGS], [
717 LB_CHECK_COMPILE([if Linux kernel has 'vfs_rename' with 5 args],
718 vfs_rename_5args, [
719         #include <linux/fs.h>
720 ],[
721         vfs_rename(NULL, NULL, NULL, NULL, NULL);
722 ], [
723         AC_DEFINE(HAVE_VFS_RENAME_5ARGS, 1,
724                 [kernel has vfs_rename with 5 args])
725 ])
726 ]) # LC_VFS_RENAME_5ARGS
727
728 #
729 # LC_VFS_UNLINK_3ARGS
730 #
731 # 3.13 has vfs_unlink with 3 args
732 #
733 AC_DEFUN([LC_VFS_UNLINK_3ARGS], [
734 LB_CHECK_COMPILE([if Linux kernel has 'vfs_unlink' with 3 args],
735 vfs_unlink_3args, [
736         #include <linux/fs.h>
737 ],[
738         vfs_unlink(NULL, NULL, NULL);
739 ], [
740         AC_DEFINE(HAVE_VFS_UNLINK_3ARGS, 1,
741                 [kernel has vfs_unlink with 3 args])
742 ])
743 ]) # LC_VFS_UNLINK_3ARGS
744
745 # LC_HAVE_D_IS_POSITIVE
746 #
747 # Kernel version 3.13 b18825a7c8e37a7cf6abb97a12a6ad71af160de7
748 # d_is_positive is added
749 #
750 AC_DEFUN([LC_HAVE_D_IS_POSITIVE], [
751 LB_CHECK_COMPILE([if 'd_is_positive' exist],
752 d_is_positive, [
753         #include <linux/dcache.h>
754 ],[
755         d_is_positive(NULL);
756 ],[
757         AC_DEFINE(HAVE_D_IS_POSITIVE, 1,
758                 ['d_is_positive' is available])
759 ])
760 ]) # LC_HAVE_D_IS_POSITIVE
761
762 #
763 # LC_HAVE_BVEC_ITER
764 #
765 # 3.14 move some of its data in struct bio into the new
766 # struct bvec_iter
767 #
768 AC_DEFUN([LC_HAVE_BVEC_ITER], [
769 LB_CHECK_COMPILE([if Linux kernel has struct bvec_iter],
770 have_bvec_iter, [
771         #include <linux/bio.h>
772 ],[
773         struct bvec_iter iter;
774
775         iter.bi_bvec_done = 0;
776 ], [
777         AC_DEFINE(HAVE_BVEC_ITER, 1,
778                 [kernel has struct bvec_iter])
779 ])
780 ]) # LC_HAVE_BVEC_ITER
781
782 #
783 # LC_IOP_SET_ACL
784 #
785 # 3.14 adds set_acl method to inode_operations
786 # see kernel commit 893d46e443346370cd4ea81d9d35f72952c62a37
787 #
788 AC_DEFUN([LC_IOP_SET_ACL], [
789 LB_CHECK_COMPILE([if 'inode_operations' has '.set_acl' member function],
790 inode_ops_set_acl, [
791         #include <linux/fs.h>
792 ],[
793         struct inode_operations iop;
794         iop.set_acl = NULL;
795 ],[
796         AC_DEFINE(HAVE_IOP_SET_ACL, 1,
797                 [inode_operations has .set_acl member function])
798 ])
799 ]) # LC_IOP_SET_ACL
800
801 #
802 # LC_HAVE_TRUNCATE_IPAGE_FINAL
803 #
804 # 3.14 bring truncate_inode_pages_final for evict_inode
805 #
806 AC_DEFUN([LC_HAVE_TRUNCATE_IPAGES_FINAL], [
807 LB_CHECK_COMPILE([if Linux kernel has truncate_inode_pages_final],
808 truncate_ipages_final, [
809         #include <linux/mm.h>
810 ],[
811         truncate_inode_pages_final(NULL);
812 ], [
813         AC_DEFINE(HAVE_TRUNCATE_INODE_PAGES_FINAL, 1,
814                 [kernel has truncate_inode_pages_final])
815 ])
816 ]) # LC_HAVE_TRUNCATE_IPAGES_FINAL
817
818 #
819 # LC_IOPS_RENAME_WITH_FLAGS
820 #
821 # 3.14 has inode_operations->rename with 5 args
822 # commit 520c8b16505236fc82daa352e6c5e73cd9870cff
823 #
824 AC_DEFUN([LC_IOPS_RENAME_WITH_FLAGS], [
825 LB_CHECK_COMPILE([if 'inode_operations->rename' taken flags as argument],
826 iops_rename_with_flags, [
827         #include <linux/fs.h>
828 ],[
829         struct inode *i1 = NULL, *i2 = NULL;
830         struct dentry *d1 = NULL, *d2 = NULL;
831         int rc;
832         rc = ((struct inode_operations *)0)->rename(i1, d1, i2, d2, 0);
833 ], [
834         AC_DEFINE(HAVE_IOPS_RENAME_WITH_FLAGS, 1,
835                 [inode_operations->rename need flags as argument])
836 ])
837 ]) # LC_IOPS_RENAME_WITH_FLAGS
838
839 #
840 # LC_VFS_RENAME_6ARGS
841 #
842 # 3.15 has vfs_rename with 6 args
843 #
844 AC_DEFUN([LC_VFS_RENAME_6ARGS], [
845 LB_CHECK_COMPILE([if Linux kernel has 'vfs_rename' with 6 args],
846 vfs_rename_6args, [
847         #include <linux/fs.h>
848 ],[
849         vfs_rename(NULL, NULL, NULL, NULL, NULL, NULL);
850 ], [
851         AC_DEFINE(HAVE_VFS_RENAME_6ARGS, 1,
852                 [kernel has vfs_rename with 6 args])
853 ])
854 ]) # LC_VFS_RENAME_6ARGS
855
856 #
857 # LC_DIRECTIO_USE_ITER
858 #
859 # 3.16 kernel changes direct IO to use iov_iter
860 #
861 AC_DEFUN([LC_DIRECTIO_USE_ITER], [
862 LB_CHECK_COMPILE([if direct IO uses iov_iter],
863 direct_io_iter, [
864         #include <linux/fs.h>
865 ],[
866         struct address_space_operations ops = { };
867         struct iov_iter *iter = NULL;
868         loff_t offset = 0;
869
870         ops.direct_IO(0, NULL, iter, offset);
871 ],[
872         AC_DEFINE(HAVE_DIRECTIO_ITER, 1,
873                 [direct IO uses iov_iter])
874 ])
875 ]) # LC_DIRECTIO_USE_ITER
876
877 #
878 # LC_HAVE_IOV_ITER_INIT_DIRECTION
879 #
880 #
881 # 3.16 linux commit 71d8e532b1549a478e6a6a8a44f309d050294d00
882 #      changed iov_iter_init api to start accepting a tag
883 #      that defines if its a read or write operation
884 #
885 AC_DEFUN([LC_HAVE_IOV_ITER_INIT_DIRECTION], [
886 tmp_flags="$EXTRA_KCFLAGS"
887 EXTRA_KCFLAGS="-Werror"
888 LB_CHECK_COMPILE([if 'iov_iter_init' takes a tag],
889 iter_init, [
890         #include <linux/uio.h>
891         #include <linux/fs.h>
892 ],[
893         const struct iovec *iov = NULL;
894
895         iov_iter_init(NULL, READ, iov, 1, 0);
896 ],[
897         AC_DEFINE(HAVE_IOV_ITER_INIT_DIRECTION, 1,
898                 [iov_iter_init handles directional tag])
899 ])
900 EXTRA_KCFLAGS="$tmp_flags"
901 ]) # LC_HAVE_IOV_ITER_INIT_DIRECTION
902
903 #
904 # LC_HAVE_IOV_ITER_TRUNCATE
905 #
906 #
907 # 3.16 introduces a new API iov_iter_truncate()
908 #
909 AC_DEFUN([LC_HAVE_IOV_ITER_TRUNCATE], [
910 tmp_flags="$EXTRA_KCFLAGS"
911 EXTRA_KCFLAGS="-Werror"
912 LB_CHECK_COMPILE([if 'iov_iter_truncate' exists ],
913 iter_truncate, [
914         #include <linux/uio.h>
915         #include <linux/fs.h>
916 ],[
917         struct iov_iter *i = NULL;
918
919         iov_iter_truncate(i, 0);
920 ],[
921         AC_DEFINE(HAVE_IOV_ITER_TRUNCATE, 1, [iov_iter_truncate exists])
922 ])
923 EXTRA_KCFLAGS="$tmp_flags"
924 ]) # LC_HAVE_IOV_ITER_TRUNCATE
925
926 #
927 # LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER
928 #
929 # 3.16 introduces [read|write]_iter to struct file_operations
930 #
931 AC_DEFUN([LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER], [
932 LB_CHECK_COMPILE([if 'file_operations.[read|write]_iter' exist],
933 file_function_iter, [
934         #include <linux/fs.h>
935 ],[
936         ((struct file_operations *)NULL)->read_iter(NULL, NULL);
937         ((struct file_operations *)NULL)->write_iter(NULL, NULL);
938 ],[
939         AC_DEFINE(HAVE_FILE_OPERATIONS_READ_WRITE_ITER, 1,
940                 [file_operations.[read|write]_iter functions exist])
941 ])
942 ]) # LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER
943
944 #
945 # LC_HAVE_INTERVAL_BLK_INTEGRITY
946 #
947 # 3.17 replace sector_size with interval in struct blk_integrity
948 #
949 AC_DEFUN([LC_HAVE_INTERVAL_BLK_INTEGRITY], [
950 LB_CHECK_COMPILE([if 'blk_integrity.interval' exist],
951 interval_blk_integrity, [
952         #include <linux/blkdev.h>
953 ],[
954         ((struct blk_integrity *)0)->interval = 0;
955 ],[
956         AC_DEFINE(HAVE_INTERVAL_BLK_INTEGRITY, 1,
957                 [blk_integrity.interval exist])
958 ])
959 ]) # LC_HAVE_INTERVAL_BLK_INTEGRITY
960
961 #
962 # LC_KEY_MATCH_DATA
963 #
964 # 3.17  replaces key_type::match with match_preparse
965 #       and has new struct key_match_data
966 #
967 AC_DEFUN([LC_KEY_MATCH_DATA], [
968 LB_CHECK_COMPILE([if struct key_match field exist],
969 key_match, [
970         #include <linux/key-type.h>
971 ],[
972         struct key_match_data data;
973
974         data.raw_data = NULL;
975 ],[
976         AC_DEFINE(HAVE_KEY_MATCH_DATA, 1,
977                 [struct key_match_data exist])
978 ])
979 ]) # LC_KEY_MATCH_DATA
980
981 #
982 # LC_NFS_FILLDIR_USE_CTX
983 #
984 # 3.18 kernel moved from void cookie to struct dir_context
985 #
986 AC_DEFUN([LC_NFS_FILLDIR_USE_CTX], [
987 tmp_flags="$EXTRA_KCFLAGS"
988 EXTRA_KCFLAGS="-Werror"
989 LB_CHECK_COMPILE([if filldir_t uses struct dir_context],
990 filldir_ctx, [
991         #include <linux/fs.h>
992 ],[
993         int filldir(struct dir_context *ctx, const char* name,
994                     int i, loff_t off, u64 tmp, unsigned temp)
995         {
996                 return 0;
997         }
998
999         struct dir_context ctx = {
1000                 .actor = filldir,
1001         };
1002
1003         ctx.actor(NULL, "test", 0, (loff_t) 0, 0, 0);
1004 ],[
1005         AC_DEFINE(HAVE_FILLDIR_USE_CTX, 1,
1006                 [filldir_t needs struct dir_context as argument])
1007 ])
1008 EXTRA_KCFLAGS="$tmp_flags"
1009 ]) # LC_NFS_FILLDIR_USE_CTX
1010
1011 #
1012 # LC_PERCPU_COUNTER_INIT
1013 #
1014 # 3.18  For kernels 3.18 and after percpu_counter_init starts
1015 #       to pass a GFP_* memory allocation flag for internal
1016 #       memory allocation purposes.
1017 #
1018 AC_DEFUN([LC_PERCPU_COUNTER_INIT], [
1019 LB_CHECK_COMPILE([if percpu_counter_init uses GFP_* flag as argument],
1020 percpu_counter_init, [
1021         #include <linux/percpu_counter.h>
1022 ],[
1023         percpu_counter_init(NULL, 0, GFP_KERNEL);
1024 ],[
1025         AC_DEFINE(HAVE_PERCPU_COUNTER_INIT_GFP_FLAG, 1,
1026                 [percpu_counter_init uses GFP_* flag])
1027 ])
1028 ]) # LC_PERCPU_COUNTER_INIT
1029
1030 #
1031 # LC_KIOCB_HAS_NBYTES
1032 #
1033 # 3.19 kernel removed ki_nbytes from struct kiocb
1034 #
1035 AC_DEFUN([LC_KIOCB_HAS_NBYTES], [
1036 LB_CHECK_COMPILE([if struct kiocb has ki_nbytes field],
1037 ki_nbytes, [
1038         #include <linux/fs.h>
1039 ],[
1040         struct kiocb iocb = { };
1041
1042         iocb.ki_nbytes = 0;
1043 ],[
1044         AC_DEFINE(HAVE_KI_NBYTES, 1, [ki_nbytes field exist])
1045 ])
1046 ]) # LC_KIOCB_HAS_NBYTES
1047
1048 #
1049 # LC_HAVE_DQUOT_QC_DQBLK
1050 #
1051 # 3.19 has quotactl_ops->[sg]et_dqblk that take struct kqid and qc_dqblk
1052 # Added in commit 14bf61ffe
1053 #
1054 AC_DEFUN([LC_HAVE_DQUOT_QC_DQBLK], [
1055 tmp_flags="$EXTRA_KCFLAGS"
1056 EXTRA_KCFLAGS="-Werror"
1057 LB_CHECK_COMPILE([if 'quotactl_ops.set_dqblk' takes struct qc_dqblk],
1058 qc_dqblk, [
1059         #include <linux/fs.h>
1060         #include <linux/quota.h>
1061 ],[
1062         ((struct quotactl_ops *)0)->set_dqblk(NULL, *((struct kqid*)0), (struct qc_dqblk*)0);
1063 ],[
1064         AC_DEFINE(HAVE_DQUOT_QC_DQBLK, 1,
1065                 [quotactl_ops.set_dqblk takes struct qc_dqblk])
1066         AC_DEFINE(HAVE_DQUOT_KQID, 1,
1067                 [quotactl_ops.set_dqblk takes struct kqid])
1068 ])
1069 EXTRA_KCFLAGS="$tmp_flags"
1070 ]) # LC_HAVE_DQUOT_QC_DQBLK
1071
1072 #
1073 # LC_HAVE_AIO_COMPLETE
1074 #
1075 # 3.19 kernel makes aio_complete() static
1076 #
1077 AC_DEFUN([LC_HAVE_AIO_COMPLETE], [
1078 LB_CHECK_COMPILE([if kernel has exported aio_complete() ],
1079 aio_complete, [
1080         #include <linux/aio.h>
1081 ],[
1082         aio_complete(NULL, 0, 0);
1083 ],[
1084         AC_DEFINE(HAVE_AIO_COMPLETE, 1, [aio_complete defined])
1085 ])
1086 ]) # LC_HAVE_AIO_COMPLETE
1087
1088 #
1089 # LC_HAVE_IS_ROOT_INODE
1090 #
1091 # 3.19 kernel adds is_root_inode()
1092 # Commit a7400222e3eb ("new helper: is_root_inode()")
1093 #
1094 AC_DEFUN([LC_HAVE_IS_ROOT_INODE], [
1095 LB_CHECK_COMPILE([if kernel has is_root_inode() ],
1096 is_root_inode, [
1097         #include <linux/fs.h>
1098 ],[
1099         is_root_inode(NULL);
1100 ],[
1101         AC_DEFINE(HAVE_IS_ROOT_INODE, 1, [is_root_inode defined])
1102 ])
1103 ]) # LC_HAVE_IS_ROOT_INODE
1104
1105 #
1106 # LC_BACKING_DEV_INFO_REMOVAL
1107 #
1108 # 3.20 kernel removed backing_dev_info from address_space
1109 #
1110 AC_DEFUN([LC_BACKING_DEV_INFO_REMOVAL], [
1111 LB_CHECK_COMPILE([if struct address_space has backing_dev_info],
1112 backing_dev_info, [
1113         #include <linux/fs.h>
1114 ],[
1115         struct address_space mapping;
1116
1117         mapping.backing_dev_info = NULL;
1118 ],[
1119         AC_DEFINE(HAVE_BACKING_DEV_INFO, 1, [backing_dev_info exist])
1120 ])
1121 ]) # LC_BACKING_DEV_INFO_REMOVAL
1122
1123 #
1124 # LC_HAVE_BDI_CAP_MAP_COPY
1125 #
1126 # 3.20  removed mmap handling for backing devices since
1127 #       it breaks on non-MMU systems. See kernel commit
1128 #       b4caecd48005fbed3949dde6c1cb233142fd69e9
1129 #
1130 AC_DEFUN([LC_HAVE_BDI_CAP_MAP_COPY], [
1131 LB_CHECK_COMPILE([if have 'BDI_CAP_MAP_COPY'],
1132 bdi_cap_map_copy, [
1133         #include <linux/backing-dev.h>
1134 ],[
1135         struct backing_dev_info info;
1136
1137         info.capabilities = BDI_CAP_MAP_COPY;
1138 ],[
1139         AC_DEFINE(HAVE_BDI_CAP_MAP_COPY, 1,
1140                 [BDI_CAP_MAP_COPY exist])
1141 ])
1142 ]) # LC_HAVE_BDI_CAP_MAP_COPY
1143
1144 #
1145 # LC_HAVE_PROJECT_QUOTA
1146 #
1147 # Kernel version v4.0-rc1-197-g847aac644e92
1148 #
1149 AC_DEFUN([LC_HAVE_PROJECT_QUOTA], [
1150 LB_CHECK_COMPILE([if get_projid exists],
1151 get_projid, [
1152         struct inode;
1153         #include <linux/quota.h>
1154 ],[
1155         struct dquot_operations ops = { };
1156
1157         ops.get_projid(NULL, NULL);
1158 ],[
1159         AC_DEFINE(HAVE_PROJECT_QUOTA, 1,
1160                 [get_projid function exists])
1161 ])
1162 ]) # LC_HAVE_PROJECT_QUOTA
1163
1164 #
1165 # LC_IOV_ITER_RW
1166 #
1167 # 4.1 kernel has iov_iter_rw
1168 #
1169 AC_DEFUN([LC_IOV_ITER_RW], [
1170 LB_CHECK_COMPILE([if iov_iter_rw exist],
1171 iov_iter_rw, [
1172         #include <linux/fs.h>
1173         #include <linux/uio.h>
1174 ],[
1175         struct iov_iter *iter = NULL;
1176
1177         iov_iter_rw(iter);
1178 ],[
1179         AC_DEFINE(HAVE_IOV_ITER_RW, 1,
1180                 [iov_iter_rw exist])
1181 ])
1182 ]) # LC_IOV_ITER_RW
1183
1184 #
1185 # LC_HAVE_SYNC_READ_WRITE
1186 #
1187 # 4.1 new_sync_[read|write] no longer exported
1188 #
1189 AC_DEFUN([LC_HAVE_SYNC_READ_WRITE], [
1190 LB_CHECK_EXPORT([new_sync_read], [fs/read_write.c],
1191         [AC_DEFINE(HAVE_SYNC_READ_WRITE, 1,
1192                         [new_sync_[read|write] is exported by the kernel])])
1193 ]) # LC_HAVE_SYNC_READ_WRITE
1194
1195 #
1196 # LC_HAVE___BI_CNT
1197 #
1198 # 4.1 redefined bi_cnt as __bi_cnt in commit dac56212e8127dbc0
1199 #
1200 AC_DEFUN([LC_HAVE___BI_CNT], [
1201 LB_CHECK_COMPILE([if Linux kernel has __bi_cnt in struct bio],
1202 have___bi_cnt, [
1203         #include <asm/atomic.h>
1204         #include <linux/bio.h>
1205         #include <linux/blk_types.h>
1206 ],[
1207         struct bio bio = { };
1208         int cnt;
1209         cnt = atomic_read(&bio.__bi_cnt);
1210 ], [
1211         AC_DEFINE(HAVE___BI_CNT, 1,
1212                 [struct bio has __bi_cnt])
1213 ])
1214 ]) # LC_HAVE___BI_CNT
1215
1216 #
1217 # LC_SYMLINK_OPS_USE_NAMEIDATA
1218 #
1219 # For the 4.2+ kernels the file system internal symlink api no
1220 # longer uses struct nameidata as a argument
1221 #
1222 AC_DEFUN([LC_SYMLINK_OPS_USE_NAMEIDATA], [
1223 LB_CHECK_COMPILE([if symlink inode operations have struct nameidata argument],
1224 symlink_use_nameidata, [
1225         #include <linux/namei.h>
1226         #include <linux/fs.h>
1227 ],[
1228         struct nameidata *nd = NULL;
1229
1230         ((struct inode_operations *)0)->follow_link(NULL, nd);
1231         ((struct inode_operations *)0)->put_link(NULL, nd, NULL);
1232 ],[
1233         AC_DEFINE(HAVE_SYMLINK_OPS_USE_NAMEIDATA, 1,
1234                 [symlink inode operations need struct nameidata argument])
1235 ])
1236 ]) # LC_SYMLINK_OPS_USE_NAMEIDATA
1237
1238 #
1239 # LC_BIO_ENDIO_USES_ONE_ARG
1240 #
1241 # 4.2 kernel bio_endio now only takes one argument
1242 #
1243 AC_DEFUN([LC_BIO_ENDIO_USES_ONE_ARG], [
1244 LB_CHECK_COMPILE([if 'bio_endio' with one argument exist],
1245 bio_endio, [
1246         #include <linux/bio.h>
1247 ],[
1248         bio_endio(NULL);
1249 ],[
1250         AC_DEFINE(HAVE_BIO_ENDIO_USES_ONE_ARG, 1,
1251                 [bio_endio takes only one argument])
1252 ])
1253 ]) # LC_BIO_ENDIO_USES_ONE_ARG
1254
1255 #
1256 # LC_ACCOUNT_PAGE_DIRTIED_3ARGS
1257 #
1258 # 4.2 [to 4.5] kernel page dirtied takes 3 arguments
1259 #
1260 AC_DEFUN([LC_ACCOUNT_PAGE_DIRTIED_3ARGS], [
1261 LB_CHECK_COMPILE([if 'account_page_dirtied' with 3 args exists],
1262 account_page_dirtied, [
1263         #include <linux/mm.h>
1264 ],[
1265         account_page_dirtied(NULL, NULL, NULL);
1266 ],[
1267         AC_DEFINE(HAVE_ACCOUNT_PAGE_DIRTIED_3ARGS, 1,
1268                 [account_page_dirtied takes three arguments])
1269 ])
1270 ]) # LC_ACCOUNT_PAGE_DIRTIED_3ARGS
1271
1272 #
1273 # LC_HAVE_CRYPTO_ALLOC_SKCIPHER
1274 #
1275 # Kernel version 4.12 commit 7a7ffe65c8c5
1276 # introduced crypto_alloc_skcipher().
1277 #
1278 AC_DEFUN([LC_HAVE_CRYPTO_ALLOC_SKCIPHER], [
1279 LB_CHECK_COMPILE([if crypto_alloc_skcipher is defined],
1280 crypto_alloc_skcipher, [
1281         #include <crypto/skcipher.h>
1282 ],[
1283         crypto_alloc_skcipher(NULL, 0, 0);
1284 ],[
1285         AC_DEFINE(HAVE_CRYPTO_ALLOC_SKCIPHER, 1,
1286                 [crypto_alloc_skcipher is defined])
1287 ])
1288 ]) # LC_HAVE_CRYPTO_ALLOC_SKCIPHER
1289
1290 #
1291 # LC_HAVE_INTERVAL_EXP_BLK_INTEGRITY
1292 #
1293 # 4.3 replace interval with interval_exp in 'struct blk_integrity'
1294 # 'struct blk_integrity_profile' is also added in this version,
1295 # thus use this to determine whether 'struct blk_integrity' has profile
1296 #
1297 AC_DEFUN([LC_HAVE_INTERVAL_EXP_BLK_INTEGRITY], [
1298 LB_CHECK_COMPILE([if 'blk_integrity.interval_exp' exist],
1299 blk_integrity_interval_exp, [
1300         #include <linux/blkdev.h>
1301 ],[
1302         ((struct blk_integrity *)0)->interval_exp = 0;
1303 ],[
1304         AC_DEFINE(HAVE_INTERVAL_EXP_BLK_INTEGRITY, 1,
1305                 [blk_integrity.interval_exp exist])
1306 ])
1307 ]) # LC_HAVE_INTERVAL_EXP_BLK_INTEGRITY
1308
1309 #
1310 # LC_HAVE_CACHE_HEAD_HLIST
1311 #
1312 # 4.3 kernel swiched to hlist for cache_head
1313 #
1314 AC_DEFUN([LC_HAVE_CACHE_HEAD_HLIST], [
1315 LB_CHECK_COMPILE([if 'struct cache_head' has 'cache_list' field],
1316 cache_head_has_hlist, [
1317         #include <linux/sunrpc/cache.h>
1318 ],[
1319         do {} while(sizeof(((struct cache_head *)0)->cache_list));
1320 ],[
1321         AC_DEFINE(HAVE_CACHE_HEAD_HLIST, 1,
1322                 [cache_head has hlist cache_list])
1323 ])
1324 ]) # LC_HAVE_CACHE_HEAD_HLIST
1325
1326 #
1327 # LC_HAVE_XATTR_HANDLER_SIMPLIFIED
1328 #
1329 # Kernel version 4.3 commit e409de992e3ea3674393465f07cc71c948edd87a
1330 # simplified xattr_handler handling by passing in the handler pointer
1331 #
1332 AC_DEFUN([LC_HAVE_XATTR_HANDLER_SIMPLIFIED], [
1333 tmp_flags="$EXTRA_KCFLAGS"
1334 EXTRA_KCFLAGS="-Werror"
1335 LB_CHECK_COMPILE([if 'struct xattr_handler' functions pass in handler pointer],
1336 xattr_handler_simplified, [
1337         #include <linux/xattr.h>
1338 ],[
1339         struct xattr_handler handler;
1340
1341         ((struct xattr_handler *)0)->get(&handler, NULL, NULL, NULL, 0);
1342         ((struct xattr_handler *)0)->set(&handler, NULL, NULL, NULL, 0, 0);
1343 ],[
1344         AC_DEFINE(HAVE_XATTR_HANDLER_SIMPLIFIED, 1, [handler pointer is parameter])
1345 ])
1346 EXTRA_KCFLAGS="$tmp_flags"
1347 ]) # LC_HAVE_XATTR_HANDLER_SIMPLIFIED
1348
1349 #
1350 # LC_HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD
1351 #
1352 # 4.3 replace interval with interval_exp in 'struct blk_integrity'.
1353 #
1354 AC_DEFUN([LC_HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD], [
1355 LB_CHECK_COMPILE([if 'bio_integrity_payload.bip_iter' exist],
1356 bio_integrity_payload_bip_iter, [
1357         #include <linux/bio.h>
1358 ],[
1359         ((struct bio_integrity_payload *)0)->bip_iter.bi_size = 0;
1360 ],[
1361         AC_DEFINE(HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD, 1,
1362                 [bio_integrity_payload.bip_iter exist])
1363 ])
1364 ]) # LC_HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD
1365
1366 #
1367 # LC_BIO_INTEGRITY_PREP_FN
1368 #
1369 # Lustre kernel patch extents bio_integrity_prep to accept optional
1370 # generate/verify_fn as extra args.
1371 #
1372 AC_DEFUN([LC_BIO_INTEGRITY_PREP_FN], [
1373 LB_CHECK_COMPILE([if 'bio_integrity_prep_fn' exists],
1374 bio_integrity_prep_fn, [
1375         #include <linux/bio.h>
1376 ],[
1377         bio_integrity_prep_fn(NULL, NULL, NULL);
1378 ],[
1379         AC_DEFINE(HAVE_BIO_INTEGRITY_PREP_FN, 1,
1380                 [kernel has bio_integrity_prep_fn])
1381         AC_SUBST(PATCHED_INTEGRITY_INTF)
1382 ],[
1383         AC_SUBST(PATCHED_INTEGRITY_INTF, [#])
1384 ])
1385 ]) # LC_BIO_INTEGRITY_PREP_FN
1386
1387 # LC_BIO_INTEGRITY_PREP_FN_RETURNS_BOOL
1388 #
1389 # 13 kernel integrity API has changed and in 4.13+
1390 # (as well as in rhel 8.4) bio_integrity_prep() returns boolean true
1391 # on success.
1392 #
1393 AC_DEFUN([LC_BIO_INTEGRITY_PREP_FN_RETURNS_BOOL], [
1394 LB_CHECK_COMPILE([if 'bio_integrity_prep_fn' returns bool],
1395 bio_integrity_prep, [
1396        #include <linux/bio.h>
1397        #include <linux/typecheck.h>
1398 ],[
1399         #pragma GCC diagnostic warning "-Werror"
1400         typedef bool (*bio_integrity_prep_type)(struct bio *bio) ;
1401
1402         typecheck_fn(bio_integrity_prep_type, bio_integrity_prep);
1403 ],[
1404        AC_DEFINE(HAVE_BIO_INTEGRITY_PREP_FN_RETURNS_BOOL, 1,
1405                [bio_integrity_prep_fn returns bool])
1406 ])
1407 ]) # LC_BIO_INTEGRITY_PREP_FN_RETURNS_BOOL
1408
1409 #
1410 # LC_HAVE_BI_OPF
1411 #
1412 # 4.4/4.8 redefined bi_rw as bi_opf (SLES12/kernel commit 4382e33ad37486)
1413 #
1414 AC_DEFUN([LC_HAVE_BI_OPF], [
1415 LB_CHECK_COMPILE([if Linux kernel has bi_opf in struct bio],
1416 have_bi_opf, [
1417         #include <linux/bio.h>
1418 ],[
1419         struct bio bio;
1420
1421         bio.bi_opf = 0;
1422 ], [
1423         AC_DEFINE(HAVE_BI_OPF, 1,
1424                 [struct bio has bi_opf])
1425 ])
1426 ]) # LC_HAVE_BI_OPF
1427
1428 #
1429 # LC_HAVE_SUBMIT_BIO_2ARGS
1430 #
1431 # 4.4 removed an argument from submit_bio
1432 #
1433 AC_DEFUN([LC_HAVE_SUBMIT_BIO_2ARGS], [
1434 LB_CHECK_COMPILE([if submit_bio takes two arguments],
1435 have_submit_bio_2args, [
1436         #include <linux/bio.h>
1437 ],[
1438         struct bio bio;
1439         submit_bio(READ, &bio);
1440 ], [
1441         AC_DEFINE(HAVE_SUBMIT_BIO_2ARGS, 1,
1442                 [submit_bio takes two arguments])
1443 ])
1444 ]) # LC_HAVE_SUBMIT_BIO_2_ARGS
1445
1446 #
1447 # LC_HAVE_CLEAN_BDEV_ALIASES
1448 #
1449 # 4.4/4.9 unmap_underlying_metadata was replaced by clean_bdev_aliases
1450 # (SLES12/kernel commit 29f3ad7d8380364c)
1451 #
1452 AC_DEFUN([LC_HAVE_CLEAN_BDEV_ALIASES], [
1453 LB_CHECK_COMPILE([if kernel has clean_bdev_aliases],
1454 have_clean_bdev_aliases, [
1455         #include <linux/buffer_head.h>
1456 ],[
1457         clean_bdev_aliases(NULL,1,1);
1458 ], [
1459         AC_DEFINE(HAVE_CLEAN_BDEV_ALIASES, 1,
1460                 [kernel has clean_bdev_aliases])
1461 ])
1462 ]) # LC_HAVE_CLEAN_BDEV_ALIASES
1463
1464 #
1465 # LC_HAVE_LOCKS_LOCK_FILE_WAIT
1466 #
1467 # 4.4 kernel have moved locks API users to
1468 # locks_lock_inode_wait()
1469 #
1470 AC_DEFUN([LC_HAVE_LOCKS_LOCK_FILE_WAIT], [
1471 LB_CHECK_COMPILE([if 'locks_lock_file_wait' exists],
1472 locks_lock_file_wait, [
1473         #include <linux/fs.h>
1474 ],[
1475         locks_lock_file_wait(NULL, NULL);
1476 ],[
1477         AC_DEFINE(HAVE_LOCKS_LOCK_FILE_WAIT, 1,
1478                 [kernel has locks_lock_file_wait])
1479 ])
1480 ]) # LC_HAVE_LOCKS_LOCK_FILE_WAIT
1481
1482 #
1483 # LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
1484 #
1485 # 4.4 kernel merged type-specific data with the payload data for keys
1486 #
1487 AC_DEFUN([LC_HAVE_KEY_PAYLOAD_DATA_ARRAY], [
1488 LB_CHECK_COMPILE([if 'struct key' has 'payload.data' as an array],
1489 key_payload_data_array, [
1490         #include <linux/key.h>
1491 ],[
1492         struct key key = { };
1493
1494         key.payload.data[0] = NULL;
1495 ],[
1496         AC_DEFINE(HAVE_KEY_PAYLOAD_DATA_ARRAY, 1, [payload.data is an array])
1497 ])
1498 ]) #LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
1499
1500 #
1501 # LC_HAVE_XATTR_HANDLER_NAME
1502 #
1503 # Kernel version 4.4 commit 98e9cb5711c68223f0e4d5201b9a6add255ec550
1504 # add a name member to struct xattr_handler
1505 #
1506 AC_DEFUN([LC_HAVE_XATTR_HANDLER_NAME], [
1507 tmp_flags="$EXTRA_KCFLAGS"
1508 EXTRA_KCFLAGS="-Werror"
1509 LB_CHECK_COMPILE([if 'struct xattr_handler' has a name member],
1510 xattr_handler_name, [
1511         #include <linux/xattr.h>
1512 ],[
1513         ((struct xattr_handler *)NULL)->name = NULL;
1514 ],[
1515         AC_DEFINE(HAVE_XATTR_HANDLER_NAME, 1, [xattr_handler has a name member])
1516 ])
1517 EXTRA_KCFLAGS="$tmp_flags"
1518 ]) # LC_HAVE_XATTR_HANDLER_NAME
1519
1520 #
1521 # LC_HAVE_FILE_DENTRY
1522 #
1523 # 4.5 adds wrapper file_dentry
1524 #
1525 AC_DEFUN([LC_HAVE_FILE_DENTRY], [
1526 LB_CHECK_COMPILE([if Linux kernel has 'file_dentry'],
1527 file_dentry, [
1528         #include <linux/fs.h>
1529 ],[
1530         file_dentry(NULL);
1531 ], [
1532         AC_DEFINE(HAVE_FILE_DENTRY, 1,
1533                 [kernel has file_dentry])
1534 ])
1535 ]) # LC_HAVE_FILE_DENTRY
1536
1537 #
1538 # LC_HAVE_INODE_LOCK
1539 #
1540 # 4.5 introduced inode_lock
1541 #
1542 AC_DEFUN([LC_HAVE_INODE_LOCK], [
1543 LB_CHECK_COMPILE([if 'inode_lock' is defined],
1544 inode_lock, [
1545         #include <linux/fs.h>
1546 ],[
1547         inode_lock(NULL);
1548 ], [
1549         AC_DEFINE(HAVE_INODE_LOCK, 1,
1550                   [inode_lock is defined])
1551 ])
1552 ]) # LC_HAVE_INODE_LOCK
1553
1554 #
1555 # LC_HAVE_IOP_GET_LINK
1556 #
1557 # 4.5 vfs replaced iop->follow_link with
1558 # iop->get_link
1559 #
1560 AC_DEFUN([LC_HAVE_IOP_GET_LINK], [
1561 LB_CHECK_COMPILE([if 'iop' has 'get_link'],
1562 inode_ops_get_link, [
1563         #include <linux/fs.h>
1564 ],[
1565         struct inode_operations iop;
1566         iop.get_link = NULL;
1567 ],[
1568         AC_DEFINE(HAVE_IOP_GET_LINK, 1,
1569                 [have iop get_link])
1570 ])
1571 ]) # LC_HAVE_IOP_GET_LINK
1572
1573 #
1574 # LC_HAVE_IN_COMPAT_SYSCALL
1575 #
1576 # 4.6 renamed is_compat_task to in_compat_syscall
1577 #
1578 AC_DEFUN([LC_HAVE_IN_COMPAT_SYSCALL], [
1579 LB_CHECK_COMPILE([if 'in_compat_syscall' is defined],
1580 in_compat_syscall, [
1581         #include <linux/compat.h>
1582 ],[
1583         in_compat_syscall();
1584 ],[
1585         AC_DEFINE(HAVE_IN_COMPAT_SYSCALL, 1,
1586                 [have in_compat_syscall])
1587 ])
1588 ]) # LC_HAVE_IN_COMPAT_SYSCALL
1589
1590 #
1591 # LC_HAVE_XATTR_HANDLER_INODE_PARAM
1592 #
1593 # Kernel version 4.6 commit b296821a7c42fa58baa17513b2b7b30ae66f3336
1594 # and commit 5930122683dff58f0846b0f0405b4bd598a3ba6a added inode parameter
1595 # to xattr_handler functions
1596 #
1597 AC_DEFUN([LC_HAVE_XATTR_HANDLER_INODE_PARAM], [
1598 tmp_flags="$EXTRA_KCFLAGS"
1599 EXTRA_KCFLAGS="-Werror"
1600 LB_CHECK_COMPILE([if 'struct xattr_handler' functions have inode parameter],
1601 xattr_handler_inode_param, [
1602         #include <linux/xattr.h>
1603 ],[
1604         const struct xattr_handler handler;
1605
1606         ((struct xattr_handler *)0)->get(&handler, NULL, NULL, NULL, NULL, 0);
1607         ((struct xattr_handler *)0)->set(&handler, NULL, NULL, NULL, NULL, 0, 0);
1608 ],[
1609         AC_DEFINE(HAVE_XATTR_HANDLER_INODE_PARAM, 1, [needs inode parameter])
1610 ])
1611 EXTRA_KCFLAGS="$tmp_flags"
1612 ]) # LC_HAVE_XATTR_HANDLER_INODE_PARAM
1613
1614 #
1615 # LC_D_IN_LOOKUP
1616 #
1617 # Kernel version 4.6 commit 85c7f81041d57cfe9dc97f4680d5586b54534a39
1618 # introduced parallel lookups in the VFS layer. The inline function
1619 # d_in_lookup was added to notify when the same item was being queried
1620 # at the same time.
1621 #
1622 AC_DEFUN([LC_D_IN_LOOKUP], [
1623 tmp_flags="$EXTRA_KCFLAGS"
1624 EXTRA_KCFLAGS="-Werror"
1625 LB_CHECK_COMPILE([if 'd_in_lookup' is defined],
1626 d_in_lookup, [
1627         #include <linux/dcache.h>
1628 ],[
1629         d_in_lookup(NULL);
1630 ],[
1631         AC_DEFINE(HAVE_D_IN_LOOKUP, 1, [d_in_lookup is defined])
1632 ])
1633 EXTRA_KCFLAGS="$tmp_flags"
1634 ]) # LC_D_IN_LOOKUP
1635
1636 #
1637 # LC_LOCK_PAGE_MEMCG
1638 #
1639 # Kernel version 4.6 adds lock_page_memcg(page)
1640 # Linux commit v5.15-12273-gab2f9d2d3626
1641 #   mm: unexport {,un}lock_page_memcg
1642 #
1643 AC_DEFUN([LC_LOCK_PAGE_MEMCG], [
1644 LB_CHECK_COMPILE([if 'lock_page_memcg' is defined],
1645 lock_page_memcg, [
1646         #include <linux/memcontrol.h>
1647 ],[
1648         lock_page_memcg(NULL);
1649 ],[
1650         AC_DEFINE(HAVE_LOCK_PAGE_MEMCG, 1,
1651                 [lock_page_memcg is defined])
1652 ])
1653 ]) # LC_LOCK_PAGE_MEMCG
1654
1655 #
1656 # LC_HAVE_DOWN_WRITE_KILLABLE
1657 #
1658 # Kernel version v4.6-rc3-28-g916633a40370
1659 #
1660 AC_DEFUN([LC_HAVE_DOWN_WRITE_KILLABLE], [
1661 LB_CHECK_COMPILE([if down_write_killable exists],
1662 down_write_killable, [
1663         struct rw_semaphore sem;
1664         #include <linux/rwsem.h>
1665 ],[
1666         int rc;
1667
1668         rc = down_write_killable(&sem);
1669 ],[
1670         AC_DEFINE(HAVE_DOWN_WRITE_KILLABLE, 1,
1671                 [down_write_killable function exists])
1672 ])
1673 ]) # LC_HAVE_DOWN_WRITE_KILLABLE
1674
1675 #
1676 # LC_D_INIT
1677 #
1678 # Kernel version 4.7-rc5 commit 285b102d3b745f3c2c110c9c327741d87e64aacc
1679 # add new d_init to initialize dentry at allocation time
1680 #
1681 AC_DEFUN([LC_D_INIT], [
1682 LB_CHECK_COMPILE([if dentry operations supports 'd_init'],
1683 d_init, [
1684         #include <linux/dcache.h>
1685 ],[
1686         struct dentry_operations ops = { };
1687         int rc;
1688
1689         rc = ops.d_init(NULL);
1690 ],[
1691         AC_DEFINE(HAVE_D_INIT, 1, ['d_init' exists])
1692 ])
1693 ]) # LC_D_INIT
1694
1695 #
1696 # LC_DIRECTIO_2ARGS
1697 #
1698 # Kernel version 4.7 commit c8b8e32d700fe943a935e435ae251364d016c497
1699 # direct-io: eliminate the offset argument to ->direct_IO
1700 #
1701 AC_DEFUN([LC_DIRECTIO_2ARGS], [
1702 LB_CHECK_COMPILE([if '->direct_IO()' taken 2 arguments],
1703 direct_io_2args, [
1704         #include <linux/fs.h>
1705 ],[
1706         struct address_space_operations ops = { };
1707         struct iov_iter *iter = NULL;
1708         struct kiocb *iocb = NULL;
1709         int rc;
1710
1711         rc = ops.direct_IO(iocb, iter);
1712 ],[
1713         AC_DEFINE(HAVE_DIRECTIO_2ARGS, 1,
1714                 [direct_IO need 2 arguments])
1715 ])
1716 ]) # LC_DIRECTIO_2ARGS
1717
1718 #
1719 # LC_GENERIC_WRITE_SYNC_2ARGS
1720 #
1721 # Kernel version 4.7 commit dde0c2e79848298cc25621ad080d47f94dbd7cce
1722 # fs: add IOCB_SYNC and IOCB_DSYNC
1723 #
1724 AC_DEFUN([LC_GENERIC_WRITE_SYNC_2ARGS], [
1725 LB_CHECK_COMPILE([if 'generic_write_sync()' taken 2 arguments],
1726 generic_write_sync_2args, [
1727         #include <linux/fs.h>
1728 ],[
1729         struct kiocb *iocb = NULL;
1730         ssize_t rc;
1731
1732         rc = generic_write_sync(iocb, 0);
1733 ],[
1734         AC_DEFINE(HAVE_GENERIC_WRITE_SYNC_2ARGS, 1,
1735                 [generic_write_sync need 2 arguments])
1736 ])
1737 ]) # LC_GENERIC_WRITE_SYNC_2ARGS
1738
1739 #
1740 # LC_FOP_ITERATE_SHARED
1741 #
1742 # Kernel v4.6-rc3-29-g6192269 adds iterate_shared method to file_operations
1743 #
1744 AC_DEFUN([LC_FOP_ITERATE_SHARED], [
1745 LB_CHECK_COMPILE([if 'file_operations' has 'iterate_shared'],
1746 fop_iterate_shared, [
1747         #include <linux/fs.h>
1748 ],[
1749         struct file_operations fop;
1750         fop.iterate_shared = NULL;
1751 ],[
1752         AC_DEFINE(HAVE_FOP_ITERATE_SHARED, 1,
1753                 [file_operations has iterate_shared])
1754 ])
1755 ]) # LC_FOP_ITERATE_SHARED
1756
1757 #
1758 # LC_EXPORT_DEFAULT_FILE_SPLICE_READ
1759 #
1760 # 4.8-rc8 commit 82c156f853840645604acd7c2cebcb75ed1b6652 switched
1761 # generic_file_splice_read() to using ->read_iter. We can test this
1762 # change since default_file_splice_read() is no longer exported.
1763 #
1764 AC_DEFUN([LC_EXPORT_DEFAULT_FILE_SPLICE_READ], [
1765 LB_CHECK_EXPORT([default_file_splice_read], [fs/splice.c],
1766         [AC_DEFINE(HAVE_DEFAULT_FILE_SPLICE_READ_EXPORT, 1,
1767                         [default_file_splice_read is exported])])
1768 ]) # LC_EXPORT_DEFAULT_FILE_SPLCE_READ
1769
1770 #
1771 # LC_HAVE_POSIX_ACL_VALID_USER_NS
1772 #
1773 # 4.8 posix_acl_valid takes struct user_namespace
1774 #
1775 AC_DEFUN([LC_HAVE_POSIX_ACL_VALID_USER_NS], [
1776 LB_CHECK_COMPILE([if 'posix_acl_valid' takes 'struct user_namespace'],
1777 posix_acl_valid, [
1778         #include <linux/fs.h>
1779         #include <linux/posix_acl.h>
1780 ],[
1781         posix_acl_valid((struct user_namespace*)NULL, (const struct posix_acl*)NULL);
1782 ],[
1783         AC_DEFINE(HAVE_POSIX_ACL_VALID_USER_NS, 1,
1784                 [posix_acl_valid takes struct user_namespace])
1785 ])
1786 ]) # LC_HAVE_POSIX_ACL_VALID_USER_NS
1787
1788 #
1789 # LC_D_COMPARE_4ARGS
1790 #
1791 # Kernel version 4.8 commit 6fa67e707559303e086303aeecc9e8b91ef497d5
1792 # get rid of 'parent' argument of ->d_compare()
1793 #
1794 AC_DEFUN([LC_D_COMPARE_4ARGS], [
1795 LB_CHECK_COMPILE([if 'd_compare' taken 4 arguments],
1796 d_compare_4args, [
1797         #include <linux/dcache.h>
1798 ],[
1799         ((struct dentry_operations*)0)->d_compare(NULL,0,NULL,NULL);
1800 ],[
1801         AC_DEFINE(HAVE_D_COMPARE_4ARGS, 1,
1802                 [d_compare need 4 arguments])
1803 ])
1804 ]) # LC_D_COMPARE_4ARGS
1805
1806 #
1807 # LC_FULL_NAME_HASH_3ARGS
1808 #
1809 # Kernel version 4.8 commit 8387ff2577eb9ed245df9a39947f66976c6bcd02
1810 # vfs: make the string hashes salt the hash
1811 #
1812 AC_DEFUN([LC_FULL_NAME_HASH_3ARGS], [
1813 LB_CHECK_COMPILE([if 'full_name_hash' taken 3 arguments],
1814 full_name_hash_3args, [
1815         #include <linux/stringhash.h>
1816 ],[
1817         unsigned int hash;
1818         hash = full_name_hash(NULL,NULL,0);
1819 ],[
1820         AC_DEFINE(HAVE_FULL_NAME_HASH_3ARGS, 1,
1821                 [full_name_hash need 3 arguments])
1822 ])
1823 ]) # LC_FULL_NAME_HASH_3ARGS
1824
1825 #
1826 # LC_STRUCT_POSIX_ACL_XATTR
1827 #
1828 # Kernel version 4.8 commit 2211d5ba5c6c4e972ba6dbc912b2897425ea6621
1829 # posix_acl: xattr representation cleanups
1830 #
1831 AC_DEFUN([LC_STRUCT_POSIX_ACL_XATTR], [
1832 LB_CHECK_COMPILE([if 'struct posix_acl_xattr_{header,entry}' defined],
1833 struct_posix_acl_xattr, [
1834         #include <linux/fs.h>
1835         #include <linux/posix_acl_xattr.h>
1836 ],[
1837         struct posix_acl_xattr_header *h = NULL;
1838         struct posix_acl_xattr_entry  *e;
1839         e = (void *)(h + 1);
1840 ],[
1841         AC_DEFINE(HAVE_STRUCT_POSIX_ACL_XATTR, 1,
1842                 [struct posix_acl_xattr_{header,entry} defined])
1843 ])
1844 ]) # LC_STRUCT_POSIX_ACL_XATTR
1845
1846 #
1847 # LC_IOP_XATTR
1848 #
1849 # Kernel version 4.8 commit fd50ecaddf8372a1d96e0daeaac0f93cf04e4d42
1850 # removed {get,set,remove}xattr inode operations
1851 #
1852 AC_DEFUN([LC_IOP_XATTR], [
1853 LB_CHECK_COMPILE([if 'inode_operations' has {get,set,remove}xattr members],
1854 inode_ops_xattr, [
1855         #include <linux/fs.h>
1856 ],[
1857         struct inode_operations iop;
1858         iop.setxattr = NULL;
1859         iop.getxattr = NULL;
1860         iop.removexattr = NULL;
1861 ],[
1862         AC_DEFINE(HAVE_IOP_XATTR, 1,
1863                 [inode_operations has {get,set,remove}xattr members])
1864 ])
1865 ]) # LC_IOP_XATTR
1866
1867 #
1868 # LC_GROUP_INFO_GID
1869 #
1870 # Kernel version 4.9 commit 81243eacfa400f5f7b89f4c2323d0de9982bb0fb
1871 # cred: simpler, 1D supplementary groups
1872 #
1873 AC_DEFUN([LC_GROUP_INFO_GID], [
1874 LB_CHECK_COMPILE([if 'struct group_info' has member 'gid'],
1875 group_info_gid, [
1876         #include <linux/cred.h>
1877 ],[
1878         kgid_t *p;
1879         p = ((struct group_info *)0)->gid;
1880 ],[
1881         AC_DEFINE(HAVE_GROUP_INFO_GID, 1,
1882                 [struct group_info has member gid])
1883 ])
1884 ]) # LC_GROUP_INFO_GID
1885
1886 #
1887 # LC_VFS_SETXATTR
1888 #
1889 # Kernel version 4.9 commit 5d6c31910bc0713e37628dc0ce677dcb13c8ccf4
1890 # added __vfs_{get,set,remove}xattr helpers
1891 #
1892 AC_DEFUN([LC_VFS_SETXATTR], [
1893 LB_CHECK_COMPILE([if '__vfs_setxattr' helper is available],
1894 vfs_setxattr, [
1895         #include <linux/xattr.h>
1896 ],[
1897         __vfs_setxattr(NULL, NULL, NULL, NULL, 0, 0);
1898 ],[
1899         AC_DEFINE(HAVE_VFS_SETXATTR, 1,
1900                 ['__vfs_setxattr' is available])
1901 ])
1902 ]) # LC_VFS_SETXATTR
1903
1904 #
1905 # LC_POSIX_ACL_UPDATE_MODE
1906 #
1907 # Kernel version 4.9 commit 073931017b49d9458aa351605b43a7e34598caef
1908 # posix_acl: Clear SGID bit when setting file permissions
1909 #
1910 AC_DEFUN([LC_POSIX_ACL_UPDATE_MODE], [
1911 LB_CHECK_COMPILE([if 'posix_acl_update_mode' exists],
1912 posix_acl_update_mode, [
1913         #include <linux/fs.h>
1914         #include <linux/posix_acl.h>
1915 ],[
1916         posix_acl_update_mode(NULL, NULL, NULL);
1917 ],[
1918         AC_DEFINE(HAVE_POSIX_ACL_UPDATE_MODE, 1,
1919                 ['posix_acl_update_mode' is available])
1920 ])
1921 ]) # LC_POSIX_ACL_UPDATE_MODE
1922
1923 #
1924 # LC_HAVE_BDI_IO_PAGES
1925 #
1926 # Kernel version 4.9 commit 9491ae4aade6814afcfa67f4eb3e3342c2b39750
1927 # mm: don't cap request size based on read-ahead setting
1928 # This patch introduces a bdi hint, io_pages.
1929 #
1930 AC_DEFUN([LC_HAVE_BDI_IO_PAGES], [
1931 LB_CHECK_COMPILE([if 'struct backing_dev_info' has 'io_pages' field],
1932 bdi_has_io_pages, [
1933         #include <linux/backing-dev.h>
1934 ],[
1935         struct backing_dev_info info;
1936
1937         info.io_pages = 0;
1938 ],[
1939         AC_DEFINE(HAVE_BDI_IO_PAGES, 1,
1940                 [backing_dev_info has io_pages])
1941 ])
1942 ]) # LC_HAVE_BDI_IO_PAGES
1943
1944 #
1945 # LC_IOP_GENERIC_READLINK
1946 #
1947 # Kernel version 4.10 commit dfeef68862edd7d4bafe68ef7aeb5f658ef24bb5
1948 # removed generic_readlink from individual file systems
1949 #
1950 AC_DEFUN([LC_IOP_GENERIC_READLINK], [
1951 LB_CHECK_COMPILE([if 'generic_readlink' still exist],
1952 inode_ops_readlink, [
1953         #include <linux/fs.h>
1954 ],[
1955         struct inode_operations iop;
1956         iop.readlink = generic_readlink;
1957 ],[
1958         AC_DEFINE(HAVE_IOP_GENERIC_READLINK, 1,
1959                 [generic_readlink has been removed])
1960 ])
1961 ]) # LC_IOP_GENERIC_READLINK
1962
1963 #
1964 # LC_HAVE_VM_FAULT_ADDRESS
1965 #
1966 # Kernel version 4.10 commit 1a29d85eb0f19b7d8271923d8917d7b4f5540b3e
1967 # removed virtual_address field. Need to use address field instead
1968 #
1969 AC_DEFUN([LC_HAVE_VM_FAULT_ADDRESS], [
1970 LB_CHECK_COMPILE([if 'struct vm_fault' replaced virtual_address with address field],
1971 vm_fault_address, [
1972         #include <linux/mm.h>
1973 ],[
1974                 struct vm_fault vmf = { 0 };
1975                 unsigned long addr = (unsigned long)vmf.address;
1976                 (void)addr;
1977 ],[
1978         AC_DEFINE(HAVE_VM_FAULT_ADDRESS, 1,
1979                 [virtual_address has been replaced by address field])
1980 ])
1981 ]) # LC_HAVE_VM_FAULT_ADDRESS
1982
1983 #
1984 # LC_INODEOPS_ENHANCED_GETATTR
1985 #
1986 # Kernel version 4.11 commit a528d35e8bfcc521d7cb70aaf03e1bd296c8493f
1987 # expanded getattr to be able to get more stat information.
1988 #
1989 AC_DEFUN([LC_INODEOPS_ENHANCED_GETATTR], [
1990 LB_CHECK_COMPILE([if 'inode_operations' getattr member can gather advance stats],
1991 getattr_path, [
1992         #include <linux/fs.h>
1993 ],[
1994         struct path path;
1995
1996         ((struct inode_operations *)1)->getattr(&path, NULL, 0, 0);
1997 ],[
1998         AC_DEFINE(HAVE_INODEOPS_ENHANCED_GETATTR, 1,
1999                 [inode_operations .getattr member function can gather advance stats])
2000 ])
2001 ]) # LC_INODEOPS_ENHANCED_GETATTR
2002
2003 #
2004 # LC_VM_OPERATIONS_REMOVE_VMF_ARG
2005 #
2006 # Kernel version 4.11 commit 11bac80004499ea59f361ef2a5516c84b6eab675
2007 # removed struct vm_area_struct as an argument for vm_operations since
2008 # in the same kernel version struct vma_area_struct was folded into
2009 # struct vm_fault.
2010 #
2011 AC_DEFUN([LC_VM_OPERATIONS_REMOVE_VMF_ARG], [
2012 LB_CHECK_COMPILE([if 'struct vm_operations' removed struct vm_area_struct],
2013 vm_operations_no_vm_area_struct, [
2014         #include <linux/mm.h>
2015 ],[
2016         struct vm_fault vmf;
2017
2018         ((struct vm_operations_struct *)0)->fault(&vmf);
2019         ((struct vm_operations_struct *)0)->page_mkwrite(&vmf);
2020 ],[
2021         AC_DEFINE(HAVE_VM_OPS_USE_VM_FAULT_ONLY, 1,
2022                 ['struct vm_operations' remove struct vm_area_struct argument])
2023 ])
2024 ]) # LC_VM_OPERATIONS_REMOVE_VMF_ARG
2025
2026 #
2027 # LC_HAVE_KEY_USAGE_REFCOUNT
2028 #
2029 # Kernel version 4.11 commit fff292914d3a2f1efd05ca71c2ba72a3c663201e
2030 # converted key.usage from atomic_t to refcount_t.
2031 #
2032 AC_DEFUN([LC_HAVE_KEY_USAGE_REFCOUNT], [
2033 LB_CHECK_COMPILE([if 'key.usage' is refcount_t],
2034 key_usage_refcount, [
2035         #include <linux/key.h>
2036 ],[
2037         struct key key = { };
2038
2039         refcount_read(&key.usage);
2040 ],[
2041         AC_DEFINE(HAVE_KEY_USAGE_REFCOUNT, 1, [key.usage is of type refcount_t])
2042 ])
2043 ]) #LC_HAVE_KEY_USAGE_REFCOUNT
2044
2045 #
2046 # LC_HAVE_CRYPTO_MAX_ALG_NAME_128
2047 #
2048 # Kernel version 4.11 commit f437a3f477cce402dbec6537b29e9e33962c9f73
2049 # switched CRYPTO_MAX_ALG_NAME from 64 to 128.
2050 #
2051 AC_DEFUN([LC_HAVE_CRYPTO_MAX_ALG_NAME_128], [
2052 LB_CHECK_COMPILE([if 'CRYPTO_MAX_ALG_NAME' is 128],
2053 crypto_max_alg_name, [
2054         #include <linux/crypto.h>
2055 ],[
2056         #if CRYPTO_MAX_ALG_NAME != 128
2057         exit(1);
2058         #endif
2059 ],[
2060         AC_DEFINE(HAVE_CRYPTO_MAX_ALG_NAME_128, 1,
2061                 ['CRYPTO_MAX_ALG_NAME' is 128])
2062 ])
2063 ]) # LC_HAVE_CRYPTO_MAX_ALG_NAME_128
2064
2065 #
2066 # Kernel version 4.12 commit 47f38c539e9a42344ff5a664942075bd4df93876
2067 # CURRENT_TIME is not 64 bit time safe so it was replaced with
2068 # current_time()
2069 #
2070 AC_DEFUN([LC_CURRENT_TIME], [
2071 LB_CHECK_COMPILE([if CURRENT_TIME has been replaced with current_time],
2072 current_time, [
2073         #include <linux/fs.h>
2074 ],[
2075         struct iattr attr;
2076
2077         attr.ia_atime = current_time(NULL);
2078 ],[
2079         AC_DEFINE(HAVE_CURRENT_TIME, 1,
2080                 [current_time() has replaced CURRENT_TIME])
2081 ])
2082 ]) # LIBCFS_CURRENT_TIME
2083
2084 #
2085 # LC_HAVE_GET_INODE_USAGE
2086 #
2087 # Kernel version v4.12-rc2-43-g7a9ca53aea10
2088 #
2089 AC_DEFUN([LC_HAVE_GET_INODE_USAGE], [
2090 LB_CHECK_COMPILE([if get_inode_usage exists],
2091 get_inode_usage, [
2092         struct inode;
2093         #include <linux/quota.h>
2094 ],[
2095         struct dquot_operations ops = { };
2096
2097         ops.get_inode_usage(NULL, NULL);
2098 ],[
2099         AC_DEFINE(HAVE_GET_INODE_USAGE, 1,
2100                 [get_inode_usage function exists])
2101 ])
2102 ]) # LC_HAVE_GET_INODE_USAGE
2103
2104
2105 #
2106 # Kernel version 4.12-rc3 85787090a21eb749d8b347eaf9ff1a455637473c
2107 # changed struct super_block s_uuid into a proper uuid_t
2108 #
2109 AC_DEFUN([LC_SUPER_BLOCK_S_UUID], [
2110 LB_CHECK_COMPILE([if 'struct super_block' s_uuid is uuid_t],
2111 super_block_s_uuid, [
2112         #include <linux/fs.h>
2113 ],[
2114         struct super_block sb;
2115
2116         uuid_parse(NULL, &sb.s_uuid);
2117 ],[
2118         AC_DEFINE(HAVE_S_UUID_AS_UUID_T, 1, ['s_uuid' is an uuid_t])
2119 ])
2120 ]) # LC_SUPER_BLOCK_S_UUID
2121
2122 #
2123 # LC_SUPER_SETUP_BDI_NAME
2124 #
2125 # Kernel version 4.12 commit 9594caf216dc0fe3e318b34af0127276db661241
2126 # unified bdi handling
2127 #
2128 AC_DEFUN([LC_SUPER_SETUP_BDI_NAME], [
2129 LB_CHECK_COMPILE([if 'super_setup_bdi_name' exist],
2130 super_setup_bdi_name, [
2131         #include <linux/fs.h>
2132 ],[
2133         super_setup_bdi_name(NULL, "lustre");
2134 ],[
2135         AC_DEFINE(HAVE_SUPER_SETUP_BDI_NAME, 1,
2136                 ['super_setup_bdi_name' is available])
2137 ])
2138 ]) # LC_SUPER_SETUP_BDI_NAME
2139
2140 #
2141 # LC_BI_STATUS
2142 #
2143 # 4.12 replace bi_error to bi_status
2144 #
2145 AC_DEFUN([LC_BI_STATUS], [
2146 LB_CHECK_COMPILE([if 'bi_status' exist],
2147 bi_status, [
2148         #include <linux/blk_types.h>
2149 ],[
2150         ((struct bio *)0)->bi_status = 0;
2151 ],[
2152         AC_DEFINE(HAVE_BI_STATUS, 1,
2153                 ['bi_status' is available])
2154 ])
2155 ]) # LC_BI_STATUS
2156
2157 #
2158 # LC_BIO_INTEGRITY_ENABLED
2159 #
2160 # 4.13 removed bio_integrity_enabled
2161 #
2162 AC_DEFUN([LC_BIO_INTEGRITY_ENABLED], [
2163 LB_CHECK_COMPILE([if 'bio_integrity_enabled' exist],
2164 bio_integrity_enabled, [
2165         #include <linux/bio.h>
2166 ],[
2167         bio_integrity_enabled(NULL);
2168 ],[
2169         AC_DEFINE(HAVE_BIO_INTEGRITY_ENABLED, 1,
2170                 ['bio_integrity_enabled' is available])
2171 ])
2172 ]) # LC_BIO_INTEGRITY_ENABLED
2173
2174 #
2175 # LC_PAGEVEC_INIT_ONE_PARAM
2176 #
2177 # 4.14 pagevec_init takes one parameter
2178 #
2179 AC_DEFUN([LC_PAGEVEC_INIT_ONE_PARAM], [
2180 LB_CHECK_COMPILE([if 'pagevec_init' takes one parameter],
2181 pagevec_init, [
2182         #include <linux/pagevec.h>
2183 ],[
2184         pagevec_init(NULL);
2185 ],[
2186         AC_DEFINE(HAVE_PAGEVEC_INIT_ONE_PARAM, 1,
2187                 ['pagevec_init' takes one parameter])
2188 ])
2189 ]) # LC_PAGEVEC_INIT_ONE_PARAM
2190
2191 #
2192 # LC_BI_BDEV
2193 #
2194 # 4.14 replaced bi_bdev to bi_disk
2195 #
2196 AC_DEFUN([LC_BI_BDEV], [
2197 LB_CHECK_COMPILE([if 'bi_bdev' exist],
2198 bi_bdev, [
2199         #include <linux/bio.h>
2200 ],[
2201         ((struct bio *)0)->bi_bdev = NULL;
2202 ],[
2203         AC_DEFINE(HAVE_BI_BDEV, 1,
2204                 ['bi_bdev' is available])
2205 ])
2206 ]) # LC_BI_BDEV
2207
2208 #
2209 # LC_INTERVAL_TREE_CACHED
2210 #
2211 # 4.14 f808c13fd3738948e10196496959871130612b61
2212 # switched INTERVAL_TREE_DEFINE to use cached RB_Trees.
2213 #
2214 AC_DEFUN([LC_INTERVAL_TREE_CACHED], [
2215 tmp_flags="$EXTRA_KCFLAGS"
2216 EXTRA_KCFLAGS="-Werror"
2217 LB_CHECK_COMPILE([if interval_trees use rb_tree_cached],
2218 itree_cached, [
2219         #include <linux/interval_tree_generic.h>
2220         struct foo { struct rb_node rb; int last; int a,b;};
2221         #define START(n) ((n)->a)
2222         #define LAST(n) ((n)->b)
2223         struct rb_root_cached tree;
2224         INTERVAL_TREE_DEFINE(struct foo, rb, int, last,
2225                 START, LAST, , foo);
2226 ],[
2227         foo_insert(NULL, &tree);
2228 ],[
2229         AC_DEFINE(HAVE_INTERVAL_TREE_CACHED, 1,
2230                 [interval trees use rb_tree_cached])
2231 ])
2232 EXTRA_KCFLAGS="$tmp_flags"
2233 ]) # LC_INTERVAL_TREE_CACHED
2234
2235 #
2236 # LC_IS_ENCRYPTED
2237 #
2238 # 4.14 introduced IS_ENCRYPTED and S_ENCRYPTED
2239 #
2240 AC_DEFUN([LC_IS_ENCRYPTED], [
2241 LB_CHECK_COMPILE([if IS_ENCRYPTED is defined],
2242 is_encrypted, [
2243         #include <linux/fs.h>
2244 ],[
2245         IS_ENCRYPTED((struct inode *)0);
2246 ],[
2247         has_is_encrypted="yes"
2248 ])
2249 ]) # LC_IS_ENCRYPTED
2250
2251 #
2252 # LC_I_PAGES
2253 #
2254 # kernel 4.17 commit b93b016313b3ba8003c3b8bb71f569af91f19fc7
2255 #
2256 AC_DEFUN([LC_I_PAGES], [
2257 LB_CHECK_COMPILE([if struct address_space has i_pages],
2258 i_pages, [
2259         #include <linux/fs.h>
2260 ],[
2261         struct address_space mapping = {};
2262         void *i_pages;
2263
2264         i_pages = &mapping.i_pages;
2265 ],[
2266         AC_DEFINE(HAVE_I_PAGES, 1,
2267                 [struct address_space has i_pages])
2268 ])
2269 ]) # LC_I_PAGES
2270
2271 #
2272 # LC_VM_FAULT_T
2273 #
2274 # kernel 4.17 commit 3d3539018d2cbd12e5af4a132636ee7fd8d43ef0
2275 # mm: create the new vm_fault_t type
2276 #
2277 AC_DEFUN([LC_VM_FAULT_T], [
2278 LB_CHECK_COMPILE([if vm_fault_t type exists],
2279 vm_fault_t, [
2280         #include <linux/mm_types.h>
2281 ],[
2282         vm_fault_t x = VM_FAULT_SIGBUS;
2283         (void)x
2284 ],[
2285         AC_DEFINE(HAVE_VM_FAULT_T, 1,
2286                 [if vm_fault_t type exists])
2287 ])
2288 ]) # LC_VM_FAULT_T
2289
2290 #
2291 # LC_VM_FAULT_RETRY
2292 #
2293 # kernel 4.17 commit 3d3539018d2cbd12e5af4a132636ee7fd8d43ef0
2294 # mm: VM_FAULT_RETRY is defined in enum vm_fault_reason
2295 #
2296 AC_DEFUN([LC_VM_FAULT_RETRY], [
2297 LB_CHECK_COMPILE([if VM_FAULT_RETRY is defined],
2298 VM_FAULT_RETRY, [
2299         #include <linux/mm.h>
2300 ],[
2301         #ifndef VM_FAULT_RETRY
2302                 vm_fault_t x;
2303                 x = VM_FAULT_RETRY;
2304         #endif
2305 ],[
2306         AC_DEFINE(HAVE_VM_FAULT_RETRY, 1,
2307                 [if VM_FAULT_RETRY is defined])
2308 ])
2309 ]) # LC_VM_FAULT_RETRY
2310
2311 #
2312 # LC_ALLOC_FILE_PSEUDO
2313 #
2314 # kernel 4.18-rc1 commit d93aa9d82aea80b80f225dbf9c7986df444d8106
2315 # new wrapper: alloc_file_pseudo()
2316 #
2317 AC_DEFUN([LC_ALLOC_FILE_PSEUDO], [
2318 LB_CHECK_COMPILE([if 'alloc_file_pseudo' is defined],
2319 alloc_file_pseudo, [
2320         #include <linux/file.h>
2321 ],[
2322         struct file *file;
2323         file = alloc_file_pseudo(NULL, NULL, "[test]",
2324                                  00000002, NULL);
2325 ],[
2326         AC_DEFINE(HAVE_ALLOC_FILE_PSEUDO, 1,
2327                 ['alloc_file_pseudo' exist])
2328 ])
2329 ]) # LC_ALLOC_FILE_PSEUDO
2330
2331 #
2332 # LC_INODE_TIMESPEC64
2333 #
2334 # kernel 4.17-rc7 commit 8efd6894ff089adeeac7cb9f32125b85d963d1bc
2335 # fs: add timespec64_truncate()
2336 # kernel 4.18 commit 95582b00838837fc07e042979320caf917ce3fe6
2337 # inode timestamps switched to timespec64
2338 # kernel 4.19-rc2 commit 976516404ff3fab2a8caa8bd6f5efc1437fed0b8
2339 # y2038: remove unused time interfaces
2340 # ...
2341 #  timespec_trunc
2342 # ...
2343 # When inode times are timespec64 stop using the deprecated
2344 # time interfaces.
2345 #
2346 # kernel v5.5-rc1-6-gba70609d5ec6 ba70609d5ec664a8f36ba1c857fcd97a478adf79
2347 # fs: Delete timespec64_trunc()
2348 #
2349 AC_DEFUN([LC_INODE_TIMESPEC64], [
2350 tmp_flags="$EXTRA_KCFLAGS"
2351 EXTRA_KCFLAGS="-Werror"
2352 LB_CHECK_COMPILE([if inode timestamps are struct timespec64],
2353 inode_timespec64, [
2354         #include <linux/fs.h>
2355 ],[
2356         struct inode *inode = NULL;
2357         struct timespec64 ts = {0, 1};
2358
2359         inode->i_atime = ts;
2360         (void)inode;
2361 ],[
2362         AC_DEFINE(HAVE_INODE_TIMESPEC64, 1,
2363                 [inode times are using timespec64])
2364 ])
2365 EXTRA_KCFLAGS="$tmp_flags"
2366 ]) # LC_INODE_TIMESPEC64
2367
2368 #
2369 # LC_RADIX_TREE_TAG_SET
2370 #
2371 # kernel 4.20 commit v4.19-rc5-248-g9b89a0355144
2372 # xarray: Add XArray marks - replaced radix_tree_tag_set
2373 #
2374 AC_DEFUN([LC_RADIX_TREE_TAG_SET], [
2375 tmp_flags="$EXTRA_KCFLAGS"
2376 EXTRA_KCFLAGS="-Werror"
2377 LB_CHECK_COMPILE([if 'radix_tree_tag_set' exists],
2378 radix_tree_tag_set, [
2379         #include <linux/fs.h>
2380         #include <linux/radix-tree.h>
2381 ],[
2382         radix_tree_tag_set(NULL, 0, PAGECACHE_TAG_DIRTY);
2383 ],[
2384         AC_DEFINE(HAVE_RADIX_TREE_TAG_SET, 1,
2385                 [radix_tree_tag_set exists])
2386 ])
2387 EXTRA_KCFLAGS="$tmp_flags"
2388 ]) # LC_RADIX_TREE_TAG_SET
2389
2390 #
2391 # LC_UAPI_LINUX_MOUNT_H
2392 #
2393 # kernel 4.20 commit e262e32d6bde0f77fb0c95d977482fc872c51996
2394 # vfs: Suppress MS_* flag defs within the kernel ...
2395 #
2396 AC_DEFUN([LC_UAPI_LINUX_MOUNT_H], [
2397 tmp_flags="$EXTRA_KCFLAGS"
2398 EXTRA_KCFLAGS="-Werror"
2399 LB_CHECK_COMPILE([if MS_RDONLY was moved to uapi/linux/mount.h],
2400 uapi_linux_mount, [
2401         #include <uapi/linux/mount.h>
2402 ],[
2403         int x = MS_RDONLY;
2404         (void)x;
2405 ],[
2406         AC_DEFINE(HAVE_UAPI_LINUX_MOUNT_H, 1,
2407                 [if MS_RDONLY was moved to uapi/linux/mount.h])
2408 ])
2409 EXTRA_KCFLAGS="$tmp_flags"
2410 ]) # LC_UAPI_LINUX_MOUNT_H
2411
2412 #
2413 # LC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK
2414 #
2415 # kernel 4.20 commit 1863d77f15da0addcd293a1719fa5d3ef8cde3ca
2416 # SUNRPC: Replace the cache_detail->hash_lock with a regular spinlock
2417 #
2418 # Now that the reader functions are all RCU protected, use a regular
2419 # spinlock rather than a reader/writer lock.
2420 #
2421 AC_DEFUN([LC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK], [
2422 tmp_flags="$EXTRA_KCFLAGS"
2423 EXTRA_KCFLAGS="-Werror"
2424 LB_CHECK_COMPILE([if cache_detail->hash_lock is a spinlock],
2425 hash_lock_isa_spinlock_t, [
2426         #include <linux/sunrpc/cache.h>
2427 ],[
2428         spinlock_t *lock = &(((struct cache_detail *)0)->hash_lock);
2429         spin_lock(lock);
2430 ],[
2431         AC_DEFINE(HAVE_CACHE_HASH_SPINLOCK, 1,
2432                 [if cache_detail->hash_lock is a spinlock])
2433 ])
2434 EXTRA_KCFLAGS="$tmp_flags"
2435 ]) # LC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK
2436
2437 #
2438 # LC_HAS_LINUX_SELINUX_ENABLED
2439 #
2440 # kernel 5.1 commit 3d252529480c68bfd6a6774652df7c8968b28e41
2441 # SELinux: Remove unused selinux_is_enabled
2442 #
2443 AC_DEFUN([LC_HAS_LINUX_SELINUX_ENABLED], [
2444 tmp_flags="$EXTRA_KCFLAGS"
2445 EXTRA_KCFLAGS="-Werror"
2446 LB_CHECK_COMPILE([if linux/selinux.h exists],
2447 selinux_is_enabled, [
2448         #include <linux/selinux.h>
2449 ],[
2450         bool has_selinux = selinux_is_enabled();
2451         (void)has_selinux;
2452 ],[
2453         AC_DEFINE(HAVE_LINUX_SELINUX_IS_ENABLED, 1,
2454                 [if linux/selinux.h exists])
2455 ])
2456 EXTRA_KCFLAGS="$tmp_flags"
2457 ]) # LC_HAS_LINUX_SELINUX_ENABLED
2458
2459 #
2460 # LB_HAVE_BVEC_ITER_ALL
2461 #
2462 # kernel 5.1 commit 6dc4f100c175dd0511ae8674786e7c9006cdfbfa
2463 # block: allow bio_for_each_segment_all() to iterate over multi-page bvec
2464 #
2465 AC_DEFUN([LB_HAVE_BVEC_ITER_ALL], [
2466 tmp_flags="$EXTRA_KCFLAGS"
2467 EXTRA_KCFLAGS="-Werror"
2468 LB_CHECK_COMPILE([if bvec_iter_all exists for multi-page bvec iternation],
2469 ext4fs_dirhash, [
2470         #include <linux/bvec.h>
2471 ],[
2472         struct bvec_iter_all iter;
2473         (void)iter;
2474 ],[
2475         AC_DEFINE(HAVE_BVEC_ITER_ALL, 1,
2476                 [if bvec_iter_all exists for multi-page bvec iternation])
2477 ])
2478 EXTRA_KCFLAGS="$tmp_flags"
2479 ]) # LB_HAVE_BVEC_ITER_ALL
2480
2481 #
2482 # LC_ACCOUNT_PAGE_DIRTIED
2483 #
2484 # After 5.2 kernel page dirtied is not exported
2485 #
2486 AC_DEFUN([LC_ACCOUNT_PAGE_DIRTIED], [
2487 LB_CHECK_EXPORT([account_page_dirtied], [mm/page-writeback.c],
2488         [AC_DEFINE(HAVE_ACCOUNT_PAGE_DIRTIED_EXPORT, 1,
2489                         [account_page_dirtied is exported])])
2490 ]) # LC_ACCOUNT_PAGE_DIRTIED
2491
2492 #
2493 # LC_KEYRING_SEARCH_4ARGS
2494 #
2495 # Kernel 5.2 commit dcf49dbc8077
2496 # keys: Add a 'recurse' flag for keyring searches
2497 #
2498 AC_DEFUN([LC_KEYRING_SEARCH_4ARGS], [
2499 LB_CHECK_COMPILE([if 'keyring_search' has 4 args],
2500 keyring_search_4args, [
2501         #include <linux/key.h>
2502 ],[
2503         key_ref_t keyring;
2504         keyring_search(keyring, NULL, NULL, false);
2505 ],[
2506         AC_DEFINE(HAVE_KEYRING_SEARCH_4ARGS, 1,
2507                 [keyring_search has 4 args])
2508 ])
2509 ]) # LC_KEYRING_SEARCH_4ARGS
2510
2511 #
2512 # LC_BIO_BI_PHYS_SEGMENTS
2513 #
2514 # kernel 5.3-rc1 commit 14ccb66b3f585b2bc21e7256c96090abed5a512c
2515 # block: remove the bi_phys_segments field in struct bio
2516 #
2517 AC_DEFUN([LC_BIO_BI_PHYS_SEGMENTS], [
2518 tmp_flags="$EXTRA_KCFLAGS"
2519 EXTRA_KCFLAGS="-Werror"
2520 LB_CHECK_COMPILE([if struct bio has bi_phys_segments member],
2521 bye_bio_bi_phys_segments, [
2522         #include <linux/bio.h>
2523 ],[
2524         struct bio *bio = NULL;
2525         bio->bi_phys_segments++;
2526 ],[
2527         AC_DEFINE(HAVE_BIO_BI_PHYS_SEGMENTS, 1,
2528                 [struct bio has bi_phys_segments member])
2529 ])
2530 EXTRA_KCFLAGS="$tmp_flags"
2531 ]) # LC_BIO_BI_PHYS_SEGMENTS
2532
2533 #
2534 # LC_LM_COMPARE_OWNER_EXISTS
2535 #
2536 # kernel 5.3-rc3 commit f85d93385e9fe6886a751f647f6812a89bf6bee3
2537 # locks: Cleanup lm_compare_owner and lm_owner_key
2538 # removed lm_compare_owner
2539 #
2540 AC_DEFUN([LC_LM_COMPARE_OWNER_EXISTS], [
2541 tmp_flags="$EXTRA_KCFLAGS"
2542 EXTRA_KCFLAGS="-Werror"
2543 LB_CHECK_COMPILE([if lock_manager_operations has lm_compare_owner],
2544 lock_manager_ops_lm_compare_owner, [
2545         #include <linux/fs.h>
2546 ],[
2547         struct lock_manager_operations lm_ops;
2548         lm_ops.lm_compare_owner = NULL;
2549 ],[
2550         AC_DEFINE(HAVE_LM_COMPARE_OWNER, 1,
2551                 [lock_manager_operations has lm_compare_owner])
2552 ])
2553 EXTRA_KCFLAGS="$tmp_flags"
2554 ]) # LC_LM_COMPARE_OWNER_EXISTS
2555
2556 #
2557 # LC_FSCRYPT_SUPPORT
2558 #
2559 # 5.4 introduced fscrypt encryption policies v2
2560 #
2561 AC_DEFUN([LC_FSCRYPT_SUPPORT], [
2562 LB_CHECK_COMPILE([for fscrypt in-kernel support],
2563 fscrypt_support, [
2564         #define __FS_HAS_ENCRYPTION 0
2565         #include <linux/fscrypt.h>
2566 ],[
2567         fscrypt_ioctl_get_policy_ex(NULL, NULL);
2568 ],[
2569         has_fscrypt_support="yes"
2570 ])
2571 ]) # LC_FSCRYPT_SUPPORT
2572
2573 #
2574 # LC_FSCRYPT_DIGESTED_NAME
2575 #
2576 # Kernel 5.5-rc4 edc440e3d27fb31e6f9663cf413fad97d714c060
2577 # improved the format of no-key names. This results in the
2578 # removal of FSCRYPT_FNAME_DIGEST and FSCRYPT_FNAME_DIGEST_SIZE.
2579 #
2580 AC_DEFUN([LC_FSCRYPT_DIGESTED_NAME], [
2581 tmp_flags="$EXTRA_KCFLAGS"
2582 EXTRA_KCFLAGS="-Werror"
2583 LB_CHECK_COMPILE([if fscrypt has 'struct fscrypt_digested_name'],
2584 fscrypt_digested_name, [
2585         #include <linux/fscrypt.h>
2586 ],[
2587         struct fscrypt_digested_name fname;
2588
2589         fname.hash = 0;
2590 ],[
2591         AC_DEFINE(HAVE_FSCRYPT_DIGESTED_NAME, 1,
2592                 ['struct fscrypt_digested_name' exists])
2593 ])
2594 EXTRA_KCFLAGS="$tmp_flags"
2595 ]) # LC_FSCRYPT_DIGESTED_NAME
2596
2597 #
2598 # LC_FSCRYPT_DUMMY_CONTEXT_ENABLED
2599 #
2600 # Kernel 5.7-rc7 ed318a6cc0b620440e65f48eb527dc3df7269ce4
2601 # replaces fscrypt_dummy_context_enabled() with
2602 # fscrypt_get_dummy_context(). Later kernels rename
2603 # fscrypt_get_dummy_context() to fscrypt_get_dummy_policy()
2604 # which is why we test fscrypt_dummy_context_enabled().
2605 #
2606 AC_DEFUN([LC_FSCRYPT_DUMMY_CONTEXT_ENABLED], [
2607 tmp_flags="$EXTRA_KCFLAGS"
2608 EXTRA_KCFLAGS="-Werror"
2609 LB_CHECK_COMPILE([if fscrypt_dummy_context_enabled() exists],
2610 fscrypt_dummy_context_enabled, [
2611         #include <linux/fscrypt.h>
2612 ],[
2613         fscrypt_dummy_context_enabled(NULL);
2614 ],[
2615         AC_DEFINE(HAVE_FSCRYPT_DUMMY_CONTEXT_ENABLED, 1,
2616                 [fscrypt_dummy_context_enabled() exists])
2617 ])
2618 EXTRA_KCFLAGS="$tmp_flags"
2619 ]) # LC_FSCRYPT_DUMMY_CONTEXT_ENABLED
2620
2621 #
2622 # LC_HAVE_ITER_FILE_SPLICE_WRITE
2623 #
2624 # Linux commit v5.9-rc1-6-g36e2c7421f02
2625 #  fs: don't allow splice read/write without explicit ops
2626 #
2627 AC_DEFUN([LC_HAVE_ITER_FILE_SPLICE_WRITE], [
2628 tmp_flags="$EXTRA_KCFLAGS"
2629 EXTRA_KCFLAGS="-Werror"
2630 LB_CHECK_COMPILE([if 'iter_file_splice_write' exists],
2631 iter_file_splice_write, [
2632         #include <linux/fs.h>
2633 ],[
2634         (void)iter_file_splice_write(NULL, NULL, NULL, 1, 0);
2635 ],[
2636         AC_DEFINE(HAVE_ITER_FILE_SPLICE_WRITE, 1,
2637                 ['iter_file_splice_write' exists])
2638 ])
2639 EXTRA_KCFLAGS="$tmp_flags"
2640 ]) # LC_HAVE_ITER_FILE_SPLICE_WRITE
2641
2642 #
2643 # LC_FSCRYPT_IS_NOKEY_NAME
2644 #
2645 # Kernel 5.10-rc4 159e1de201b6fca10bfec50405a3b53a561096a8
2646 # introduced fscrypt_is_nokey_name() inline macro. While
2647 # introduced for 5.10 kernels it was backported to earlier
2648 # Ubuntu kernels. Also it hides the change introduced due
2649 # to git commit 501e43fbe for kernel 5.9 which also was
2650 # backported to earlier Ubuntu kernels.
2651 #
2652 AC_DEFUN([LC_FSCRYPT_IS_NOKEY_NAME], [
2653 tmp_flags="$EXTRA_KCFLAGS"
2654 EXTRA_KCFLAGS="-Werror"
2655 LB_CHECK_COMPILE([if fscrypt_is_nokey_name() exists],
2656 fscrypt_is_no_key_name, [
2657         #include <linux/fscrypt.h>
2658 ],[
2659         fscrypt_is_nokey_name(NULL);
2660 ],[
2661         AC_DEFINE(HAVE_FSCRYPT_IS_NOKEY_NAME, 1,
2662                 [fscrypt_is_nokey_name() exists])
2663 ])
2664 EXTRA_KCFLAGS="$tmp_flags"
2665 ]) # LC_FSCRYPT_IS_NOKEY_NAME
2666
2667 #
2668 # LC_BIO_SET_DEV
2669 #
2670 # Linux: v5.11-rc5-9-g309dca309fc3
2671 #   block: store a block_device pointer in struct bio
2672 # created bio_set_dev macro
2673 # Linux: v5.15-rc6-127-gcf6d6238cdd3
2674 #   block: turn macro helpers into inline functions
2675 # created inline function(s).
2676 #
2677 # Only provide a bio_set_dev it is is not proveded by the kernel
2678 #
2679 AC_DEFUN([LC_BIO_SET_DEV], [
2680 tmp_flags="$EXTRA_KCFLAGS"
2681 EXTRA_KCFLAGS="-Werror"
2682         LB_CHECK_COMPILE([if 'bio_set_dev' is available],
2683         [bio_set_dev], [
2684                 #include <linux/bio.h>
2685         ],[
2686                 struct bio *bio = NULL;
2687                 struct block_device *bdev = NULL;
2688
2689                 bio_set_dev(bio, bdev);
2690         ],[
2691                 AC_DEFINE(HAVE_BIO_SET_DEV, 1, ['bio_set_dev' is available])
2692         ])
2693 EXTRA_KCFLAGS="$tmp_flags"
2694 ]) # LC_BIO_SET_DEV
2695
2696 #
2697 # LC_HAVE_USER_NAMESPACE_ARG
2698 #
2699 # kernel 5.12 commit 549c7297717c32ee53f156cd949e055e601f67bb
2700 # fs: make helpers idmap mount aware
2701 # Extend some inode methods with an additional user namespace argument.
2702 #
2703 AC_DEFUN([LC_HAVE_USER_NAMESPACE_ARG], [
2704 tmp_flags="$EXTRA_KCFLAGS"
2705 EXTRA_KCFLAGS="-Werror"
2706 LB_CHECK_COMPILE([if 'inode_operations' members have user namespace argument],
2707 user_namespace_argument, [
2708         #include <linux/fs.h>
2709 ],[
2710         ((struct inode_operations *)1)->getattr((struct user_namespace *)NULL,
2711                                                 NULL, NULL, 0, 0);
2712 ],[
2713         AC_DEFINE(HAVE_USER_NAMESPACE_ARG, 1,
2714                 ['inode_operations' members have user namespace argument])
2715 ])
2716 EXTRA_KCFLAGS="$tmp_flags"
2717 ]) # LC_HAVE_USER_NAMESPACE_ARG
2718
2719 #
2720 # LC_HAVE_GET_ACL_RCU_ARG
2721 #
2722 # kernel 5.15 commit 0cad6246621b5887d5b33fea84219d2a71f2f99a
2723 # vfs: add rcu argument to ->get_acl() callback
2724 # Add a rcu argument to the ->get_acl() callback to allow
2725 # get_cached_acl_rcu() to call the ->get_acl() method.
2726 #
2727 AC_DEFUN([LC_HAVE_GET_ACL_RCU_ARG], [
2728 tmp_flags="$EXTRA_KCFLAGS"
2729 EXTRA_KCFLAGS="-Werror"
2730 LB_CHECK_COMPILE([if 'get_acl' has a rcu argument],
2731 get_acl_rcu_argument, [
2732         #include <linux/fs.h>
2733 ],[
2734         ((struct inode_operations *)1)->get_acl((struct inode *)NULL, 0, false);
2735 ],[
2736         AC_DEFINE(HAVE_GET_ACL_RCU_ARG, 1,
2737                 ['get_acl' has a rcu argument])
2738 ])
2739 EXTRA_KCFLAGS="$tmp_flags"
2740 ]) # LC_HAVE_GET_ACL_RCU_ARG
2741
2742 #
2743 # LC_HAVE_SECURITY_DENTRY_INIT_WITH_XATTR_NAME_ARG
2744 #
2745 # Linux v5.15-rc1-20-g15bf32398ad4
2746 # security: Return xattr name from security_dentry_init_security()
2747 #
2748 AC_DEFUN([LC_HAVE_SECURITY_DENTRY_INIT_WITH_XATTR_NAME_ARG], [
2749 tmp_flags="$EXTRA_KCFLAGS"
2750 EXTRA_KCFLAGS="-Werror"
2751 LB_CHECK_COMPILE([if security_dentry_init_security() returns xattr name],
2752 security_dentry_init_security_xattr_name_arg, [
2753         #include <linux/security.h>
2754 ],[
2755         struct dentry *dentry = NULL;
2756         int mode = 0;
2757         const struct qstr *name = NULL;
2758         const char *xattr_name = NULL;
2759         void **ctx = NULL;
2760         u32 *ctxlen = 0;
2761         int rc = security_dentry_init_security(dentry, mode, name, &xattr_name,
2762                                                ctx, ctxlen);
2763         (void)rc;
2764
2765 ],[
2766         AC_DEFINE(HAVE_SECURITY_DENTRY_INIT_WITH_XATTR_NAME_ARG, 1,
2767                 [security_dentry_init_security() returns xattr name])
2768 ])
2769 EXTRA_KCFLAGS="$tmp_flags"
2770 ]) # LC_HAVE_SECURITY_DENTRY_INIT_WITH_XATTR_NAME_ARG
2771
2772 #
2773 # LC_HAVE_KIOCB_COMPLETE_2ARGS
2774 #
2775 # kernel v5.15-rc6-145-g6b19b766e8f0
2776 # fs: get rid of the res2 iocb->ki_complete argument
2777 #
2778 AC_DEFUN([LC_HAVE_KIOCB_COMPLETE_2ARGS], [
2779 tmp_flags="$EXTRA_KCFLAGS"
2780 EXTRA_KCFLAGS="-Werror"
2781 LB_CHECK_COMPILE([if kiocb->ki_complete() has 2 arguments],
2782 kiocb_ki_complete_2args, [
2783         #include <linux/fs.h>
2784
2785         static void complete_fn(struct kiocb *iocb, long ret)
2786         {
2787                 (void)iocb;
2788                 (void)ret;
2789         }
2790 ],[
2791         struct kiocb *kio = NULL;
2792
2793         kio->ki_complete = complete_fn;
2794 ],[
2795         AC_DEFINE(HAVE_KIOCB_COMPLETE_2ARGS, 1,
2796                 [kiocb->ki_complete() has 2 arguments])
2797 ])
2798 EXTRA_KCFLAGS="$tmp_flags"
2799 ]) # LC_HAVE_KIOCB_COMPLETE_2ARGS
2800
2801 AC_DEFUN([LC_PROG_LINUX_SRC], [])
2802 AC_DEFUN([LC_PROG_LINUX_RESULTS], [])
2803
2804 #
2805 # LC_PROG_LINUX
2806 #
2807 # Lustre linux kernel checks
2808 #
2809 AC_DEFUN([LC_PROG_LINUX], [
2810         AC_MSG_NOTICE([Lustre kernel checks
2811 ==============================================================================])
2812
2813         LC_CONFIG_PINGER
2814         LC_CONFIG_CHECKSUM
2815         LC_CONFIG_FLOCK
2816         LC_CONFIG_HEALTH_CHECK_WRITE
2817         LC_CONFIG_LRU_RESIZE
2818         LC_CONFIG_FHANDLE
2819         LC_CONFIG_GSS
2820
2821         # 3.10
2822         LC_HAVE_PROJECT_QUOTA
2823
2824         # 3.11
2825         LC_INVALIDATE_RANGE
2826         LC_HAVE_DIR_CONTEXT
2827         LC_D_COMPARE_5ARGS
2828         LC_HAVE_DCOUNT
2829         LC_HAVE_DENTRY_D_U_D_ALIAS
2830         LC_HAVE_DENTRY_D_CHILD
2831         LC_PID_NS_FOR_CHILDREN
2832
2833         # 3.12
2834         LC_OLDSIZE_TRUNCATE_PAGECACHE
2835         LC_PTR_ERR_OR_ZERO_MISSING
2836         LC_KIOCB_KI_LEFT
2837         LC_REGISTER_SHRINKER_RET
2838
2839         # 3.13
2840         LC_VFS_RENAME_5ARGS
2841         LC_VFS_UNLINK_3ARGS
2842         LC_HAVE_D_IS_POSITIVE
2843
2844         # 3.14
2845         LC_HAVE_BVEC_ITER
2846         LC_HAVE_TRUNCATE_IPAGES_FINAL
2847         LC_IOPS_RENAME_WITH_FLAGS
2848         LC_IOP_SET_ACL
2849
2850         # 3.15
2851         LC_VFS_RENAME_6ARGS
2852
2853         # 3.16
2854         LC_DIRECTIO_USE_ITER
2855         LC_HAVE_IOV_ITER_INIT_DIRECTION
2856         LC_HAVE_IOV_ITER_TRUNCATE
2857         LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER
2858
2859         # 3.17
2860         LC_HAVE_INTERVAL_BLK_INTEGRITY
2861         LC_KEY_MATCH_DATA
2862
2863         # 3.18
2864         LC_PERCPU_COUNTER_INIT
2865         LC_NFS_FILLDIR_USE_CTX
2866
2867         # 3.19
2868         LC_KIOCB_HAS_NBYTES
2869         LC_HAVE_DQUOT_QC_DQBLK
2870         LC_HAVE_AIO_COMPLETE
2871         LC_HAVE_IS_ROOT_INODE
2872
2873         # 3.20
2874         LC_BACKING_DEV_INFO_REMOVAL
2875         LC_HAVE_BDI_CAP_MAP_COPY
2876
2877         # 4.1.0
2878         LC_IOV_ITER_RW
2879         LC_HAVE_SYNC_READ_WRITE
2880         LC_HAVE___BI_CNT
2881
2882         # 4.2
2883         LC_BIO_ENDIO_USES_ONE_ARG
2884         LC_SYMLINK_OPS_USE_NAMEIDATA
2885         LC_ACCOUNT_PAGE_DIRTIED_3ARGS
2886         LC_HAVE_CRYPTO_ALLOC_SKCIPHER
2887
2888         # 4.3
2889         LC_HAVE_INTERVAL_EXP_BLK_INTEGRITY
2890         LC_HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD
2891         LC_HAVE_CACHE_HEAD_HLIST
2892         LC_HAVE_XATTR_HANDLER_SIMPLIFIED
2893
2894         # 4.4
2895         LC_HAVE_LOCKS_LOCK_FILE_WAIT
2896         LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
2897         LC_HAVE_XATTR_HANDLER_NAME
2898         LC_HAVE_BI_OPF
2899         LC_HAVE_SUBMIT_BIO_2ARGS
2900         LC_HAVE_CLEAN_BDEV_ALIASES
2901
2902         # 4.5
2903         LC_HAVE_FILE_DENTRY
2904
2905         # 4.5
2906         LC_HAVE_INODE_LOCK
2907         LC_HAVE_IOP_GET_LINK
2908
2909         # 4.6
2910         LC_HAVE_IN_COMPAT_SYSCALL
2911         LC_HAVE_XATTR_HANDLER_INODE_PARAM
2912         LC_LOCK_PAGE_MEMCG
2913         LC_HAVE_DOWN_WRITE_KILLABLE
2914
2915         # 4.7
2916         LC_D_IN_LOOKUP
2917         LC_D_INIT
2918         LC_DIRECTIO_2ARGS
2919         LC_GENERIC_WRITE_SYNC_2ARGS
2920         LC_FOP_ITERATE_SHARED
2921
2922         # 4.8
2923         LC_EXPORT_DEFAULT_FILE_SPLICE_READ
2924         LC_HAVE_POSIX_ACL_VALID_USER_NS
2925         LC_D_COMPARE_4ARGS
2926         LC_FULL_NAME_HASH_3ARGS
2927         LC_STRUCT_POSIX_ACL_XATTR
2928         LC_IOP_XATTR
2929
2930         # 4.9
2931         LC_GROUP_INFO_GID
2932         LC_VFS_SETXATTR
2933         LC_POSIX_ACL_UPDATE_MODE
2934         LC_HAVE_BDI_IO_PAGES
2935
2936         # 4.10
2937         LC_IOP_GENERIC_READLINK
2938         LC_HAVE_VM_FAULT_ADDRESS
2939
2940         # 4.11
2941         LC_INODEOPS_ENHANCED_GETATTR
2942         LC_VM_OPERATIONS_REMOVE_VMF_ARG
2943         LC_HAVE_KEY_USAGE_REFCOUNT
2944         LC_HAVE_CRYPTO_MAX_ALG_NAME_128
2945
2946         # 4.12
2947         LC_CURRENT_TIME
2948         LC_SUPER_BLOCK_S_UUID
2949         LC_SUPER_SETUP_BDI_NAME
2950         LC_BI_STATUS
2951
2952         # 4.13
2953         LC_BIO_INTEGRITY_ENABLED
2954         LC_BIO_INTEGRITY_PREP_FN_RETURNS_BOOL
2955         LC_HAVE_GET_INODE_USAGE
2956
2957         # 4.14
2958         LC_PAGEVEC_INIT_ONE_PARAM
2959         LC_BI_BDEV
2960         LC_INTERVAL_TREE_CACHED
2961
2962         # 4.17
2963         LC_VM_FAULT_T
2964         LC_VM_FAULT_RETRY
2965         LC_I_PAGES
2966
2967         # 4.18
2968         LC_ALLOC_FILE_PSEUDO
2969         LC_INODE_TIMESPEC64
2970
2971         # 4.20
2972         LC_RADIX_TREE_TAG_SET
2973         LC_UAPI_LINUX_MOUNT_H
2974         LC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK
2975
2976         # 5.1
2977         LC_HAS_LINUX_SELINUX_ENABLED
2978         LB_HAVE_BVEC_ITER_ALL
2979
2980         # 5.2
2981         LC_ACCOUNT_PAGE_DIRTIED
2982         LC_KEYRING_SEARCH_4ARGS
2983
2984         # 5.3
2985         LC_BIO_BI_PHYS_SEGMENTS
2986         LC_LM_COMPARE_OWNER_EXISTS
2987
2988         # 5.5
2989         LC_FSCRYPT_DIGESTED_NAME
2990
2991         # 5.7
2992         LC_FSCRYPT_DUMMY_CONTEXT_ENABLED
2993
2994         # 5.9
2995         LC_HAVE_ITER_FILE_SPLICE_WRITE
2996
2997         # 5.10
2998         LC_FSCRYPT_IS_NOKEY_NAME
2999
3000         # 5.11
3001         LC_BIO_SET_DEV
3002
3003         # 5.12
3004         LC_HAVE_USER_NAMESPACE_ARG
3005
3006         # 5.15
3007         LC_HAVE_GET_ACL_RCU_ARG
3008
3009         # 5.16
3010         LC_HAVE_SECURITY_DENTRY_INIT_WITH_XATTR_NAME_ARG
3011         LC_HAVE_KIOCB_COMPLETE_2ARGS
3012
3013         # kernel patch to extend integrity interface
3014         LC_BIO_INTEGRITY_PREP_FN
3015
3016         #
3017         AS_IF([test "x$enable_server" != xno], [
3018                 LC_STACK_SIZE
3019                 LC_QUOTA_CONFIG
3020         ])
3021         LC_POSIX_ACL_CONFIG
3022 ]) # LC_PROG_LINUX
3023
3024 #
3025 # LC_CONFIG_CLIENT
3026 #
3027 # Check whether to build the client side of Lustre
3028 #
3029 AC_DEFUN([LC_CONFIG_CLIENT], [
3030 AC_MSG_CHECKING([whether to build Lustre client support])
3031 AC_ARG_ENABLE([client],
3032         AS_HELP_STRING([--disable-client],
3033                 [disable Lustre client support]),
3034         [], [enable_client="yes"])
3035 AC_MSG_RESULT([$enable_client])
3036 ]) # LC_CONFIG_CLIENT
3037
3038 #
3039 # --enable-mpitests
3040 #
3041 AC_DEFUN([LB_CONFIG_MPITESTS], [
3042 AC_ARG_ENABLE([mpitests],
3043         AS_HELP_STRING([--enable-mpitests=<yes|no|mpicc wrapper>],
3044                        [include mpi tests]), [
3045                 enable_mpitests="yes"
3046                 case $enableval in
3047                 yes)
3048                         MPICC_WRAPPER="mpicc"
3049                         MPI_BIN=$(eval which $MPICC_WRAPPER | xargs dirname)
3050                         ;;
3051                 no)
3052                         enable_mpitests="no"
3053                         MPI_BIN=""
3054                         ;;
3055                 *)
3056                         MPICC_WRAPPER=$enableval
3057                         MPI_BIN=$(eval echo $MPICC_WRAPPER | xargs dirname)
3058                         ;;
3059                 esac
3060         ], [
3061                 enable_mpitests="yes"
3062                 MPICC_WRAPPER="mpicc"
3063                 MPI_BIN=$(eval which $MPICC_WRAPPER | xargs dirname)
3064         ])
3065
3066         if test "x$enable_mpitests" != "xno"; then
3067                 oldcc=$CC
3068                 CC=$MPICC_WRAPPER
3069                 AC_CACHE_CHECK([whether mpitests can be built],
3070                 lb_cv_mpi_tests, [AC_COMPILE_IFELSE([AC_LANG_SOURCE([
3071                         #include <mpi.h>
3072                         int main(void) {
3073                                 int flag;
3074                                 MPI_Initialized(&flag);
3075                                 return 0;
3076                         }
3077                 ])], [lb_cv_mpi_tests="yes"], [lb_cv_mpi_tests="no"])
3078                 ])
3079                 enable_mpitests=$lb_cv_mpi_tests
3080                 CC=$oldcc
3081         fi
3082         AC_SUBST(MPI_BIN)
3083         AC_SUBST(MPICC_WRAPPER)
3084 ]) # LB_CONFIG_MPITESTS
3085
3086 #
3087 # LC_CONFIG_QUOTA
3088 #
3089 # whether to enable quota support global control
3090 #
3091 AC_DEFUN([LC_CONFIG_QUOTA], [
3092 AC_MSG_CHECKING([whether to enable quota support global control])
3093 AC_ARG_ENABLE([quota],
3094         AS_HELP_STRING([--enable-quota],
3095                 [enable quota support]),
3096         [], [enable_quota="yes"])
3097 AS_IF([test "x$enable_quota" = xyes],
3098         [AC_MSG_RESULT([yes])],
3099         [AC_MSG_RESULT([no])])
3100 ]) # LC_CONFIG_QUOTA
3101
3102 #
3103 # LC_QUOTA
3104 #
3105 AC_DEFUN([LC_QUOTA], [
3106 #check global
3107 LC_CONFIG_QUOTA
3108 #check for utils
3109 AS_IF([test "x$enable_quota" != xno -a "x$enable_utils" != xno], [
3110         AC_CHECK_HEADER([sys/quota.h],
3111                 [AC_DEFINE(HAVE_SYS_QUOTA_H, 1,
3112                         [Define to 1 if you have <sys/quota.h>.])],
3113                 [AC_MSG_ERROR([don't find <sys/quota.h> in your system])])
3114 ])
3115 ]) # LC_QUOTA
3116
3117 #
3118 # LC_OSD_ADDON
3119 #
3120 # configure support for optional OSD implementation
3121 #
3122 AC_DEFUN([LC_OSD_ADDON], [
3123 AC_MSG_CHECKING([whether to use OSD addon])
3124 AC_ARG_WITH([osd],
3125         AS_HELP_STRING([--with-osd=path],
3126                 [set path to optional osd]),
3127         [
3128         case "$with_osd" in
3129         no)
3130                 ENABLEOSDADDON=0
3131                 ;;
3132         *)
3133                 OSDADDON="$with_osd"
3134                 ENABLEOSDADDON=1
3135                 ;;
3136         esac
3137         ], [
3138                 ENABLEOSDADDON=0
3139         ])
3140 AS_IF([test $ENABLEOSDADDON -eq 0], [
3141         AC_MSG_RESULT([no])
3142         OSDADDON=""
3143 ], [
3144         OSDMODNAME=$(basename $OSDADDON)
3145         AS_IF([test -e $LUSTRE/$OSDMODNAME], [
3146                 AC_MSG_RESULT([can't link])
3147                 OSDADDON=""
3148         ], [ln -s $OSDADDON $LUSTRE/$OSDMODNAME], [
3149                 AC_MSG_RESULT([$OSDMODNAME])
3150                 OSDADDON="obj-m += $OSDMODNAME/"
3151         ], [
3152                 AC_MSG_RESULT([can't link])
3153                 OSDADDON=""
3154         ])
3155 ])
3156 AC_SUBST(OSDADDON)
3157 ]) # LC_OSD_ADDON
3158
3159 #
3160 # LC_CONFIG_CRYPTO
3161 #
3162 # Check whether to enable Lustre client crypto
3163 #
3164 AC_DEFUN([LC_CONFIG_CRYPTO], [
3165 AC_MSG_CHECKING([whether to enable Lustre client crypto])
3166 AC_ARG_ENABLE([crypto],
3167         AS_HELP_STRING([--enable-crypto=yes|no|in-kernel],
3168                 [enable Lustre client crypto (default is yes), use 'in-kernel' to force use of in-kernel fscrypt instead of embedded llcrypt]),
3169         [], [enable_crypto="auto"])
3170 AS_IF([test "x$enable_crypto" != xno -a "x$enable_dist" = xno], [
3171         AC_MSG_RESULT(
3172         )
3173         LC_IS_ENCRYPTED
3174         LC_FSCRYPT_SUPPORT])
3175 AS_IF([test "x$enable_crypto" = xin-kernel], [
3176         AS_IF([test "x$has_fscrypt_support" = xyes], [
3177               AC_DEFINE(HAVE_LUSTRE_CRYPTO, 1, [Enable Lustre client crypto via in-kernel fscrypt])], [
3178               AC_MSG_ERROR([Lustre client crypto cannot be enabled via in-kernel fscrypt.])
3179               enable_crypto=no])],
3180         [AS_IF([test "x$has_is_encrypted" = xyes], [
3181               AC_DEFINE(HAVE_LUSTRE_CRYPTO, 1, [Enable Lustre client crypto via embedded llcrypt])
3182               AC_DEFINE(CONFIG_LL_ENCRYPTION, 1, [embedded llcrypt])
3183               AC_DEFINE(HAVE_FSCRYPT_DUMMY_CONTEXT_ENABLED, 1, [embedded llcrypt uses llcrypt_dummy_context_enabled()])
3184               enable_crypto="embedded-llcrypt"
3185               enable_llcrypt=yes], [
3186               AS_IF([test "x$enable_crypto" = xyes],
3187                     [AC_MSG_ERROR([Lustre client crypto cannot be enabled because of lack of encryption support in your kernel.])])
3188               AS_IF([test "x$enable_crypto" != xno -a "x$enable_dist" = xno],
3189                     [AC_MSG_WARN(Lustre client crypto cannot be enabled because of lack of encryption support in your kernel.)])
3190               enable_crypto=no])])
3191 AS_IF([test "x$enable_dist" != xno], [
3192         enable_crypto=yes
3193         enable_llcrypt=yes])
3194 AC_MSG_RESULT([$enable_crypto])
3195 ]) # LC_CONFIG_CRYPTO
3196
3197 #
3198 # LC_CONFIGURE
3199 #
3200 # other configure checks
3201 #
3202 AC_DEFUN([LC_CONFIGURE], [
3203 AC_MSG_NOTICE([Lustre core checks
3204 ==============================================================================])
3205
3206 AS_IF([test $target_cpu == "i686" -o $target_cpu == "x86_64"],
3207         [CFLAGS="$CFLAGS -Wall -Werror"])
3208
3209 # maximum MDS thread count
3210 LC_MDS_MAX_THREADS
3211
3212 # lustre/utils/gss/gss_util.c
3213 # lustre/utils/gss/gssd_proc.c
3214 # lustre/utils/gss/krb5_util.c
3215 # lustre/utils/llog_reader.c
3216 # lustre/utils/create_iam.c
3217 # lustre/utils/libiam.c
3218 AC_CHECK_HEADERS([netdb.h endian.h])
3219 AC_CHECK_FUNCS([gethostbyname])
3220
3221 # lustre/utils/llverfs.c lustre/utils/libmount_utils_ldiskfs.c
3222 AC_CHECK_HEADERS([ext2fs/ext2fs.h], [], [
3223         AS_IF([test "x$enable_utils" = xyes -a "x$enable_ldiskfs" = xyes], [
3224                 AC_MSG_ERROR([
3225 ext2fs.h not found. Please install e2fsprogs development package.
3226                 ])
3227         ])
3228 ])
3229
3230 # lustre/tests/statx_test.c
3231 AC_CHECK_FUNCS([statx])
3232
3233 # lustre/utils/lfs.c
3234 AS_IF([test "$enable_dist" = "no"], [
3235                 AC_CHECK_LIB([z], [crc32], [
3236                                  AC_CHECK_HEADER([zlib.h], [], [
3237                                                  AC_MSG_ERROR([zlib.h not found.])])
3238                                  ], [
3239                                  AC_MSG_ERROR([
3240                 zlib library not found. Please install zlib development package.])
3241                 ])
3242 ])
3243
3244 SELINUX=""
3245
3246 AC_CHECK_LIB([selinux], [is_selinux_enabled],
3247         [AC_CHECK_HEADERS([selinux/selinux.h],
3248                         [SELINUX="-lselinux"
3249                         AC_DEFINE([HAVE_SELINUX], 1,
3250                                 [support for selinux ])],
3251                         [AC_MSG_WARN([
3252
3253 No libselinux-devel package found, unable to build selinux enabled tools
3254 ])
3255 ])],
3256         [AC_MSG_WARN([
3257
3258 No selinux package found, unable to build selinux enabled tools
3259 ])
3260 ])
3261 AC_SUBST(SELINUX)
3262
3263 AC_CHECK_LIB([keyutils], [add_key])
3264
3265 # Super safe df
3266 AC_MSG_CHECKING([whether to report minimum OST free space])
3267 AC_ARG_ENABLE([mindf],
3268         AS_HELP_STRING([--enable-mindf],
3269                 [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
3270         [], [enable_mindf="no"])
3271 AC_MSG_RESULT([$enable_mindf])
3272 AS_IF([test "$enable_mindf" = "yes"],
3273         [AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])])
3274
3275 AC_MSG_CHECKING([whether to randomly failing memory alloc])
3276 AC_ARG_ENABLE([fail_alloc],
3277         AS_HELP_STRING([--disable-fail-alloc],
3278                 [disable randomly alloc failure]),
3279         [], [enable_fail_alloc="yes"])
3280 AC_MSG_RESULT([$enable_fail_alloc])
3281 AS_IF([test "x$enable_fail_alloc" != xno],
3282         [AC_DEFINE([RANDOM_FAIL_ALLOC], 1,
3283                 [enable randomly alloc failure])])
3284
3285 AC_MSG_CHECKING([whether to check invariants (expensive cpu-wise)])
3286 AC_ARG_ENABLE([invariants],
3287         AS_HELP_STRING([--enable-invariants],
3288                 [enable invariant checking (cpu intensive)]),
3289         [], [enable_invariants="no"])
3290 AC_MSG_RESULT([$enable_invariants])
3291 AS_IF([test "x$enable_invariants" = xyes],
3292         [AC_DEFINE([CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK], 1,
3293                 [enable invariant checking])])
3294
3295 AC_MSG_CHECKING([whether to track references with lu_ref])
3296 AC_ARG_ENABLE([lu_ref],
3297         AS_HELP_STRING([--enable-lu_ref],
3298                 [enable lu_ref reference tracking code]),
3299         [], [enable_lu_ref="no"])
3300 AC_MSG_RESULT([$enable_lu_ref])
3301 AS_IF([test "x$enable_lu_ref" = xyes],
3302         [AC_DEFINE([CONFIG_LUSTRE_DEBUG_LU_REF], 1,
3303                 [enable lu_ref reference tracking code])])
3304
3305 AC_MSG_CHECKING([whether to enable page state tracking])
3306 AC_ARG_ENABLE([pgstate-track],
3307         AS_HELP_STRING([--enable-pgstate-track],
3308                 [enable page state tracking]),
3309         [], [enable_pgstat_track="no"])
3310 AC_MSG_RESULT([$enable_pgstat_track])
3311 AS_IF([test "x$enable_pgstat_track" = xyes],
3312         [AC_DEFINE([CONFIG_DEBUG_PAGESTATE_TRACKING], 1,
3313                 [enable page state tracking code])])
3314
3315 PKG_PROG_PKG_CONFIG
3316 AC_MSG_CHECKING([systemd unit file directory])
3317 AC_ARG_WITH([systemdsystemunitdir],
3318         [AS_HELP_STRING([--with-systemdsystemunitdir=DIR],
3319                 [Directory for systemd service files])],
3320         [], [with_systemdsystemunitdir=auto])
3321 AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"],
3322         [def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
3323         AS_IF([test "x$def_systemdsystemunitdir" = "x"],
3324                 [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
3325                 [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
3326                 with_systemdsystemunitdir=no],
3327         [with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
3328 AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
3329         [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
3330 AC_MSG_RESULT([$with_systemdsystemunitdir])
3331
3332 AC_MSG_CHECKING([bash-completion directory])
3333 AC_ARG_WITH([bash-completion-dir],
3334         AS_HELP_STRING([--with-bash-completion-dir[=PATH]],
3335                 [Install the bash auto-completion script in this directory.]),
3336         [],
3337         [with_bash_completion_dir=yes])
3338 AS_IF([test "x$with_bash_completion_dir" = "xyes"], [
3339         BASH_COMPLETION_DIR="`pkg-config --variable=completionsdir bash-completion`"
3340         AS_IF([test "x$BASH_COMPLETION_DIR" = "x"], [
3341                 [BASH_COMPLETION_DIR="/usr/share/bash-completion/completions"]
3342         ])
3343 ], [
3344         BASH_COMPLETION_DIR="$with_bash_completion_dir"
3345 ])
3346 AC_SUBST([BASH_COMPLETION_DIR])
3347 AC_MSG_RESULT([$BASH_COMPLETION_DIR])
3348 ]) # LC_CONFIGURE
3349
3350 #
3351 # LC_CONDITIONALS
3352 #
3353 # AM_CONDITIONALS for lustre
3354 #
3355 AC_DEFUN([LC_CONDITIONALS], [
3356 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
3357 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
3358 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
3359 AM_CONDITIONAL(SPLIT, test x$enable_split = xyes)
3360 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
3361 AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
3362 AM_CONDITIONAL(GSS_KEYRING, test x$enable_gss_keyring = xyes)
3363 AM_CONDITIONAL(GSS_PIPEFS, test x$enable_gss_pipefs = xyes)
3364 AM_CONDITIONAL(GSS_SSK, test x$enable_ssk = xyes)
3365 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
3366 AM_CONDITIONAL(HAVE_SYSTEMD, test "x$with_systemdsystemunitdir" != "xno")
3367 AM_CONDITIONAL(ENABLE_BASH_COMPLETION, test "x$with_bash_completion_dir" != "xno")
3368 AM_CONDITIONAL(XATTR_HANDLER, test "x$lb_cv_compile_xattr_handler_flags" = xyes)
3369 AM_CONDITIONAL(SELINUX, test "$SELINUX" = "-lselinux")
3370 AM_CONDITIONAL(GETSEPOL, test x$enable_getsepol = xyes)
3371 AM_CONDITIONAL(LLCRYPT, test x$enable_llcrypt = xyes)
3372 AM_CONDITIONAL(LIBAIO, test x$enable_libaio = xyes)
3373 ]) # LC_CONDITIONALS
3374
3375 #
3376 # LC_CONFIG_FILES
3377 #
3378 # files that should be generated with AC_OUTPUT
3379 #
3380 AC_DEFUN([LC_CONFIG_FILES],
3381 [AC_CONFIG_FILES([
3382 lustre/Makefile
3383 lustre/autoMakefile
3384 lustre/autoconf/Makefile
3385 lustre/conf/Makefile
3386 lustre/conf/resource/Makefile
3387 lustre/contrib/Makefile
3388 lustre/doc/Makefile
3389 lustre/include/Makefile
3390 lustre/include/lustre/Makefile
3391 lustre/include/uapi/linux/lustre/Makefile
3392 lustre/kernel_patches/targets/5.14-rhel9.0.target
3393 lustre/kernel_patches/targets/4.18-rhel8.7.target
3394 lustre/kernel_patches/targets/4.18-rhel8.6.target
3395 lustre/kernel_patches/targets/4.18-rhel8.5.target
3396 lustre/kernel_patches/targets/4.18-rhel8.4.target
3397 lustre/kernel_patches/targets/4.18-rhel8.3.target
3398 lustre/kernel_patches/targets/4.18-rhel8.2.target
3399 lustre/kernel_patches/targets/4.18-rhel8.1.target
3400 lustre/kernel_patches/targets/4.18-rhel8.target
3401 lustre/kernel_patches/targets/3.10-rhel7.9.target
3402 lustre/kernel_patches/targets/3.10-rhel7.8.target
3403 lustre/kernel_patches/targets/3.10-rhel7.7.target
3404 lustre/kernel_patches/targets/3.10-rhel7.6.target
3405 lustre/kernel_patches/targets/3.10-rhel7.5.target
3406 lustre/kernel_patches/targets/4.14-rhel7.5.target
3407 lustre/kernel_patches/targets/4.14-rhel7.6.target
3408 lustre/kernel_patches/targets/4.12-sles12sp4.target
3409 lustre/kernel_patches/targets/4.12-sles12sp5.target
3410 lustre/kernel_patches/targets/4.12-sles15sp1.target
3411 lustre/kernel_patches/targets/5.3-sles15sp2.target
3412 lustre/kernel_patches/targets/5.3-sles15sp3.target
3413 lustre/kernel_patches/targets/5.14-sles15sp4.target
3414 lustre/kernel_patches/targets/3.x-fc18.target
3415 lustre/kernel_patches/targets/5.10-oe2203.target
3416 lustre/ldlm/Makefile
3417 lustre/ldlm/autoMakefile
3418 lustre/ec/autoMakefile
3419 lustre/ec/Makefile
3420 lustre/fid/Makefile
3421 lustre/fid/autoMakefile
3422 lustre/llite/Makefile
3423 lustre/llite/autoMakefile
3424 lustre/lov/Makefile
3425 lustre/lov/autoMakefile
3426 lustre/mdc/Makefile
3427 lustre/mdc/autoMakefile
3428 lustre/lmv/Makefile
3429 lustre/lmv/autoMakefile
3430 lustre/lfsck/Makefile
3431 lustre/lfsck/autoMakefile
3432 lustre/mdt/Makefile
3433 lustre/mdt/autoMakefile
3434 lustre/mdd/Makefile
3435 lustre/mdd/autoMakefile
3436 lustre/fld/Makefile
3437 lustre/fld/autoMakefile
3438 lustre/obdclass/Makefile
3439 lustre/obdclass/autoMakefile
3440 lustre/obdecho/Makefile
3441 lustre/obdecho/autoMakefile
3442 lustre/ofd/Makefile
3443 lustre/ofd/autoMakefile
3444 lustre/osc/Makefile
3445 lustre/osc/autoMakefile
3446 lustre/ost/Makefile
3447 lustre/ost/autoMakefile
3448 lustre/osd-ldiskfs/Makefile
3449 lustre/osd-ldiskfs/autoMakefile
3450 lustre/osd-zfs/Makefile
3451 lustre/osd-zfs/autoMakefile
3452 lustre/mgc/Makefile
3453 lustre/mgc/autoMakefile
3454 lustre/mgs/Makefile
3455 lustre/mgs/autoMakefile
3456 lustre/target/Makefile
3457 lustre/target/autoMakefile
3458 lustre/ptlrpc/Makefile
3459 lustre/ptlrpc/autoMakefile
3460 lustre/ptlrpc/gss/Makefile
3461 lustre/ptlrpc/gss/autoMakefile
3462 lustre/quota/Makefile
3463 lustre/quota/autoMakefile
3464 lustre/scripts/Makefile
3465 lustre/scripts/systemd/Makefile
3466 lustre/tests/Makefile
3467 lustre/tests/mpi/Makefile
3468 lustre/tests/iabf/Makefile
3469 lustre/tests/lutf/Makefile
3470 lustre/tests/lutf/src/Makefile
3471 lustre/tests/kernel/Makefile
3472 lustre/tests/kernel/autoMakefile
3473 lustre/utils/Makefile
3474 lustre/utils/gss/Makefile
3475 lustre/osp/Makefile
3476 lustre/osp/autoMakefile
3477 lustre/lod/Makefile
3478 lustre/lod/autoMakefile
3479 ])
3480 ]) # LC_CONFIG_FILES