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