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