Whamcloud - gitweb
LU-16518 build: llvm/clang support
[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="-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_SRC_STACK_SIZE], [
100         LB2_LINUX_TEST_SRC([stack_size_8k], [
101                 #include <linux/thread_info.h>
102         ], [
103                 #if THREAD_SIZE < 8192
104                 #error "stack size < 8192"
105                 #endif
106         ])
107 ])
108 AC_DEFUN([LC_STACK_SIZE], [
109         AC_MSG_CHECKING([if stack size is at least 8k])
110         LB2_LINUX_TEST_RESULT([stack_size_8k], [],[
111                 AC_MSG_ERROR(
112                 [Lustre requires that Linux is configured with at least a 8KB stack.])
113         ])
114 ]) # LC_STACK_SIZE
115
116 #
117 # LC_MDS_MAX_THREADS
118 #
119 # Allow the user to set the MDS thread upper limit
120 #
121 AC_DEFUN([LC_MDS_MAX_THREADS], [
122 AC_MSG_CHECKING([for maximum number of MDS threads])
123 AC_ARG_WITH([mds_max_threads],
124         AS_HELP_STRING([--with-mds-max-threads=count],
125                 [maximum threads available on the MDS: (default=512)]),
126         [AC_DEFINE_UNQUOTED(MDS_MAX_THREADS, $with_mds_max_threads,
127                 [maximum number of MDS threads])])
128 AC_MSG_RESULT([$with_mds_max_threads])
129 ]) # LC_MDS_MAX_THREADS
130
131 #
132 # LC_CONFIG_PINGER
133 #
134 # the pinger is temporary, until we have the recovery node in place
135 #
136 AC_DEFUN([LC_CONFIG_PINGER], [
137 AC_MSG_CHECKING([whether to enable Lustre pinger support])
138 AC_ARG_ENABLE([pinger],
139         AS_HELP_STRING([--disable-pinger],
140                 [disable recovery pinger support]),
141         [], [enable_pinger="yes"])
142 AC_MSG_RESULT([$enable_pinger])
143 AS_IF([test "x$enable_pinger" != xno], [
144         AC_DEFINE(CONFIG_LUSTRE_FS_PINGER, 1, [Use the Pinger])
145         AC_SUBST(ENABLE_PINGER, yes)
146 ], [
147         AC_SUBST(ENABLE_PINGER, no)
148 ])
149 ]) # LC_CONFIG_PINGER
150
151 #
152 # LC_CONFIG_CHECKSUM
153 #
154 # do checksum of bulk data between client and OST
155 #
156 AC_DEFUN([LC_CONFIG_CHECKSUM], [
157 AC_MSG_CHECKING([whether to enable data checksum support])
158 AC_ARG_ENABLE([checksum],
159         AS_HELP_STRING([--disable-checksum],
160                 [disable data checksum support]),
161         [], [enable_checksum="yes"])
162 AC_MSG_RESULT([$enable_checksum])
163 AS_IF([test "x$enable_checksum" != xno], [
164         AC_DEFINE(CONFIG_ENABLE_CHECKSUM, 1, [do data checksums])
165         AC_SUBST(ENABLE_CHECKSUM, yes)
166 ], [
167         AC_SUBST(ENABLE_CHECKSUM, no)
168 ])
169 ]) # LC_CONFIG_CHECKSUM
170
171 #
172 # LC_CONFIG_FLOCK
173 #
174 # enable distributed flock by default
175 #
176 AC_DEFUN([LC_CONFIG_FLOCK], [
177 AC_MSG_CHECKING([whether to enable flock by default])
178 AC_ARG_ENABLE([flock],
179         AS_HELP_STRING([--disable-flock],
180                 [disable flock by default]),
181         [], [enable_flock="yes"])
182 AC_MSG_RESULT([$enable_flock])
183 AS_IF([test "x$enable_flock" != xno], [
184         AC_DEFINE(CONFIG_ENABLE_FLOCK, 1, [enable flock by default])
185         AC_SUBST(ENABLE_FLOCK, yes)
186 ], [
187         AC_SUBST(ENABLE_FLOCK, no)
188 ])
189 ]) # LC_CONFIG_FLOCK
190
191 #
192 # LC_CONFIG_HEALTH_CHECK_WRITE
193 #
194 # Turn off the actual write to the disk
195 #
196 AC_DEFUN([LC_CONFIG_HEALTH_CHECK_WRITE], [
197 AC_MSG_CHECKING([whether to enable a write with the health check])
198 AC_ARG_ENABLE([health_write],
199         AS_HELP_STRING([--enable-health_write],
200                 [enable disk writes when doing health check]),
201         [], [enable_health_write="no"])
202 AC_MSG_RESULT([$enable_health_write])
203 AS_IF([test "x$enable_health_write" != xno], [
204         AC_DEFINE(USE_HEALTH_CHECK_WRITE, 1, [Write when Checking Health])
205         AC_SUBST(ENABLE_HEALTH_WRITE, yes)
206 ], [
207         AC_SUBST(ENABLE_HEALTH_WRITE, no)
208 ])
209 ]) # LC_CONFIG_HEALTH_CHECK_WRITE
210
211 #
212 # LC_CONFIG_LRU_RESIZE
213 #
214 AC_DEFUN([LC_CONFIG_LRU_RESIZE], [
215 AC_MSG_CHECKING([whether to enable lru self-adjusting])
216 AC_ARG_ENABLE([lru_resize],
217         AS_HELP_STRING([--enable-lru-resize],
218                 [enable lru resize support]),
219         [], [enable_lru_resize="yes"])
220 AC_MSG_RESULT([$enable_lru_resize])
221 AS_IF([test "x$enable_lru_resize" != xno], [
222         AC_DEFINE(HAVE_LRU_RESIZE_SUPPORT, 1, [Enable lru resize support])
223         AC_SUBST(ENABLE_LRU_RESIZE, yes)
224 ], [
225         AC_SUBST(ENABLE_LRU_RESIZE, no)
226 ])
227 ]) # LC_CONFIG_LRU_RESIZE
228
229 #
230 # LC_CONFIG_QUOTA
231 #
232 # Quota support. The kernel must support CONFIG_QUOTA.
233 #
234 AC_DEFUN([LC_SRC_CONFIG_QUOTA], [
235         LB2_SRC_CHECK_CONFIG_IM([QUOTA])
236 ])
237 AC_DEFUN([LC_CONFIG_QUOTA], [
238         LB2_TEST_CHECK_CONFIG_IM([QUOTA],[],[AC_MSG_ERROR(
239 [Lustre quota requires that CONFIG_QUOTA is enabled in your kernel.])])
240 ]) # LC_CONFIG_QUOTA
241
242 #
243 # LC_CONFIG_FHANDLE
244 #
245 # fhandle kernel support for open_by_handle_at() and name_to_handle_at()
246 # system calls. The kernel must support CONFIG_FHANDLE.
247 #
248 AC_DEFUN([LC_SRC_CONFIG_FHANDLE], [
249         LB2_SRC_CHECK_CONFIG_IM([FHANDLE])
250 ])
251 AC_DEFUN([LC_CONFIG_FHANDLE], [
252         LB2_TEST_CHECK_CONFIG_IM([FHANDLE],[],[AC_MSG_ERROR(
253 [Lustre fid handling requires that CONFIG_FHANDLE is enabled in your kernel.])])
254 ]) # LC_CONFIG_FHANDLE
255
256 #
257 # LC_POSIX_ACL_CONFIG
258 #
259 # POSIX ACL support.
260 #
261 AC_DEFUN([LC_SRC_POSIX_ACL_CONFIG], [
262         LB2_SRC_CHECK_CONFIG_IM([FS_POSIX_ACL])
263 ])
264 AC_DEFUN([LC_POSIX_ACL_CONFIG], [
265         LB2_TEST_CHECK_CONFIG_IM([FS_POSIX_ACL],
266                 [AC_DEFINE(CONFIG_LUSTRE_FS_POSIX_ACL, 1, [Enable POSIX acl])],
267                 [])
268 ]) # LC_POSIX_ACL_CONFIG
269
270 # CRYPTO_MD5 check and warn only if GSS is not disabled.
271
272 #
273 # LC_CONFIG_GSS_KEYRING
274 #
275 # default 'auto', tests for dependencies, if found, enables;
276 # only called if gss is enabled
277 #
278 AC_DEFUN([LC_CONFIG_GSS_KEYRING], [
279 AC_MSG_CHECKING([whether to enable gss keyring backend])
280 AC_ARG_ENABLE([gss_keyring],
281         [AS_HELP_STRING([--disable-gss-keyring],
282                 [disable gss keyring backend])],
283         [], [AS_IF([test "x$enable_gss" != xno], [
284                         enable_gss_keyring="yes"], [
285                         enable_gss_keyring="auto"])])
286 AC_MSG_RESULT([$enable_gss_keyring])
287 AS_IF([test "x$enable_gss_keyring" != xno], [
288         LB_CHECK_CONFIG_IM([KEYS], [], [
289                 gss_keyring_conf_test="fail"
290                 AC_MSG_WARN([GSS keyring backend requires that CONFIG_KEYS be enabled in your kernel.])])
291
292         AC_CHECK_LIB([keyutils], [keyctl_search], [], [
293                 gss_keyring_conf_test="fail"
294                 AC_MSG_WARN([GSS keyring backend requires libkeyutils])])
295
296         AS_IF([test "x$gss_keyring_conf_test" != xfail], [
297                 AC_DEFINE([HAVE_GSS_KEYRING], [1],
298                         [Define this if you enable gss keyring backend])
299                 enable_gss_keyring="yes"
300         ], [
301                 AS_IF([test "x$enable_gss_keyring" = xyes], [
302                         AC_MSG_ERROR([Cannot enable gss_keyring. See above for details.])
303                 ])
304                 enable_ssk="no"
305         ])
306 ], [
307         enable_ssk="no"
308 ])
309 ]) # LC_CONFIG_GSS_KEYRING
310
311 #
312 # LC_KEY_TYPE_INSTANTIATE_2ARGS
313 #
314 # rhel7 key_type->instantiate takes 2 args (struct key, struct key_preparsed_payload)
315 #
316 AC_DEFUN([LC_SRC_KEY_TYPE_INSTANTIATE_2ARGS], [
317         LB2_LINUX_TEST_SRC([key_type_instantiate_2args], [
318                 #include <linux/key-type.h>
319         ],[
320                 ((struct key_type *)0)->instantiate(0, NULL);
321         ])
322 ])
323 AC_DEFUN([LC_KEY_TYPE_INSTANTIATE_2ARGS], [
324         AC_MSG_CHECKING([if 'key_type->instantiate' has two args])
325         LB2_LINUX_TEST_RESULT([key_type_instantiate_2args], [
326                 AC_DEFINE(HAVE_KEY_TYPE_INSTANTIATE_2ARGS, 1,
327                         [key_type->instantiate has two args])
328         ])
329 ]) # LC_KEY_TYPE_INSTANTIATE_2ARGS
330
331 #
332 # LC_CONFIG_SUNRPC
333 #
334 AC_DEFUN([LC_CONFIG_SUNRPC], [
335 LB_CHECK_CONFIG_IM([SUNRPC], [], [
336         AS_IF([test "x$sunrpc_required" = xyes], [
337                 AC_MSG_ERROR([
338
339 kernel SUNRPC support is required by using GSS.
340 ])
341         ])])
342 ]) # LC_CONFIG_SUNRPC
343
344 #
345 # LC_CONFIG_GSS (default 'auto' (tests for dependencies, if found, enables))
346 #
347 # Build gss and related tools of Lustre. Currently both kernel and user space
348 # parts are depend on linux platform.
349 #
350 AC_DEFUN([LC_CONFIG_GSS], [
351 AC_MSG_CHECKING([whether to enable gss support])
352 AC_ARG_ENABLE([gss],
353         [AS_HELP_STRING([--enable-gss], [enable gss support])],
354         [], [enable_gss="auto"])
355 AC_MSG_RESULT([$enable_gss])
356
357 AC_ARG_VAR([TEST_JOBS],
358     [simultaneous jobs during configure (defaults to $(nproc))])
359 if test "x$ac_cv_env_TEST_JOBS_set" != "xset"; then
360         TEST_JOBS=${TEST_JOBS:-$(nproc)}
361 fi
362 AC_SUBST(TEST_JOBS)
363
364 AC_ARG_VAR([TEST_DIR],
365     [location of temporary parallel configure tests (defaults to $PWD/lb2)])
366         TEST_DIR=${TEST_DIR:-${ac_pwd}/_lpb}
367 AC_SUBST(TEST_DIR)
368
369 AS_IF([test "x$enable_gss" != xno], [
370         LC_CONFIG_GSS_KEYRING
371
372         sunrpc_required=$enable_gss
373         LC_CONFIG_SUNRPC
374         sunrpc_required="no"
375
376         require_krb5=$enable_gss
377         AC_KERBEROS_V5
378         require_krb5="no"
379
380         AS_IF([test -n "$KRBDIR"], [
381                 gss_conf_test="success"
382         ], [
383                 gss_conf_test="failure"
384         ])
385
386         AS_IF([test "x$gss_conf_test" = xsuccess && test "x$enable_gss" != xno], [
387                 AC_DEFINE([HAVE_GSS], [1], [Define this is if you enable gss])
388                 enable_gss="yes"
389         ], [
390                 enable_gss_keyring="no"
391                 enable_gss="no"
392         ])
393
394         AS_IF([test "x$enable_ssk" != xno], [
395                 enable_ssk=$enable_gss
396         ])
397 ], [
398         enable_gss_keyring="no"
399 ])
400 ]) # LC_CONFIG_GSS
401
402 # LC_OPENSSL_HMAC
403 #
404 # OpenSSL 1.0+ return int for HMAC functions but older SLES11 versions do not
405 AC_DEFUN([LC_OPENSSL_HMAC], [
406 has_hmac_functions="no"
407 saved_flags="$CFLAGS"
408 CFLAGS="-Werror"
409 AC_MSG_CHECKING([whether OpenSSL has HMAC_Init_ex])
410 AS_IF([test "x$enable_ssk" != xno], [
411 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
412         #include <openssl/hmac.h>
413         #include <openssl/evp.h>
414
415         int main(void) {
416                 int rc;
417                 rc = HMAC_Init_ex(NULL, "test", 4, EVP_md_null(), NULL);
418                 return rc;
419         }
420 ])],[
421         has_hmac_functions="yes"
422 ])
423 ])
424 AC_MSG_RESULT([$has_hmac_functions])
425 CFLAGS="$saved_flags"
426 ]) # LC_OPENSSL_HMAC
427
428 # LC_OPENSSL_EVP_PKEY
429 #
430 # OpenSSL 3.0 introduces EVP_PKEY_get_params
431 AC_DEFUN([LC_OPENSSL_EVP_PKEY], [
432 has_evp_pkey="no"
433 saved_flags="$CFLAGS"
434 CFLAGS="-Werror"
435 AC_MSG_CHECKING([whether OpenSSL has EVP_PKEY_get_params])
436 AS_IF([test "x$enable_ssk" != xno], [
437 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
438         #include <openssl/evp.h>
439
440         int main(void) {
441                 OSSL_PARAM *params;
442
443                 int rc = EVP_PKEY_get_params(NULL, params);
444                 return rc;
445         }
446 ])],[
447         AC_DEFINE(HAVE_OPENSSL_EVP_PKEY, 1, [OpenSSL EVP_PKEY_get_params])
448         has_evp_pkey="yes"
449 ])
450 ])
451 CFLAGS="$saved_flags"
452 AC_MSG_RESULT([$has_evp_pkey])
453 ]) # LC_OPENSSL_EVP_PKEY
454
455 #
456 # LC_OPENSSL_SSK
457 #
458 # Check whether to enable Lustre client crypto
459 #
460 AC_DEFUN([LC_OPENSSL_SSK], [
461 AC_MSG_CHECKING([whether OpenSSL has functions needed for SSK])
462 AS_IF([test "x$enable_ssk" != xno], [
463         AC_MSG_RESULT(
464         )
465         LC_OPENSSL_HMAC
466         LC_OPENSSL_EVP_PKEY
467 ])
468 AS_IF([test "x$has_hmac_functions" = xyes -o "x$has_evp_pkey" = xyes], [
469         AC_DEFINE(HAVE_OPENSSL_SSK, 1, [OpenSSL HMAC functions needed for SSK])
470 ], [
471         enable_ssk="no"
472 ])
473 AC_MSG_RESULT([$enable_ssk])
474 ]) # LC_OPENSSL_SSK
475
476 # LC_OPENSSL_GETSEPOL
477 #
478 # OpenSSL is needed for l_getsepol
479 AC_DEFUN([LC_OPENSSL_GETSEPOL], [
480 saved_flags="$CFLAGS"
481 CFLAGS="-Werror"
482 AC_MSG_CHECKING([whether openssl-devel is present])
483 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
484         #include <openssl/evp.h>
485
486         int main(void) {
487                 EVP_MD_CTX *mdctx = EVP_MD_CTX_create();
488                 (void) mdctx;
489         }
490 ])],[
491         AC_DEFINE(HAVE_OPENSSL_GETSEPOL, 1, [openssl-devel is present])
492         enable_getsepol="yes"
493
494 ],[
495         enable_getsepol="no"
496         AC_MSG_WARN([
497
498 No openssl-devel headers found, unable to build l_getsepol and SELinux status checking
499 ])
500 ])
501 AC_MSG_RESULT([$enable_getsepol])
502 CFLAGS="$saved_flags"
503 ]) # LC_OPENSSL_GETSEPOL
504
505 # LC_HAVE_LIBAIO
506 AC_DEFUN([LC_HAVE_LIBAIO], [
507         AC_CHECK_HEADER([libaio.h],
508                 enable_libaio="yes",
509                 AC_MSG_WARN([libaio is not installed on the system]))
510 ]) # LC_HAVE_LIBAIO
511
512 #
513 # LC_INVALIDATE_RANGE
514 #
515 # 3.11 invalidatepage requires the length of the range to invalidate
516 #
517 AC_DEFUN([LC_SRC_INVALIDATE_RANGE], [
518         LB2_LINUX_TEST_SRC([address_space_ops_invalidatepage_3args], [
519                 #include <linux/fs.h>
520         ],[
521                 struct address_space_operations a_ops;
522                 a_ops.invalidatepage(NULL, 0, 0);
523         ])
524 ])
525 AC_DEFUN([LC_INVALIDATE_RANGE], [
526         AC_MSG_CHECKING(
527                 [if 'address_space_operations.invalidatepage' requires 3 arguments])
528         LB2_LINUX_TEST_RESULT([address_space_ops_invalidatepage_3args], [
529                 AC_DEFINE(HAVE_INVALIDATE_RANGE, 1,
530                         [address_space_operations.invalidatepage needs 3 arguments])
531         ])
532 ]) # LC_INVALIDATE_RANGE
533
534 #
535 # LC_HAVE_DIR_CONTEXT
536 #
537 # 3.11 readdir now takes the new struct dir_context
538 #
539 AC_DEFUN([LC_SRC_HAVE_DIR_CONTEXT], [
540         LB2_LINUX_TEST_SRC([dir_context], [
541                 #include <linux/fs.h>
542         ],[
543         #ifdef FMODE_KABI_ITERATE
544         #error "back to use readdir in kabi_extand mode"
545         #else
546                 struct dir_context ctx;
547
548                 ctx.pos = 0;
549         #endif
550         ])
551 ])
552 AC_DEFUN([LC_HAVE_DIR_CONTEXT], [
553         AC_MSG_CHECKING([if 'dir_context' exist])
554         LB2_LINUX_TEST_RESULT([dir_context], [
555                 AC_DEFINE(HAVE_DIR_CONTEXT, 1, [dir_context exist])
556         ])
557 ]) # LC_HAVE_DIR_CONTEXT
558
559 #
560 # LC_D_COMPARE_5ARGS
561 #
562 # 3.11 dentry_operations.d_compare() taken 5 arguments.
563 #
564 AC_DEFUN([LC_SRC_D_COMPARE_5ARGS], [
565         LB2_LINUX_TEST_SRC([d_compare_5args], [
566                 #include <linux/dcache.h>
567         ],[
568                 ((struct dentry_operations*)0)->d_compare(NULL,NULL,0,NULL,NULL);
569         ])
570 ])
571 AC_DEFUN([LC_D_COMPARE_5ARGS], [
572         AC_MSG_CHECKING([if 'd_compare' taken 5 arguments])
573         LB2_LINUX_TEST_RESULT([d_compare_5args], [
574                 AC_DEFINE(HAVE_D_COMPARE_5ARGS, 1,
575                         [d_compare need 5 arguments])
576         ])
577 ]) # LC_D_COMPARE_5ARGS
578
579 #
580 # LC_HAVE_DCOUNT
581 #
582 # 3.11 need to access d_count to get dentry reference count
583 #
584 AC_DEFUN([LC_SRC_HAVE_DCOUNT], [
585         LB2_LINUX_TEST_SRC([d_count], [
586                 #include <linux/dcache.h>
587         ],[
588                 struct dentry de = { };
589                 int count;
590
591                 count = d_count(&de);
592         ])
593 ])
594 AC_DEFUN([LC_HAVE_DCOUNT], [
595         AC_MSG_CHECKING([if 'd_count' exists])
596         LB2_LINUX_TEST_RESULT([d_count], [
597                 AC_DEFINE(HAVE_D_COUNT, 1, [d_count exist])
598         ])
599 ]) # LC_HAVE_DCOUNT
600
601 #
602 # LC_PID_NS_FOR_CHILDREN
603 #
604 # 3.11 replaces pid_ns by pid_ns_for_children in struct nsproxy
605 #
606 AC_DEFUN([LC_SRC_PID_NS_FOR_CHILDREN], [
607         LB2_LINUX_TEST_SRC([pid_ns_for_children], [
608                 #include <linux/nsproxy.h>
609         ],[
610                 struct nsproxy ns;
611                 ns.pid_ns_for_children = NULL;
612         ])
613 ])
614 AC_DEFUN([LC_PID_NS_FOR_CHILDREN], [
615         AC_MSG_CHECKING([if 'struct nsproxy' has 'pid_ns_for_children'])
616         LB2_LINUX_TEST_RESULT([pid_ns_for_children], [
617                 AC_DEFINE(HAVE_PID_NS_FOR_CHILDREN, 1,
618                           ['struct nsproxy' has 'pid_ns_for_children'])
619         ])
620 ]) # LC_PID_NS_FOR_CHILDREN
621
622 #
623 # LC_OLDSIZE_TRUNCATE_PAGECACHE
624 #
625 # 3.12 truncate_pagecache without oldsize parameter
626 #
627 AC_DEFUN([LC_SRC_OLDSIZE_TRUNCATE_PAGECACHE], [
628         LB2_LINUX_TEST_SRC([truncate_pagecache_old_size], [
629                 #include <linux/mm.h>
630         ],[
631                 truncate_pagecache(NULL, 0, 0);
632         ])
633 ])
634 AC_DEFUN([LC_OLDSIZE_TRUNCATE_PAGECACHE], [
635         AC_MSG_CHECKING([if 'truncate_pagecache' with 'old_size' parameter])
636         LB2_LINUX_TEST_RESULT([truncate_pagecache_old_size], [
637                 AC_DEFINE(HAVE_OLDSIZE_TRUNCATE_PAGECACHE, 1,
638                         [with oldsize])
639         ])
640 ]) # LC_OLDSIZE_TRUNCATE_PAGECACHE
641
642 #
643 # LC_PTR_ERR_OR_ZERO
644 #
645 # For some reason SLES11SP4 is missing the PTR_ERR_OR_ZERO macro
646 # It was added to linux kernel 3.12
647 #
648 AC_DEFUN([LC_SRC_PTR_ERR_OR_ZERO_MISSING], [
649         LB2_LINUX_TEST_SRC([is_err_or_null], [
650                 #include <linux/err.h>
651         ],[
652                 if (PTR_ERR_OR_ZERO(NULL)) return 0;
653         ])
654 ])
655 AC_DEFUN([LC_PTR_ERR_OR_ZERO_MISSING], [
656         AC_MSG_CHECKING([if 'PTR_ERR_OR_ZERO' is missing])
657         LB2_LINUX_TEST_RESULT([is_err_or_null], [
658                 AC_DEFINE(HAVE_PTR_ERR_OR_ZERO, 1,
659                         ['PTR_ERR_OR_ZERO' exist])
660         ])
661 ]) # LC_PTR_ERR_OR_ZERO_MISSING
662
663 #
664 # LC_HAVE_DENTRY_D_U_D_ALIAS
665 #
666 # 3.11 kernel moved d_alias to the union d_u in struct dentry
667 #
668 # Some distros move d_alias to d_u but it is still a struct list
669 #
670 AC_DEFUN([LC_SRC_HAVE_DENTRY_D_U_D_ALIAS_LIST], [
671         LB2_LINUX_TEST_SRC([d_alias_list], [
672                 #include <linux/list.h>
673                 #include <linux/dcache.h>
674         ],[
675                 struct dentry de;
676                 INIT_LIST_HEAD(&de.d_u.d_alias);
677         ])
678 ])
679 AC_DEFUN([LC_HAVE_DENTRY_D_U_D_ALIAS_LIST], [
680         AC_MSG_CHECKING([if list 'dentry.d_u.d_alias' exist])
681         LB2_LINUX_TEST_RESULT([d_alias_list], [
682                 AC_DEFINE(HAVE_DENTRY_D_U_D_ALIAS, 1,
683                         [list dentry.d_u.d_alias exist])
684         ])
685 ]) # LC_HAVE_DENTRY_D_U_D_ALIAS_LIST
686
687 #
688 # LC_HAVE_DENTRY_D_U_D_ALIAS_HLIST
689 #
690 # Some distros move d_alias to d_u and it is an hlist
691 #
692 AC_DEFUN([LC_SRC_HAVE_DENTRY_D_U_D_ALIAS_HLIST], [
693         LB2_LINUX_TEST_SRC([d_alias_hlist], [
694                 #include <linux/list.h>
695                 #include <linux/dcache.h>
696         ],[
697                 struct dentry de;
698                 INIT_HLIST_NODE(&de.d_u.d_alias);
699         ])
700 ])
701 AC_DEFUN([LC_HAVE_DENTRY_D_U_D_ALIAS_HLIST], [
702         AC_MSG_CHECKING([if hlist 'dentry.d_u.d_alias' exist])
703         LB2_LINUX_TEST_RESULT([d_alias_hlist], [
704                 AC_DEFINE(HAVE_DENTRY_D_U_D_ALIAS, 1,
705                         [list dentry.d_u.d_alias exist])
706         ])
707 ]) # LC_HAVE_DENTRY_D_U_D_ALIAS_HLIST
708
709
710 #
711 # LC_HAVE_DENTRY_D_CHILD
712 #
713 # 3.11 kernel d_child has been moved out of the union d_u
714 # in struct dentry
715 #
716 AC_DEFUN([LC_SRC_HAVE_DENTRY_D_CHILD], [
717         LB2_LINUX_TEST_SRC([d_child], [
718                 #include <linux/list.h>
719                 #include <linux/dcache.h>
720         ],[
721                 struct dentry de;
722                 INIT_LIST_HEAD(&de.d_child);
723         ])
724 ])
725 AC_DEFUN([LC_HAVE_DENTRY_D_CHILD], [
726         AC_MSG_CHECKING([if 'dentry.d_child' exist])
727         LB2_LINUX_TEST_RESULT([d_child], [
728                 AC_DEFINE(HAVE_DENTRY_D_CHILD, 1, [dentry.d_child exist])
729         ])
730 ]) # LC_HAVE_DENTRY_D_CHILD
731
732 #
733 # LC_KIOCB_KI_LEFT
734 #
735 # 3.12 ki_left removed from struct kiocb
736 #
737 AC_DEFUN([LC_SRC_KIOCB_KI_LEFT], [
738         LB2_LINUX_TEST_SRC([kiocb_ki_left], [
739                 #include <linux/aio.h>
740         ],[
741                 ((struct kiocb*)0)->ki_left = 0;
742         ])
743 ])
744 AC_DEFUN([LC_KIOCB_KI_LEFT], [
745         AC_MSG_CHECKING([if 'struct kiocb' with 'ki_left' member])
746         LB2_LINUX_TEST_RESULT([kiocb_ki_left], [
747                 AC_DEFINE(HAVE_KIOCB_KI_LEFT, 1,
748                         [ki_left exist])
749         ])
750 ]) # LC_KIOCB_KI_LEFT
751
752 #
753 # LC_REGISTER_SHRINKER_RET
754 #
755 # v3.11-8748-g1d3d4437eae1 register_shrinker returns a status
756 #
757 AC_DEFUN([LC_SRC_REGISTER_SHRINKER_RET], [
758         LB2_LINUX_TEST_SRC([register_shrinker_ret], [
759                 #include <linux/mm.h>
760         ],[
761                 if (register_shrinker(NULL))
762                         unregister_shrinker(NULL);
763         ],[])
764 ])
765 AC_DEFUN([LC_REGISTER_SHRINKER_RET], [
766         AC_MSG_CHECKING([if register_shrinker() returns status])
767         LB2_LINUX_TEST_RESULT([register_shrinker_ret], [
768                 AC_DEFINE(HAVE_REGISTER_SHRINKER_RET, 1,
769                         [register_shrinker() returns status])
770         ])
771 ]) # LC_REGISTER_SHRINKER_RET
772
773 #
774 # LC_VFS_RENAME_5ARGS
775 #
776 # 3.13 has vfs_rename with 5 args
777 #
778 AC_DEFUN([LC_SRC_VFS_RENAME_5ARGS], [
779         LB2_LINUX_TEST_SRC([vfs_rename_5args], [
780                 #include <linux/fs.h>
781         ],[
782                 vfs_rename(NULL, NULL, NULL, NULL, NULL);
783         ], [
784                 AC_DEFINE(HAVE_VFS_RENAME_5ARGS, 1,
785                         [kernel has vfs_rename with 5 args])
786         ])
787 ])
788 AC_DEFUN([LC_VFS_RENAME_5ARGS], [
789         AC_MSG_CHECKING([if Linux kernel has 'vfs_rename' with 5 args])
790         LB2_LINUX_TEST_RESULT([vfs_rename_5args], [
791                 AC_DEFINE(HAVE_VFS_RENAME_5ARGS, 1,
792                         [kernel has vfs_rename with 5 args])
793         ])
794 ]) # LC_VFS_RENAME_5ARGS
795
796 #
797 # LC_VFS_UNLINK_3ARGS
798 #
799 # 3.13 has vfs_unlink with 3 args
800 #
801 AC_DEFUN([LC_SRC_VFS_UNLINK_3ARGS], [
802         LB2_LINUX_TEST_SRC([vfs_unlink_3args], [
803                 #include <linux/fs.h>
804         ],[
805                 vfs_unlink(NULL, NULL, NULL);
806         ])
807 ])
808 AC_DEFUN([LC_VFS_UNLINK_3ARGS], [
809         AC_MSG_CHECKING([if Linux kernel has 'vfs_unlink' with 3 args])
810         LB2_LINUX_TEST_RESULT([vfs_unlink_3args], [
811                 AC_DEFINE(HAVE_VFS_UNLINK_3ARGS, 1,
812                         [kernel has vfs_unlink with 3 args])
813         ])
814 ]) # LC_VFS_UNLINK_3ARGS
815
816 # LC_HAVE_D_IS_POSITIVE
817 #
818 # Kernel version 3.13 b18825a7c8e37a7cf6abb97a12a6ad71af160de7
819 # d_is_positive is added
820 #
821 AC_DEFUN([LC_SRC_HAVE_D_IS_POSITIVE], [
822         LB2_LINUX_TEST_SRC([d_is_positive], [
823                 #include <linux/dcache.h>
824         ],[
825                 d_is_positive(NULL);
826         ])
827 ])
828 AC_DEFUN([LC_HAVE_D_IS_POSITIVE], [
829         AC_MSG_CHECKING([if 'd_is_positive' exist])
830         LB2_LINUX_TEST_RESULT([d_is_positive], [
831                 AC_DEFINE(HAVE_D_IS_POSITIVE, 1,
832                         ['d_is_positive' is available])
833         ])
834 ]) # LC_HAVE_D_IS_POSITIVE
835
836 #
837 # LC_HAVE_BVEC_ITER
838 #
839 # 3.14 move some of its data in struct bio into the new
840 # struct bvec_iter
841 #
842 AC_DEFUN([LC_SRC_HAVE_BVEC_ITER], [
843         LB2_LINUX_TEST_SRC([have_bvec_iter], [
844                 #include <linux/bio.h>
845         ],[
846                 struct bvec_iter iter;
847
848                 iter.bi_bvec_done = 0;
849         ])
850 ])
851 AC_DEFUN([LC_HAVE_BVEC_ITER], [
852         AC_MSG_CHECKING([if Linux kernel has struct bvec_iter])
853         LB2_LINUX_TEST_RESULT([have_bvec_iter], [
854                 AC_DEFINE(HAVE_BVEC_ITER, 1,
855                         [kernel has struct bvec_iter])
856         ])
857 ]) # LC_HAVE_BVEC_ITER
858
859 #
860 # LC_IOP_SET_ACL
861 #
862 # 3.14 adds set_acl method to inode_operations
863 # see kernel commit 893d46e443346370cd4ea81d9d35f72952c62a37
864 #
865 AC_DEFUN([LC_SRC_IOP_SET_ACL], [
866         LB2_LINUX_TEST_SRC([inode_ops_set_acl], [
867                 #include <linux/fs.h>
868         ],[
869                 struct inode_operations iop;
870                 iop.set_acl = NULL;
871         ])
872 ])
873 AC_DEFUN([LC_IOP_SET_ACL], [
874         AC_MSG_CHECKING([if 'inode_operations' has '.set_acl' member function])
875         LB2_LINUX_TEST_RESULT([inode_ops_set_acl], [
876                 AC_DEFINE(HAVE_IOP_SET_ACL, 1,
877                         [inode_operations has .set_acl member function])
878         ])
879 ]) # LC_IOP_SET_ACL
880
881 #
882 # LC_HAVE_TRUNCATE_IPAGE_FINAL
883 #
884 # 3.14 bring truncate_inode_pages_final for evict_inode
885 #
886 AC_DEFUN([LC_SRC_HAVE_TRUNCATE_IPAGES_FINAL], [
887         LB2_LINUX_TEST_SRC([truncate_ipages_final], [
888                 #include <linux/mm.h>
889         ],[
890                 truncate_inode_pages_final(NULL);
891         ])
892 ])
893 AC_DEFUN([LC_HAVE_TRUNCATE_IPAGES_FINAL], [
894         AC_MSG_CHECKING([if Linux kernel has truncate_inode_pages_final])
895         LB2_LINUX_TEST_RESULT([truncate_ipages_final], [
896                 AC_DEFINE(HAVE_TRUNCATE_INODE_PAGES_FINAL, 1,
897                         [kernel has truncate_inode_pages_final])
898         ])
899 ]) # LC_HAVE_TRUNCATE_IPAGES_FINAL
900
901 #
902 # LC_IOPS_RENAME_WITH_FLAGS
903 #
904 # 3.14 has inode_operations->rename with 5 args
905 # commit 520c8b16505236fc82daa352e6c5e73cd9870cff
906 #
907 AC_DEFUN([LC_SRC_IOPS_RENAME_WITH_FLAGS], [
908         LB2_LINUX_TEST_SRC([iops_rename_with_flags], [
909                 #include <linux/fs.h>
910         ],[
911                 struct inode *i1 = NULL, *i2 = NULL;
912                 struct dentry *d1 = NULL, *d2 = NULL;
913                 int rc;
914                 rc = ((struct inode_operations *)0)->rename(i1, d1, i2, d2, 0);
915         ])
916 ]) # LC_IOPS_RENAME_WITH_FLAGS
917 AC_DEFUN([LC_IOPS_RENAME_WITH_FLAGS], [
918         AC_MSG_CHECKING([if 'inode_operations->rename' taken flags as argument])
919         LB2_LINUX_TEST_RESULT([iops_rename_with_flags], [
920                 AC_DEFINE(HAVE_IOPS_RENAME_WITH_FLAGS, 1,
921                         [inode_operations->rename need flags as argument])
922         ])
923 ]) # LC_IOPS_RENAME_WITH_FLAGS
924
925 #
926 # LC_VFS_RENAME_6ARGS
927 #
928 # 3.15 has vfs_rename with 6 args
929 #
930 AC_DEFUN([LC_SRC_VFS_RENAME_6ARGS], [
931         LB2_LINUX_TEST_SRC([vfs_rename_6args], [
932                 #include <linux/fs.h>
933         ],[
934                 vfs_rename(NULL, NULL, NULL, NULL, NULL, NULL);
935         ])
936 ])
937 AC_DEFUN([LC_VFS_RENAME_6ARGS], [
938         AC_MSG_CHECKING([if Linux kernel has 'vfs_rename' with 6 args])
939         LB2_LINUX_TEST_RESULT([vfs_rename_6args], [
940                 AC_DEFINE(HAVE_VFS_RENAME_6ARGS, 1,
941                         [kernel has vfs_rename with 6 args])
942         ])
943 ]) # LC_VFS_RENAME_6ARGS
944
945 #
946 # LC_DIRECTIO_USE_ITER
947 #
948 # 3.16 kernel changes direct IO to use iov_iter
949 #
950 AC_DEFUN([LC_SRC_DIRECTIO_USE_ITER], [
951         LB2_LINUX_TEST_SRC([direct_io_iter], [
952                 #include <linux/fs.h>
953         ],[
954                 struct address_space_operations ops = { };
955                 struct iov_iter *iter = NULL;
956                 loff_t offset = 0;
957
958                 ops.direct_IO(0, NULL, iter, offset);
959         ])
960 ])
961 AC_DEFUN([LC_DIRECTIO_USE_ITER], [
962         AC_MSG_CHECKING([if direct IO uses iov_iter])
963         LB2_LINUX_TEST_RESULT([direct_io_iter], [
964                 AC_DEFINE(HAVE_DIRECTIO_ITER, 1, [direct IO uses iov_iter])
965         ])
966 ]) # LC_DIRECTIO_USE_ITER
967
968 #
969 # LC_HAVE_IOV_ITER_INIT_DIRECTION
970 #
971 #
972 # 3.16 linux commit 71d8e532b1549a478e6a6a8a44f309d050294d00
973 #      changed iov_iter_init api to start accepting a tag
974 #      that defines if its a read or write operation
975 #
976 AC_DEFUN([LC_SRC_HAVE_IOV_ITER_INIT_DIRECTION], [
977         LB2_LINUX_TEST_SRC([iter_init], [
978                 #include <linux/uio.h>
979                 #include <linux/fs.h>
980         ],[
981                 const struct iovec *iov = NULL;
982
983                 iov_iter_init(NULL, READ, iov, 1, 0);
984         ],[-Werror])
985 ])
986 AC_DEFUN([LC_HAVE_IOV_ITER_INIT_DIRECTION], [
987         AC_MSG_CHECKING([if 'iov_iter_init' takes a tag])
988         LB2_LINUX_TEST_RESULT([iter_init], [
989                 AC_DEFINE(HAVE_IOV_ITER_INIT_DIRECTION, 1,
990                         [iov_iter_init handles directional tag])
991         ])
992 ]) # LC_HAVE_IOV_ITER_INIT_DIRECTION
993
994 #
995 # LC_HAVE_IOV_ITER_TRUNCATE
996 #
997 #
998 # 3.16 introduces a new API iov_iter_truncate()
999 #
1000 AC_DEFUN([LC_SRC_HAVE_IOV_ITER_TRUNCATE], [
1001         LB2_LINUX_TEST_SRC([iter_truncate], [
1002                 #include <linux/uio.h>
1003                 #include <linux/fs.h>
1004         ],[
1005                 struct iov_iter *i = NULL;
1006
1007                 iov_iter_truncate(i, 0);
1008         ],[-Werror])
1009 ])
1010 AC_DEFUN([LC_HAVE_IOV_ITER_TRUNCATE], [
1011         AC_MSG_CHECKING([if 'iov_iter_truncate' exists])
1012         LB2_LINUX_TEST_RESULT([iter_truncate], [
1013                 AC_DEFINE(HAVE_IOV_ITER_TRUNCATE, 1, [iov_iter_truncate exists])
1014         ])
1015 ]) # LC_HAVE_IOV_ITER_TRUNCATE
1016
1017 #
1018 # LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER
1019 #
1020 # 3.16 introduces [read|write]_iter to struct file_operations
1021 #
1022 AC_DEFUN([LC_SRC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER], [
1023         LB2_LINUX_TEST_SRC([file_function_iter], [
1024                 #include <linux/fs.h>
1025         ],[
1026                 ((struct file_operations *)NULL)->read_iter(NULL, NULL);
1027                 ((struct file_operations *)NULL)->write_iter(NULL, NULL);
1028         ])
1029 ])
1030 AC_DEFUN([LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER], [
1031         AC_MSG_CHECKING([if 'file_operations.[read|write]_iter' exist])
1032         LB2_LINUX_TEST_RESULT([file_function_iter], [
1033                 AC_DEFINE(HAVE_FILE_OPERATIONS_READ_WRITE_ITER, 1,
1034                         [file_operations.[read|write]_iter functions exist])
1035         ])
1036 ]) # LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER
1037
1038 #
1039 # LC_PAGECACHE_GET_PAGE
1040 #
1041 # Kernel version 3.16 commit 2457aec63745e235bcafb7ef312b182d8682f0fc
1042 # @pagecache_get_page was introduced since Linux 3.16
1043 #
1044 AC_DEFUN([LC_SRC_PAGECACHE_GET_PAGE], [
1045         LB2_LINUX_TEST_SRC([pagecache_get_page], [
1046                 #include <linux/pagemap.h>
1047         ],[
1048                 pagecache_get_page(NULL, 0, 0, 0);
1049         ])
1050 ])
1051 AC_DEFUN([LC_PAGECACHE_GET_PAGE], [
1052         AC_MSG_CHECKING([if 'pagecache_get_page' exists])
1053         LB2_LINUX_TEST_RESULT([pagecache_get_page], [
1054                 AC_DEFINE(HAVE_PAGECACHE_GET_PAGE, 1,
1055                         ['pagecache_get_page' is available])
1056         ])
1057 ]) # LC_PAGECACHE_GET_PAGE
1058
1059 #
1060 # LC_HAVE_INTERVAL_BLK_INTEGRITY
1061 #
1062 # 3.17 replace sector_size with interval in struct blk_integrity
1063 #
1064 AC_DEFUN([LC_SRC_HAVE_INTERVAL_BLK_INTEGRITY], [
1065         LB2_LINUX_TEST_SRC([interval_blk_integrity], [
1066                 #include <linux/blkdev.h>
1067         ],[
1068                 ((struct blk_integrity *)0)->interval = 0;
1069         ])
1070 ])
1071 AC_DEFUN([LC_HAVE_INTERVAL_BLK_INTEGRITY], [
1072         AC_MSG_CHECKING([if 'blk_integrity.interval' exist])
1073         LB2_LINUX_TEST_RESULT([interval_blk_integrity], [
1074                 AC_DEFINE(HAVE_INTERVAL_BLK_INTEGRITY, 1,
1075                         [blk_integrity.interval exist])
1076         ])
1077 ]) # LC_HAVE_INTERVAL_BLK_INTEGRITY
1078
1079 #
1080 # LC_KEY_MATCH_DATA
1081 #
1082 # 3.17  replaces key_type::match with match_preparse
1083 #       and has new struct key_match_data
1084 #
1085 AC_DEFUN([LC_SRC_KEY_MATCH_DATA], [
1086         LB2_LINUX_TEST_SRC([key_match], [
1087                 #include <linux/key-type.h>
1088         ],[
1089                 struct key_match_data data;
1090
1091                 data.raw_data = NULL;
1092         ])
1093 ])
1094 AC_DEFUN([LC_KEY_MATCH_DATA], [
1095         AC_MSG_CHECKING([if struct key_match field exist])
1096         LB2_LINUX_TEST_RESULT([key_match], [
1097                 AC_DEFINE(HAVE_KEY_MATCH_DATA, 1, [struct key_match_data exist])
1098         ])
1099 ]) # LC_KEY_MATCH_DATA
1100
1101 #
1102 # LC_HAVE_BLK_INTEGRITY_ITER
1103 #
1104 # Linux commit v3.17-rc5-69-g1859308853b1 replaces
1105 # struct blk_integrity_exchg with struct blk_integrity_iter
1106 #
1107 # LB_CHECK_LINUX_HEADER has already run so we can rely on
1108 # HAVE_LINUX_BLK_INTEGRITY_HEADER being set correctly before
1109 # this test is run.
1110 #
1111 AC_DEFUN([LC_SRC_HAVE_BLK_INTEGRITY_ITER], [
1112         LB2_LINUX_TEST_SRC([blk_integrity_iter], [
1113                 #ifdef HAVE_LINUX_BLK_INTEGRITY_HEADER
1114                 # include <linux/blk-integrity.h>
1115                 #else
1116                 # include <linux/blkdev.h>
1117                 #endif
1118         ],[
1119                 struct blk_integrity_iter iter;
1120
1121                 iter.prot_buf = NULL;
1122         ])
1123 ])
1124 AC_DEFUN([LC_HAVE_BLK_INTEGRITY_ITER], [
1125         AC_MSG_CHECKING([if struct blk_integrity_iter exist])
1126         LB2_LINUX_TEST_RESULT([blk_integrity_iter], [
1127                 AC_DEFINE(HAVE_BLK_INTEGRITY_ITER, 1,
1128                         [kernel has struct blk_integrity_iter])
1129         ])
1130 ]) # LC_HAVE_BLK_INTEGRITY_ITER
1131
1132 #
1133 # LC_NFS_FILLDIR_USE_CTX
1134 #
1135 # 3.18 kernel moved from void cookie to struct dir_context
1136 #
1137 AC_DEFUN([LC_SRC_NFS_FILLDIR_USE_CTX], [
1138         LB2_LINUX_TEST_SRC([filldir_ctx], [
1139                 #include <linux/fs.h>
1140         ],[
1141                 int filldir(struct dir_context *ctx, const char* name,
1142                             int i, loff_t off, u64 tmp, unsigned temp)
1143                 {
1144                         return 0;
1145                 }
1146
1147                 struct dir_context ctx = {
1148                         .actor = filldir,
1149                 };
1150
1151                 ctx.actor(NULL, "test", 0, (loff_t) 0, 0, 0);
1152         ],[-Werror])
1153 ])
1154 AC_DEFUN([LC_NFS_FILLDIR_USE_CTX], [
1155         AC_MSG_CHECKING([if filldir_t uses struct dir_context])
1156         LB2_LINUX_TEST_RESULT([filldir_ctx], [
1157                 AC_DEFINE(HAVE_FILLDIR_USE_CTX, 1,
1158                         [filldir_t needs struct dir_context as argument])
1159         ])
1160 ]) # LC_NFS_FILLDIR_USE_CTX
1161
1162 #
1163 # LC_PERCPU_COUNTER_INIT
1164 #
1165 # 3.18  For kernels 3.18 and after percpu_counter_init starts
1166 #       to pass a GFP_* memory allocation flag for internal
1167 #       memory allocation purposes.
1168 #
1169 AC_DEFUN([LC_SRC_PERCPU_COUNTER_INIT], [
1170         LB2_LINUX_TEST_SRC([percpu_counter_init], [
1171                 #include <linux/percpu_counter.h>
1172         ],[
1173                 percpu_counter_init(NULL, 0, GFP_KERNEL);
1174         ])
1175 ])
1176 AC_DEFUN([LC_PERCPU_COUNTER_INIT], [
1177         AC_MSG_CHECKING([if percpu_counter_init uses GFP_* flag as argument])
1178         LB2_LINUX_TEST_RESULT([percpu_counter_init], [
1179                 AC_DEFINE(HAVE_PERCPU_COUNTER_INIT_GFP_FLAG, 1,
1180                         [percpu_counter_init uses GFP_* flag])
1181         ])
1182 ]) # LC_PERCPU_COUNTER_INIT
1183
1184 #
1185 # LC_KIOCB_HAS_NBYTES
1186 #
1187 # 3.19 kernel removed ki_nbytes from struct kiocb
1188 #
1189 AC_DEFUN([LC_SRC_KIOCB_HAS_NBYTES], [
1190         LB2_LINUX_TEST_SRC([ki_nbytes], [
1191                 #include <linux/fs.h>
1192         ],[
1193                 struct kiocb iocb = { };
1194
1195                 iocb.ki_nbytes = 0;
1196         ])
1197 ])
1198 AC_DEFUN([LC_KIOCB_HAS_NBYTES], [
1199         AC_MSG_CHECKING([if struct kiocb has ki_nbytes field])
1200         LB2_LINUX_TEST_RESULT([ki_nbytes], [
1201                 AC_DEFINE(HAVE_KI_NBYTES, 1, [ki_nbytes field exist])
1202         ])
1203 ]) # LC_KIOCB_HAS_NBYTES
1204
1205 #
1206 # LC_HAVE_DQUOT_QC_DQBLK
1207 #
1208 # 3.19 has quotactl_ops->[sg]et_dqblk that take struct kqid and qc_dqblk
1209 # Added in commit 14bf61ffe
1210 #
1211 AC_DEFUN([LC_SRC_HAVE_DQUOT_QC_DQBLK], [
1212         LB2_LINUX_TEST_SRC([qc_dqblk], [
1213                 #include <linux/fs.h>
1214                 #include <linux/quota.h>
1215         ],[
1216                 ((struct quotactl_ops *)0)->set_dqblk(NULL, *((struct kqid*)0), (struct qc_dqblk*)0);
1217         ],[-Werror])
1218 ])
1219 AC_DEFUN([LC_HAVE_DQUOT_QC_DQBLK], [
1220         AC_MSG_CHECKING([if 'quotactl_ops.set_dqblk' takes struct qc_dqblk])
1221         LB2_LINUX_TEST_RESULT([qc_dqblk], [
1222                 AC_DEFINE(HAVE_DQUOT_QC_DQBLK, 1,
1223                         [quotactl_ops.set_dqblk takes struct qc_dqblk])
1224                 AC_DEFINE(HAVE_DQUOT_KQID, 1,
1225                         [quotactl_ops.set_dqblk takes struct kqid])
1226         ])
1227 ]) # LC_HAVE_DQUOT_QC_DQBLK
1228
1229 #
1230 # LC_HAVE_AIO_COMPLETE
1231 #
1232 # 3.19 kernel makes aio_complete() static
1233 #
1234 AC_DEFUN([LC_SRC_HAVE_AIO_COMPLETE], [
1235         LB2_LINUX_TEST_SRC([aio_complete], [
1236                 #include <linux/aio.h>
1237         ],[
1238                 aio_complete(NULL, 0, 0);
1239         ])
1240 ])
1241 AC_DEFUN([LC_HAVE_AIO_COMPLETE], [
1242         AC_MSG_CHECKING([if kernel has exported aio_complete()])
1243         LB2_LINUX_TEST_RESULT([aio_complete], [
1244                 AC_DEFINE(HAVE_AIO_COMPLETE, 1, [aio_complete defined])
1245         ])
1246 ]) # LC_HAVE_AIO_COMPLETE
1247
1248 #
1249 # LC_HAVE_IS_ROOT_INODE
1250 #
1251 # 3.19 kernel adds is_root_inode()
1252 # Commit a7400222e3eb ("new helper: is_root_inode()")
1253 #
1254 AC_DEFUN([LC_SRC_HAVE_IS_ROOT_INODE], [
1255         LB2_LINUX_TEST_SRC([is_root_inode], [
1256                 #include <linux/fs.h>
1257         ],[
1258                 is_root_inode(NULL);
1259         ],[])
1260 ])
1261 AC_DEFUN([LC_HAVE_IS_ROOT_INODE], [
1262         AC_MSG_CHECKING([if kernel has is_root_inode()])
1263         LB2_LINUX_TEST_RESULT([is_root_inode], [
1264                 AC_DEFINE(HAVE_IS_ROOT_INODE, 1, [is_root_inode defined])
1265         ])
1266 ]) # LC_HAVE_IS_ROOT_INODE
1267
1268 #
1269 # LC_BACKING_DEV_INFO_REMOVAL
1270 #
1271 # 3.20 kernel removed backing_dev_info from address_space
1272 #
1273 AC_DEFUN([LC_SRC_BACKING_DEV_INFO_REMOVAL], [
1274         LB2_LINUX_TEST_SRC([backing_dev_info], [
1275                 #include <linux/fs.h>
1276         ],[
1277                 struct address_space mapping;
1278
1279                 mapping.backing_dev_info = NULL;
1280         ])
1281 ])
1282 AC_DEFUN([LC_BACKING_DEV_INFO_REMOVAL], [
1283         AC_MSG_CHECKING([if struct address_space has backing_dev_info])
1284         LB2_LINUX_TEST_RESULT([backing_dev_info], [
1285                 AC_DEFINE(HAVE_BACKING_DEV_INFO, 1, [backing_dev_info exist])
1286         ])
1287 ]) # LC_BACKING_DEV_INFO_REMOVAL
1288
1289 #
1290 # LC_HAVE_BDI_CAP_MAP_COPY
1291 #
1292 # 3.20  removed mmap handling for backing devices since
1293 #       it breaks on non-MMU systems. See kernel commit
1294 #       b4caecd48005fbed3949dde6c1cb233142fd69e9
1295 #
1296 AC_DEFUN([LC_SRC_HAVE_BDI_CAP_MAP_COPY], [
1297         LB2_LINUX_TEST_SRC([bdi_cap_map_copy], [
1298                 #include <linux/backing-dev.h>
1299         ],[
1300                 struct backing_dev_info info;
1301
1302                 info.capabilities = BDI_CAP_MAP_COPY;
1303         ])
1304 ]) # LC_HAVE_BDI_CAP_MAP_COPY
1305 AC_DEFUN([LC_HAVE_BDI_CAP_MAP_COPY], [
1306         AC_MSG_CHECKING([if have 'BDI_CAP_MAP_COPY'])
1307         LB2_LINUX_TEST_RESULT([bdi_cap_map_copy], [
1308                 AC_DEFINE(HAVE_BDI_CAP_MAP_COPY, 1,
1309                         [BDI_CAP_MAP_COPY exist])
1310         ])
1311 ]) # LC_HAVE_BDI_CAP_MAP_COPY
1312
1313 #
1314 # LC_HAVE_PROJECT_QUOTA
1315 #
1316 # Kernel version v4.0-rc1-197-g847aac644e92
1317 #
1318 AC_DEFUN([LC_SRC_HAVE_PROJECT_QUOTA], [
1319         LB2_LINUX_TEST_SRC([get_projid], [
1320                 struct inode;
1321                 #include <linux/quota.h>
1322         ],[
1323                 struct dquot_operations ops = { };
1324
1325                 ops.get_projid(NULL, NULL);
1326         ])
1327 ])
1328 AC_DEFUN([LC_HAVE_PROJECT_QUOTA], [
1329         AC_MSG_CHECKING([if get_projid exists])
1330         LB2_LINUX_TEST_RESULT([get_projid], [
1331                 AC_DEFINE(HAVE_PROJECT_QUOTA, 1,
1332                         [get_projid function exists])
1333         ])
1334 ]) # LC_HAVE_PROJECT_QUOTA
1335
1336 #
1337 # LC_IOV_ITER_RW
1338 #
1339 # 4.1 kernel has iov_iter_rw
1340 #
1341 AC_DEFUN([LC_SRC_IOV_ITER_RW], [
1342         LB2_LINUX_TEST_SRC([iov_iter_rw], [
1343                 #include <linux/fs.h>
1344                 #include <linux/uio.h>
1345         ],[
1346                 struct iov_iter *iter = NULL;
1347
1348                 iov_iter_rw(iter);
1349         ])
1350 ])
1351 AC_DEFUN([LC_IOV_ITER_RW], [
1352         AC_MSG_CHECKING([if iov_iter_rw exist])
1353         LB2_LINUX_TEST_RESULT([iov_iter_rw], [
1354                 AC_DEFINE(HAVE_IOV_ITER_RW, 1, [iov_iter_rw exist])
1355         ])
1356 ]) # LC_IOV_ITER_RW
1357
1358 #
1359 # LC_HAVE_SYNC_READ_WRITE
1360 #
1361 # 4.1 new_sync_[read|write] no longer exported
1362 #
1363 AC_DEFUN([LC_HAVE_SYNC_READ_WRITE], [
1364 LB_CHECK_EXPORT([new_sync_read], [fs/read_write.c],
1365         [AC_DEFINE(HAVE_SYNC_READ_WRITE, 1,
1366                         [new_sync_[read|write] is exported by the kernel])])
1367 ]) # LC_HAVE_SYNC_READ_WRITE
1368
1369 #
1370 # LC_HAVE___BI_CNT
1371 #
1372 # 4.1 redefined bi_cnt as __bi_cnt in commit dac56212e8127dbc0
1373 #
1374 AC_DEFUN([LC_SRC_HAVE___BI_CNT], [
1375         LB2_LINUX_TEST_SRC([have___bi_cnt], [
1376                 #include <asm/atomic.h>
1377                 #include <linux/bio.h>
1378                 #include <linux/blk_types.h>
1379         ],[
1380                 struct bio bio = { };
1381                 int cnt;
1382                 cnt = atomic_read(&bio.__bi_cnt);
1383         ])
1384 ])
1385 AC_DEFUN([LC_HAVE___BI_CNT], [
1386         AC_MSG_CHECKING([if Linux kernel has __bi_cnt in struct bio])
1387         LB2_LINUX_TEST_RESULT([have___bi_cnt], [
1388                 AC_DEFINE(HAVE___BI_CNT, 1, [struct bio has __bi_cnt])
1389         ])
1390 ]) # LC_HAVE___BI_CNT
1391
1392 #
1393 # LC_SYMLINK_OPS_USE_NAMEIDATA
1394 #
1395 # For the 4.2+ kernels the file system internal symlink api no
1396 # longer uses struct nameidata as a argument
1397 #
1398 AC_DEFUN([LC_SRC_SYMLINK_OPS_USE_NAMEIDATA], [
1399         LB2_LINUX_TEST_SRC([symlink_use_nameidata], [
1400                 #include <linux/namei.h>
1401                 #include <linux/fs.h>
1402         ],[
1403                 struct nameidata *nd = NULL;
1404
1405                 ((struct inode_operations *)0)->follow_link(NULL, nd);
1406                 ((struct inode_operations *)0)->put_link(NULL, nd, NULL);
1407         ])
1408 ])
1409 AC_DEFUN([LC_SYMLINK_OPS_USE_NAMEIDATA], [
1410         AC_MSG_CHECKING([if symlink inode operations have struct nameidata argument])
1411         LB2_LINUX_TEST_RESULT([symlink_use_nameidata], [
1412                 AC_DEFINE(HAVE_SYMLINK_OPS_USE_NAMEIDATA, 1,
1413                         [symlink inode operations need struct nameidata argument])
1414         ])
1415 ]) # LC_SYMLINK_OPS_USE_NAMEIDATA
1416
1417 #
1418 # LC_BIO_ENDIO_USES_ONE_ARG
1419 #
1420 # 4.2 kernel bio_endio now only takes one argument
1421 #
1422 AC_DEFUN([LC_SRC_BIO_ENDIO_USES_ONE_ARG], [
1423         LB2_LINUX_TEST_SRC([bio_endio], [
1424                 #include <linux/bio.h>
1425         ],[
1426                 bio_endio(NULL);
1427         ])
1428 ])
1429 AC_DEFUN([LC_BIO_ENDIO_USES_ONE_ARG], [
1430         AC_MSG_CHECKING([if 'bio_endio' with one argument exist])
1431         LB2_LINUX_TEST_RESULT([bio_endio], [
1432                 AC_DEFINE(HAVE_BIO_ENDIO_USES_ONE_ARG, 1,
1433                         [bio_endio takes only one argument])
1434         ])
1435 ]) # LC_BIO_ENDIO_USES_ONE_ARG
1436
1437 #
1438 # LC_ACCOUNT_PAGE_DIRTIED_3ARGS
1439 #
1440 # 4.2 [to 4.5] kernel page dirtied takes 3 arguments
1441 #
1442 AC_DEFUN([LC_SRC_ACCOUNT_PAGE_DIRTIED_3ARGS], [
1443         LB2_LINUX_TEST_SRC([account_page_dirtied_3a], [
1444                 #include <linux/mm.h>
1445         ],[
1446                 account_page_dirtied(NULL, NULL, NULL);
1447         ])
1448 ])
1449 AC_DEFUN([LC_ACCOUNT_PAGE_DIRTIED_3ARGS], [
1450         AC_MSG_CHECKING([if 'account_page_dirtied' with 3 args exists])
1451         LB2_LINUX_TEST_RESULT([account_page_dirtied_3a], [
1452                 AC_DEFINE(HAVE_ACCOUNT_PAGE_DIRTIED_3ARGS, 1,
1453                         [account_page_dirtied takes three arguments])
1454         ])
1455 ]) # LC_ACCOUNT_PAGE_DIRTIED_3ARGS
1456
1457 #
1458 # LC_HAVE_CRYPTO_ALLOC_SKCIPHER
1459 #
1460 # Kernel version 4.12 commit 7a7ffe65c8c5
1461 # introduced crypto_alloc_skcipher().
1462 #
1463 AC_DEFUN([LC_SRC_HAVE_CRYPTO_ALLOC_SKCIPHER], [
1464         LB2_LINUX_TEST_SRC([crypto_alloc_skcipher], [
1465                 #include <crypto/skcipher.h>
1466         ],[
1467                 crypto_alloc_skcipher(NULL, 0, 0);
1468         ])
1469 ])
1470 AC_DEFUN([LC_HAVE_CRYPTO_ALLOC_SKCIPHER], [
1471         AC_MSG_CHECKING([if crypto_alloc_skcipher is defined])
1472         LB2_LINUX_TEST_RESULT([crypto_alloc_skcipher], [
1473                 AC_DEFINE(HAVE_CRYPTO_ALLOC_SKCIPHER, 1,
1474                         [crypto_alloc_skcipher is defined])
1475         ])
1476 ]) # LC_HAVE_CRYPTO_ALLOC_SKCIPHER
1477
1478 #
1479 # LC_HAVE_INTERVAL_EXP_BLK_INTEGRITY
1480 #
1481 # 4.3 replace interval with interval_exp in 'struct blk_integrity'
1482 # 'struct blk_integrity_profile' is also added in this version,
1483 # thus use this to determine whether 'struct blk_integrity' has profile
1484 #
1485 AC_DEFUN([LC_SRC_HAVE_INTERVAL_EXP_BLK_INTEGRITY], [
1486         LB2_LINUX_TEST_SRC([blk_integrity_interval_exp], [
1487                 #include <linux/blkdev.h>
1488         ],[
1489                 ((struct blk_integrity *)0)->interval_exp = 0;
1490         ])
1491 ])
1492 AC_DEFUN([LC_HAVE_INTERVAL_EXP_BLK_INTEGRITY], [
1493         AC_MSG_CHECKING([if 'blk_integrity.interval_exp' exist])
1494         LB2_LINUX_TEST_RESULT([blk_integrity_interval_exp], [
1495                 AC_DEFINE(HAVE_INTERVAL_EXP_BLK_INTEGRITY, 1,
1496                         [blk_integrity.interval_exp exist])
1497         ])
1498 ]) # LC_HAVE_INTERVAL_EXP_BLK_INTEGRITY
1499
1500 #
1501 # LC_HAVE_CACHE_HEAD_HLIST
1502 #
1503 # 4.3 kernel swiched to hlist for cache_head
1504 #
1505 AC_DEFUN([LC_SRC_HAVE_CACHE_HEAD_HLIST], [
1506         LB2_LINUX_TEST_SRC([cache_head_has_hlist], [
1507                 #include <linux/sunrpc/cache.h>
1508         ],[
1509                 do {} while(sizeof(((struct cache_head *)0)->cache_list));
1510         ])
1511 ])
1512 AC_DEFUN([LC_HAVE_CACHE_HEAD_HLIST], [
1513         AC_MSG_CHECKING([if 'struct cache_head' has 'cache_list' field])
1514         LB2_LINUX_TEST_RESULT([cache_head_has_hlist], [
1515                 AC_DEFINE(HAVE_CACHE_HEAD_HLIST, 1,
1516                         [cache_head has hlist cache_list])
1517         ])
1518 ]) # LC_HAVE_CACHE_HEAD_HLIST
1519
1520 #
1521 # LC_HAVE_XATTR_HANDLER_SIMPLIFIED
1522 #
1523 # Kernel version 4.3 commit e409de992e3ea3674393465f07cc71c948edd87a
1524 # simplified xattr_handler handling by passing in the handler pointer
1525 #
1526 AC_DEFUN([LC_SRC_HAVE_XATTR_HANDLER_SIMPLIFIED], [
1527         LB2_LINUX_TEST_SRC([xattr_handler_simplified], [
1528                 #include <linux/xattr.h>
1529         ],[
1530                 struct xattr_handler handler;
1531
1532                 ((struct xattr_handler *)0)->get(&handler, NULL, NULL, NULL, 0);
1533                 ((struct xattr_handler *)0)->set(&handler, NULL, NULL, NULL, 0, 0);
1534         ],[-Werror])
1535 ])
1536 AC_DEFUN([LC_HAVE_XATTR_HANDLER_SIMPLIFIED], [
1537         AC_MSG_CHECKING([if 'struct xattr_handler' functions pass in handler pointer])
1538         LB2_LINUX_TEST_RESULT([xattr_handler_simplified], [
1539                 AC_DEFINE(HAVE_XATTR_HANDLER_SIMPLIFIED, 1,
1540                         [handler pointer is parameter])
1541         ])
1542 ]) # LC_HAVE_XATTR_HANDLER_SIMPLIFIED
1543
1544 #
1545 # LC_HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD
1546 #
1547 # 4.3 replace interval with interval_exp in 'struct blk_integrity'.
1548 #
1549 AC_DEFUN([LC_SRC_HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD], [
1550         LB2_LINUX_TEST_SRC([bio_integrity_payload_bip_iter], [
1551                 #include <linux/bio.h>
1552         ],[
1553                 ((struct bio_integrity_payload *)0)->bip_iter.bi_size = 0;
1554         ])
1555 ])
1556 AC_DEFUN([LC_HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD], [
1557         AC_MSG_CHECKING([if 'bio_integrity_payload.bip_iter' exist])
1558         LB2_LINUX_TEST_RESULT([bio_integrity_payload_bip_iter], [
1559                 AC_DEFINE(HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD, 1,
1560                         [bio_integrity_payload.bip_iter exist])
1561         ])
1562 ]) # LC_HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD
1563
1564 #
1565 # LC_BIO_INTEGRITY_PREP_FN
1566 #
1567 # Lustre kernel patch extents bio_integrity_prep to accept optional
1568 # generate/verify_fn as extra args.
1569 #
1570 AC_DEFUN([LC_SRC_BIO_INTEGRITY_PREP_FN], [
1571         LB2_LINUX_TEST_SRC([bio_integrity_prep_fn], [
1572                 #include <linux/bio.h>
1573         ],[
1574                 bio_integrity_prep_fn(NULL, NULL, NULL);
1575         ])
1576 ])
1577 AC_DEFUN([LC_BIO_INTEGRITY_PREP_FN], [
1578         AC_MSG_CHECKING([if 'bio_integrity_prep_fn' exists])
1579         LB2_LINUX_TEST_RESULT([bio_integrity_prep_fn], [
1580                 AC_DEFINE(HAVE_BIO_INTEGRITY_PREP_FN, 1,
1581                         [kernel has bio_integrity_prep_fn])
1582                 AC_SUBST(PATCHED_INTEGRITY_INTF)
1583         ],[
1584                 AC_SUBST(PATCHED_INTEGRITY_INTF, [#])
1585         ])
1586 ]) # LC_BIO_INTEGRITY_PREP_FN
1587
1588 # LC_BIO_INTEGRITY_PREP_FN_RETURNS_BOOL
1589 #
1590 # 13 kernel integrity API has changed and in 4.13+
1591 # (as well as in rhel 8.4) bio_integrity_prep() returns boolean true
1592 # on success.
1593 #
1594 AC_DEFUN([LC_SRC_BIO_INTEGRITY_PREP_FN_RETURNS_BOOL], [
1595         LB2_LINUX_TEST_SRC([bio_integrity_prep_ret_bool], [
1596                 #include <linux/bio.h>
1597                 #include <linux/typecheck.h>
1598         ],[
1599                 #pragma GCC diagnostic warning "-Werror"
1600                 typedef bool (*bio_integrity_prep_type)(struct bio *bio) ;
1601
1602                 typecheck_fn(bio_integrity_prep_type, bio_integrity_prep);
1603         ])
1604 ])
1605 AC_DEFUN([LC_BIO_INTEGRITY_PREP_FN_RETURNS_BOOL], [
1606         AC_MSG_CHECKING([if 'bio_integrity_prep_fn' returns bool])
1607         LB2_LINUX_TEST_RESULT([bio_integrity_prep_ret_bool], [
1608                 AC_DEFINE(HAVE_BIO_INTEGRITY_PREP_FN_RETURNS_BOOL, 1,
1609                         [bio_integrity_prep_fn returns bool])
1610         ])
1611 ]) # LC_BIO_INTEGRITY_PREP_FN_RETURNS_BOOL
1612
1613 #
1614 # LC_HAVE_BI_OPF
1615 #
1616 # 4.4/4.8 redefined bi_rw as bi_opf (SLES12/kernel commit 4382e33ad37486)
1617 #
1618 AC_DEFUN([LC_SRC_HAVE_BI_OPF], [
1619         LB2_LINUX_TEST_SRC([have_bi_opf], [
1620                 #include <linux/bio.h>
1621         ],[
1622                 struct bio bio;
1623
1624                 bio.bi_opf = 0;
1625         ])
1626 ])
1627 AC_DEFUN([LC_HAVE_BI_OPF], [
1628         AC_MSG_CHECKING([if Linux kernel has bi_opf in struct bio])
1629         LB2_LINUX_TEST_RESULT([have_bi_opf], [
1630                 AC_DEFINE(HAVE_BI_OPF, 1, [struct bio has bi_opf])
1631         ])
1632 ]) # LC_HAVE_BI_OPF
1633
1634 #
1635 # LC_HAVE_SUBMIT_BIO_2ARGS
1636 #
1637 # 4.4 removed an argument from submit_bio
1638 #
1639 AC_DEFUN([LC_SRC_HAVE_SUBMIT_BIO_2ARGS], [
1640         LB2_LINUX_TEST_SRC([have_submit_bio_2args], [
1641                 #include <linux/bio.h>
1642         ],[
1643                 struct bio bio;
1644                 submit_bio(READ, &bio);
1645         ])
1646 ])
1647 AC_DEFUN([LC_HAVE_SUBMIT_BIO_2ARGS], [
1648         AC_MSG_CHECKING([if submit_bio takes two arguments])
1649         LB2_LINUX_TEST_RESULT([have_submit_bio_2args], [
1650                 AC_DEFINE(HAVE_SUBMIT_BIO_2ARGS, 1,
1651                         [submit_bio takes two arguments])
1652         ])
1653 ]) # LC_HAVE_SUBMIT_BIO_2_ARGS
1654
1655 #
1656 # LC_HAVE_CLEAN_BDEV_ALIASES
1657 #
1658 # 4.4/4.9 unmap_underlying_metadata was replaced by clean_bdev_aliases
1659 # (SLES12/kernel commit 29f3ad7d8380364c)
1660 #
1661 AC_DEFUN([LC_SRC_HAVE_CLEAN_BDEV_ALIASES], [
1662         LB2_LINUX_TEST_SRC([have_clean_bdev_aliases], [
1663                 #include <linux/buffer_head.h>
1664         ],[
1665                 clean_bdev_aliases(NULL,1,1);
1666         ])
1667 ])
1668 AC_DEFUN([LC_HAVE_CLEAN_BDEV_ALIASES], [
1669         AC_MSG_CHECKING([if kernel has clean_bdev_aliases])
1670         LB2_LINUX_TEST_RESULT([have_clean_bdev_aliases], [
1671                 AC_DEFINE(HAVE_CLEAN_BDEV_ALIASES, 1,
1672                         [kernel has clean_bdev_aliases])
1673         ])
1674 ]) # LC_HAVE_CLEAN_BDEV_ALIASES
1675
1676 #
1677 # LC_HAVE_LOCKS_LOCK_FILE_WAIT
1678 #
1679 # 4.4 kernel have moved locks API users to
1680 # locks_lock_inode_wait()
1681 #
1682 AC_DEFUN([LC_SRC_HAVE_LOCKS_LOCK_FILE_WAIT], [
1683         LB2_LINUX_TEST_SRC([locks_lock_file_wait], [
1684                 #include <linux/fs.h>
1685         ],[
1686                 locks_lock_file_wait(NULL, NULL);
1687         ])
1688 ])
1689 AC_DEFUN([LC_HAVE_LOCKS_LOCK_FILE_WAIT], [
1690         AC_MSG_CHECKING([if 'locks_lock_file_wait' exists])
1691         LB2_LINUX_TEST_RESULT([locks_lock_file_wait], [
1692                 AC_DEFINE(HAVE_LOCKS_LOCK_FILE_WAIT, 1,
1693                         [kernel has locks_lock_file_wait])
1694         ])
1695 ]) # LC_HAVE_LOCKS_LOCK_FILE_WAIT
1696
1697 #
1698 # LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
1699 #
1700 # 4.4 kernel merged type-specific data with the payload data for keys
1701 #
1702 AC_DEFUN([LC_SRC_HAVE_KEY_PAYLOAD_DATA_ARRAY], [
1703         LB2_LINUX_TEST_SRC([key_payload_data_array], [
1704                 #include <linux/key.h>
1705         ],[
1706                 struct key key = { };
1707
1708                 key.payload.data[0] = NULL;
1709         ])
1710 ])
1711 AC_DEFUN([LC_HAVE_KEY_PAYLOAD_DATA_ARRAY], [
1712         AC_MSG_CHECKING([if 'struct key' has 'payload.data' as an array])
1713         LB2_LINUX_TEST_RESULT([key_payload_data_array], [
1714                 AC_DEFINE(HAVE_KEY_PAYLOAD_DATA_ARRAY, 1, [payload.data is an array])
1715         ])
1716 ]) # LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
1717
1718 #
1719 # LC_HAVE_XATTR_HANDLER_NAME
1720 #
1721 # Kernel version 4.4 commit 98e9cb5711c68223f0e4d5201b9a6add255ec550
1722 # add a name member to struct xattr_handler
1723 #
1724 AC_DEFUN([LC_SRC_HAVE_XATTR_HANDLER_NAME], [
1725         LB2_LINUX_TEST_SRC([xattr_handler_name], [
1726                 #include <linux/xattr.h>
1727         ],[
1728                 ((struct xattr_handler *)NULL)->name = NULL;
1729         ],[-Werror])
1730 ])
1731 AC_DEFUN([LC_HAVE_XATTR_HANDLER_NAME], [
1732         AC_MSG_CHECKING([if 'struct xattr_handler' has a name member])
1733         LB2_LINUX_TEST_RESULT([xattr_handler_name], [
1734                 AC_DEFINE(HAVE_XATTR_HANDLER_NAME, 1,
1735                         [xattr_handler has a name member])
1736         ])
1737 ]) # LC_HAVE_XATTR_HANDLER_NAME
1738
1739 #
1740 # LC_HAVE_FILE_DENTRY
1741 #
1742 # 4.5 adds wrapper file_dentry
1743 #
1744 AC_DEFUN([LC_SRC_HAVE_FILE_DENTRY], [
1745         LB2_LINUX_TEST_SRC([file_dentry], [
1746                 #include <linux/fs.h>
1747         ],[
1748                 file_dentry(NULL);
1749         ])
1750 ])
1751 AC_DEFUN([LC_HAVE_FILE_DENTRY], [
1752         AC_MSG_CHECKING([if Linux kernel has 'file_dentry'])
1753         LB2_LINUX_TEST_RESULT([file_dentry], [
1754                 AC_DEFINE(HAVE_FILE_DENTRY, 1, [kernel has file_dentry])
1755         ])
1756 ]) # LC_HAVE_FILE_DENTRY
1757
1758 #
1759 # LC_HAVE_INODE_LOCK
1760 #
1761 # 4.5 introduced inode_lock
1762 #
1763 AC_DEFUN([LC_SRC_HAVE_INODE_LOCK], [
1764         LB2_LINUX_TEST_SRC([inode_lock], [
1765                 #include <linux/fs.h>
1766         ],[
1767                 inode_lock(NULL);
1768         ])
1769 ])
1770 AC_DEFUN([LC_HAVE_INODE_LOCK], [
1771         AC_MSG_CHECKING([if 'inode_lock' is defined])
1772         LB2_LINUX_TEST_RESULT([inode_lock], [
1773                 AC_DEFINE(HAVE_INODE_LOCK, 1, [inode_lock is defined])
1774         ])
1775 ]) # LC_HAVE_INODE_LOCK
1776
1777 #
1778 # LC_HAVE_IOP_GET_LINK
1779 #
1780 # 4.5 vfs replaced iop->follow_link with
1781 # iop->get_link
1782 #
1783 AC_DEFUN([LC_SRC_HAVE_IOP_GET_LINK], [
1784         LB2_LINUX_TEST_SRC([inode_ops_get_link], [
1785                 #include <linux/fs.h>
1786         ],[
1787                 struct inode_operations iop;
1788                 iop.get_link = NULL;
1789         ])
1790 ])
1791 AC_DEFUN([LC_HAVE_IOP_GET_LINK], [
1792         AC_MSG_CHECKING([if 'iop' has 'get_link'])
1793         LB2_LINUX_TEST_RESULT([inode_ops_get_link], [
1794                 AC_DEFINE(HAVE_IOP_GET_LINK, 1, [have iop get_link])
1795         ])
1796 ]) # LC_HAVE_IOP_GET_LINK
1797
1798 #
1799 # LC_HAVE_IN_COMPAT_SYSCALL
1800 #
1801 # 4.6 renamed is_compat_task to in_compat_syscall
1802 #
1803 AC_DEFUN([LC_SRC_HAVE_IN_COMPAT_SYSCALL], [
1804         LB2_LINUX_TEST_SRC([in_compat_syscall], [
1805                 #include <linux/compat.h>
1806         ],[
1807                 in_compat_syscall();
1808         ])
1809 ])
1810 AC_DEFUN([LC_HAVE_IN_COMPAT_SYSCALL], [
1811         AC_MSG_CHECKING([if 'in_compat_syscall' is defined])
1812         LB2_LINUX_TEST_RESULT([in_compat_syscall], [
1813                 AC_DEFINE(HAVE_IN_COMPAT_SYSCALL, 1, [have in_compat_syscall])
1814         ])
1815 ]) # LC_HAVE_IN_COMPAT_SYSCALL
1816
1817 #
1818 # LC_HAVE_XATTR_HANDLER_INODE_PARAM
1819 #
1820 # Kernel version 4.6 commit b296821a7c42fa58baa17513b2b7b30ae66f3336
1821 # and commit 5930122683dff58f0846b0f0405b4bd598a3ba6a added inode parameter
1822 # to xattr_handler functions
1823 #
1824 AC_DEFUN([LC_SRC_HAVE_XATTR_HANDLER_INODE_PARAM], [
1825         LB2_LINUX_TEST_SRC([xattr_handler_inode_param], [
1826                 #include <linux/xattr.h>
1827         ],[
1828                 const struct xattr_handler handler;
1829
1830                 ((struct xattr_handler *)0)->get(&handler, NULL, NULL, NULL, NULL, 0);
1831                 ((struct xattr_handler *)0)->set(&handler, NULL, NULL, NULL, NULL, 0, 0);
1832         ],[-Werror])
1833 ])
1834 AC_DEFUN([LC_HAVE_XATTR_HANDLER_INODE_PARAM], [
1835         AC_MSG_CHECKING([if 'struct xattr_handler' functions have inode parameter])
1836         LB2_LINUX_TEST_RESULT([xattr_handler_inode_param], [
1837                 AC_DEFINE(HAVE_XATTR_HANDLER_INODE_PARAM, 1, [needs inode parameter])
1838         ])
1839 ]) # LC_HAVE_XATTR_HANDLER_INODE_PARAM
1840
1841 #
1842 # LC_D_IN_LOOKUP
1843 #
1844 # Kernel version 4.6 commit 85c7f81041d57cfe9dc97f4680d5586b54534a39
1845 # introduced parallel lookups in the VFS layer. The inline function
1846 # d_in_lookup was added to notify when the same item was being queried
1847 # at the same time.
1848 #
1849 AC_DEFUN([LC_SRC_D_IN_LOOKUP], [
1850         LB2_LINUX_TEST_SRC([d_in_lookup], [
1851                 #include <linux/dcache.h>
1852         ],[
1853                 d_in_lookup(NULL);
1854         ],[-Werror])
1855 ])
1856 AC_DEFUN([LC_D_IN_LOOKUP], [
1857         AC_MSG_CHECKING([if 'd_in_lookup' is defined])
1858         LB2_LINUX_TEST_RESULT([d_in_lookup], [
1859                 AC_DEFINE(HAVE_D_IN_LOOKUP, 1, [d_in_lookup is defined])
1860         ])
1861 ]) # LC_D_IN_LOOKUP
1862
1863 #
1864 # LC_LOCK_PAGE_MEMCG
1865 #
1866 # Kernel version 4.6 adds lock_page_memcg(page)
1867 # Linux commit v5.15-12273-gab2f9d2d3626
1868 #   mm: unexport {,un}lock_page_memcg
1869 #
1870 AC_DEFUN([LC_SRC_LOCK_PAGE_MEMCG], [
1871         LB2_LINUX_TEST_SRC([lock_page_memcg], [
1872                 #include <linux/memcontrol.h>
1873         ],[
1874                 lock_page_memcg(NULL);
1875         ],[-Werror])
1876 ])
1877 AC_DEFUN([LC_LOCK_PAGE_MEMCG], [
1878         AC_MSG_CHECKING([if 'lock_page_memcg' is defined])
1879         LB2_LINUX_TEST_RESULT([lock_page_memcg], [
1880                 AC_DEFINE(HAVE_LOCK_PAGE_MEMCG, 1, [lock_page_memcg is defined])
1881         ])
1882 ]) # LC_LOCK_PAGE_MEMCG
1883
1884 #
1885 # LC_HAVE_DOWN_WRITE_KILLABLE
1886 #
1887 # Kernel version v4.6-rc3-28-g916633a40370
1888 #
1889 AC_DEFUN([LC_SRC_HAVE_DOWN_WRITE_KILLABLE], [
1890         LB2_LINUX_TEST_SRC([down_write_killable], [
1891                 #include <linux/rwsem.h>
1892
1893                 struct rw_semaphore sem;
1894         ],[
1895                 int rc;
1896
1897                 rc = down_write_killable(&sem);
1898                 (void)rc;
1899         ])
1900 ])
1901 AC_DEFUN([LC_HAVE_DOWN_WRITE_KILLABLE], [
1902         AC_MSG_CHECKING([if down_write_killable exists])
1903         LB2_LINUX_TEST_RESULT([down_write_killable], [
1904                 AC_DEFINE(HAVE_DOWN_WRITE_KILLABLE, 1,
1905                         [down_write_killable function exists])
1906         ])
1907 ]) # LC_HAVE_DOWN_WRITE_KILLABLE
1908
1909 #
1910 # LC_D_INIT
1911 #
1912 # Kernel version 4.7-rc5 commit 285b102d3b745f3c2c110c9c327741d87e64aacc
1913 # add new d_init to initialize dentry at allocation time
1914 #
1915 AC_DEFUN([LC_SRC_D_INIT], [
1916         LB2_LINUX_TEST_SRC([d_init], [
1917                 #include <linux/dcache.h>
1918         ],[
1919                 struct dentry_operations ops = { };
1920                 int rc;
1921
1922                 rc = ops.d_init(NULL);
1923         ])
1924 ])
1925 AC_DEFUN([LC_D_INIT], [
1926         AC_MSG_CHECKING([if dentry operations supports 'd_init'])
1927         LB2_LINUX_TEST_RESULT([d_init], [
1928                 AC_DEFINE(HAVE_D_INIT, 1, ['d_init' exists])
1929         ])
1930 ]) # LC_D_INIT
1931
1932 #
1933 # LC_DIRECTIO_2ARGS
1934 #
1935 # Kernel version 4.7 commit c8b8e32d700fe943a935e435ae251364d016c497
1936 # direct-io: eliminate the offset argument to ->direct_IO
1937 #
1938 AC_DEFUN([LC_SRC_DIRECTIO_2ARGS], [
1939         LB2_LINUX_TEST_SRC([direct_io_2args], [
1940                 #include <linux/fs.h>
1941         ],[
1942                 struct address_space_operations ops = { };
1943                 struct iov_iter *iter = NULL;
1944                 struct kiocb *iocb = NULL;
1945                 int rc;
1946
1947                 rc = ops.direct_IO(iocb, iter);
1948         ])
1949 ])
1950 AC_DEFUN([LC_DIRECTIO_2ARGS], [
1951         AC_MSG_CHECKING([if '->direct_IO()' takes 2 arguments])
1952         LB2_LINUX_TEST_RESULT([direct_io_2args], [
1953                 AC_DEFINE(HAVE_DIRECTIO_2ARGS, 1, [direct_IO has 2 arguments])
1954         ])
1955 ]) # LC_DIRECTIO_2ARGS
1956
1957 #
1958 # LC_GENERIC_WRITE_SYNC_2ARGS
1959 #
1960 # Kernel version 4.7 commit dde0c2e79848298cc25621ad080d47f94dbd7cce
1961 # fs: add IOCB_SYNC and IOCB_DSYNC
1962 #
1963 AC_DEFUN([LC_SRC_GENERIC_WRITE_SYNC_2ARGS], [
1964         LB2_LINUX_TEST_SRC([generic_write_sync_2args], [
1965                 #include <linux/fs.h>
1966         ],[
1967                 struct kiocb *iocb = NULL;
1968                 ssize_t rc;
1969
1970                 rc = generic_write_sync(iocb, 0);
1971         ])
1972 ])
1973 AC_DEFUN([LC_GENERIC_WRITE_SYNC_2ARGS], [
1974         AC_MSG_CHECKING([if 'generic_write_sync()' takes 2 arguments])
1975         LB2_LINUX_TEST_RESULT([generic_write_sync_2args], [
1976                 AC_DEFINE(HAVE_GENERIC_WRITE_SYNC_2ARGS, 1,
1977                         [generic_write_sync has 2 arguments])
1978         ])
1979 ]) # LC_GENERIC_WRITE_SYNC_2ARGS
1980
1981 #
1982 # LC_FOP_ITERATE_SHARED
1983 #
1984 # Kernel v4.6-rc3-29-g6192269 adds iterate_shared method to file_operations
1985 #
1986 AC_DEFUN([LC_SRC_FOP_ITERATE_SHARED], [
1987         LB2_LINUX_TEST_SRC([fop_iterate_shared], [
1988                 #include <linux/fs.h>
1989         ],[
1990                 struct file_operations fop;
1991                 fop.iterate_shared = NULL;
1992         ])
1993 ])
1994 AC_DEFUN([LC_FOP_ITERATE_SHARED], [
1995         AC_MSG_CHECKING([if 'file_operations' has 'iterate_shared'])
1996         LB2_LINUX_TEST_RESULT([fop_iterate_shared], [
1997                 AC_DEFINE(HAVE_FOP_ITERATE_SHARED, 1,
1998                         [file_operations has iterate_shared])
1999         ])
2000 ]) # LC_FOP_ITERATE_SHARED
2001
2002 #
2003 # LC_EXPORT_DEFAULT_FILE_SPLICE_READ
2004 #
2005 # 4.8-rc8 commit 82c156f853840645604acd7c2cebcb75ed1b6652 switched
2006 # generic_file_splice_read() to using ->read_iter. We can test this
2007 # change since default_file_splice_read() is no longer exported.
2008 #
2009 AC_DEFUN([LC_EXPORT_DEFAULT_FILE_SPLICE_READ], [
2010 LB_CHECK_EXPORT([default_file_splice_read], [fs/splice.c],
2011         [AC_DEFINE(HAVE_DEFAULT_FILE_SPLICE_READ_EXPORT, 1,
2012                         [default_file_splice_read is exported])])
2013 ]) # LC_EXPORT_DEFAULT_FILE_SPLCE_READ
2014
2015 #
2016 # LC_HAVE_POSIX_ACL_VALID_USER_NS
2017 #
2018 # 4.8 posix_acl_valid takes struct user_namespace
2019 #
2020 AC_DEFUN([LC_SRC_HAVE_POSIX_ACL_VALID_USER_NS], [
2021         LB2_LINUX_TEST_SRC([posix_acl_valid], [
2022                 #include <linux/fs.h>
2023                 #include <linux/posix_acl.h>
2024         ],[
2025                 posix_acl_valid((struct user_namespace*)NULL, (const struct posix_acl*)NULL);
2026         ])
2027 ])
2028 AC_DEFUN([LC_HAVE_POSIX_ACL_VALID_USER_NS], [
2029         AC_MSG_CHECKING([if 'posix_acl_valid' takes 'struct user_namespace'])
2030         LB2_LINUX_TEST_RESULT([posix_acl_valid], [
2031                 AC_DEFINE(HAVE_POSIX_ACL_VALID_USER_NS, 1,
2032                         [posix_acl_valid takes struct user_namespace])
2033         ])
2034 ]) # LC_HAVE_POSIX_ACL_VALID_USER_NS
2035
2036 #
2037 # LC_D_COMPARE_4ARGS
2038 #
2039 # Kernel version 4.8 commit 6fa67e707559303e086303aeecc9e8b91ef497d5
2040 # get rid of 'parent' argument of ->d_compare()
2041 #
2042 AC_DEFUN([LC_SRC_D_COMPARE_4ARGS], [
2043         LB2_LINUX_TEST_SRC([d_compare_4args], [
2044                 #include <linux/dcache.h>
2045         ],[
2046                 ((struct dentry_operations*)0)->d_compare(NULL,0,NULL,NULL);
2047         ])
2048 ])
2049 AC_DEFUN([LC_D_COMPARE_4ARGS], [
2050         AC_MSG_CHECKING([if 'd_compare' taken 4 arguments])
2051         LB2_LINUX_TEST_RESULT([d_compare_4args], [
2052                 AC_DEFINE(HAVE_D_COMPARE_4ARGS, 1,
2053                         [d_compare need 4 arguments])
2054         ])
2055 ]) # LC_D_COMPARE_4ARGS
2056
2057 #
2058 # LC_FULL_NAME_HASH_3ARGS
2059 #
2060 # Kernel version 4.8 commit 8387ff2577eb9ed245df9a39947f66976c6bcd02
2061 # vfs: make the string hashes salt the hash
2062 #
2063 AC_DEFUN([LC_SRC_FULL_NAME_HASH_3ARGS], [
2064         LB2_LINUX_TEST_SRC([full_name_hash_3args], [
2065                 #include <linux/stringhash.h>
2066         ],[
2067                 unsigned int hash;
2068                 hash = full_name_hash(NULL,NULL,0);
2069         ])
2070 ])
2071 AC_DEFUN([LC_FULL_NAME_HASH_3ARGS], [
2072         AC_MSG_CHECKING([if 'full_name_hash' taken 3 arguments])
2073         LB2_LINUX_TEST_RESULT([full_name_hash_3args], [
2074                 AC_DEFINE(HAVE_FULL_NAME_HASH_3ARGS, 1,
2075                         [full_name_hash need 3 arguments])
2076         ])
2077 ]) # LC_FULL_NAME_HASH_3ARGS
2078
2079 #
2080 # LC_STRUCT_POSIX_ACL_XATTR
2081 #
2082 # Kernel version 4.8 commit 2211d5ba5c6c4e972ba6dbc912b2897425ea6621
2083 # posix_acl: xattr representation cleanups
2084 #
2085 AC_DEFUN([LC_SRC_STRUCT_POSIX_ACL_XATTR], [
2086         LB2_LINUX_TEST_SRC([struct_posix_acl_xattr], [
2087                 #include <linux/fs.h>
2088                 #include <linux/posix_acl_xattr.h>
2089         ],[
2090                 struct posix_acl_xattr_header *h = NULL;
2091                 struct posix_acl_xattr_entry  *e;
2092                 e = (void *)(h + 1);
2093         ])
2094 ])
2095 AC_DEFUN([LC_STRUCT_POSIX_ACL_XATTR], [
2096         AC_MSG_CHECKING([if 'struct posix_acl_xattr_{header,entry}' defined])
2097         LB2_LINUX_TEST_RESULT([struct_posix_acl_xattr], [
2098                 AC_DEFINE(HAVE_STRUCT_POSIX_ACL_XATTR, 1,
2099                         [struct posix_acl_xattr_{header,entry} defined])
2100         ])
2101 ]) # LC_STRUCT_POSIX_ACL_XATTR
2102
2103 #
2104 # LC_IOP_XATTR
2105 #
2106 # Kernel version 4.8 commit fd50ecaddf8372a1d96e0daeaac0f93cf04e4d42
2107 # removed {get,set,remove}xattr inode operations
2108 #
2109 AC_DEFUN([LC_SRC_IOP_XATTR], [
2110         LB2_LINUX_TEST_SRC([inode_ops_xattr], [
2111                 #include <linux/fs.h>
2112         ],[
2113                 struct inode_operations iop;
2114                 iop.setxattr = NULL;
2115                 iop.getxattr = NULL;
2116                 iop.removexattr = NULL;
2117         ])
2118 ])
2119 AC_DEFUN([LC_IOP_XATTR], [
2120         AC_MSG_CHECKING([if 'inode_operations' has {get,set,remove}xattr members])
2121         LB2_LINUX_TEST_RESULT([inode_ops_xattr], [
2122                 AC_DEFINE(HAVE_IOP_XATTR, 1,
2123                         [inode_operations has {get,set,remove}xattr members])
2124         ])
2125 ]) # LC_IOP_XATTR
2126
2127 #
2128 # LC_GROUP_INFO_GID
2129 #
2130 # Kernel version 4.9 commit 81243eacfa400f5f7b89f4c2323d0de9982bb0fb
2131 # cred: simpler, 1D supplementary groups
2132 #
2133 AC_DEFUN([LC_SRC_GROUP_INFO_GID], [
2134         LB2_LINUX_TEST_SRC([group_info_gid], [
2135                 #include <linux/cred.h>
2136         ],[
2137                 kgid_t *p;
2138                 p = ((struct group_info *)0)->gid;
2139         ])
2140 ])
2141 AC_DEFUN([LC_GROUP_INFO_GID], [
2142         AC_MSG_CHECKING([if 'struct group_info' has member 'gid'])
2143         LB2_LINUX_TEST_RESULT([group_info_gid], [
2144                 AC_DEFINE(HAVE_GROUP_INFO_GID, 1,
2145                         [struct group_info has member gid])
2146         ])
2147 ]) # LC_GROUP_INFO_GID
2148
2149 #
2150 # LC_VFS_SETXATTR
2151 #
2152 # Kernel version 4.9 commit 5d6c31910bc0713e37628dc0ce677dcb13c8ccf4
2153 # added __vfs_{get,set,remove}xattr helpers
2154 #
2155 AC_DEFUN([LC_SRC_VFS_SETXATTR], [
2156         LB2_LINUX_TEST_SRC([vfs_setxattr], [
2157                 #include <linux/xattr.h>
2158         ],[
2159                 __vfs_setxattr(NULL, NULL, NULL, NULL, 0, 0);
2160         ])
2161 ])
2162 AC_DEFUN([LC_VFS_SETXATTR], [
2163         AC_MSG_CHECKING([if '__vfs_setxattr' helper is available])
2164         LB2_LINUX_TEST_RESULT([vfs_setxattr], [
2165                 AC_DEFINE(HAVE_VFS_SETXATTR, 1, ['__vfs_setxattr' is available])
2166         ])
2167 ]) # LC_VFS_SETXATTR
2168
2169 #
2170 # LC_POSIX_ACL_UPDATE_MODE
2171 #
2172 # Kernel version 4.9 commit 073931017b49d9458aa351605b43a7e34598caef
2173 # posix_acl: Clear SGID bit when setting file permissions
2174 #
2175 AC_DEFUN([LC_SRC_POSIX_ACL_UPDATE_MODE], [
2176         LB2_LINUX_TEST_SRC([posix_acl_update_mode], [
2177                 #include <linux/fs.h>
2178                 #include <linux/posix_acl.h>
2179         ],[
2180                 posix_acl_update_mode(NULL, NULL, NULL);
2181         ])
2182 ])
2183 AC_DEFUN([LC_POSIX_ACL_UPDATE_MODE], [
2184         AC_MSG_CHECKING([if 'posix_acl_update_mode' exists])
2185         LB2_LINUX_TEST_RESULT([posix_acl_update_mode], [
2186                 AC_DEFINE(HAVE_POSIX_ACL_UPDATE_MODE, 1,
2187                         ['posix_acl_update_mode' is available])
2188         ])
2189 ]) # LC_POSIX_ACL_UPDATE_MODE
2190
2191 #
2192 # LC_HAVE_BDI_IO_PAGES
2193 #
2194 # Kernel version 4.9 commit 9491ae4aade6814afcfa67f4eb3e3342c2b39750
2195 # mm: don't cap request size based on read-ahead setting
2196 # This patch introduces a bdi hint, io_pages.
2197 #
2198 AC_DEFUN([LC_SRC_HAVE_BDI_IO_PAGES], [
2199         LB2_LINUX_TEST_SRC([bdi_has_io_pages], [
2200                 #include <linux/backing-dev.h>
2201         ],[
2202                 struct backing_dev_info info;
2203
2204                 info.io_pages = 0;
2205         ])
2206 ])
2207 AC_DEFUN([LC_HAVE_BDI_IO_PAGES], [
2208         AC_MSG_CHECKING([if 'struct backing_dev_info' has 'io_pages' field])
2209         LB2_LINUX_TEST_RESULT([bdi_has_io_pages], [
2210                 AC_DEFINE(HAVE_BDI_IO_PAGES, 1,
2211                         [backing_dev_info has io_pages])
2212         ])
2213 ]) # LC_HAVE_BDI_IO_PAGES
2214
2215 #
2216 # LC_IOP_GENERIC_READLINK
2217 #
2218 # Kernel version 4.10 commit dfeef68862edd7d4bafe68ef7aeb5f658ef24bb5
2219 # removed generic_readlink from individual file systems
2220 #
2221 AC_DEFUN([LC_SRC_IOP_GENERIC_READLINK], [
2222         LB2_LINUX_TEST_SRC([inode_ops_readlink], [
2223                 #include <linux/fs.h>
2224         ],[
2225                 struct inode_operations iop;
2226                 iop.readlink = generic_readlink;
2227         ])
2228 ])
2229 AC_DEFUN([LC_IOP_GENERIC_READLINK], [
2230         AC_MSG_CHECKING([if 'generic_readlink' still exist])
2231         LB2_LINUX_TEST_RESULT([inode_ops_readlink], [
2232                 AC_DEFINE(HAVE_IOP_GENERIC_READLINK, 1,
2233                         [generic_readlink has been removed])
2234         ])
2235 ]) # LC_IOP_GENERIC_READLINK
2236
2237 #
2238 # LC_HAVE_VM_FAULT_ADDRESS
2239 #
2240 # Kernel version 4.10 commit 1a29d85eb0f19b7d8271923d8917d7b4f5540b3e
2241 # removed virtual_address field. Need to use address field instead
2242 #
2243 AC_DEFUN([LC_SRC_HAVE_VM_FAULT_ADDRESS], [
2244         LB2_LINUX_TEST_SRC([vm_fault_address], [
2245                 #include <linux/mm.h>
2246         ],[
2247                 struct vm_fault vmf = { 0 };
2248                 unsigned long addr = (unsigned long)vmf.address;
2249                 (void)addr;
2250         ])
2251 ])
2252 AC_DEFUN([LC_HAVE_VM_FAULT_ADDRESS], [
2253         AC_MSG_CHECKING([if 'struct vm_fault' replaced virtual_address with address field])
2254         LB2_LINUX_TEST_RESULT([vm_fault_address], [
2255                 AC_DEFINE(HAVE_VM_FAULT_ADDRESS, 1,
2256                         [virtual_address has been replaced by address field])
2257         ])
2258 ]) # LC_HAVE_VM_FAULT_ADDRESS
2259
2260 #
2261 # LC_INODEOPS_ENHANCED_GETATTR
2262 #
2263 # Kernel version 4.11 commit a528d35e8bfcc521d7cb70aaf03e1bd296c8493f
2264 # expanded getattr to be able to get more stat information.
2265 #
2266 AC_DEFUN([LC_SRC_INODEOPS_ENHANCED_GETATTR], [
2267         LB2_LINUX_TEST_SRC([getattr_path], [
2268                 #include <linux/fs.h>
2269         ],[
2270                 struct path path;
2271
2272                 ((struct inode_operations *)1)->getattr(&path, NULL, 0, 0);
2273         ])
2274 ])
2275 AC_DEFUN([LC_INODEOPS_ENHANCED_GETATTR], [
2276         AC_MSG_CHECKING([if 'inode_operations' getattr member can gather advance stats])
2277         LB2_LINUX_TEST_RESULT([getattr_path], [
2278                 AC_DEFINE(HAVE_INODEOPS_ENHANCED_GETATTR, 1,
2279                         [inode_operations .getattr member function can gather advance stats])
2280         ])
2281 ]) # LC_INODEOPS_ENHANCED_GETATTR
2282
2283 #
2284 # LC_VM_OPERATIONS_REMOVE_VMF_ARG
2285 #
2286 # Kernel version 4.11 commit 11bac80004499ea59f361ef2a5516c84b6eab675
2287 # removed struct vm_area_struct as an argument for vm_operations since
2288 # in the same kernel version struct vma_area_struct was folded into
2289 # struct vm_fault.
2290 #
2291 AC_DEFUN([LC_SRC_VM_OPERATIONS_REMOVE_VMF_ARG], [
2292         LB2_LINUX_TEST_SRC([vm_operations_no_vm_area_struct], [
2293                 #include <linux/mm.h>
2294         ],[
2295                 struct vm_fault vmf;
2296
2297                 ((struct vm_operations_struct *)0)->fault(&vmf);
2298                 ((struct vm_operations_struct *)0)->page_mkwrite(&vmf);
2299         ])
2300 ])
2301 AC_DEFUN([LC_VM_OPERATIONS_REMOVE_VMF_ARG], [
2302         AC_MSG_CHECKING([if 'struct vm_operations' removed struct vm_area_struct])
2303         LB2_LINUX_TEST_RESULT([vm_operations_no_vm_area_struct], [
2304                 AC_DEFINE(HAVE_VM_OPS_USE_VM_FAULT_ONLY, 1,
2305                         ['struct vm_operations' remove struct vm_area_struct argument])
2306         ])
2307 ]) # LC_VM_OPERATIONS_REMOVE_VMF_ARG
2308
2309 #
2310 # LC_HAVE_KEY_USAGE_REFCOUNT
2311 #
2312 # Kernel version 4.11 commit fff292914d3a2f1efd05ca71c2ba72a3c663201e
2313 # converted key.usage from atomic_t to refcount_t.
2314 #
2315 AC_DEFUN([LC_SRC_HAVE_KEY_USAGE_REFCOUNT], [
2316         LB2_LINUX_TEST_SRC([key_usage_refcount], [
2317                 #include <linux/key.h>
2318         ],[
2319                 struct key key = { };
2320
2321                 refcount_read(&key.usage);
2322         ])
2323 ])
2324 AC_DEFUN([LC_HAVE_KEY_USAGE_REFCOUNT], [
2325         AC_MSG_CHECKING([if 'key.usage' is refcount_t])
2326         LB2_LINUX_TEST_RESULT([key_usage_refcount], [
2327                 AC_DEFINE(HAVE_KEY_USAGE_REFCOUNT, 1,
2328                         [key.usage is of type refcount_t])
2329         ])
2330 ]) #LC_HAVE_KEY_USAGE_REFCOUNT
2331
2332 #
2333 # LC_HAVE_CRYPTO_MAX_ALG_NAME_128
2334 #
2335 # Kernel version 4.11 commit f437a3f477cce402dbec6537b29e9e33962c9f73
2336 # switched CRYPTO_MAX_ALG_NAME from 64 to 128.
2337 #
2338 AC_DEFUN([LC_SRC_HAVE_CRYPTO_MAX_ALG_NAME_128], [
2339         LB2_LINUX_TEST_SRC([crypto_max_alg_name], [
2340                 #include <linux/crypto.h>
2341         ],[
2342                 #if CRYPTO_MAX_ALG_NAME != 128
2343                 exit(1);
2344                 #endif
2345         ])
2346 ])
2347 AC_DEFUN([LC_HAVE_CRYPTO_MAX_ALG_NAME_128], [
2348         AC_MSG_CHECKING([if 'CRYPTO_MAX_ALG_NAME' is 128])
2349         LB2_LINUX_TEST_RESULT([crypto_max_alg_name], [
2350                 AC_DEFINE(HAVE_CRYPTO_MAX_ALG_NAME_128, 1,
2351                         ['CRYPTO_MAX_ALG_NAME' is 128])
2352         ])
2353 ]) # LC_HAVE_CRYPTO_MAX_ALG_NAME_128
2354
2355 #
2356 # Kernel version 4.12 commit 47f38c539e9a42344ff5a664942075bd4df93876
2357 # CURRENT_TIME is not 64 bit time safe so it was replaced with
2358 # current_time()
2359 #
2360 AC_DEFUN([LC_SRC_CURRENT_TIME], [
2361         LB2_LINUX_TEST_SRC([current_time], [
2362                 #include <linux/fs.h>
2363         ],[
2364                 struct iattr attr;
2365
2366                 attr.ia_atime = current_time(NULL);
2367         ])
2368 ])
2369 AC_DEFUN([LC_CURRENT_TIME], [
2370         AC_MSG_CHECKING([if CURRENT_TIME has been replaced with current_time])
2371         LB2_LINUX_TEST_RESULT([current_time], [
2372                 AC_DEFINE(HAVE_CURRENT_TIME, 1,
2373                         [current_time() has replaced CURRENT_TIME])
2374         ])
2375 ]) # LC_CURRENT_TIME
2376
2377 #
2378 # LC_HAVE_GET_INODE_USAGE
2379 #
2380 # Kernel version v4.12-rc2-43-g7a9ca53aea10
2381 #
2382 AC_DEFUN([LC_SRC_HAVE_GET_INODE_USAGE], [
2383         LB2_LINUX_TEST_SRC([get_inode_usage], [
2384                 struct inode;
2385                 #include <linux/quota.h>
2386         ],[
2387                 struct dquot_operations ops = { };
2388
2389                 ops.get_inode_usage(NULL, NULL);
2390         ])
2391 ])
2392 AC_DEFUN([LC_HAVE_GET_INODE_USAGE], [
2393         AC_MSG_CHECKING([if get_inode_usage exists])
2394         LB2_LINUX_TEST_RESULT([get_inode_usage], [
2395                 AC_DEFINE(HAVE_GET_INODE_USAGE, 1,
2396                         [get_inode_usage function exists])
2397         ])
2398 ]) # LC_HAVE_GET_INODE_USAGE
2399
2400 #
2401 # LC_SUPER_SETUP_BDI_NAME
2402 #
2403 # Kernel version 4.12 commit 9594caf216dc0fe3e318b34af0127276db661241
2404 # unified bdi handling
2405 #
2406 AC_DEFUN([LC_SRC_SUPER_SETUP_BDI_NAME], [
2407         LB2_LINUX_TEST_SRC([super_setup_bdi_name], [
2408                 #include <linux/fs.h>
2409         ],[
2410                 super_setup_bdi_name(NULL, "lustre");
2411         ])
2412 ])
2413 AC_DEFUN([LC_SUPER_SETUP_BDI_NAME], [
2414         AC_MSG_CHECKING([if 'super_setup_bdi_name' exist])
2415         LB2_LINUX_TEST_RESULT([super_setup_bdi_name], [
2416                 AC_DEFINE(HAVE_SUPER_SETUP_BDI_NAME, 1,
2417                         ['super_setup_bdi_name' is available])
2418         ])
2419 ]) # LC_SUPER_SETUP_BDI_NAME
2420
2421 #
2422 # LC_BI_STATUS
2423 #
2424 # 4.12 replace bi_error to bi_status
2425 #
2426 AC_DEFUN([LC_SRC_BI_STATUS], [
2427         LB2_LINUX_TEST_SRC([bi_status], [
2428                 #include <linux/blk_types.h>
2429         ],[
2430                 ((struct bio *)0)->bi_status = 0;
2431         ])
2432 ])
2433 AC_DEFUN([LC_BI_STATUS], [
2434         AC_MSG_CHECKING([if 'bi_status' exist])
2435         LB2_LINUX_TEST_RESULT([bi_status], [
2436                 AC_DEFINE(HAVE_BI_STATUS, 1, ['bi_status' is available])
2437         ])
2438 ]) # LC_BI_STATUS
2439
2440 #
2441 # LC_BIO_INTEGRITY_ENABLED
2442 #
2443 # 4.13 removed bio_integrity_enabled
2444 #
2445 AC_DEFUN([LC_SRC_BIO_INTEGRITY_ENABLED], [
2446         LB2_LINUX_TEST_SRC([bio_integrity_enabled], [
2447                 #include <linux/bio.h>
2448         ],[
2449                 bio_integrity_enabled(NULL);
2450         ])
2451 ])
2452 AC_DEFUN([LC_BIO_INTEGRITY_ENABLED], [
2453         AC_MSG_CHECKING([if 'bio_integrity_enabled' exist])
2454         LB2_LINUX_TEST_RESULT([bio_integrity_enabled], [
2455                 AC_DEFINE(HAVE_BIO_INTEGRITY_ENABLED, 1,
2456                         ['bio_integrity_enabled' is available])
2457         ])
2458 ]) # LC_BIO_INTEGRITY_ENABLED
2459
2460 #
2461 # LC_PAGEVEC_INIT_ONE_PARAM
2462 #
2463 # 4.14 pagevec_init takes one parameter
2464 #
2465 AC_DEFUN([LC_SRC_PAGEVEC_INIT_ONE_PARAM], [
2466         LB2_LINUX_TEST_SRC([pagevec_init], [
2467                 #include <linux/pagevec.h>
2468         ],[
2469                 pagevec_init(NULL);
2470         ])
2471 ])
2472 AC_DEFUN([LC_PAGEVEC_INIT_ONE_PARAM], [
2473         AC_MSG_CHECKING([if 'pagevec_init' takes one parameter])
2474         LB2_LINUX_TEST_RESULT([pagevec_init], [
2475                 AC_DEFINE(HAVE_PAGEVEC_INIT_ONE_PARAM, 1,
2476                         ['pagevec_init' takes one parameter])
2477         ])
2478 ]) # LC_PAGEVEC_INIT_ONE_PARAM
2479
2480 #
2481 # LC_BI_BDEV
2482 #
2483 # 4.14 replaced bi_bdev to bi_disk
2484 #
2485 AC_DEFUN([LC_SRC_BI_BDEV], [
2486         LB2_LINUX_TEST_SRC([bi_bdev], [
2487                 #include <linux/bio.h>
2488         ],[
2489                 ((struct bio *)0)->bi_bdev = NULL;
2490         ])
2491 ])
2492 AC_DEFUN([LC_BI_BDEV], [
2493         AC_MSG_CHECKING([if 'bi_bdev' exist])
2494         LB2_LINUX_TEST_RESULT([bi_bdev], [
2495                 AC_DEFINE(HAVE_BI_BDEV, 1, ['bi_bdev' is available])
2496         ])
2497 ]) # LC_BI_BDEV
2498
2499 #
2500 # LC_INTERVAL_TREE_CACHED
2501 #
2502 # 4.14 f808c13fd3738948e10196496959871130612b61
2503 # switched INTERVAL_TREE_DEFINE to use cached RB_Trees.
2504 #
2505 AC_DEFUN([LC_SRC_INTERVAL_TREE_CACHED], [
2506         LB2_LINUX_TEST_SRC([itree_cached], [
2507                 #include <linux/interval_tree_generic.h>
2508                 struct foo { struct rb_node rb; int last; int a,b;};
2509                 #define START(n) ((n)->a)
2510                 #define LAST(n) ((n)->b)
2511                 struct rb_root_cached tree;
2512                 INTERVAL_TREE_DEFINE(struct foo, rb, int, last,
2513                         START, LAST, , foo);
2514         ],[
2515                 foo_insert(NULL, &tree);
2516         ],[-Werror])
2517 ])
2518 AC_DEFUN([LC_INTERVAL_TREE_CACHED], [
2519         AC_MSG_CHECKING([if interval_trees use rb_tree_cached])
2520         LB2_LINUX_TEST_RESULT([itree_cached], [
2521                 AC_DEFINE(HAVE_INTERVAL_TREE_CACHED, 1,
2522                         [interval trees use rb_tree_cached])
2523         ])
2524 ]) # LC_INTERVAL_TREE_CACHED
2525
2526 #
2527 # LC_IS_ENCRYPTED
2528 #
2529 # 4.14 introduced IS_ENCRYPTED and S_ENCRYPTED
2530 #
2531 AC_DEFUN([LC_IS_ENCRYPTED], [
2532 LB_CHECK_COMPILE([if IS_ENCRYPTED is defined],
2533 is_encrypted, [
2534         #include <linux/fs.h>
2535 ],[
2536         (void)IS_ENCRYPTED((struct inode *)1);
2537 ],[
2538         has_is_encrypted="yes"
2539 ])
2540 ]) # LC_IS_ENCRYPTED used by LC_CONFIG_CRYPTO
2541
2542 #
2543 # LC_I_PAGES
2544 #
2545 # kernel 4.17 commit b93b016313b3ba8003c3b8bb71f569af91f19fc7
2546 #
2547 AC_DEFUN([LC_SRC_I_PAGES], [
2548         LB2_LINUX_TEST_SRC([i_pages], [
2549                 #include <linux/fs.h>
2550         ],[
2551                 struct address_space mapping = {};
2552                 void *i_pages;
2553
2554                 i_pages = &mapping.i_pages;
2555         ])
2556 ])
2557 AC_DEFUN([LC_I_PAGES], [
2558         AC_MSG_CHECKING([if struct address_space has i_pages])
2559         LB2_LINUX_TEST_RESULT([i_pages], [
2560                 AC_DEFINE(HAVE_I_PAGES, 1, [struct address_space has i_pages])
2561         ])
2562 ]) # LC_I_PAGES
2563
2564 #
2565 # LC_VM_FAULT_T
2566 #
2567 # kernel 4.17 commit 3d3539018d2cbd12e5af4a132636ee7fd8d43ef0
2568 # mm: create the new vm_fault_t type
2569 #
2570 AC_DEFUN([LC_SRC_VM_FAULT_T], [
2571         LB2_LINUX_TEST_SRC([vm_fault_t], [
2572                 #include <linux/mm_types.h>
2573         ],[
2574                 vm_fault_t x = VM_FAULT_SIGBUS;
2575                 (void)x
2576         ])
2577 ])
2578 AC_DEFUN([LC_VM_FAULT_T], [
2579         AC_MSG_CHECKING([if vm_fault_t type exists])
2580         LB2_LINUX_TEST_RESULT([vm_fault_t], [
2581                 AC_DEFINE(HAVE_VM_FAULT_T, 1, [if vm_fault_t type exists])
2582         ])
2583 ]) # LC_VM_FAULT_T
2584
2585 #
2586 # LC_VM_FAULT_RETRY
2587 #
2588 # kernel 4.17 commit 3d3539018d2cbd12e5af4a132636ee7fd8d43ef0
2589 # mm: VM_FAULT_RETRY is defined in enum vm_fault_reason
2590 #
2591 AC_DEFUN([LC_SRC_VM_FAULT_RETRY], [
2592         LB2_LINUX_TEST_SRC([VM_FAULT_RETRY], [
2593                 #include <linux/mm.h>
2594         ],[
2595                 #ifndef VM_FAULT_RETRY
2596                         vm_fault_t x;
2597                         x = VM_FAULT_RETRY;
2598                 #endif
2599         ])
2600 ])
2601 AC_DEFUN([LC_VM_FAULT_RETRY], [
2602         AC_MSG_CHECKING([if VM_FAULT_RETRY is defined])
2603         LB2_LINUX_TEST_RESULT([VM_FAULT_RETRY], [
2604                 AC_DEFINE(HAVE_VM_FAULT_RETRY, 1,
2605                         [if VM_FAULT_RETRY is defined])
2606         ])
2607 ]) # LC_VM_FAULT_RETRY
2608
2609 #
2610 # LC_ALLOC_FILE_PSEUDO
2611 #
2612 # kernel 4.18-rc1 commit d93aa9d82aea80b80f225dbf9c7986df444d8106
2613 # new wrapper: alloc_file_pseudo()
2614 #
2615 AC_DEFUN([LC_SRC_ALLOC_FILE_PSEUDO], [
2616         LB2_LINUX_TEST_SRC([alloc_file_pseudo], [
2617                 #include <linux/file.h>
2618         ],[
2619                 struct file *file;
2620                 file = alloc_file_pseudo(NULL, NULL, "[test]",
2621                                          00000002, NULL);
2622         ])
2623 ])
2624 AC_DEFUN([LC_ALLOC_FILE_PSEUDO], [
2625         AC_MSG_CHECKING([if 'alloc_file_pseudo' is defined])
2626         LB2_LINUX_TEST_RESULT([alloc_file_pseudo], [
2627                 AC_DEFINE(HAVE_ALLOC_FILE_PSEUDO, 1,
2628                         ['alloc_file_pseudo' exist])
2629         ])
2630 ]) # LC_ALLOC_FILE_PSEUDO
2631
2632 #
2633 # LC_INODE_TIMESPEC64
2634 #
2635 # kernel 4.17-rc7 commit 8efd6894ff089adeeac7cb9f32125b85d963d1bc
2636 # fs: add timespec64_truncate()
2637 # kernel 4.18 commit 95582b00838837fc07e042979320caf917ce3fe6
2638 # inode timestamps switched to timespec64
2639 # kernel 4.19-rc2 commit 976516404ff3fab2a8caa8bd6f5efc1437fed0b8
2640 # y2038: remove unused time interfaces
2641 # ...
2642 #  timespec_trunc
2643 # ...
2644 # When inode times are timespec64 stop using the deprecated
2645 # time interfaces.
2646 #
2647 # kernel v5.5-rc1-6-gba70609d5ec6 ba70609d5ec664a8f36ba1c857fcd97a478adf79
2648 # fs: Delete timespec64_trunc()
2649 #
2650 AC_DEFUN([LC_SRC_INODE_TIMESPEC64], [
2651         LB2_LINUX_TEST_SRC([inode_timespec64], [
2652                 #include <linux/fs.h>
2653         ],[
2654                 struct inode *inode = NULL;
2655                 struct timespec64 ts = {0, 1};
2656
2657                 inode->i_atime = ts;
2658                 (void)inode;
2659         ],[-Werror])
2660 ])
2661 AC_DEFUN([LC_INODE_TIMESPEC64], [
2662         AC_MSG_CHECKING([if inode timestamps are struct timespec64])
2663         LB2_LINUX_TEST_RESULT([inode_timespec64], [
2664                 AC_DEFINE(HAVE_INODE_TIMESPEC64, 1,
2665                         [inode times are using timespec64])
2666         ])
2667 ]) # LC_INODE_TIMESPEC64
2668
2669 #
2670 # LC_RADIX_TREE_TAG_SET
2671 #
2672 # kernel 4.20 commit v4.19-rc5-248-g9b89a0355144
2673 # xarray: Add XArray marks - replaced radix_tree_tag_set
2674 #
2675 AC_DEFUN([LC_SRC_RADIX_TREE_TAG_SET], [
2676         LB2_LINUX_TEST_SRC([radix_tree_tag_set], [
2677                 #include <linux/fs.h>
2678                 #include <linux/radix-tree.h>
2679         ],[
2680                 radix_tree_tag_set(NULL, 0, PAGECACHE_TAG_DIRTY);
2681         ],[-Werror])
2682 ])
2683 AC_DEFUN([LC_RADIX_TREE_TAG_SET], [
2684         AC_MSG_CHECKING([if 'radix_tree_tag_set' exists])
2685         LB2_LINUX_TEST_RESULT([radix_tree_tag_set], [
2686                 AC_DEFINE(HAVE_RADIX_TREE_TAG_SET, 1,
2687                         [radix_tree_tag_set exists])
2688         ])
2689 ]) # LC_RADIX_TREE_TAG_SET
2690
2691 #
2692 # LC_UAPI_LINUX_MOUNT_H
2693 #
2694 # kernel 4.20 commit e262e32d6bde0f77fb0c95d977482fc872c51996
2695 # vfs: Suppress MS_* flag defs within the kernel ...
2696 #
2697 AC_DEFUN([LC_SRC_UAPI_LINUX_MOUNT_H], [
2698         LB2_LINUX_TEST_SRC([uapi_linux_mount], [
2699                 #include <uapi/linux/mount.h>
2700         ],[
2701                 int x = MS_RDONLY;
2702                 (void)x;
2703         ],[-Werror])
2704 ])
2705 AC_DEFUN([LC_UAPI_LINUX_MOUNT_H], [
2706         AC_MSG_CHECKING([if MS_RDONLY was moved to uapi/linux/mount.h])
2707         LB2_LINUX_TEST_RESULT([uapi_linux_mount], [
2708                 AC_DEFINE(HAVE_UAPI_LINUX_MOUNT_H, 1,
2709                         [if MS_RDONLY was moved to uapi/linux/mount.h])
2710         ])
2711 ]) # LC_UAPI_LINUX_MOUNT_H
2712
2713 #
2714 # LC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK
2715 #
2716 # kernel 4.20 commit 1863d77f15da0addcd293a1719fa5d3ef8cde3ca
2717 # SUNRPC: Replace the cache_detail->hash_lock with a regular spinlock
2718 #
2719 # Now that the reader functions are all RCU protected, use a regular
2720 # spinlock rather than a reader/writer lock.
2721 #
2722 AC_DEFUN([LC_SRC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK], [
2723         LB2_LINUX_TEST_SRC([hash_lock_isa_spinlock_t], [
2724                 #include <linux/sunrpc/cache.h>
2725         ],[
2726                 spinlock_t *lock = &(((struct cache_detail *)0)->hash_lock);
2727                 spin_lock(lock);
2728         ],[-Werror])
2729 ])
2730 AC_DEFUN([LC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK], [
2731         AC_MSG_CHECKING([if cache_detail->hash_lock is a spinlock])
2732         LB2_LINUX_TEST_RESULT([hash_lock_isa_spinlock_t], [
2733                 AC_DEFINE(HAVE_CACHE_HASH_SPINLOCK, 1,
2734                         [if cache_detail->hash_lock is a spinlock])
2735         ])
2736 ]) # LC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK
2737
2738 #
2739 # LC_GENL_FAMILY_HAS_RESV_START_OP
2740 #
2741 # Linux v5.0-11693-g3b0f31f2b8c9
2742 #   genetlink: make policy common to family
2743 #
2744 AC_DEFUN([LC_SRC_GENL_FAMILY_HAS_RESV_START_OP], [
2745         LB2_LINUX_TEST_SRC([genl_family_has_resv_start_op], [
2746                 #include <net/genetlink.h>
2747         ],[
2748                 static const struct genl_family family = {
2749                         .resv_start_op = 42,
2750                 };
2751                 (void)family;
2752         ],[-Werror])
2753 ])
2754 AC_DEFUN([LC_GENL_FAMILY_HAS_RESV_START_OP], [
2755         AC_MSG_CHECKING([if struct genl_family has resv_start_op member])
2756         LB2_LINUX_TEST_RESULT([genl_family_has_resv_start_op], [
2757                 AC_DEFINE(GENL_FAMILY_HAS_RESV_START_OP, 1,
2758                         [struct genl_family has resv_start_op member])
2759         ])
2760 ]) # LC_GENL_FAMILY_HAS_RESV_START_OP
2761
2762 #
2763 # LC_HAVE_BVEC_ITER_ALL
2764 #
2765 # kernel 5.1 commit 6dc4f100c175dd0511ae8674786e7c9006cdfbfa
2766 # block: allow bio_for_each_segment_all() to iterate over multi-page bvec
2767 #
2768 AC_DEFUN([LC_SRC_HAVE_BVEC_ITER_ALL], [
2769         LB2_LINUX_TEST_SRC([struct_bvec_iter_all], [
2770                 #include <linux/bvec.h>
2771         ],[
2772                 struct bvec_iter_all iter;
2773                 (void)iter;
2774         ],[-Werror])
2775 ])
2776 AC_DEFUN([LC_HAVE_BVEC_ITER_ALL], [
2777         AC_MSG_CHECKING([if bvec_iter_all exists for multi-page bvec iternation])
2778         LB2_LINUX_TEST_RESULT([struct_bvec_iter_all], [
2779                 AC_DEFINE(HAVE_BVEC_ITER_ALL, 1,
2780                         [if bvec_iter_all exists for multi-page bvec iternation])
2781         ])
2782 ]) # LC_HAVE_BVEC_ITER_ALL
2783
2784 #
2785 # LC_ACCOUNT_PAGE_DIRTIED
2786 #
2787 # After 5.2 kernel page dirtied is not exported
2788 #
2789 AC_DEFUN([LC_ACCOUNT_PAGE_DIRTIED], [
2790 LB_CHECK_EXPORT([account_page_dirtied], [mm/page-writeback.c],
2791         [AC_DEFINE(HAVE_ACCOUNT_PAGE_DIRTIED_EXPORT, 1,
2792                         [account_page_dirtied is exported])])
2793 ]) # LC_ACCOUNT_PAGE_DIRTIED
2794
2795 #
2796 # LC_KEYRING_SEARCH_4ARGS
2797 #
2798 # Kernel 5.2 commit dcf49dbc8077
2799 # keys: Add a 'recurse' flag for keyring searches
2800 #
2801 AC_DEFUN([LC_SRC_KEYRING_SEARCH_4ARGS], [
2802         LB2_LINUX_TEST_SRC([keyring_search_4args], [
2803                 #include <linux/key.h>
2804         ],[
2805                 key_ref_t keyring;
2806                 keyring_search(keyring, NULL, NULL, false);
2807         ])
2808 ])
2809 AC_DEFUN([LC_KEYRING_SEARCH_4ARGS], [
2810         AC_MSG_CHECKING([if 'keyring_search' has 4 args])
2811         LB2_LINUX_TEST_RESULT([keyring_search_4args], [
2812                 AC_DEFINE(HAVE_KEYRING_SEARCH_4ARGS, 1,
2813                         [keyring_search has 4 args])
2814         ])
2815 ]) # LC_KEYRING_SEARCH_4ARGS
2816
2817 #
2818 # LC_BIO_BI_PHYS_SEGMENTS
2819 #
2820 # kernel 5.3-rc1 commit 14ccb66b3f585b2bc21e7256c96090abed5a512c
2821 # block: remove the bi_phys_segments field in struct bio
2822 #
2823 AC_DEFUN([LC_SRC_BIO_BI_PHYS_SEGMENTS], [
2824         LB2_LINUX_TEST_SRC([bye_bio_bi_phys_segments], [
2825                 #include <linux/bio.h>
2826         ],[
2827                 struct bio *bio = NULL;
2828                 bio->bi_phys_segments++;
2829         ],[-Werror])
2830 ])
2831 AC_DEFUN([LC_BIO_BI_PHYS_SEGMENTS], [
2832         AC_MSG_CHECKING([if struct bio has bi_phys_segments member])
2833         LB2_LINUX_TEST_RESULT([bye_bio_bi_phys_segments], [
2834                 AC_DEFINE(HAVE_BIO_BI_PHYS_SEGMENTS, 1,
2835                         [struct bio has bi_phys_segments member])
2836         ])
2837 ]) # LC_BIO_BI_PHYS_SEGMENTS
2838
2839 #
2840 # LC_LM_COMPARE_OWNER_EXISTS
2841 #
2842 # kernel 5.3-rc3 commit f85d93385e9fe6886a751f647f6812a89bf6bee3
2843 # locks: Cleanup lm_compare_owner and lm_owner_key
2844 # removed lm_compare_owner
2845 #
2846 AC_DEFUN([LC_SRC_LM_COMPARE_OWNER_EXISTS], [
2847         LB2_LINUX_TEST_SRC([lock_manager_ops_lm_compare_owner], [
2848                 #include <linux/fs.h>
2849         ],[
2850                 struct lock_manager_operations lm_ops;
2851                 lm_ops.lm_compare_owner = NULL;
2852         ],[-Werror])
2853 ])
2854 AC_DEFUN([LC_LM_COMPARE_OWNER_EXISTS], [
2855         AC_MSG_CHECKING([if lock_manager_operations has lm_compare_owner])
2856         LB2_LINUX_TEST_RESULT([lock_manager_ops_lm_compare_owner], [
2857                 AC_DEFINE(HAVE_LM_COMPARE_OWNER, 1,
2858                         [lock_manager_operations has lm_compare_owner])
2859         ])
2860 ]) # LC_LM_COMPARE_OWNER_EXISTS
2861
2862 #
2863 # LC_FSCRYPT_SUPPORT
2864 #
2865 # 5.4 introduced fscrypt encryption policies v2
2866 #
2867 AC_DEFUN([LC_FSCRYPT_SUPPORT], [
2868 LB_CHECK_COMPILE([for fscrypt in-kernel support],
2869 fscrypt_support, [
2870         #define __FS_HAS_ENCRYPTION 0
2871         #include <linux/fscrypt.h>
2872 ],[
2873         fscrypt_ioctl_get_policy_ex(NULL, NULL);
2874 ],[
2875         has_fscrypt_support="yes"
2876 ])
2877 ]) # LC_FSCRYPT_SUPPORT used by LC_CONFIG_CRYPTO
2878
2879 #
2880 # LC_FSCRYPT_DIGESTED_NAME
2881 #
2882 # Kernel 5.5-rc4 edc440e3d27fb31e6f9663cf413fad97d714c060
2883 # improved the format of no-key names. This results in the
2884 # removal of FSCRYPT_FNAME_DIGEST and FSCRYPT_FNAME_DIGEST_SIZE.
2885 #
2886 AC_DEFUN([LC_SRC_FSCRYPT_DIGESTED_NAME], [
2887         LB2_LINUX_TEST_SRC([fscrypt_digested_name], [
2888                 #include <linux/fscrypt.h>
2889         ],[
2890                 struct fscrypt_digested_name fname;
2891
2892                 fname.hash = 0;
2893         ],[-Werror])
2894 ])
2895 AC_DEFUN([LC_FSCRYPT_DIGESTED_NAME], [
2896         AC_MSG_CHECKING([if fscrypt has 'struct fscrypt_digested_name'])
2897         LB2_LINUX_TEST_RESULT([fscrypt_digested_name], [
2898                 AC_DEFINE(HAVE_FSCRYPT_DIGESTED_NAME, 1,
2899                         ['struct fscrypt_digested_name' exists])
2900         ])
2901 ]) # LC_FSCRYPT_DIGESTED_NAME
2902
2903 #
2904 # LC_FSCRYPT_DUMMY_CONTEXT_ENABLED
2905 #
2906 # Kernel 5.7-rc7 ed318a6cc0b620440e65f48eb527dc3df7269ce4
2907 # replaces fscrypt_dummy_context_enabled() with
2908 # fscrypt_get_dummy_context(). Later kernels rename
2909 # fscrypt_get_dummy_context() to fscrypt_get_dummy_policy()
2910 # which is why we test fscrypt_dummy_context_enabled().
2911 #
2912 AC_DEFUN([LC_SRC_FSCRYPT_DUMMY_CONTEXT_ENABLED], [
2913         LB2_LINUX_TEST_SRC([fscrypt_dummy_context_enabled], [
2914                 #include <linux/fscrypt.h>
2915         ],[
2916                 fscrypt_dummy_context_enabled(NULL);
2917         ],[-Werror])
2918 ])
2919 AC_DEFUN([LC_FSCRYPT_DUMMY_CONTEXT_ENABLED], [
2920         AC_MSG_CHECKING([if fscrypt_dummy_context_enabled() exists])
2921         LB2_LINUX_TEST_RESULT([fscrypt_dummy_context_enabled], [
2922                 AC_DEFINE(HAVE_FSCRYPT_DUMMY_CONTEXT_ENABLED, 1,
2923                         [fscrypt_dummy_context_enabled() exists])
2924         ])
2925 ]) # LC_FSCRYPT_DUMMY_CONTEXT_ENABLED
2926
2927 #
2928 # LC_FSCRYPT_FNAME_ALLOC_BUFFER
2929 #
2930 # Kernel 5.9-rc4 8b10fe68985278de4926daa56ad6af701839e40a
2931 # removed the inode parameter for the fscrypt function
2932 # fscrypt_fname_alloc_buffer()
2933 #
2934 AC_DEFUN([LC_SRC_FSCRYPT_FNAME_ALLOC_BUFFER], [
2935         LB2_LINUX_TEST_SRC([fscrypt_fname_alloc_buffer], [
2936                 #include <linux/fscrypt.h>
2937         ],[
2938                 fscrypt_fname_alloc_buffer(0, NULL);
2939         ],[-Werror])
2940 ])
2941 AC_DEFUN([LC_FSCRYPT_FNAME_ALLOC_BUFFER], [
2942         AC_MSG_CHECKING([if fscrypt_fname_alloc_buffer() removed inode parameter])
2943         LB2_LINUX_TEST_RESULT([fscrypt_fname_alloc_buffer], [
2944         AC_DEFINE(HAVE_FSCRYPT_FNAME_ALLOC_BUFFER_NO_INODE, 1,
2945                 [fscrypt_fname_alloc_buffer() does not have inode parameter])
2946         ])
2947 ]) # LC_FSCRYPT_FNAME_ALLOC_BUFFER
2948
2949 #
2950 # LC_FSCRYPT_SET_CONTEXT
2951 #
2952 # Kernel 5.9-rc4 a992b20cd4ee360dbbe6f69339cb07146e4304d6
2953 # fscrypt_get_encryption_info() is not GFP_NOFS safe which
2954 # is used by fscrypt_inherit_context. Replace fscrypt_inherit_context,
2955 # with two new functions, fscrypt_prepare_new_inode() and
2956 # fscrypt_set_context()
2957 #
2958 AC_DEFUN([LC_SRC_FSCRYPT_SET_CONTEXT], [
2959         LB2_LINUX_TEST_SRC([fscrypt_set_context], [
2960                 #include <linux/fscrypt.h>
2961         ],[
2962                 fscrypt_set_context(NULL, NULL);
2963                 fscrypt_prepare_new_inode(NULL, NULL, NULL);
2964         ])
2965 ])
2966 AC_DEFUN([LC_FSCRYPT_SET_CONTEXT], [
2967         AC_MSG_CHECKING([if 'fscrypt_set_context()' exists])
2968         LB2_LINUX_TEST_RESULT([fscrypt_set_context], [
2969                 AC_DEFINE(HAVE_FSCRYPT_SET_CONTEXT, 1,
2970                         [fscrypt_set_context() does exist])
2971         ])
2972 ]) # LC_FSCRYPT_SET_CONTEXT
2973
2974 #
2975 # LC_FSCRYPT_D_REVALIDATE
2976 #
2977 # kernel 5.9-rc4 5b2a828b98ec1872799b1b4d82113c76a12d594f
2978 # exported fscrypt_d_revalidate()
2979 #
2980 AC_DEFUN([LC_FSCRYPT_D_REVALIDATE], [
2981 LB_CHECK_EXPORT([fscrypt_d_revalidate], [fs/crypto/fname.c],
2982         [AC_DEFINE(HAVE_FSCRYPT_D_REVALIDATE, 1,
2983                    [fscrypt_d_revalidate() is exported by the kernel])])
2984 ]) # LC_FSCRYPT_D_REVALIDATE
2985
2986 #
2987 # LC_FSCRYPT_NOKEY_NAME
2988 #
2989 # kernel 5.9-rc4 70fb2612aab62d47e03f82eaa7384a8d30ca175d
2990 # renamed is_ciphertext_name to is_nokey_name
2991 #
2992 AC_DEFUN([LC_SRC_FSCRYPT_NOKEY_NAME], [
2993         LB2_LINUX_TEST_SRC([fname_is_nokey_name], [
2994                 #include <linux/fscrypt.h>
2995         ],[
2996                 struct fscrypt_name fname;
2997
2998                 fname.is_nokey_name = true;
2999         ],[-Werror])
3000 ])
3001 AC_DEFUN([LC_FSCRYPT_NOKEY_NAME], [
3002         AC_MSG_CHECKING([if struct fscrypt_name has is_nokey_name field])
3003         LB2_LINUX_TEST_RESULT([fname_is_nokey_name], [
3004                 AC_DEFINE(HAVE_FSCRYPT_NOKEY_NAME, 1,
3005                         [struct fscrypt_name has is_nokey_name field])
3006         ])
3007 ]) # LC_FSCRYPT_NOKEY_NAME
3008
3009 #
3010 # LC_FSCRYPT_SET_TEST_DUMMY_ENC_CHAR_ARG
3011 # Kernel 5.9-rc4 c8c868abc91ff23f6f5c4444c419de7c277d77e1
3012 # changed fscrypt_set_test_dummy_encryption() take a 'const char *
3013 #
3014 AC_DEFUN([LC_SRC_FSCRYPT_SET_TEST_DUMMY_ENC_CHAR_ARG], [
3015         LB2_LINUX_TEST_SRC([fscrypt_set_test_dummy_encryption], [
3016                 #include <linux/fscrypt.h>
3017         ],[
3018                 char *arg = "arg";
3019                 fscrypt_set_test_dummy_encryption(NULL, arg, NULL);
3020         ],[-Werror])
3021 ])
3022 AC_DEFUN([LC_FSCRYPT_SET_TEST_DUMMY_ENC_CHAR_ARG], [
3023         AC_MSG_CHECKING([if fscrypt_set_test_dummy_encryption() take 'const char' parameter])
3024         LB2_LINUX_TEST_RESULT([fscrypt_set_test_dummy_encryption], [
3025                 AC_DEFINE(HAVE_FSCRYPT_SET_TEST_DUMMY_ENC_CHAR_ARG, 1,
3026                         [fscrypt_set_test_dummy_encryption() take 'const char' parameter])
3027         ])
3028 ]) # LC_FSCRYPT_SET_TEST_DUMMY_ENC_CHAR_ARG
3029
3030 #
3031 # LC_FSCRYPT_DUMMY_POLICY
3032 #
3033 # Kernel 5.9-rc4 ac4acb1f4b2b6b7e8d913537cccec8789903e164
3034 # move the test dummy context for fscrypt_policy which is
3035 # also used by the user land interface.
3036 #
3037 AC_DEFUN([LC_SRC_FSCRYPT_DUMMY_POLICY], [
3038         LB2_LINUX_TEST_SRC([fscrypt_free_dummy_policy], [
3039                 #include <linux/fscrypt.h>
3040         ],[
3041                 fscrypt_free_dummy_policy(NULL);
3042         ],[-Werror])
3043 ])
3044 AC_DEFUN([LC_FSCRYPT_DUMMY_POLICY], [
3045         AC_MSG_CHECKING([if fscrypt_free_dummy_policy() exists])
3046         LB2_LINUX_TEST_RESULT([fscrypt_free_dummy_policy], [
3047                 AC_DEFINE(HAVE_FSCRYPT_DUMMY_POLICY, 1,
3048                         [fscrypt_free_dummy_policy() exists])
3049         ])
3050 ]) # LC_FSCRYPT_DUMMY_POLICY
3051
3052 #
3053 # LC_HAVE_ITER_FILE_SPLICE_WRITE
3054 #
3055 # Linux commit v5.9-rc1-6-g36e2c7421f02
3056 #  fs: don't allow splice read/write without explicit ops
3057 #
3058 AC_DEFUN([LC_SRC_HAVE_ITER_FILE_SPLICE_WRITE], [
3059         LB2_LINUX_TEST_SRC([iter_file_splice_write], [
3060                 #include <linux/fs.h>
3061         ],[
3062                 (void)iter_file_splice_write(NULL, NULL, NULL, 1, 0);
3063         ],[-Werror])
3064 ])
3065 AC_DEFUN([LC_HAVE_ITER_FILE_SPLICE_WRITE], [
3066         AC_MSG_CHECKING([if iter_file_splice_write() exists])
3067         LB2_LINUX_TEST_RESULT([iter_file_splice_write], [
3068                 AC_DEFINE(HAVE_ITER_FILE_SPLICE_WRITE, 1,
3069                         ['iter_file_splice_write' exists])
3070         ])
3071 ]) # LC_HAVE_ITER_FILE_SPLICE_WRITE
3072
3073 #
3074 # LC_FSCRYPT_IS_NOKEY_NAME
3075 #
3076 # Kernel 5.10-rc4 159e1de201b6fca10bfec50405a3b53a561096a8
3077 # introduced fscrypt_is_nokey_name() inline macro. While
3078 # introduced for 5.10 kernels it was backported to earlier
3079 # Ubuntu kernels. Also it hides the change introduced due
3080 # to git commit 501e43fbe for kernel 5.9 which also was
3081 # backported to earlier Ubuntu kernels.
3082 #
3083 AC_DEFUN([LC_SRC_FSCRYPT_IS_NOKEY_NAME], [
3084         LB2_LINUX_TEST_SRC([fscrypt_is_no_key_name], [
3085                 #include <linux/fscrypt.h>
3086         ],[
3087                 fscrypt_is_nokey_name(NULL);
3088         ],[-Werror])
3089 ])
3090 AC_DEFUN([LC_FSCRYPT_IS_NOKEY_NAME], [
3091         AC_MSG_CHECKING([if fscrypt_is_no_key_name() exists])
3092         LB2_LINUX_TEST_RESULT([fscrypt_is_no_key_name], [
3093                 AC_DEFINE(HAVE_FSCRYPT_IS_NOKEY_NAME, 1,
3094                         [fscrypt_is_nokey_name() exists])
3095         ])
3096 ]) # LC_FSCRYPT_IS_NOKEY_NAME
3097
3098 #
3099 # LC_FSCRYPT_PREPARE_READDIR
3100 #
3101 # Kernel 5.10-rc4 ec0caa974cd092549ab282deb8ec7ea73b36eba0
3102 # replaced fscrypt_get_encryption_info() with
3103 # fscrypt_prepare_readdir()
3104 #
3105 AC_DEFUN([LC_SRC_FSCRYPT_PREPARE_READDIR], [
3106         LB2_LINUX_TEST_SRC([fscrypt_prepare_readdir], [
3107                 #include <linux/fscrypt.h>
3108         ],[
3109                 fscrypt_prepare_readdir(NULL);
3110         ],[-Werror])
3111 ])
3112 AC_DEFUN([LC_FSCRYPT_PREPARE_READDIR], [
3113         AC_MSG_CHECKING([if fscrypt_prepare_readdir() exists])
3114         LB2_LINUX_TEST_RESULT([fscrypt_prepare_readdir], [
3115                 AC_DEFINE(HAVE_FSCRYPT_PREPARE_READDIR, 1,
3116                         [fscrypt_prepare_readdir() exists])
3117         ])
3118 ]) # LC_FSCRYPT_PREPARE_READDIR
3119
3120 #
3121 # LC_BIO_SET_DEV
3122 #
3123 # Linux: v5.11-rc5-9-g309dca309fc3
3124 #   block: store a block_device pointer in struct bio
3125 # created bio_set_dev macro
3126 # Linux: v5.15-rc6-127-gcf6d6238cdd3
3127 #   block: turn macro helpers into inline functions
3128 # created inline function(s).
3129 #
3130 # Only provide a bio_set_dev it is is not proveded by the kernel
3131 #
3132 AC_DEFUN([LC_SRC_BIO_SET_DEV], [
3133         LB2_LINUX_TEST_SRC([bio_set_dev], [
3134                 #include <linux/bio.h>
3135         ],[
3136                 struct bio *bio = NULL;
3137                 struct block_device *bdev = NULL;
3138
3139                 bio_set_dev(bio, bdev);
3140         ],[-Werror])
3141 ])
3142 AC_DEFUN([LC_BIO_SET_DEV], [
3143         AC_MSG_CHECKING([if 'bio_set_dev' is available])
3144         LB2_LINUX_TEST_RESULT([bio_set_dev], [
3145                 AC_DEFINE(HAVE_BIO_SET_DEV, 1, ['bio_set_dev' is available])
3146         ])
3147 ]) # LC_BIO_SET_DEV
3148
3149 #
3150 # LC_HAVE_USER_NAMESPACE_ARG
3151 #
3152 # kernel 5.12 commit 549c7297717c32ee53f156cd949e055e601f67bb
3153 # fs: make helpers idmap mount aware
3154 # Extend some inode methods with an additional user namespace argument.
3155 #
3156 AC_DEFUN([LC_SRC_HAVE_USER_NAMESPACE_ARG], [
3157         LB2_LINUX_TEST_SRC([inode_ops_has_user_namespace_argument], [
3158                 #include <linux/fs.h>
3159         ],[
3160                 ((struct inode_operations *)1)->getattr((struct user_namespace *)NULL,
3161                                                         NULL, NULL, 0, 0);
3162         ],[-Werror])
3163 ])
3164 AC_DEFUN([LC_HAVE_USER_NAMESPACE_ARG], [
3165         AC_MSG_CHECKING([if 'inode_operations' members have user namespace argument])
3166         LB2_LINUX_TEST_RESULT([inode_ops_has_user_namespace_argument], [
3167                 AC_DEFINE(HAVE_USER_NAMESPACE_ARG, 1,
3168                         ['inode_operations' members have user namespace argument])
3169         ])
3170 ]) # LC_HAVE_USER_NAMESPACE_ARG
3171
3172 #
3173 # LC_HAVE_GET_ACL_RCU_ARG
3174 #
3175 # kernel 5.15 commit 0cad6246621b5887d5b33fea84219d2a71f2f99a
3176 # vfs: add rcu argument to ->get_acl() callback
3177 # Add a rcu argument to the ->get_acl() callback to allow
3178 # get_cached_acl_rcu() to call the ->get_acl() method.
3179 #
3180 AC_DEFUN([LC_SRC_HAVE_GET_ACL_RCU_ARG], [
3181         LB2_LINUX_TEST_SRC([get_acl_rcu_argument], [
3182                 #include <linux/fs.h>
3183         ],[
3184                 ((struct inode_operations *)1)->get_acl((struct inode *)NULL, 0, false);
3185         ],[-Werror])
3186 ])
3187 AC_DEFUN([LC_HAVE_GET_ACL_RCU_ARG], [
3188         AC_MSG_CHECKING([if 'get_acl' has a rcu argument])
3189         LB2_LINUX_TEST_RESULT([get_acl_rcu_argument], [
3190                 AC_DEFINE(HAVE_GET_ACL_RCU_ARG, 1,
3191                         ['get_acl' has a rcu argument])
3192         ])
3193 ]) # LC_HAVE_GET_ACL_RCU_ARG
3194
3195 #
3196 # LC_HAVE_SECURITY_DENTRY_INIT_WITH_XATTR_NAME_ARG
3197 #
3198 # Linux v5.15-rc1-20-g15bf32398ad4
3199 # security: Return xattr name from security_dentry_init_security()
3200 #
3201 AC_DEFUN([LC_SRC_HAVE_SECURITY_DENTRY_INIT_WITH_XATTR_NAME_ARG], [
3202         LB2_LINUX_TEST_SRC([security_dentry_init_security_xattr_name_arg], [
3203                 #include <linux/security.h>
3204         ],[
3205                 struct dentry *dentry = NULL;
3206                 int mode = 0;
3207                 const struct qstr *name = NULL;
3208                 const char *xattr_name = NULL;
3209                 void **ctx = NULL;
3210                 u32 *ctxlen = 0;
3211                 int rc = security_dentry_init_security(dentry, mode, name, &xattr_name,
3212                                                        ctx, ctxlen);
3213                 (void)rc;
3214
3215         ],[-Werror])
3216 ])
3217 AC_DEFUN([LC_HAVE_SECURITY_DENTRY_INIT_WITH_XATTR_NAME_ARG], [
3218         AC_MSG_CHECKING([if security_dentry_init_security() returns xattr name])
3219         LB2_LINUX_TEST_RESULT([security_dentry_init_security_xattr_name_arg], [
3220                 AC_DEFINE(HAVE_SECURITY_DENTRY_INIT_WITH_XATTR_NAME_ARG, 1,
3221                         [security_dentry_init_security() returns xattr name])
3222         ])
3223 ]) # LC_HAVE_SECURITY_DENTRY_INIT_WITH_XATTR_NAME_ARG
3224
3225 #
3226 # LC_HAVE_KIOCB_COMPLETE_2ARGS
3227 #
3228 # kernel v5.15-rc6-145-g6b19b766e8f0
3229 # fs: get rid of the res2 iocb->ki_complete argument
3230 #
3231 AC_DEFUN([LC_SRC_HAVE_KIOCB_COMPLETE_2ARGS], [
3232         LB2_LINUX_TEST_SRC([kiocb_ki_complete_2args], [
3233                 #include <linux/fs.h>
3234
3235                 static void complete_fn(struct kiocb *iocb, long ret)
3236                 {
3237                         (void)iocb;
3238                         (void)ret;
3239                 }
3240         ],[
3241                 struct kiocb *kio = NULL;
3242
3243                 kio->ki_complete = complete_fn;
3244         ],[-Werror])
3245 ])
3246 AC_DEFUN([LC_HAVE_KIOCB_COMPLETE_2ARGS], [
3247         AC_MSG_CHECKING([if kiocb->ki_complete() has 2 arguments])
3248         LB2_LINUX_TEST_RESULT([kiocb_ki_complete_2args], [
3249                 AC_DEFINE(HAVE_KIOCB_COMPLETE_2ARGS, 1,
3250                         [kiocb->ki_complete() has 2 arguments])
3251         ])
3252 ]) # LC_HAVE_KIOCB_COMPLETE_2ARGS
3253
3254 #
3255 # LC_EXPORTS_DELETE_FROM_PAGE_CACHE
3256 #
3257 # Linux commit v5.16-rc4-44-g452e9e6992fe
3258 # filemap: Add filemap_remove_folio and __filemap_remove_folio
3259 #
3260 # Also removes the export of delete_from_page_cache
3261 #
3262 AC_DEFUN([LC_EXPORTS_DELETE_FROM_PAGE_CACHE], [
3263 LB_CHECK_EXPORT([delete_from_page_cache], [mm/filemap.c],
3264         [AC_DEFINE(HAVE_DELETE_FROM_PAGE_CACHE, 1,
3265                         [delete_from_page_cache is exported])])
3266 ]) # LC_EXPORTS_DELETE_FROM_PAGE_CACHE
3267
3268 #
3269 # LC_HAVE_INVALIDATE_FOLIO
3270 #
3271 # linux commit v5.17-rc4-10-g128d1f8241d6
3272 # fs: Add invalidate_folio() aops method
3273 #
3274 AC_DEFUN([LC_SRC_HAVE_INVALIDATE_FOLIO], [
3275         LB2_LINUX_TEST_SRC([address_spaace_operaions_invalidate_folio], [
3276                 #include <linux/fs.h>
3277         ],[
3278                 struct address_space_operations *aops = NULL;
3279                 struct folio *folio = NULL;
3280                 aops->invalidate_folio(folio, 0, PAGE_SIZE);
3281
3282         ],[-Werror])
3283 ])
3284 AC_DEFUN([LC_HAVE_INVALIDATE_FOLIO], [
3285         AC_MSG_CHECKING([if have address_spaace_operaions->invalidate_folio() member])
3286         LB2_LINUX_TEST_RESULT([address_spaace_operaions_invalidate_folio], [
3287                 AC_DEFINE(HAVE_INVALIDATE_FOLIO, 1,
3288                         [address_spaace_operaions->invalidate_folio() member exists])
3289         ])
3290 ]) # LC_HAVE_INVALIDATE_FOLIO
3291
3292 #
3293 # LC_HAVE_DIRTY_FOLIO
3294 #
3295 # linux commit v5.17-rc4-38-g6f31a5a261db
3296 # fs: Add aops->dirty_folio
3297 # ... replaces ->set_page_dirty() with ->dirty_folio()
3298 #
3299 AC_DEFUN([LC_SRC_HAVE_DIRTY_FOLIO], [
3300         LB2_LINUX_TEST_SRC([address_spaace_operaions_dirty_folio], [
3301                 #include <linux/fs.h>
3302         ],[
3303                 struct address_space_operations *aops = NULL;
3304                 struct address_space *mapping = NULL;
3305                 struct folio *folio = NULL;
3306                 bool dirty = aops->dirty_folio(mapping, folio);
3307                 (void) dirty;
3308         ],[-Werror])
3309 ])
3310 AC_DEFUN([LC_HAVE_DIRTY_FOLIO], [
3311         AC_MSG_CHECKING([if have address_spaace_operaions->dirty_folio() member])
3312         LB2_LINUX_TEST_RESULT([address_spaace_operaions_dirty_folio], [
3313                 AC_DEFINE(HAVE_DIRTY_FOLIO, 1,
3314                         [address_spaace_operaions->dirty_folio() member exists])
3315         ])
3316 ]) # LC_HAVE_DIRTY_FOLIO
3317
3318 #
3319 # LC_HAVE_ALLOC_INODE_SB
3320 #
3321 # linux commit v5.17-49-g8b9f3ac5b01d
3322 #   fs: introduce alloc_inode_sb() to allocate filesystems specific inode
3323 #
3324 AC_DEFUN([LC_SRC_HAVE_ALLOC_INODE_SB], [
3325         LB2_LINUX_TEST_SRC([alloc_inode_sb], [
3326                 #include <linux/fs.h>
3327         ],[
3328                 struct super_block *sb = NULL;
3329                 struct kmem_cache *cache = NULL;
3330
3331                 (void)alloc_inode_sb(sb, cache, GFP_NOFS);
3332         ],[-Werror])
3333 ])
3334 AC_DEFUN([LC_HAVE_ALLOC_INODE_SB], [
3335         AC_MSG_CHECKING([if alloc_inode_sb() exists])
3336         LB2_LINUX_TEST_RESULT([alloc_inode_sb], [
3337                 AC_DEFINE(HAVE_ALLOC_INODE_SB, 1,
3338                         [alloc_inode_sb() exists])
3339         ])
3340 ]) # LC_HAVE_ALLOC_INODE_SB
3341
3342 #
3343 # LC_GRAB_CACHE_PAGE_WRITE_BEGIN_WITH_FLAGS
3344 #
3345 # Linux commit v5.18-rc5-221-gb7446e7cf15f
3346 #   fs: Remove aop flags parameter from grab_cache_page_write_begin()
3347 #
3348 AC_DEFUN([LC_SRC_GRAB_CACHE_PAGE_WRITE_BEGIN_WITH_FLAGS], [
3349         LB2_LINUX_TEST_SRC([grab_cache_page_write_begin_with_flags], [
3350                 #include <linux/pagemap.h>
3351         ],[
3352                 struct address_space *mapping = NULL;
3353                 (void)grab_cache_page_write_begin(mapping, 0, 1);
3354         ],[-Werror])
3355 ]) 
3356 AC_DEFUN([LC_GRAB_CACHE_PAGE_WRITE_BEGIN_WITH_FLAGS], [
3357         AC_MSG_CHECKING([if grab_cache_page_write_begin() has flags argument])
3358         LB2_LINUX_TEST_RESULT([grab_cache_page_write_begin_with_flags], [
3359                 AC_DEFINE(HAVE_GRAB_CACHE_PAGE_WRITE_BEGIN_WITH_FLAGS, 1,
3360                         [grab_cache_page_write_begin() has flags argument])
3361         ])
3362 ]) # LC_GRAB_CACHE_PAGE_WRITE_BEGIN_WITH_FLAGS
3363
3364 #
3365 # LC_HAVE_ADDRESS_SPACE_OPERATIONS_READ_FOLIO
3366 #
3367 # Linux commit v5.18-rc5-241-g5efe7448a142
3368 #   fs: Introduce aops->read_folio
3369 #
3370 AC_DEFUN([LC_SRC_HAVE_ADDRESS_SPACE_OPERATIONS_READ_FOLIO], [
3371         LB2_LINUX_TEST_SRC([address_space_operations_read_folio], [
3372                 #include <linux/fs.h>
3373         ],[
3374                 struct address_space_operations *aops = NULL;
3375                 struct file *file = NULL;
3376                 struct folio *folio = NULL;
3377                 int err = aops->read_folio(file, folio);
3378                 (void)err;
3379         ],[-Werror])
3380 ])
3381 AC_DEFUN([LC_HAVE_ADDRESS_SPACE_OPERATIONS_READ_FOLIO], [
3382         AC_MSG_CHECKING([if struct address_space_operations() has read_folio()])
3383         LB2_LINUX_TEST_RESULT([address_space_operations_read_folio], [
3384                 AC_DEFINE(HAVE_AOPS_READ_FOLIO, 1,
3385                         [struct address_space_operations() has read_folio()])
3386         ])
3387 ]) # LC_HAVE_ADDRESS_SPACE_OPERATIONS_READ_FOLIO
3388
3389 #
3390 # LC_HAVE_READ_CACHE_PAGE_FILLER_WITH_FILE
3391 #
3392 # Linux commit v5.18-rc5-280-ge9b5b23e957e
3393 #   fs: Change the type of filler_t
3394 #
3395 AC_DEFUN([LC_SRC_HAVE_READ_CACHE_PAGE_FILLER_WITH_FILE], [
3396         LB2_LINUX_TEST_SRC([read_cache_page_filler_with_file], [
3397                 #include <linux/pagemap.h>
3398                 static inline int _filler(struct file *file, struct folio *f)
3399                 {
3400                         return 0;
3401                 }
3402         ],[
3403                 struct address_space *mapping = NULL;
3404                 struct file *file = NULL;
3405                 struct page *page = read_cache_page(mapping, 0, _filler, file);
3406                 (void)page;
3407         ],[-Werror])
3408 ])
3409 AC_DEFUN([LC_HAVE_READ_CACHE_PAGE_FILLER_WITH_FILE], [
3410         AC_MSG_CHECKING([if read_cache_page() filler_t needs struct file])
3411         LB2_LINUX_TEST_RESULT([read_cache_page_filler_with_file], [
3412                 AC_DEFINE(HAVE_READ_CACHE_PAGE_WANTS_FILE, 1,
3413                         [read_cache_page() filler_t needs struct file])
3414         ])
3415 ]) # LC_HAVE_READ_CACHE_PAGE_FILLER_WITH_FILE
3416
3417 #
3418 # LC_HAVE_ADDRESS_SPACE_OPERATIONS_RELEASE_FOLIO
3419 #
3420 # Linux commit v5.18-rc5-282-gfa29000b6b26
3421 #  fs: Add aops->release_folio
3422 #
3423 AC_DEFUN([LC_SRC_HAVE_ADDRESS_SPACE_OPERATIONS_RELEASE_FOLIO], [
3424         LB2_LINUX_TEST_SRC([address_space_operations_release_folio], [
3425                 #include <linux/fs.h>
3426         ],[
3427                 struct address_space_operations *aops = NULL;
3428                 struct folio *folio = NULL;
3429                 int err = aops->release_folio(folio, GFP_KERNEL);
3430                 (void)err;
3431         ],[-Werror])
3432 ])
3433 AC_DEFUN([LC_HAVE_ADDRESS_SPACE_OPERATIONS_RELEASE_FOLIO], [
3434         AC_MSG_CHECKING([if struct address_space_operations() has release_folio()])
3435         LB2_LINUX_TEST_RESULT([address_space_operations_release_folio], [
3436                 AC_DEFINE(HAVE_AOPS_RELEASE_FOLIO, 1,
3437                         [struct address_space_operations() has release_folio()])
3438         ])
3439 ]) # LC_HAVE_ADDRESS_SPACE_OPERATIONS_RELEASE_FOLIO
3440
3441 #
3442 # LC_HAVE_LSMCONTEXT_INIT
3443 #
3444 # repo: git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/jammy
3445 # kernel linux-hwe-5.19 commit fef1deb99dad87dd700afae76b35c5b5750e33a8
3446 # LSM: Removed scaffolding function lsmcontext_init
3447 #
3448 AC_DEFUN([LC_SRC_HAVE_LSMCONTEXT_INIT], [
3449         LB2_LINUX_TEST_SRC([lsmcontext_init], [
3450                 #include <linux/security.h>
3451         ],[
3452                 struct lsmcontext ctx = {};
3453
3454                 lsmcontext_init(&ctx, "", 0, 0);
3455         ],[])
3456 ])
3457 AC_DEFUN([LC_HAVE_LSMCONTEXT_INIT], [
3458         AC_MSG_CHECKING([if lsmcontext_init is available])
3459         LB2_LINUX_TEST_RESULT([lsmcontext_init], [
3460                 AC_DEFINE(HAVE_LSMCONTEXT_INIT, 1,
3461                         [lsmcontext_init is available])
3462         ])
3463 ]) # LC_HAVE_LSMCONTEXT_INIT
3464
3465 #
3466 # LC_SECURITY_DENTRY_INIT_SECURTY_WITH_CTX
3467 #
3468 # repo: git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/jammy
3469 # kernel linux-hwe-5.19 commit 57d0004bc811254916be30f94c86d9607867deb0
3470 # LSM: Use lsmcontext in security_dentry_init_security
3471 #
3472 AC_DEFUN([LC_SRC_SECURITY_DENTRY_INIT_SECURTY_WITH_CTX], [
3473         LB2_LINUX_TEST_SRC([security_dentry_init_security_with_ctx], [
3474                 #include <linux/security.h>
3475         ],[
3476                 struct dentry *dentry = NULL;
3477                 const struct qstr *name = NULL;
3478                 struct lsmcontext *ctx = NULL;
3479                 const char *xattr_name = "";
3480
3481                 (void)security_dentry_init_security(dentry, 0, name,
3482                                                     &xattr_name, ctx);
3483         ],[-Werror])
3484 ])
3485 AC_DEFUN([LC_SECURITY_DENTRY_INIT_SECURTY_WITH_CTX], [
3486         AC_MSG_CHECKING([if security_dentry_init_security needs lsmcontext])
3487         LB2_LINUX_TEST_RESULT([security_dentry_init_security_with_ctx], [
3488                 AC_DEFINE(HAVE_SECURITY_DENTRY_INIT_SECURTY_WITH_CTX, 1,
3489                         [security_dentry_init_security needs lsmcontext])
3490         ])
3491 ]) # LC_SECURITY_DENTRY_INIT_SECURTY_WITH_CTX
3492
3493 #
3494 # LC_HAVE_NO_LLSEEK
3495 #
3496 # Linux commit v5.19-rc2-6-g868941b14441
3497 #   fs: remove no_llseek
3498 #
3499 AC_DEFUN([LC_SRC_HAVE_NO_LLSEEK], [
3500         LB2_LINUX_TEST_SRC([no_llseek], [
3501                 #include <linux/fs.h>
3502         ],[
3503                 static const struct file_operations fops = {
3504                         .llseek = &no_llseek,
3505                 };
3506                 (void)fops;
3507         ],[-Werror])
3508 ])
3509 AC_DEFUN([LC_HAVE_NO_LLSEEK], [
3510         AC_MSG_CHECKING([if no_llseek() is available])
3511         LB2_LINUX_TEST_RESULT([no_llseek], [
3512                 AC_DEFINE(HAVE_NO_LLSEEK, 1, [no_llseek() is available])
3513         ])
3514 ]) # LC_HAVE_NO_LLSEEK
3515
3516 #
3517 # LC_DQUOT_TRANSFER_WITH_USER_NS
3518 #
3519 # Linux commit v5.19-rc3-6-g71e7b535b890
3520 #  quota: port quota helpers mount ids
3521 #
3522 AC_DEFUN([LC_SRC_DQUOT_TRANSFER_WITH_USER_NS], [
3523         LB2_LINUX_TEST_SRC([dquot_transfer], [
3524                 #include <linux/quotaops.h>
3525         ],[
3526                 struct user_namespace *userns = NULL;
3527                 struct inode *inode = NULL;
3528                 struct iattr *iattr = NULL;
3529                 int err __attribute__ ((unused));
3530
3531                 err = dquot_transfer(userns, inode, iattr);
3532         ],[-Werror])
3533 ])
3534 AC_DEFUN([LC_DQUOT_TRANSFER_WITH_USER_NS], [
3535         AC_MSG_CHECKING([if dquot_transfer() has user_ns argument])
3536         LB2_LINUX_TEST_RESULT([dquot_transfer], [
3537                 AC_DEFINE(HAVE_DQUOT_TRANSFER_WITH_USER_NS, 1,
3538                         [dquot_transfer() has user_ns argument])
3539         ])
3540 ]) # LC_DQUOT_TRANSFER_WITH_USER_NS
3541
3542 #
3543 # LC_HAVE_ADDRESS_SPACE_OPERATIONS_MIGRATE_FOLIO
3544 #
3545 # Linux commit v5.19-rc3-392-g5490da4f06d1
3546 #  fs: Add aops->migrate_folio
3547 #
3548 AC_DEFUN([LC_SRC_HAVE_ADDRESS_SPACE_OPERATIONS_MIGRATE_FOLIO], [
3549         LB2_LINUX_TEST_SRC([address_space_operations_migrate_folio], [
3550                 #include <linux/fs.h>
3551         ],[
3552                 struct address_space_operations *aops = NULL;
3553                 struct address_space *m = NULL;
3554                 struct folio *src = NULL;
3555                 struct folio *dst = NULL;
3556                 int err = aops->migrate_folio(m, dst, src, MIGRATE_ASYNC);
3557                 (void)err;
3558         ],[-Werror])
3559 ])
3560 AC_DEFUN([LC_HAVE_ADDRESS_SPACE_OPERATIONS_MIGRATE_FOLIO], [
3561         AC_MSG_CHECKING([if struct address_space_operations() has migrate_folio()])
3562         LB2_LINUX_TEST_RESULT([address_space_operations_migrate_folio], [
3563                 AC_DEFINE(HAVE_AOPS_MIGRATE_FOLIO, 1,
3564                         [struct address_space_operations() has migrate_folio()])
3565         ])
3566 ]) # LC_HAVE_ADDRESS_SPACE_OPERATIONS_MIGRATE_FOLIO
3567
3568 #
3569 # LC_REGISTER_SHRINKER_FORMAT_NAMED
3570 #
3571 # Linux commit v5.19-rc4-52-ge33c267ab70d
3572 #   mm: shrinkers: provide shrinkers with names
3573 #
3574 AC_DEFUN([LC_SRC_REGISTER_SHRINKER_FORMAT_NAMED], [
3575         LB2_LINUX_TEST_SRC([register_shrinker_format], [
3576                 #include <linux/mm.h>
3577         ],[
3578                 if (register_shrinker(NULL, "lustre-%ps", __func__))
3579                         unregister_shrinker(NULL);
3580         ],[-Werror])
3581 ])
3582 AC_DEFUN([LC_REGISTER_SHRINKER_FORMAT_NAMED], [
3583         AC_MSG_CHECKING([if register_shrinker() returns status])
3584         LB2_LINUX_TEST_RESULT([address_space_operations_migrate_folio], [
3585                 AC_DEFINE(HAVE_REGISTER_SHRINKER_FORMAT_NAMED, 1,
3586                         [register_shrinker() returns status])
3587         ])
3588 ]) # LC_REGISTER_SHRINKER_FORMAT_NAMED
3589
3590 #
3591 # LC_HAVE_VFS_SETXATTR_NON_CONST_VALUE
3592 #
3593 # From Linux commit v5.19-rc5-17-g0c5fd887d2bb
3594 #   acl: move idmapped mount fixup into vfs_{g,s}etxattr()
3595 # Until Linux commit v6.0-rc3-6-g6344e66970c6
3596 #   xattr: constify value argument in vfs_setxattr()
3597 #
3598 AC_DEFUN([LC_SRC_HAVE_VFS_SETXATTR_NON_CONST_VALUE], [
3599         LB2_LINUX_TEST_SRC([vfs_setxattr_non_const_value_arg], [
3600                 #include <linux/xattr.h>
3601         ],[
3602                 struct dentry *de = NULL;
3603                 const char *name = "an.xattr";
3604                 const void *value = NULL;
3605                 int err = vfs_setxattr(&init_user_ns, de, name, value, 0, 0);
3606                 (void)err;
3607         ],[-Werror])
3608 ]) # LC_HAVE_VFS_SETXATTR_NON_CONST_VALUE
3609 AC_DEFUN([LC_HAVE_VFS_SETXATTR_NON_CONST_VALUE], [
3610         AC_MSG_CHECKING([if vfs_setxattr() value argument is non-const])
3611         LB2_LINUX_TEST_RESULT([vfs_setxattr_non_const_value_arg], [
3612                 AC_DEFINE([VFS_SETXATTR_VALUE(value)],
3613                           [(value)],
3614                           [vfs_setxattr() value argument is const void *])
3615         ],[
3616                 AC_DEFINE([VFS_SETXATTR_VALUE(value)],
3617                           [((void *)(value))],
3618                           [vfs_setxattr() value argument is non-const])
3619         ])
3620 ]) # LC_HAVE_VFS_SETXATTR_NON_CONST_VALUE
3621
3622 #
3623 # LC_HAVE_IOV_ITER_GET_PAGES_ALLOC2
3624 #
3625 # Linux commit v5.19-10313-geba2d3d79829
3626 #   get rid of non-advancing variants
3627 #
3628 AC_DEFUN([LC_SRC_HAVE_IOV_ITER_GET_PAGES_ALLOC2], [
3629         LB2_LINUX_TEST_SRC([iov_iter_get_pages_alloc2], [
3630                 #include <linux/uio.h>
3631         ],[
3632                 struct iov_iter *iter = NULL;
3633                 struct page ***pages = NULL;
3634                 size_t maxsize = 1;
3635                 size_t start;
3636                 size_t result __attribute__ ((unused));
3637                 result = iov_iter_get_pages_alloc2(iter, pages, maxsize, &start);
3638         ],[-Werror])
3639 ])
3640 AC_DEFUN([LC_HAVE_IOV_ITER_GET_PAGES_ALLOC2], [
3641         AC_MSG_CHECKING([if iov_iter_get_pages_alloc2() is available])
3642         LB2_LINUX_TEST_RESULT([iov_iter_get_pages_alloc2], [
3643                 AC_DEFINE(HAVE_IOV_ITER_GET_PAGES_ALLOC2, 1,
3644                         [iov_iter_get_pages_alloc2() is available])
3645         ])
3646 ]) # LC_HAVE_IOV_ITER_GET_PAGES_ALLOC2
3647
3648 #
3649 # LC_HAVE_GET_RANDOM_U32_AND_U64
3650 #
3651 # Linux commit v4.10-rc3-6-gc440408cf690
3652 #   random: convert get_random_int/long into get_random_u32/u64
3653 # Linux commit v6.0-11338-gde492c83cae0
3654 #   prandom: remove unused functions
3655 #
3656 AC_DEFUN([LC_SRC_HAVE_GET_RANDOM_U32_AND_U64], [
3657         LB2_LINUX_TEST_SRC([get_random_u32_and_u64], [
3658                 #include <linux/random.h>
3659         ],[
3660                 u32 rand32 = get_random_u32();
3661                 u64 rand64 = get_random_u64();
3662                 (void)rand32;
3663                 (void)rand64;
3664         ],[-Werror])
3665 ])
3666 AC_DEFUN([LC_HAVE_GET_RANDOM_U32_AND_U64], [
3667         AC_MSG_CHECKING([if get_random_u32() and get_random_u64() are available])
3668         LB2_LINUX_TEST_RESULT([get_random_u32_and_u64], [
3669                 AC_DEFINE(HAVE_GET_RANDOM_U32_AND_U64, 1,
3670                         [get_random_[u32|u64] are available])
3671         ],[
3672                 AC_DEFINE([get_random_u32()], [prandom_u32()],
3673                         [get_random_u32() is not available, use prandom_u32])
3674         ])
3675 ]) # LC_HAVE_GET_RANDOM_U32_AND_U64
3676
3677 #
3678 # LC_NFS_FILLDIR_USE_CTX_RETURN_BOOL
3679 #
3680 # Linux commit v6.0-rc1-2-g25885a35a720
3681 #  Change calling conventions for filldir_t
3682 #
3683 AC_DEFUN([LC_SRC_NFS_FILLDIR_USE_CTX_RETURN_BOOL], [
3684         LB2_LINUX_TEST_SRC([filldir_ctx_return_bool], [
3685                 #include <linux/fs.h>
3686         ],[
3687                 bool filldir(struct dir_context *ctx, const char* name,
3688                              int i, loff_t off, u64 tmp, unsigned temp)
3689                 {
3690                         return 0;
3691                 }
3692
3693                 struct dir_context ctx = {
3694                         .actor = filldir,
3695                 };
3696
3697                 ctx.actor(NULL, "test", 0, (loff_t) 0, 0, 0);
3698         ],[-Werror])
3699 ])
3700 AC_DEFUN([LC_NFS_FILLDIR_USE_CTX_RETURN_BOOL], [
3701         AC_MSG_CHECKING([if filldir_t uses struct dir_context and returns bool])
3702         LB2_LINUX_TEST_RESULT([filldir_ctx_return_bool], [
3703                 AC_DEFINE(HAVE_FILLDIR_USE_CTX_RETURN_BOOL, 1,
3704                         [filldir_t needs struct dir_context and returns bool])
3705                 AC_DEFINE(HAVE_FILLDIR_USE_CTX, 1,
3706                         [filldir_t needs struct dir_context as argument])
3707                 AC_DEFINE(FILLDIR_TYPE, bool,
3708                         [filldir_t return type is bool or int])
3709         ],[
3710                 AC_DEFINE(FILLDIR_TYPE, int,
3711                         [filldir_t return type is bool or int])
3712         ])
3713 ]) # LC_NFS_FILLDIR_USE_CTX_RETURN_BOOL
3714
3715 #
3716 # LC_HAVE_FILEMAP_GET_FOLIOS_CONTIG
3717 #
3718 # Linux commit v6.0-rc3-94-g35b471467f88
3719 #   filemap: add filemap_get_folios_contig()
3720 #
3721 AC_DEFUN([LC_SRC_HAVE_FILEMAP_GET_FOLIOS_CONTIG], [
3722         LB2_LINUX_TEST_SRC([filemap_get_folios_contig], [
3723                 #include <linux/pagemap.h>
3724         ],[
3725                 struct address_space *m = NULL;
3726                 pgoff_t start = 0;
3727                 struct folio_batch *fbatch = NULL;
3728                 (void)filemap_get_folios_contig(m, &start, ULONG_MAX, fbatch);
3729         ],[-Werror])
3730 ])
3731 AC_DEFUN([LC_HAVE_FILEMAP_GET_FOLIOS_CONTIG], [
3732         AC_MSG_CHECKING([if filemap_get_folios_contig() is available])
3733         LB2_LINUX_TEST_RESULT([filldir_ctx_return_bool], [
3734                 AC_DEFINE(HAVE_FILEMAP_GET_FOLIOS_CONTIG, 1,
3735                         [filemap_get_folios_contig() is available])
3736         ])
3737 ]) # LC_HAVE_FILEMAP_GET_FOLIOS_CONTIG
3738
3739 #
3740 # LC_PROG_LINUX
3741 #
3742 # Lustre linux kernel checks
3743 #
3744 AC_DEFUN([LC_PROG_LINUX_SRC], [
3745         AS_IF([test "x$enable_gss" != xno], [
3746                 LC_SRC_KEY_TYPE_INSTANTIATE_2ARGS
3747                 LB2_SRC_CHECK_CONFIG_IM([CRYPTO_MD5])
3748                 LB2_SRC_CHECK_CONFIG_IM([CRYPTO_SHA1])
3749                 LB2_SRC_CHECK_CONFIG_IM([CRYPTO_SHA256])
3750                 LB2_SRC_CHECK_CONFIG_IM([CRYPTO_SHA512])
3751         ])
3752         AS_IF([test "x$enable_server" != xno], [
3753                 LC_SRC_CONFIG_QUOTA
3754                 LC_SRC_STACK_SIZE
3755         ])
3756         LC_SRC_CONFIG_FHANDLE
3757         LC_SRC_POSIX_ACL_CONFIG
3758         LC_SRC_HAVE_PROJECT_QUOTA
3759
3760         # 3.11
3761         LC_SRC_INVALIDATE_RANGE
3762         LC_SRC_HAVE_DIR_CONTEXT
3763         LC_SRC_D_COMPARE_5ARGS
3764         LC_SRC_HAVE_DCOUNT
3765         LC_SRC_PID_NS_FOR_CHILDREN
3766
3767         # 3.12
3768         LC_SRC_OLDSIZE_TRUNCATE_PAGECACHE
3769         LC_SRC_PTR_ERR_OR_ZERO_MISSING
3770         LC_SRC_HAVE_DENTRY_D_U_D_ALIAS_LIST
3771         LC_SRC_HAVE_DENTRY_D_U_D_ALIAS_HLIST
3772         LC_SRC_HAVE_DENTRY_D_CHILD
3773         LC_SRC_KIOCB_KI_LEFT
3774         LC_SRC_REGISTER_SHRINKER_RET
3775
3776         # 3.13
3777         LC_SRC_VFS_RENAME_5ARGS
3778         LC_SRC_VFS_UNLINK_3ARGS
3779         LC_SRC_HAVE_D_IS_POSITIVE
3780
3781         # 3.14
3782         LC_SRC_HAVE_BVEC_ITER
3783         LC_SRC_HAVE_TRUNCATE_IPAGES_FINAL
3784         LC_SRC_IOPS_RENAME_WITH_FLAGS
3785         LC_SRC_IOP_SET_ACL
3786
3787         # 3.15
3788         LC_SRC_VFS_RENAME_6ARGS
3789
3790         # 3.16
3791         LC_SRC_DIRECTIO_USE_ITER
3792         LC_SRC_HAVE_IOV_ITER_INIT_DIRECTION
3793         LC_SRC_HAVE_IOV_ITER_TRUNCATE
3794         LC_SRC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER
3795         LC_SRC_PAGECACHE_GET_PAGE
3796
3797         # 3.17
3798         LC_SRC_HAVE_INTERVAL_BLK_INTEGRITY
3799         LC_SRC_KEY_MATCH_DATA
3800         LC_SRC_HAVE_BLK_INTEGRITY_ITER
3801
3802         # 3.18
3803         LC_SRC_NFS_FILLDIR_USE_CTX
3804         LC_SRC_PERCPU_COUNTER_INIT
3805
3806         # 3.19
3807         LC_SRC_KIOCB_HAS_NBYTES
3808         LC_SRC_HAVE_DQUOT_QC_DQBLK
3809         LC_SRC_HAVE_AIO_COMPLETE
3810         LC_SRC_HAVE_IS_ROOT_INODE
3811
3812         # 3.20
3813         LC_SRC_BACKING_DEV_INFO_REMOVAL
3814         LC_SRC_HAVE_BDI_CAP_MAP_COPY
3815
3816         # 4.1.0
3817         LC_SRC_IOV_ITER_RW
3818         LC_SRC_HAVE___BI_CNT
3819
3820         # 4.2
3821         LC_SRC_BIO_ENDIO_USES_ONE_ARG
3822         LC_SRC_SYMLINK_OPS_USE_NAMEIDATA
3823         LC_SRC_ACCOUNT_PAGE_DIRTIED_3ARGS
3824         LC_SRC_HAVE_CRYPTO_ALLOC_SKCIPHER
3825
3826         # 4.3
3827         LC_SRC_HAVE_INTERVAL_EXP_BLK_INTEGRITY
3828         LC_SRC_HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD
3829         LC_SRC_HAVE_CACHE_HEAD_HLIST
3830         LC_SRC_HAVE_XATTR_HANDLER_SIMPLIFIED
3831
3832         # 4.4
3833         LC_SRC_HAVE_LOCKS_LOCK_FILE_WAIT
3834         LC_SRC_HAVE_KEY_PAYLOAD_DATA_ARRAY
3835         LC_SRC_HAVE_XATTR_HANDLER_NAME
3836         LC_SRC_BIO_INTEGRITY_PREP_FN_RETURNS_BOOL
3837         LC_SRC_HAVE_BI_OPF
3838         LC_SRC_HAVE_SUBMIT_BIO_2ARGS
3839         LC_SRC_HAVE_CLEAN_BDEV_ALIASES
3840
3841         # 4.5
3842         LC_SRC_HAVE_FILE_DENTRY
3843
3844         # 4.6
3845         LC_SRC_HAVE_INODE_LOCK
3846         LC_SRC_HAVE_IOP_GET_LINK
3847         LC_SRC_HAVE_IN_COMPAT_SYSCALL
3848         LC_SRC_HAVE_XATTR_HANDLER_INODE_PARAM
3849         LC_SRC_LOCK_PAGE_MEMCG
3850         LC_SRC_HAVE_DOWN_WRITE_KILLABLE
3851
3852         # 4.7
3853         LC_SRC_D_IN_LOOKUP
3854         LC_SRC_D_INIT
3855         LC_SRC_DIRECTIO_2ARGS
3856         LC_SRC_GENERIC_WRITE_SYNC_2ARGS
3857         LC_SRC_FOP_ITERATE_SHARED
3858
3859         # 4.8
3860         LC_SRC_HAVE_POSIX_ACL_VALID_USER_NS
3861         LC_SRC_D_COMPARE_4ARGS
3862         LC_SRC_FULL_NAME_HASH_3ARGS
3863         LC_SRC_STRUCT_POSIX_ACL_XATTR
3864         LC_SRC_IOP_XATTR
3865
3866         # 4.9
3867         LC_SRC_GROUP_INFO_GID
3868         LC_SRC_VFS_SETXATTR
3869         LC_SRC_POSIX_ACL_UPDATE_MODE
3870         LC_SRC_HAVE_BDI_IO_PAGES
3871
3872         # 4.10
3873         LC_SRC_IOP_GENERIC_READLINK
3874         LC_SRC_HAVE_VM_FAULT_ADDRESS
3875
3876         # 4.11
3877         LC_SRC_INODEOPS_ENHANCED_GETATTR
3878         LC_SRC_VM_OPERATIONS_REMOVE_VMF_ARG
3879         LC_SRC_HAVE_KEY_USAGE_REFCOUNT
3880         LC_SRC_HAVE_CRYPTO_MAX_ALG_NAME_128
3881
3882         # 4.12
3883         LC_SRC_CURRENT_TIME
3884         LC_SRC_SUPER_SETUP_BDI_NAME
3885         LC_SRC_BI_STATUS
3886
3887         # 4.13
3888         LC_SRC_BIO_INTEGRITY_ENABLED
3889         LC_SRC_HAVE_GET_INODE_USAGE
3890
3891         # 4.14
3892         LC_SRC_PAGEVEC_INIT_ONE_PARAM
3893         LC_SRC_BI_BDEV
3894         LC_SRC_INTERVAL_TREE_CACHED
3895
3896         # 4.17
3897         LC_SRC_VM_FAULT_T
3898         LC_SRC_VM_FAULT_RETRY
3899         LC_SRC_I_PAGES
3900
3901         # 4.18
3902         LC_SRC_INODE_TIMESPEC64
3903         LC_SRC_ALLOC_FILE_PSEUDO
3904
3905         # 4.20
3906         LC_SRC_RADIX_TREE_TAG_SET
3907         LC_SRC_UAPI_LINUX_MOUNT_H
3908         LC_SRC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK
3909
3910         # 5.0
3911         LC_SRC_GENL_FAMILY_HAS_RESV_START_OP
3912
3913         # 5.1
3914         LC_SRC_HAVE_BVEC_ITER_ALL
3915
3916         # 5.2
3917         LC_SRC_KEYRING_SEARCH_4ARGS
3918
3919         # 5.3
3920         LC_SRC_BIO_BI_PHYS_SEGMENTS
3921         LC_SRC_LM_COMPARE_OWNER_EXISTS
3922
3923         # 5.5
3924         LC_SRC_FSCRYPT_DIGESTED_NAME
3925
3926         # 5.7
3927         LC_SRC_FSCRYPT_DUMMY_CONTEXT_ENABLED
3928
3929         # 5.9
3930         LC_SRC_FSCRYPT_FNAME_ALLOC_BUFFER
3931         LC_SRC_FSCRYPT_SET_CONTEXT
3932         LC_SRC_FSCRYPT_NOKEY_NAME
3933         LC_SRC_FSCRYPT_SET_TEST_DUMMY_ENC_CHAR_ARG
3934         LC_SRC_FSCRYPT_DUMMY_POLICY
3935         LC_SRC_HAVE_ITER_FILE_SPLICE_WRITE
3936
3937         # 5.10
3938         LC_SRC_FSCRYPT_IS_NOKEY_NAME
3939         LC_SRC_FSCRYPT_PREPARE_READDIR
3940
3941         # 5.11
3942         LC_SRC_BIO_SET_DEV
3943
3944         # 5.12
3945         LC_SRC_HAVE_USER_NAMESPACE_ARG
3946
3947         # 5.15
3948         LC_SRC_HAVE_GET_ACL_RCU_ARG
3949
3950         # 5.16
3951         LC_SRC_HAVE_SECURITY_DENTRY_INIT_WITH_XATTR_NAME_ARG
3952         LC_SRC_HAVE_KIOCB_COMPLETE_2ARGS
3953
3954         # 5.17
3955         LC_SRC_HAVE_INVALIDATE_FOLIO
3956         LC_SRC_HAVE_DIRTY_FOLIO
3957
3958         # 5.18
3959         LC_SRC_HAVE_ALLOC_INODE_SB
3960
3961         # 5.19
3962         LC_SRC_GRAB_CACHE_PAGE_WRITE_BEGIN_WITH_FLAGS
3963         LC_SRC_HAVE_ADDRESS_SPACE_OPERATIONS_READ_FOLIO
3964         LC_SRC_HAVE_READ_CACHE_PAGE_FILLER_WITH_FILE
3965         LC_SRC_HAVE_ADDRESS_SPACE_OPERATIONS_RELEASE_FOLIO
3966         LC_SRC_HAVE_LSMCONTEXT_INIT
3967         LC_SRC_SECURITY_DENTRY_INIT_SECURTY_WITH_CTX
3968
3969         # 6.0
3970         LC_SRC_HAVE_NO_LLSEEK
3971         LC_SRC_DQUOT_TRANSFER_WITH_USER_NS
3972         LC_SRC_HAVE_ADDRESS_SPACE_OPERATIONS_MIGRATE_FOLIO
3973         LC_SRC_REGISTER_SHRINKER_FORMAT_NAMED
3974         LC_SRC_HAVE_VFS_SETXATTR_NON_CONST_VALUE
3975         LC_SRC_HAVE_IOV_ITER_GET_PAGES_ALLOC2
3976
3977         # 6.1
3978         LC_SRC_HAVE_GET_RANDOM_U32_AND_U64
3979         LC_SRC_NFS_FILLDIR_USE_CTX_RETURN_BOOL
3980         LC_SRC_HAVE_FILEMAP_GET_FOLIOS_CONTIG
3981
3982         # kernel patch to extend integrity interface
3983         LC_SRC_BIO_INTEGRITY_PREP_FN
3984 ])
3985
3986 AC_DEFUN([LC_PROG_LINUX_RESULTS], [
3987         AS_IF([test "x$enable_gss" != xno], [
3988                 LC_KEY_TYPE_INSTANTIATE_2ARGS
3989
3990                 LB2_TEST_CHECK_CONFIG_IM([CRYPTO_MD5], [],
3991                         [AC_MSG_WARN(
3992                         [kernel MD5 support is recommended by using GSS.])])
3993                 LB2_TEST_CHECK_CONFIG_IM([CRYPTO_SHA1], [],
3994                         [AC_MSG_WARN(
3995                         [kernel SHA1 support is recommended by using GSS.])])
3996                 LB2_TEST_CHECK_CONFIG_IM([CRYPTO_SHA256], [],
3997                         [AC_MSG_WARN(
3998                         [kernel SHA256 support is recommended by using GSS.])])
3999                 LB2_TEST_CHECK_CONFIG_IM([CRYPTO_SHA512], [],
4000                         [AC_MSG_WARN(
4001                         [kernel SHA512 support is recommended by using GSS.])])
4002         ])
4003         AS_IF([test "x$enable_server" != xno], [
4004                 LC_CONFIG_QUOTA
4005                 LC_STACK_SIZE
4006         ])
4007         LC_CONFIG_FHANDLE
4008         LC_POSIX_ACL_CONFIG
4009         LC_HAVE_PROJECT_QUOTA
4010
4011         # 3.11
4012         LC_INVALIDATE_RANGE
4013         LC_HAVE_DIR_CONTEXT
4014         LC_D_COMPARE_5ARGS
4015         LC_HAVE_DCOUNT
4016         LC_HAVE_DENTRY_D_U_D_ALIAS_LIST
4017         LC_HAVE_DENTRY_D_U_D_ALIAS_HLIST
4018         LC_HAVE_DENTRY_D_CHILD
4019         LC_PID_NS_FOR_CHILDREN
4020
4021         # 3.12
4022         LC_OLDSIZE_TRUNCATE_PAGECACHE
4023         LC_PTR_ERR_OR_ZERO_MISSING
4024         LC_KIOCB_KI_LEFT
4025         LC_REGISTER_SHRINKER_RET
4026
4027         # 3.13
4028         LC_VFS_RENAME_5ARGS
4029         LC_VFS_UNLINK_3ARGS
4030         LC_HAVE_D_IS_POSITIVE
4031
4032         # 3.14
4033         LC_HAVE_BVEC_ITER
4034         LC_HAVE_TRUNCATE_IPAGES_FINAL
4035         LC_IOPS_RENAME_WITH_FLAGS
4036         LC_IOP_SET_ACL
4037
4038         # 3.15
4039         LC_VFS_RENAME_6ARGS
4040
4041         # 3.16
4042         LC_DIRECTIO_USE_ITER
4043         LC_HAVE_IOV_ITER_INIT_DIRECTION
4044         LC_HAVE_IOV_ITER_TRUNCATE
4045         LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER
4046         LC_PAGECACHE_GET_PAGE
4047
4048         # 3.17
4049         LC_HAVE_INTERVAL_BLK_INTEGRITY
4050         LC_KEY_MATCH_DATA
4051         LC_HAVE_BLK_INTEGRITY_ITER
4052
4053         # 3.18
4054         LC_PERCPU_COUNTER_INIT
4055         LC_NFS_FILLDIR_USE_CTX
4056
4057         # 3.19
4058         LC_KIOCB_HAS_NBYTES
4059         LC_HAVE_DQUOT_QC_DQBLK
4060         LC_HAVE_AIO_COMPLETE
4061         LC_HAVE_IS_ROOT_INODE
4062
4063         # 3.20
4064         LC_BACKING_DEV_INFO_REMOVAL
4065         LC_HAVE_BDI_CAP_MAP_COPY
4066
4067         # 4.1.0
4068         LC_IOV_ITER_RW
4069         LC_HAVE___BI_CNT
4070
4071         # 4.2
4072         LC_BIO_ENDIO_USES_ONE_ARG
4073         LC_SYMLINK_OPS_USE_NAMEIDATA
4074         LC_ACCOUNT_PAGE_DIRTIED_3ARGS
4075         LC_HAVE_CRYPTO_ALLOC_SKCIPHER
4076
4077         # 4.3
4078         LC_HAVE_INTERVAL_EXP_BLK_INTEGRITY
4079         LC_HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD
4080         LC_HAVE_CACHE_HEAD_HLIST
4081         LC_HAVE_XATTR_HANDLER_SIMPLIFIED
4082
4083         # 4.4
4084         LC_HAVE_LOCKS_LOCK_FILE_WAIT
4085         LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
4086         LC_HAVE_XATTR_HANDLER_NAME
4087         LC_HAVE_BI_OPF
4088         LC_HAVE_SUBMIT_BIO_2ARGS
4089         LC_HAVE_CLEAN_BDEV_ALIASES
4090
4091         # 4.5
4092         LC_HAVE_FILE_DENTRY
4093
4094         # 4.5
4095         LC_HAVE_INODE_LOCK
4096         LC_HAVE_IOP_GET_LINK
4097
4098         # 4.6
4099         LC_HAVE_IN_COMPAT_SYSCALL
4100         LC_HAVE_XATTR_HANDLER_INODE_PARAM
4101         LC_LOCK_PAGE_MEMCG
4102         LC_HAVE_DOWN_WRITE_KILLABLE
4103
4104         # 4.7
4105         LC_D_IN_LOOKUP
4106         LC_D_INIT
4107         LC_DIRECTIO_2ARGS
4108         LC_GENERIC_WRITE_SYNC_2ARGS
4109         LC_FOP_ITERATE_SHARED
4110
4111         # 4.8
4112         LC_HAVE_POSIX_ACL_VALID_USER_NS
4113         LC_D_COMPARE_4ARGS
4114         LC_FULL_NAME_HASH_3ARGS
4115         LC_STRUCT_POSIX_ACL_XATTR
4116         LC_IOP_XATTR
4117
4118         # 4.9
4119         LC_GROUP_INFO_GID
4120         LC_VFS_SETXATTR
4121         LC_POSIX_ACL_UPDATE_MODE
4122         LC_HAVE_BDI_IO_PAGES
4123
4124         # 4.10
4125         LC_IOP_GENERIC_READLINK
4126         LC_HAVE_VM_FAULT_ADDRESS
4127
4128         # 4.11
4129         LC_INODEOPS_ENHANCED_GETATTR
4130         LC_VM_OPERATIONS_REMOVE_VMF_ARG
4131         LC_HAVE_KEY_USAGE_REFCOUNT
4132         LC_HAVE_CRYPTO_MAX_ALG_NAME_128
4133
4134         # 4.12
4135         LC_CURRENT_TIME
4136         LC_SUPER_SETUP_BDI_NAME
4137         LC_BI_STATUS
4138
4139         # 4.13
4140         LC_BIO_INTEGRITY_ENABLED
4141         LC_BIO_INTEGRITY_PREP_FN_RETURNS_BOOL
4142         LC_HAVE_GET_INODE_USAGE
4143
4144         # 4.14
4145         LC_PAGEVEC_INIT_ONE_PARAM
4146         LC_BI_BDEV
4147         LC_INTERVAL_TREE_CACHED
4148
4149         # 4.17
4150         LC_VM_FAULT_T
4151         LC_VM_FAULT_RETRY
4152         LC_I_PAGES
4153
4154         # 4.18
4155         LC_ALLOC_FILE_PSEUDO
4156         LC_INODE_TIMESPEC64
4157
4158         # 4.20
4159         LC_RADIX_TREE_TAG_SET
4160         LC_UAPI_LINUX_MOUNT_H
4161         LC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK
4162
4163         # 5.0
4164         LC_GENL_FAMILY_HAS_RESV_START_OP
4165
4166         # 5.1
4167         LC_HAVE_BVEC_ITER_ALL
4168
4169         # 5.2
4170         LC_KEYRING_SEARCH_4ARGS
4171
4172         # 5.3
4173         LC_BIO_BI_PHYS_SEGMENTS
4174         LC_LM_COMPARE_OWNER_EXISTS
4175
4176         # 5.5
4177         LC_FSCRYPT_DIGESTED_NAME
4178
4179         # 5.7
4180         LC_FSCRYPT_DUMMY_CONTEXT_ENABLED
4181
4182         # 5.9
4183         LC_HAVE_ITER_FILE_SPLICE_WRITE
4184
4185         # 5.9
4186         LC_FSCRYPT_FNAME_ALLOC_BUFFER
4187         LC_FSCRYPT_SET_CONTEXT
4188         LC_FSCRYPT_D_REVALIDATE
4189         LC_FSCRYPT_NOKEY_NAME
4190         LC_FSCRYPT_SET_TEST_DUMMY_ENC_CHAR_ARG
4191         LC_FSCRYPT_DUMMY_POLICY
4192
4193         # 5.10
4194         LC_FSCRYPT_IS_NOKEY_NAME
4195         LC_FSCRYPT_PREPARE_READDIR
4196
4197         # 5.11
4198         LC_BIO_SET_DEV
4199
4200         # 5.12
4201         LC_HAVE_USER_NAMESPACE_ARG
4202
4203         # 5.15
4204         LC_HAVE_GET_ACL_RCU_ARG
4205
4206         # 5.16
4207         LC_HAVE_SECURITY_DENTRY_INIT_WITH_XATTR_NAME_ARG
4208         LC_HAVE_KIOCB_COMPLETE_2ARGS
4209         LC_EXPORTS_DELETE_FROM_PAGE_CACHE
4210
4211         # 5.17
4212         LC_HAVE_INVALIDATE_FOLIO
4213         LC_HAVE_DIRTY_FOLIO
4214
4215         # 5.18
4216         LC_HAVE_ALLOC_INODE_SB
4217
4218         # 5.19
4219         LC_GRAB_CACHE_PAGE_WRITE_BEGIN_WITH_FLAGS
4220         LC_HAVE_ADDRESS_SPACE_OPERATIONS_READ_FOLIO
4221         LC_HAVE_READ_CACHE_PAGE_FILLER_WITH_FILE
4222         LC_HAVE_ADDRESS_SPACE_OPERATIONS_RELEASE_FOLIO
4223         LC_HAVE_LSMCONTEXT_INIT
4224         LC_SECURITY_DENTRY_INIT_SECURTY_WITH_CTX
4225
4226         # 6.0
4227         LC_HAVE_NO_LLSEEK
4228         LC_DQUOT_TRANSFER_WITH_USER_NS
4229         LC_HAVE_ADDRESS_SPACE_OPERATIONS_MIGRATE_FOLIO
4230         LC_REGISTER_SHRINKER_FORMAT_NAMED
4231         LC_HAVE_VFS_SETXATTR_NON_CONST_VALUE
4232         LC_HAVE_IOV_ITER_GET_PAGES_ALLOC2
4233
4234         # 6.1
4235         LC_HAVE_GET_RANDOM_U32_AND_U64
4236         LC_NFS_FILLDIR_USE_CTX_RETURN_BOOL
4237         LC_HAVE_FILEMAP_GET_FOLIOS_CONTIG
4238
4239         # kernel patch to extend integrity interface
4240         LC_BIO_INTEGRITY_PREP_FN
4241 ])
4242
4243 #
4244 # LC_PROG_LINUX
4245 #
4246 # Lustre linux kernel checks
4247 #
4248 AC_DEFUN([LC_PROG_LINUX], [
4249         AC_MSG_NOTICE([Lustre kernel checks
4250 ==============================================================================])
4251
4252         LC_CONFIG_PINGER
4253         LC_CONFIG_CHECKSUM
4254         LC_CONFIG_FLOCK
4255         LC_CONFIG_HEALTH_CHECK_WRITE
4256         LC_CONFIG_LRU_RESIZE
4257         LC_CONFIG_GSS
4258
4259         LC_GLIBC_SUPPORT_FHANDLES
4260         LC_GLIBC_SUPPORT_COPY_FILE_RANGE
4261         LC_OPENSSL_SSK
4262         LC_OPENSSL_GETSEPOL
4263
4264         # 4.1.0 - Check export
4265         LC_HAVE_SYNC_READ_WRITE
4266
4267         # 4.8 - Check export
4268         LC_EXPORT_DEFAULT_FILE_SPLICE_READ
4269
4270         # 5.2 - Check export
4271         LC_ACCOUNT_PAGE_DIRTIED
4272
4273 ]) # LC_PROG_LINUX
4274
4275 #
4276 # LC_CONFIG_CLIENT
4277 #
4278 # Check whether to build the client side of Lustre
4279 #
4280 AC_DEFUN([LC_CONFIG_CLIENT], [
4281 AC_MSG_CHECKING([whether to build Lustre client support])
4282 AC_ARG_ENABLE([client],
4283         AS_HELP_STRING([--disable-client],
4284                 [disable Lustre client support]),
4285         [], [enable_client="yes"])
4286 AC_MSG_RESULT([$enable_client])
4287 ]) # LC_CONFIG_CLIENT
4288
4289 #
4290 # --enable-mpitests
4291 #
4292 AC_DEFUN([LB_CONFIG_MPITESTS], [
4293 AC_ARG_ENABLE([mpitests],
4294         AS_HELP_STRING([--enable-mpitests=<yes|no|mpicc wrapper>],
4295                        [include mpi tests]), [
4296                 enable_mpitests="yes"
4297                 case $enableval in
4298                 yes)
4299                         MPICC_WRAPPER="mpicc"
4300                         MPI_BIN=$(eval which $MPICC_WRAPPER | xargs dirname)
4301                         ;;
4302                 no)
4303                         enable_mpitests="no"
4304                         MPI_BIN=""
4305                         ;;
4306                 *)
4307                         MPICC_WRAPPER=$enableval
4308                         MPI_BIN=$(eval echo $MPICC_WRAPPER | xargs dirname)
4309                         ;;
4310                 esac
4311         ], [
4312                 enable_mpitests="yes"
4313                 MPICC_WRAPPER="mpicc"
4314                 MPI_BIN=$(eval which $MPICC_WRAPPER | xargs dirname)
4315         ])
4316
4317         if test "x$enable_mpitests" != "xno"; then
4318                 oldcc=$CC
4319                 CC=$MPICC_WRAPPER
4320                 AC_CACHE_CHECK([whether mpitests can be built],
4321                 lb_cv_mpi_tests, [AC_COMPILE_IFELSE([AC_LANG_SOURCE([
4322                         #include <mpi.h>
4323                         int main(void) {
4324                                 int flag;
4325                                 MPI_Initialized(&flag);
4326                                 return 0;
4327                         }
4328                 ])], [lb_cv_mpi_tests="yes"], [lb_cv_mpi_tests="no"])
4329                 ])
4330                 enable_mpitests=$lb_cv_mpi_tests
4331                 CC=$oldcc
4332         fi
4333         AC_SUBST(MPI_BIN)
4334         AC_SUBST(MPICC_WRAPPER)
4335 ]) # LB_CONFIG_MPITESTS
4336
4337 #
4338 # LC_ENABLE_QUOTA
4339 #
4340 # whether to enable quota support global control
4341 #
4342 AC_DEFUN([LC_ENABLE_QUOTA], [
4343 AC_MSG_CHECKING([whether to enable quota support global control])
4344 AC_ARG_ENABLE([quota],
4345         AS_HELP_STRING([--enable-quota],
4346                 [enable quota support]),
4347         [], [enable_quota="yes"])
4348 AS_IF([test "x$enable_quota" = xyes],
4349         [AC_MSG_RESULT([yes])],
4350         [AC_MSG_RESULT([no])])
4351 ]) # LC_ENABLE_QUOTA
4352
4353 #
4354 # LC_QUOTA
4355 #
4356 AC_DEFUN([LC_QUOTA], [
4357 #check global
4358 LC_ENABLE_QUOTA
4359 #check for utils
4360 AS_IF([test "x$enable_quota" != xno -a "x$enable_utils" != xno], [
4361         AC_CHECK_HEADER([sys/quota.h],
4362                 [AC_DEFINE(HAVE_SYS_QUOTA_H, 1,
4363                         [Define to 1 if you have <sys/quota.h>.])],
4364                 [AC_MSG_ERROR([did not find <sys/quota.h> on your system])])
4365 ])
4366 ]) # LC_QUOTA
4367
4368 #
4369 # LC_OSD_ADDON
4370 #
4371 # configure support for optional OSD implementation
4372 #
4373 AC_DEFUN([LC_OSD_ADDON], [
4374 AC_MSG_CHECKING([whether to use OSD addon])
4375 AC_ARG_WITH([osd],
4376         AS_HELP_STRING([--with-osd=path],
4377                 [set path to optional osd]),
4378         [
4379         case "$with_osd" in
4380         no)
4381                 ENABLEOSDADDON=0
4382                 ;;
4383         *)
4384                 OSDADDON="$with_osd"
4385                 ENABLEOSDADDON=1
4386                 ;;
4387         esac
4388         ], [
4389                 ENABLEOSDADDON=0
4390         ])
4391 AS_IF([test $ENABLEOSDADDON -eq 0], [
4392         AC_MSG_RESULT([no])
4393         OSDADDON=""
4394 ], [
4395         OSDMODNAME=$(basename $OSDADDON)
4396         AS_IF([test -e $LUSTRE/$OSDMODNAME], [
4397                 AC_MSG_RESULT([cannot link])
4398                 OSDADDON=""
4399         ], [ln -s $OSDADDON $LUSTRE/$OSDMODNAME], [
4400                 AC_MSG_RESULT([$OSDMODNAME])
4401                 OSDADDON="obj-m += $OSDMODNAME/"
4402         ], [
4403                 AC_MSG_RESULT([cannot link])
4404                 OSDADDON=""
4405         ])
4406 ])
4407 AC_SUBST(OSDADDON)
4408 ]) # LC_OSD_ADDON
4409
4410 #
4411 # LC_CONFIG_CRYPTO
4412 #
4413 # Check whether to enable Lustre client crypto
4414 #
4415 AC_DEFUN([LC_CONFIG_CRYPTO], [
4416 AC_MSG_CHECKING([whether to enable Lustre client crypto])
4417 AC_ARG_ENABLE([crypto],
4418         AS_HELP_STRING([--enable-crypto=yes|no|in-kernel],
4419                 [enable Lustre client crypto (default is yes), use 'in-kernel' to force use of in-kernel fscrypt instead of embedded llcrypt]),
4420         [], [enable_crypto="auto"])
4421 AS_IF([test "x$enable_crypto" != xno -a "x$enable_dist" = xno], [
4422         AC_MSG_RESULT(
4423         )
4424         LC_IS_ENCRYPTED
4425         LC_FSCRYPT_SUPPORT])
4426 AS_IF([test "x$enable_crypto" = xin-kernel], [
4427         AS_IF([test "x$has_fscrypt_support" = xyes], [
4428               AC_DEFINE(HAVE_LUSTRE_CRYPTO, 1, [Enable Lustre client crypto via in-kernel fscrypt])], [
4429               AC_MSG_ERROR([Lustre client crypto cannot be enabled via in-kernel fscrypt.])
4430               enable_crypto=no])],
4431         [AS_IF([test "x$has_is_encrypted" = xyes], [
4432               AC_DEFINE(HAVE_LUSTRE_CRYPTO, 1, [Enable Lustre client crypto via embedded llcrypt])
4433               AC_DEFINE(CONFIG_LL_ENCRYPTION, 1, [embedded llcrypt])
4434               AC_DEFINE(HAVE_FSCRYPT_DUMMY_CONTEXT_ENABLED, 1, [embedded llcrypt uses llcrypt_dummy_context_enabled()])
4435               enable_crypto="embedded-llcrypt"
4436               enable_llcrypt=yes], [
4437               AS_IF([test "x$enable_crypto" = xyes],
4438                     [AC_MSG_ERROR([Lustre client crypto cannot be enabled because of lack of encryption support in your kernel.])])
4439               AS_IF([test "x$enable_crypto" != xno -a "x$enable_dist" = xno],
4440                     [AC_MSG_WARN(Lustre client crypto cannot be enabled because of lack of encryption support in your kernel.)])
4441               enable_crypto=no])])
4442 AS_IF([test "x$enable_dist" != xno], [
4443         enable_crypto=yes
4444         enable_llcrypt=yes])
4445 AC_MSG_RESULT([$enable_crypto])
4446 ]) # LC_CONFIG_CRYPTO
4447
4448 #
4449 # LC_CONFIGURE
4450 #
4451 # other configure checks
4452 #
4453 AC_DEFUN([LC_CONFIGURE], [
4454 AC_MSG_NOTICE([Lustre core checks
4455 ==============================================================================])
4456
4457 # maximum MDS thread count
4458 LC_MDS_MAX_THREADS
4459
4460 # lustre/utils/gss/gss_util.c
4461 # lustre/utils/llog_reader.c
4462 # lustre/utils/create_iam.c
4463 # lustre/utils/libiam.c
4464 AC_CHECK_HEADERS([netdb.h endian.h])
4465 AC_CHECK_FUNCS([gethostbyname])
4466
4467 # lustre/utils/llverfs.c lustre/utils/libmount_utils_ldiskfs.c
4468 AC_CHECK_HEADERS([ext2fs/ext2fs.h], [], [
4469         AS_IF([test "x$enable_utils" = xyes -a "x$enable_ldiskfs" = xyes], [
4470                 AC_MSG_ERROR([
4471 ext2fs.h not found. Please install e2fsprogs development package.
4472                 ])
4473         ])
4474 ])
4475
4476 # lustre/tests/statx_test.c
4477 AC_CHECK_FUNCS([statx])
4478
4479 # lustre/utils/lfs.c
4480 AS_IF([test "$enable_dist" = "no"], [
4481                 AC_CHECK_LIB([z], [crc32], [
4482                                  AC_CHECK_HEADER([zlib.h], [], [
4483                                                  AC_MSG_ERROR([zlib.h not found.])])
4484                                  ], [
4485                                  AC_MSG_ERROR([
4486                 zlib library not found. Please install zlib development package.])
4487                 ])
4488 ])
4489
4490 SELINUX=""
4491
4492 AC_CHECK_LIB([selinux], [is_selinux_enabled],
4493         [AC_CHECK_HEADERS([selinux/selinux.h],
4494                         [SELINUX="-lselinux"
4495                         AC_DEFINE([HAVE_SELINUX], 1,
4496                                 [support for selinux ])],
4497                         [AC_MSG_WARN([
4498
4499 No libselinux-devel package found, unable to build selinux enabled tools
4500 ])
4501 ])],
4502         [AC_MSG_WARN([
4503
4504 No selinux package found, unable to build selinux enabled tools
4505 ])
4506 ])
4507 AC_SUBST(SELINUX)
4508
4509 AC_CHECK_LIB([keyutils], [add_key])
4510
4511 # Super safe df
4512 AC_MSG_CHECKING([whether to report minimum OST free space])
4513 AC_ARG_ENABLE([mindf],
4514         AS_HELP_STRING([--enable-mindf],
4515                 [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
4516         [], [enable_mindf="no"])
4517 AC_MSG_RESULT([$enable_mindf])
4518 AS_IF([test "$enable_mindf" = "yes"], [
4519         AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])
4520         AC_SUBST(ENABLE_MINDF, yes)
4521 ], [
4522         AC_SUBST(ENABLE_MINDF, no)
4523 ])
4524
4525 AC_MSG_CHECKING([whether to randomly failing memory alloc])
4526 AC_ARG_ENABLE([fail_alloc],
4527         AS_HELP_STRING([--disable-fail-alloc],
4528                 [disable randomly alloc failure]),
4529         [], [enable_fail_alloc="yes"])
4530 AC_MSG_RESULT([$enable_fail_alloc])
4531 AS_IF([test "x$enable_fail_alloc" != xno], [
4532         AC_DEFINE([RANDOM_FAIL_ALLOC], 1, [enable randomly alloc failure])
4533         AC_SUBST(ENABLE_FAIL_ALLOC, yes)
4534 ], [
4535         AC_SUBST(ENABLE_FAIL_ALLOC, no)
4536 ])
4537
4538 AC_MSG_CHECKING([whether to check invariants (expensive cpu-wise)])
4539 AC_ARG_ENABLE([invariants],
4540         AS_HELP_STRING([--enable-invariants],
4541                 [enable invariant checking (cpu intensive)]),
4542         [], [enable_invariants="no"])
4543 AC_MSG_RESULT([$enable_invariants])
4544 AS_IF([test "x$enable_invariants" = xyes], [
4545         AC_DEFINE([CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK], 1,
4546                   [enable invariant checking])
4547         AC_SUBST(ENABLE_INVARIANTS, yes)
4548 ], [
4549         AC_SUBST(ENABLE_INVARIANTS, no)
4550 ])
4551
4552 AC_MSG_CHECKING([whether to track references with lu_ref])
4553 AC_ARG_ENABLE([lu_ref],
4554         AS_HELP_STRING([--enable-lu_ref],
4555                 [enable lu_ref reference tracking code]),
4556         [], [enable_lu_ref="no"])
4557 AC_MSG_RESULT([$enable_lu_ref])
4558 AS_IF([test "x$enable_lu_ref" = xyes], [
4559         AC_DEFINE([CONFIG_LUSTRE_DEBUG_LU_REF], 1,
4560                   [enable lu_ref reference tracking code])
4561         AC_SUBST(ENABLE_LU_REF, yes)
4562 ], [
4563         AC_SUBST(ENABLE_LU_REF, no)
4564 ])
4565
4566 AC_MSG_CHECKING([whether to enable page state tracking])
4567 AC_ARG_ENABLE([pgstate-track],
4568         AS_HELP_STRING([--enable-pgstate-track],
4569                 [enable page state tracking]),
4570         [], [enable_pgstat_track="no"])
4571 AC_MSG_RESULT([$enable_pgstat_track])
4572 AS_IF([test "x$enable_pgstat_track" = xyes], [
4573         AC_DEFINE([CONFIG_DEBUG_PAGESTATE_TRACKING], 1,
4574                   [enable page state tracking code])
4575         AC_SUBST(ENABLE_PGSTAT_TRACK, yes)
4576 ], [
4577         AC_SUBST(ENABLE_PGSTAT_TRACK, no)
4578 ])
4579
4580 PKG_PROG_PKG_CONFIG
4581 AC_MSG_CHECKING([systemd unit file directory])
4582 AC_ARG_WITH([systemdsystemunitdir],
4583         [AS_HELP_STRING([--with-systemdsystemunitdir=DIR],
4584                 [Directory for systemd service files])],
4585         [], [with_systemdsystemunitdir=auto])
4586 AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"],
4587         [def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
4588         AS_IF([test "x$def_systemdsystemunitdir" = "x"],
4589                 [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
4590                 [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
4591                 with_systemdsystemunitdir=no],
4592         [with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
4593 AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
4594         [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
4595 AC_MSG_RESULT([$with_systemdsystemunitdir])
4596
4597 AC_MSG_CHECKING([bash-completion directory])
4598 AC_ARG_WITH([bash-completion-dir],
4599         AS_HELP_STRING([--with-bash-completion-dir[=PATH]],
4600                 [Install the bash auto-completion script in this directory.]),
4601         [],
4602         [with_bash_completion_dir=yes])
4603 AS_IF([test "x$with_bash_completion_dir" = "xyes"], [
4604         BASH_COMPLETION_DIR="`pkg-config --variable=completionsdir bash-completion`"
4605         AS_IF([test "x$BASH_COMPLETION_DIR" = "x"], [
4606                 [BASH_COMPLETION_DIR="/usr/share/bash-completion/completions"]
4607         ])
4608 ], [
4609         BASH_COMPLETION_DIR="$with_bash_completion_dir"
4610 ])
4611 AC_SUBST([BASH_COMPLETION_DIR])
4612 AC_MSG_RESULT([$BASH_COMPLETION_DIR])
4613 ]) # LC_CONFIGURE
4614
4615 #
4616 # LC_CONDITIONALS
4617 #
4618 # AM_CONDITIONALS for lustre
4619 #
4620 AC_DEFUN([LC_CONDITIONALS], [
4621 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
4622 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
4623 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
4624 AM_CONDITIONAL(SPLIT, test x$enable_split = xyes)
4625 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
4626 AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
4627 AM_CONDITIONAL(GSS_KEYRING, test x$enable_gss_keyring = xyes)
4628 AM_CONDITIONAL(GSS_SSK, test x$enable_ssk = xyes)
4629 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
4630 AM_CONDITIONAL(HAVE_SYSTEMD, test "x$with_systemdsystemunitdir" != "xno")
4631 AM_CONDITIONAL(ENABLE_BASH_COMPLETION, test "x$with_bash_completion_dir" != "xno")
4632 AM_CONDITIONAL(XATTR_HANDLER, test "x$lb_cv_compile_xattr_handler_flags" = xyes)
4633 AM_CONDITIONAL(SELINUX, test "$SELINUX" = "-lselinux")
4634 AM_CONDITIONAL(GETSEPOL, test x$enable_getsepol = xyes)
4635 AM_CONDITIONAL(LLCRYPT, test x$enable_llcrypt = xyes)
4636 AM_CONDITIONAL(LIBAIO, test x$enable_libaio = xyes)
4637 ]) # LC_CONDITIONALS
4638
4639 #
4640 # LC_CONFIG_FILES
4641 #
4642 # files that should be generated with AC_OUTPUT
4643 #
4644 AC_DEFUN([LC_CONFIG_FILES],
4645 [AC_CONFIG_FILES([
4646 lustre/Makefile
4647 lustre/autoMakefile
4648 lustre/autoconf/Makefile
4649 lustre/conf/Makefile
4650 lustre/conf/resource/Makefile
4651 lustre/doc/Makefile
4652 lustre/include/Makefile
4653 lustre/include/lustre/Makefile
4654 lustre/include/uapi/linux/lustre/Makefile
4655 lustre/kernel_patches/targets/5.14-rhel9.2.target
4656 lustre/kernel_patches/targets/5.14-rhel9.1.target
4657 lustre/kernel_patches/targets/5.14-rhel9.0.target
4658 lustre/kernel_patches/targets/4.18-rhel8.8.target
4659 lustre/kernel_patches/targets/4.18-rhel8.7.target
4660 lustre/kernel_patches/targets/4.18-rhel8.6.target
4661 lustre/kernel_patches/targets/4.18-rhel8.5.target
4662 lustre/kernel_patches/targets/4.18-rhel8.4.target
4663 lustre/kernel_patches/targets/4.18-rhel8.3.target
4664 lustre/kernel_patches/targets/4.18-rhel8.2.target
4665 lustre/kernel_patches/targets/4.18-rhel8.1.target
4666 lustre/kernel_patches/targets/4.18-rhel8.target
4667 lustre/kernel_patches/targets/3.10-rhel7.9.target
4668 lustre/kernel_patches/targets/3.10-rhel7.8.target
4669 lustre/kernel_patches/targets/3.10-rhel7.7.target
4670 lustre/kernel_patches/targets/3.10-rhel7.6.target
4671 lustre/kernel_patches/targets/3.10-rhel7.5.target
4672 lustre/kernel_patches/targets/4.14-rhel7.5.target
4673 lustre/kernel_patches/targets/4.14-rhel7.6.target
4674 lustre/kernel_patches/targets/4.12-sles12sp4.target
4675 lustre/kernel_patches/targets/4.12-sles12sp5.target
4676 lustre/kernel_patches/targets/4.12-sles15sp1.target
4677 lustre/kernel_patches/targets/5.3-sles15sp2.target
4678 lustre/kernel_patches/targets/5.3-sles15sp3.target
4679 lustre/kernel_patches/targets/5.14-sles15sp4.target
4680 lustre/kernel_patches/targets/3.x-fc18.target
4681 lustre/kernel_patches/targets/5.10-oe2203.target
4682 lustre/ldlm/Makefile
4683 lustre/ldlm/autoMakefile
4684 lustre/ec/autoMakefile
4685 lustre/ec/Makefile
4686 lustre/fid/Makefile
4687 lustre/fid/autoMakefile
4688 lustre/llite/Makefile
4689 lustre/llite/autoMakefile
4690 lustre/lov/Makefile
4691 lustre/lov/autoMakefile
4692 lustre/mdc/Makefile
4693 lustre/mdc/autoMakefile
4694 lustre/lmv/Makefile
4695 lustre/lmv/autoMakefile
4696 lustre/lfsck/Makefile
4697 lustre/lfsck/autoMakefile
4698 lustre/mdt/Makefile
4699 lustre/mdt/autoMakefile
4700 lustre/mdd/Makefile
4701 lustre/mdd/autoMakefile
4702 lustre/fld/Makefile
4703 lustre/fld/autoMakefile
4704 lustre/obdclass/Makefile
4705 lustre/obdclass/autoMakefile
4706 lustre/obdecho/Makefile
4707 lustre/obdecho/autoMakefile
4708 lustre/ofd/Makefile
4709 lustre/ofd/autoMakefile
4710 lustre/osc/Makefile
4711 lustre/osc/autoMakefile
4712 lustre/ost/Makefile
4713 lustre/ost/autoMakefile
4714 lustre/osd-ldiskfs/Makefile
4715 lustre/osd-ldiskfs/autoMakefile
4716 lustre/osd-zfs/Makefile
4717 lustre/osd-zfs/autoMakefile
4718 lustre/mgc/Makefile
4719 lustre/mgc/autoMakefile
4720 lustre/mgs/Makefile
4721 lustre/mgs/autoMakefile
4722 lustre/target/Makefile
4723 lustre/target/autoMakefile
4724 lustre/ptlrpc/Makefile
4725 lustre/ptlrpc/autoMakefile
4726 lustre/ptlrpc/gss/Makefile
4727 lustre/ptlrpc/gss/autoMakefile
4728 lustre/quota/Makefile
4729 lustre/quota/autoMakefile
4730 lustre/scripts/Makefile
4731 lustre/scripts/systemd/Makefile
4732 lustre/tests/Makefile
4733 lustre/tests/mpi/Makefile
4734 lustre/tests/iabf/Makefile
4735 lustre/tests/lutf/Makefile
4736 lustre/tests/lutf/src/Makefile
4737 lustre/tests/kernel/Makefile
4738 lustre/tests/kernel/autoMakefile
4739 lustre/utils/Makefile
4740 lustre/utils/gss/Makefile
4741 lustre/osp/Makefile
4742 lustre/osp/autoMakefile
4743 lustre/lod/Makefile
4744 lustre/lod/autoMakefile
4745 ])
4746 ]) # LC_CONFIG_FILES