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