Whamcloud - gitweb
9e53606f5c76a60eb9c1147b8b85079564900d80
[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 # LC_CONFIG_FHANDLE
186 #
187 # fhandle kernel support for open_by_handle_at() and name_to_handle_at()
188 # system calls. The kernel must support CONFIG_FHANDLE.
189 #
190 AC_DEFUN([LC_CONFIG_FHANDLE], [
191 LB_CHECK_CONFIG_IM([FHANDLE], [],
192         [AC_MSG_ERROR([
193
194 Lustre fid handling requires that CONFIG_FHANDLE is enabled in your kernel.
195 ])])
196 ]) # LC_CONFIG_FHANDLE
197
198 #
199 # LC_POSIX_ACL_CONFIG
200 #
201 # POSIX ACL support.
202 #
203 AC_DEFUN([LC_POSIX_ACL_CONFIG], [
204 LB_CHECK_CONFIG_IM([FS_POSIX_ACL],
205         [AC_DEFINE(CONFIG_LUSTRE_FS_POSIX_ACL, 1, [Enable POSIX acl])
206 ], [ ])
207 ]) # LC_POSIX_ACL_CONFIG
208
209 LB_CHECK_CONFIG_IM([CRYPTO_MD5], [],
210                 [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
211
212 #
213 # LC_CONFIG_GSS_KEYRING
214 #
215 # default 'auto', tests for dependencies, if found, enables;
216 # only called if gss is enabled
217 #
218 AC_DEFUN([LC_CONFIG_GSS_KEYRING], [
219 AC_MSG_CHECKING([whether to enable gss keyring backend])
220 AC_ARG_ENABLE([gss_keyring],
221         [AC_HELP_STRING([--disable-gss-keyring],
222                 [disable gss keyring backend])],
223         [], [enable_gss_keyring="auto"])
224 AC_MSG_RESULT([$enable_gss_keyring])
225 AS_IF([test "x$enable_gss_keyring" != xno], [
226         LB_CHECK_CONFIG_IM([KEYS], [], [
227                 gss_keyring_conf_test="fail"
228                 AC_MSG_WARN([GSS keyring backend requires that CONFIG_KEYS be enabled in your kernel.])])
229
230         AC_CHECK_LIB([keyutils], [keyctl_search], [], [
231                 gss_keyring_conf_test="fail"
232                 AC_MSG_WARN([GSS keyring backend requires libkeyutils])])
233
234         AS_IF([test "x$gss_keyring_conf_test" != xfail], [
235                 AC_DEFINE([HAVE_GSS_KEYRING], [1],
236                         [Define this if you enable gss keyring backend])
237                 enable_gss_keyring="yes"
238         ], [
239                 AS_IF([test "x$enable_gss_keyring" = xyes], [
240                         AC_MSG_ERROR([Cannot enable gss_keyring. See above for details.])
241                 ])
242         ])
243 ])
244 ]) # LC_CONFIG_GSS_KEYRING
245
246 #
247 # LC_KEY_TYPE_INSTANTIATE_2ARGS
248 #
249 # rhel7 key_type->instantiate takes 2 args (struct key, struct key_preparsed_payload)
250 #
251 AC_DEFUN([LC_KEY_TYPE_INSTANTIATE_2ARGS], [
252 LB_CHECK_COMPILE([if 'key_type->instantiate' has two args],
253 key_type_instantiate_2args, [
254         #include <linux/key-type.h>
255 ],[
256         ((struct key_type *)0)->instantiate(0, NULL);
257 ],[
258         AC_DEFINE(HAVE_KEY_TYPE_INSTANTIATE_2ARGS, 1,
259                 [key_type->instantiate has two args])
260 ])
261 ]) # LC_KEY_TYPE_INSTANTIATE_2ARGS
262
263 #
264 # LC_CONFIG_SUNRPC
265 #
266 AC_DEFUN([LC_CONFIG_SUNRPC], [
267 LB_CHECK_CONFIG_IM([SUNRPC], [], [
268         AS_IF([test "x$sunrpc_required" = xyes], [
269                 AC_MSG_ERROR([
270
271 kernel SUNRPC support is required by using GSS.
272 ])
273         ])])
274 ]) # LC_CONFIG_SUNRPC
275
276 #
277 # LC_CONFIG_GSS (default 'auto' (tests for dependencies, if found, enables))
278 #
279 # Build gss and related tools of Lustre. Currently both kernel and user space
280 # parts are depend on linux platform.
281 #
282 AC_DEFUN([LC_CONFIG_GSS], [
283 AC_MSG_CHECKING([whether to enable gss support])
284 AC_ARG_ENABLE([gss],
285         [AC_HELP_STRING([--enable-gss], [enable gss support])],
286         [], [enable_gss="auto"])
287 AC_MSG_RESULT([$enable_gss])
288
289 AS_IF([test "x$enable_gss" != xno], [
290         LC_CONFIG_GSS_KEYRING
291         LC_KEY_TYPE_INSTANTIATE_2ARGS
292         sunrpc_required=$enable_gss
293         LC_CONFIG_SUNRPC
294         sunrpc_required="no"
295
296         LB_CHECK_CONFIG_IM([CRYPTO_MD5], [],
297                 [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
298         LB_CHECK_CONFIG_IM([CRYPTO_SHA1], [],
299                 [AC_MSG_WARN([kernel SHA1 support is recommended by using GSS.])])
300         LB_CHECK_CONFIG_IM([CRYPTO_SHA256], [],
301                 [AC_MSG_WARN([kernel SHA256 support is recommended by using GSS.])])
302         LB_CHECK_CONFIG_IM([CRYPTO_SHA512], [],
303                 [AC_MSG_WARN([kernel SHA512 support is recommended by using GSS.])])
304
305         require_krb5=$enable_gss
306         AC_KERBEROS_V5
307         require_krb5="no"
308
309         AS_IF([test -n "$KRBDIR"], [
310                 gss_conf_test="success"
311         ], [
312                 gss_conf_test="failure"
313         ])
314
315         AS_IF([test "x$gss_conf_test" = xsuccess && test "x$enable_gss" != xno], [
316                 AC_DEFINE([HAVE_GSS], [1], [Define this is if you enable gss])
317                 enable_gss="yes"
318         ], [
319                 enable_gss_keyring="no"
320                 enable_gss="no"
321         ])
322
323         enable_ssk=$enable_gss
324 ], [
325         enable_gss_keyring="no"
326 ])
327 ]) # LC_CONFIG_GSS
328
329 # LC_OPENSSL_SSK
330 #
331 # OpenSSL 1.0+ return int for HMAC functions but older SLES11 versions do not
332 AC_DEFUN([LC_OPENSSL_SSK], [
333 AC_MSG_CHECKING([whether OpenSSL has functions needed for SSK])
334 AS_IF([test "x$enable_ssk" != xno], [
335 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
336         #include <openssl/hmac.h>
337         #include <openssl/evp.h>
338
339         int main(void) {
340                 int rc;
341                 rc = HMAC_Init_ex(NULL, "test", 4, EVP_md_null(), NULL);
342         }
343 ])],[AC_DEFINE(HAVE_OPENSSL_SSK, 1,
344                [OpenSSL HMAC functions needed for SSK])],
345         [enable_ssk="no"])
346 ])
347 AC_MSG_RESULT([$enable_ssk])
348 ]) # LC_OPENSSL_SSK
349
350 # LC_OPENSSL_GETSEPOL
351 #
352 # OpenSSL is needed for l_getsepol
353 AC_DEFUN([LC_OPENSSL_GETSEPOL], [
354 AC_MSG_CHECKING([whether openssl-devel is present])
355 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
356         #include <openssl/evp.h>
357
358         int main(void) {
359                 EVP_MD_CTX *mdctx = EVP_MD_CTX_create();
360         }
361 ])],[
362         AC_DEFINE(HAVE_OPENSSL_GETSEPOL, 1, [openssl-devel is present])
363         enable_getsepol="yes"
364
365 ],[
366         enable_getsepol="no"
367         AC_MSG_WARN([
368
369 No openssk-devel headers found, unable to build l_getsepol and SELinux status checking
370 ])
371 ])
372 AC_MSG_RESULT([$enable_getsepol])
373 ]) # LC_OPENSSL_GETSEPOL
374
375 AC_DEFUN([LC_HAVE_PROJECT_QUOTA], [
376 LB_CHECK_COMPILE([if get_projid exists],
377 get_projid, [
378         struct inode;
379         #include <linux/quota.h>
380 ],[
381         struct dquot_operations ops = { };
382
383         ops.get_projid(NULL, NULL);
384 ],[
385         AC_DEFINE(HAVE_PROJECT_QUOTA, 1,
386                 [get_projid function exists])
387 ])
388 ]) # LC_HAVE_PROJECT_QUOTA
389
390 #
391 # LC_INVALIDATE_RANGE
392 #
393 # 3.11 invalidatepage requires the length of the range to invalidate
394 #
395 AC_DEFUN([LC_INVALIDATE_RANGE], [
396 LB_CHECK_COMPILE([if 'address_space_operations.invalidatepage' requires 3 arguments],
397 address_space_ops_invalidatepage_3args, [
398         #include <linux/fs.h>
399 ],[
400         struct address_space_operations a_ops;
401         a_ops.invalidatepage(NULL, 0, 0);
402 ],[
403         AC_DEFINE(HAVE_INVALIDATE_RANGE, 1,
404                 [address_space_operations.invalidatepage needs 3 arguments])
405 ])
406 ]) # LC_INVALIDATE_RANGE
407
408 #
409 # LC_HAVE_DIR_CONTEXT
410 #
411 # 3.11 readdir now takes the new struct dir_context
412 #
413 AC_DEFUN([LC_HAVE_DIR_CONTEXT], [
414 LB_CHECK_COMPILE([if 'dir_context' exist],
415 dir_context, [
416         #include <linux/fs.h>
417 ],[
418 #ifdef FMODE_KABI_ITERATE
419 #error "back to use readdir in kabi_extand mode"
420 #else
421         struct dir_context ctx;
422
423         ctx.pos = 0;
424 #endif
425 ],[
426         AC_DEFINE(HAVE_DIR_CONTEXT, 1,
427                 [dir_context exist])
428 ])
429 ]) # LC_HAVE_DIR_CONTEXT
430
431 #
432 # LC_D_COMPARE_5ARGS
433 #
434 # 3.11 dentry_operations.d_compare() taken 5 arguments.
435 #
436 AC_DEFUN([LC_D_COMPARE_5ARGS], [
437 LB_CHECK_COMPILE([if 'd_compare' taken 5 arguments],
438 d_compare_5args, [
439         #include <linux/dcache.h>
440 ],[
441         ((struct dentry_operations*)0)->d_compare(NULL,NULL,0,NULL,NULL);
442 ],[
443         AC_DEFINE(HAVE_D_COMPARE_5ARGS, 1,
444                 [d_compare need 5 arguments])
445 ])
446 ]) # LC_D_COMPARE_5ARGS
447
448 #
449 # LC_HAVE_DCOUNT
450 #
451 # 3.11 need to access d_count to get dentry reference count
452 #
453 AC_DEFUN([LC_HAVE_DCOUNT], [
454 LB_CHECK_COMPILE([if 'd_count' exists],
455 d_count, [
456         #include <linux/dcache.h>
457 ],[
458         struct dentry de = { };
459         int count;
460
461         count = d_count(&de);
462 ],[
463         AC_DEFINE(HAVE_D_COUNT, 1,
464                 [d_count exist])
465 ])
466 ]) # LC_HAVE_DCOUNT
467
468 #
469 # LC_PID_NS_FOR_CHILDREN
470 #
471 # 3.11 replaces pid_ns by pid_ns_for_children in struct nsproxy
472 #
473 AC_DEFUN([LC_PID_NS_FOR_CHILDREN], [
474 LB_CHECK_COMPILE([if 'struct nsproxy' has 'pid_ns_for_children'],
475 pid_ns_for_children, [
476         #include <linux/nsproxy.h>
477 ],[
478         struct nsproxy ns;
479         ns.pid_ns_for_children = NULL;
480 ],[
481         AC_DEFINE(HAVE_PID_NS_FOR_CHILDREN, 1,
482                   ['struct nsproxy' has 'pid_ns_for_children'])
483 ])
484 ]) # LC_PID_NS_FOR_CHILDREN
485
486 #
487 # LC_OLDSIZE_TRUNCATE_PAGECACHE
488 #
489 # 3.12 truncate_pagecache without oldsize parameter
490 #
491 AC_DEFUN([LC_OLDSIZE_TRUNCATE_PAGECACHE], [
492 LB_CHECK_COMPILE([if 'truncate_pagecache' with 'old_size' parameter],
493 truncate_pagecache_old_size, [
494         #include <linux/mm.h>
495 ],[
496         truncate_pagecache(NULL, 0, 0);
497 ],[
498         AC_DEFINE(HAVE_OLDSIZE_TRUNCATE_PAGECACHE, 1,
499                 [with oldsize])
500 ])
501 ]) # LC_OLDSIZE_TRUNCATE_PAGECACHE
502
503 #
504 # LC_PTR_ERR_OR_ZERO
505 #
506 # For some reason SLES11SP4 is missing the PTR_ERR_OR_ZERO macro
507 # It was added to linux kernel 3.12
508 #
509 AC_DEFUN([LC_PTR_ERR_OR_ZERO_MISSING], [
510 LB_CHECK_COMPILE([if 'PTR_ERR_OR_ZERO' is missing],
511 is_err_or_null, [
512         #include <linux/err.h>
513 ],[
514         if (PTR_ERR_OR_ZERO(NULL)) return 0;
515 ],[
516         AC_DEFINE(HAVE_PTR_ERR_OR_ZERO, 1,
517                 ['PTR_ERR_OR_ZERO' exist])
518 ])
519 ]) # LC_PTR_ERR_OR_ZERO_MISSING
520
521 #
522 # LC_HAVE_DENTRY_D_U_D_ALIAS
523 #
524 # 3.11 kernel moved d_alias to the union d_u in struct dentry
525 #
526 # Some distros move d_alias to d_u but it is still a struct list
527 #
528 AC_DEFUN([LC_HAVE_DENTRY_D_U_D_ALIAS], [
529 AS_IF([test "x$lb_cv_compile_i_dentry_d_alias_list" = xyes], [
530         LB_CHECK_COMPILE([if list 'dentry.d_u.d_alias' exist],
531         d_alias, [
532                 #include <linux/list.h>
533                 #include <linux/dcache.h>
534         ],[
535                 struct dentry de;
536                 INIT_LIST_HEAD(&de.d_u.d_alias);
537         ],[
538                 AC_DEFINE(HAVE_DENTRY_D_U_D_ALIAS, 1,
539                         [list dentry.d_u.d_alias exist])
540         ])
541 ],[
542         LB_CHECK_COMPILE([if hlist 'dentry.d_u.d_alias' exist],
543         d_alias, [
544                 #include <linux/list.h>
545                 #include <linux/dcache.h>
546         ],[
547                 struct dentry de;
548                 INIT_HLIST_NODE(&de.d_u.d_alias);
549         ],[
550                 AC_DEFINE(HAVE_DENTRY_D_U_D_ALIAS, 1,
551                         [hlist dentry.d_u.d_alias exist])
552         ])
553 ])
554 ]) # LC_HAVE_DENTRY_D_U_D_ALIAS
555
556 #
557 # LC_HAVE_DENTRY_D_CHILD
558 #
559 # 3.11 kernel d_child has been moved out of the union d_u
560 # in struct dentry
561 #
562 AC_DEFUN([LC_HAVE_DENTRY_D_CHILD], [
563 LB_CHECK_COMPILE([if 'dentry.d_child' exist],
564 d_child, [
565         #include <linux/list.h>
566         #include <linux/dcache.h>
567 ],[
568         struct dentry de;
569         INIT_LIST_HEAD(&de.d_child);
570 ],[
571         AC_DEFINE(HAVE_DENTRY_D_CHILD, 1,
572                 [dentry.d_child exist])
573 ])
574 ]) # LC_HAVE_DENTRY_D_CHILD
575
576 #
577 # LC_KIOCB_KI_LEFT
578 #
579 # 3.12 ki_left removed from struct kiocb
580 #
581 AC_DEFUN([LC_KIOCB_KI_LEFT], [
582 LB_CHECK_COMPILE([if 'struct kiocb' with 'ki_left' member],
583 kiocb_ki_left, [
584         #include <linux/aio.h>
585 ],[
586         ((struct kiocb*)0)->ki_left = 0;
587 ],[
588         AC_DEFINE(HAVE_KIOCB_KI_LEFT, 1,
589                 [ki_left exist])
590 ])
591 ]) # LC_KIOCB_KI_LEFT
592
593 #
594 # LC_VFS_RENAME_5ARGS
595 #
596 # 3.13 has vfs_rename with 5 args
597 #
598 AC_DEFUN([LC_VFS_RENAME_5ARGS], [
599 LB_CHECK_COMPILE([if Linux kernel has 'vfs_rename' with 5 args],
600 vfs_rename_5args, [
601         #include <linux/fs.h>
602 ],[
603         vfs_rename(NULL, NULL, NULL, NULL, NULL);
604 ], [
605         AC_DEFINE(HAVE_VFS_RENAME_5ARGS, 1,
606                 [kernel has vfs_rename with 5 args])
607 ])
608 ]) # LC_VFS_RENAME_5ARGS
609
610 #
611 # LC_VFS_UNLINK_3ARGS
612 #
613 # 3.13 has vfs_unlink with 3 args
614 #
615 AC_DEFUN([LC_VFS_UNLINK_3ARGS], [
616 LB_CHECK_COMPILE([if Linux kernel has 'vfs_unlink' with 3 args],
617 vfs_unlink_3args, [
618         #include <linux/fs.h>
619 ],[
620         vfs_unlink(NULL, NULL, NULL);
621 ], [
622         AC_DEFINE(HAVE_VFS_UNLINK_3ARGS, 1,
623                 [kernel has vfs_unlink with 3 args])
624 ])
625 ]) # LC_VFS_UNLINK_3ARGS
626
627 # LC_HAVE_D_IS_POSITIVE
628 #
629 # Kernel version 3.13 b18825a7c8e37a7cf6abb97a12a6ad71af160de7
630 # d_is_positive is added
631 #
632 AC_DEFUN([LC_HAVE_D_IS_POSITIVE], [
633 LB_CHECK_COMPILE([if 'd_is_positive' exist],
634 d_is_positive, [
635         #include <linux/dcache.h>
636 ],[
637         d_is_positive(NULL);
638 ],[
639         AC_DEFINE(HAVE_D_IS_POSITIVE, 1,
640                 ['d_is_positive' is available])
641 ])
642 ]) # LC_HAVE_D_IS_POSITIVE
643
644 #
645 # LC_HAVE_BVEC_ITER
646 #
647 # 3.14 move some of its data in struct bio into the new
648 # struct bvec_iter
649 #
650 AC_DEFUN([LC_HAVE_BVEC_ITER], [
651 LB_CHECK_COMPILE([if Linux kernel has struct bvec_iter],
652 have_bvec_iter, [
653         #include <linux/bio.h>
654 ],[
655         struct bvec_iter iter;
656
657         iter.bi_bvec_done = 0;
658 ], [
659         AC_DEFINE(HAVE_BVEC_ITER, 1,
660                 [kernel has struct bvec_iter])
661 ])
662 ]) # LC_HAVE_BVEC_ITER
663
664 #
665 # LC_IOP_SET_ACL
666 #
667 # 3.14 adds set_acl method to inode_operations
668 # see kernel commit 893d46e443346370cd4ea81d9d35f72952c62a37
669 #
670 AC_DEFUN([LC_IOP_SET_ACL], [
671 LB_CHECK_COMPILE([if 'inode_operations' has '.set_acl' member function],
672 inode_ops_set_acl, [
673         #include <linux/fs.h>
674 ],[
675         struct inode_operations iop;
676         iop.set_acl = NULL;
677 ],[
678         AC_DEFINE(HAVE_IOP_SET_ACL, 1,
679                 [inode_operations has .set_acl member function])
680 ])
681 ]) # LC_IOP_SET_ACL
682
683 #
684 # LC_HAVE_TRUNCATE_IPAGE_FINAL
685 #
686 # 3.14 bring truncate_inode_pages_final for evict_inode
687 #
688 AC_DEFUN([LC_HAVE_TRUNCATE_IPAGES_FINAL], [
689 LB_CHECK_COMPILE([if Linux kernel has truncate_inode_pages_final],
690 truncate_ipages_final, [
691         #include <linux/mm.h>
692 ],[
693         truncate_inode_pages_final(NULL);
694 ], [
695         AC_DEFINE(HAVE_TRUNCATE_INODE_PAGES_FINAL, 1,
696                 [kernel has truncate_inode_pages_final])
697 ])
698 ]) # LC_HAVE_TRUNCATE_IPAGES_FINAL
699
700 #
701 # LC_IOPS_RENAME_WITH_FLAGS
702 #
703 # 3.14 has inode_operations->rename with 5 args
704 # commit 520c8b16505236fc82daa352e6c5e73cd9870cff
705 #
706 AC_DEFUN([LC_IOPS_RENAME_WITH_FLAGS], [
707 LB_CHECK_COMPILE([if 'inode_operations->rename' taken flags as argument],
708 iops_rename_with_flags, [
709         #include <linux/fs.h>
710 ],[
711         struct inode *i1 = NULL, *i2 = NULL;
712         struct dentry *d1 = NULL, *d2 = NULL;
713         int rc;
714         rc = ((struct inode_operations *)0)->rename(i1, d1, i2, d2, 0);
715 ], [
716         AC_DEFINE(HAVE_IOPS_RENAME_WITH_FLAGS, 1,
717                 [inode_operations->rename need flags as argument])
718 ])
719 ]) # LC_IOPS_RENAME_WITH_FLAGS
720
721 #
722 # LC_VFS_RENAME_6ARGS
723 #
724 # 3.15 has vfs_rename with 6 args
725 #
726 AC_DEFUN([LC_VFS_RENAME_6ARGS], [
727 LB_CHECK_COMPILE([if Linux kernel has 'vfs_rename' with 6 args],
728 vfs_rename_6args, [
729         #include <linux/fs.h>
730 ],[
731         vfs_rename(NULL, NULL, NULL, NULL, NULL, NULL);
732 ], [
733         AC_DEFINE(HAVE_VFS_RENAME_6ARGS, 1,
734                 [kernel has vfs_rename with 6 args])
735 ])
736 ]) # LC_VFS_RENAME_6ARGS
737
738 #
739 # LC_DIRECTIO_USE_ITER
740 #
741 # 3.16 kernel changes direct IO to use iov_iter
742 #
743 AC_DEFUN([LC_DIRECTIO_USE_ITER], [
744 LB_CHECK_COMPILE([if direct IO uses iov_iter],
745 direct_io_iter, [
746         #include <linux/fs.h>
747 ],[
748         struct address_space_operations ops = { };
749         struct iov_iter *iter = NULL;
750         loff_t offset = 0;
751
752         ops.direct_IO(0, NULL, iter, offset);
753 ],[
754         AC_DEFINE(HAVE_DIRECTIO_ITER, 1,
755                 [direct IO uses iov_iter])
756 ])
757 ]) # LC_DIRECTIO_USE_ITER
758
759 #
760 # LC_HAVE_IOV_ITER_INIT_DIRECTION
761 #
762 #
763 # 3.16 linux commit 71d8e532b1549a478e6a6a8a44f309d050294d00
764 #      changed iov_iter_init api to start accepting a tag
765 #      that defines if its a read or write operation
766 #
767 AC_DEFUN([LC_HAVE_IOV_ITER_INIT_DIRECTION], [
768 tmp_flags="$EXTRA_KCFLAGS"
769 EXTRA_KCFLAGS="-Werror"
770 LB_CHECK_COMPILE([if 'iov_iter_init' takes a tag],
771 iter_init, [
772         #include <linux/uio.h>
773         #include <linux/fs.h>
774 ],[
775         const struct iovec *iov = NULL;
776
777         iov_iter_init(NULL, READ, iov, 1, 0);
778 ],[
779         AC_DEFINE(HAVE_IOV_ITER_INIT_DIRECTION, 1,
780                 [iov_iter_init handles directional tag])
781 ])
782 EXTRA_KCFLAGS="$tmp_flags"
783 ]) # LC_HAVE_IOV_ITER_INIT_DIRECTION
784
785 #
786 # LC_HAVE_IOV_ITER_TRUNCATE
787 #
788 #
789 # 3.16 introduces a new API iov_iter_truncate()
790 #
791 AC_DEFUN([LC_HAVE_IOV_ITER_TRUNCATE], [
792 tmp_flags="$EXTRA_KCFLAGS"
793 EXTRA_KCFLAGS="-Werror"
794 LB_CHECK_COMPILE([if 'iov_iter_truncate' exists ],
795 iter_truncate, [
796         #include <linux/uio.h>
797         #include <linux/fs.h>
798 ],[
799         struct iov_iter *i = NULL;
800
801         iov_iter_truncate(i, 0);
802 ],[
803         AC_DEFINE(HAVE_IOV_ITER_TRUNCATE, 1, [iov_iter_truncate exists])
804 ])
805 EXTRA_KCFLAGS="$tmp_flags"
806 ]) # LC_HAVE_IOV_ITER_TRUNCATE
807
808 #
809 # LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER
810 #
811 # 3.16 introduces [read|write]_iter to struct file_operations
812 #
813 AC_DEFUN([LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER], [
814 LB_CHECK_COMPILE([if 'file_operations.[read|write]_iter' exist],
815 file_function_iter, [
816         #include <linux/fs.h>
817 ],[
818         ((struct file_operations *)NULL)->read_iter(NULL, NULL);
819         ((struct file_operations *)NULL)->write_iter(NULL, NULL);
820 ],[
821         AC_DEFINE(HAVE_FILE_OPERATIONS_READ_WRITE_ITER, 1,
822                 [file_operations.[read|write]_iter functions exist])
823 ])
824 ]) # LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER
825
826 #
827 # LC_HAVE_INTERVAL_BLK_INTEGRITY
828 #
829 # 3.17 replace sector_size with interval in struct blk_integrity
830 #
831 AC_DEFUN([LC_HAVE_INTERVAL_BLK_INTEGRITY], [
832 LB_CHECK_COMPILE([if 'blk_integrity.interval' exist],
833 interval_blk_integrity, [
834         #include <linux/blkdev.h>
835 ],[
836         ((struct blk_integrity *)0)->interval = 0;
837 ],[
838         AC_DEFINE(HAVE_INTERVAL_BLK_INTEGRITY, 1,
839                 [blk_integrity.interval exist])
840 ])
841 ]) # LC_HAVE_INTERVAL_BLK_INTEGRITY
842
843 #
844 # LC_KEY_MATCH_DATA
845 #
846 # 3.17  replaces key_type::match with match_preparse
847 #       and has new struct key_match_data
848 #
849 AC_DEFUN([LC_KEY_MATCH_DATA], [
850 LB_CHECK_COMPILE([if struct key_match field exist],
851 key_match, [
852         #include <linux/key-type.h>
853 ],[
854         struct key_match_data data;
855
856         data.raw_data = NULL;
857 ],[
858         AC_DEFINE(HAVE_KEY_MATCH_DATA, 1,
859                 [struct key_match_data exist])
860 ])
861 ]) # LC_KEY_MATCH_DATA
862
863 #
864 # LC_NFS_FILLDIR_USE_CTX
865 #
866 # 3.18 kernel moved from void cookie to struct dir_context
867 #
868 AC_DEFUN([LC_NFS_FILLDIR_USE_CTX], [
869 tmp_flags="$EXTRA_KCFLAGS"
870 EXTRA_KCFLAGS="-Werror"
871 LB_CHECK_COMPILE([if filldir_t uses struct dir_context],
872 filldir_ctx, [
873         #include <linux/fs.h>
874 ],[
875         int filldir(struct dir_context *ctx, const char* name,
876                     int i, loff_t off, u64 tmp, unsigned temp)
877         {
878                 return 0;
879         }
880
881         struct dir_context ctx = {
882                 .actor = filldir,
883         };
884
885         ctx.actor(NULL, "test", 0, (loff_t) 0, 0, 0);
886 ],[
887         AC_DEFINE(HAVE_FILLDIR_USE_CTX, 1,
888                 [filldir_t needs struct dir_context as argument])
889 ])
890 EXTRA_KCFLAGS="$tmp_flags"
891 ]) # LC_NFS_FILLDIR_USE_CTX
892
893 #
894 # LC_PERCPU_COUNTER_INIT
895 #
896 # 3.18  For kernels 3.18 and after percpu_counter_init starts
897 #       to pass a GFP_* memory allocation flag for internal
898 #       memory allocation purposes.
899 #
900 AC_DEFUN([LC_PERCPU_COUNTER_INIT], [
901 LB_CHECK_COMPILE([if percpu_counter_init uses GFP_* flag as argument],
902 percpu_counter_init, [
903         #include <linux/percpu_counter.h>
904 ],[
905         percpu_counter_init(NULL, 0, GFP_KERNEL);
906 ],[
907         AC_DEFINE(HAVE_PERCPU_COUNTER_INIT_GFP_FLAG, 1,
908                 [percpu_counter_init uses GFP_* flag])
909 ])
910 ]) # LC_PERCPU_COUNTER_INIT
911
912 #
913 # LC_KIOCB_HAS_NBYTES
914 #
915 # 3.19 kernel removed ki_nbytes from struct kiocb
916 #
917 AC_DEFUN([LC_KIOCB_HAS_NBYTES], [
918 LB_CHECK_COMPILE([if struct kiocb has ki_nbytes field],
919 ki_nbytes, [
920         #include <linux/fs.h>
921 ],[
922         struct kiocb iocb = { };
923
924         iocb.ki_nbytes = 0;
925 ],[
926         AC_DEFINE(HAVE_KI_NBYTES, 1, [ki_nbytes field exist])
927 ])
928 ]) # LC_KIOCB_HAS_NBYTES
929
930 #
931 # LC_HAVE_DQUOT_QC_DQBLK
932 #
933 # 3.19 has quotactl_ops->[sg]et_dqblk that take struct kqid and qc_dqblk
934 # Added in commit 14bf61ffe
935 #
936 AC_DEFUN([LC_HAVE_DQUOT_QC_DQBLK], [
937 tmp_flags="$EXTRA_KCFLAGS"
938 EXTRA_KCFLAGS="-Werror"
939 LB_CHECK_COMPILE([if 'quotactl_ops.set_dqblk' takes struct qc_dqblk],
940 qc_dqblk, [
941         #include <linux/fs.h>
942         #include <linux/quota.h>
943 ],[
944         ((struct quotactl_ops *)0)->set_dqblk(NULL, *((struct kqid*)0), (struct qc_dqblk*)0);
945 ],[
946         AC_DEFINE(HAVE_DQUOT_QC_DQBLK, 1,
947                 [quotactl_ops.set_dqblk takes struct qc_dqblk])
948         AC_DEFINE(HAVE_DQUOT_KQID, 1,
949                 [quotactl_ops.set_dqblk takes struct kqid])
950 ])
951 EXTRA_KCFLAGS="$tmp_flags"
952 ]) # LC_HAVE_DQUOT_QC_DQBLK
953
954 #
955 # LC_HAVE_AIO_COMPLETE
956 #
957 # 3.19 kernel makes aio_complete() static
958 #
959 AC_DEFUN([LC_HAVE_AIO_COMPLETE], [
960 LB_CHECK_COMPILE([if kernel has exported aio_complete() ],
961 aio_complete, [
962         #include <linux/aio.h>
963 ],[
964         aio_complete(NULL, 0, 0);
965 ],[
966         AC_DEFINE(HAVE_AIO_COMPLETE, 1, [aio_complete defined])
967 ])
968 ]) # LC_HAVE_AIO_COMPLETE
969
970 #
971 # LC_BACKING_DEV_INFO_REMOVAL
972 #
973 # 3.20 kernel removed backing_dev_info from address_space
974 #
975 AC_DEFUN([LC_BACKING_DEV_INFO_REMOVAL], [
976 LB_CHECK_COMPILE([if struct address_space has backing_dev_info],
977 backing_dev_info, [
978         #include <linux/fs.h>
979 ],[
980         struct address_space mapping;
981
982         mapping.backing_dev_info = NULL;
983 ],[
984         AC_DEFINE(HAVE_BACKING_DEV_INFO, 1, [backing_dev_info exist])
985 ])
986 ]) # LC_BACKING_DEV_INFO_REMOVAL
987
988 #
989 # LC_HAVE_BDI_CAP_MAP_COPY
990 #
991 # 3.20  removed mmap handling for backing devices since
992 #       it breaks on non-MMU systems. See kernel commit
993 #       b4caecd48005fbed3949dde6c1cb233142fd69e9
994 #
995 AC_DEFUN([LC_HAVE_BDI_CAP_MAP_COPY], [
996 LB_CHECK_COMPILE([if have 'BDI_CAP_MAP_COPY'],
997 bdi_cap_map_copy, [
998         #include <linux/backing-dev.h>
999 ],[
1000         struct backing_dev_info info;
1001
1002         info.capabilities = BDI_CAP_MAP_COPY;
1003 ],[
1004         AC_DEFINE(HAVE_BDI_CAP_MAP_COPY, 1,
1005                 [BDI_CAP_MAP_COPY exist])
1006 ])
1007 ]) # LC_HAVE_BDI_CAP_MAP_COPY
1008
1009 #
1010 # LC_IOV_ITER_RW
1011 #
1012 # 4.1 kernel has iov_iter_rw
1013 #
1014 AC_DEFUN([LC_IOV_ITER_RW], [
1015 LB_CHECK_COMPILE([if iov_iter_rw exist],
1016 iov_iter_rw, [
1017         #include <linux/fs.h>
1018         #include <linux/uio.h>
1019 ],[
1020         struct iov_iter *iter = NULL;
1021
1022         iov_iter_rw(iter);
1023 ],[
1024         AC_DEFINE(HAVE_IOV_ITER_RW, 1,
1025                 [iov_iter_rw exist])
1026 ])
1027 ]) # LC_IOV_ITER_RW
1028
1029 #
1030 # LC_HAVE_SYNC_READ_WRITE
1031 #
1032 # 4.1 new_sync_[read|write] no longer exported
1033 #
1034 AC_DEFUN([LC_HAVE_SYNC_READ_WRITE], [
1035 LB_CHECK_EXPORT([new_sync_read], [fs/read_write.c],
1036         [AC_DEFINE(HAVE_SYNC_READ_WRITE, 1,
1037                         [new_sync_[read|write] is exported by the kernel])])
1038 ]) # LC_HAVE_SYNC_READ_WRITE
1039
1040 #
1041 # LC_HAVE___BI_CNT
1042 #
1043 # 4.1 redefined bi_cnt as __bi_cnt in commit dac56212e8127dbc0
1044 #
1045 AC_DEFUN([LC_HAVE___BI_CNT], [
1046 LB_CHECK_COMPILE([if Linux kernel has __bi_cnt in struct bio],
1047 have___bi_cnt, [
1048         #include <asm/atomic.h>
1049         #include <linux/bio.h>
1050         #include <linux/blk_types.h>
1051 ],[
1052         struct bio bio = { };
1053         int cnt;
1054         cnt = atomic_read(&bio.__bi_cnt);
1055 ], [
1056         AC_DEFINE(HAVE___BI_CNT, 1,
1057                 [struct bio has __bi_cnt])
1058 ])
1059 ]) # LC_HAVE___BI_CNT
1060
1061 #
1062 # LC_SYMLINK_OPS_USE_NAMEIDATA
1063 #
1064 # For the 4.2+ kernels the file system internal symlink api no
1065 # longer uses struct nameidata as a argument
1066 #
1067 AC_DEFUN([LC_SYMLINK_OPS_USE_NAMEIDATA], [
1068 LB_CHECK_COMPILE([if symlink inode operations have struct nameidata argument],
1069 symlink_use_nameidata, [
1070         #include <linux/namei.h>
1071         #include <linux/fs.h>
1072 ],[
1073         struct nameidata *nd = NULL;
1074
1075         ((struct inode_operations *)0)->follow_link(NULL, nd);
1076         ((struct inode_operations *)0)->put_link(NULL, nd, NULL);
1077 ],[
1078         AC_DEFINE(HAVE_SYMLINK_OPS_USE_NAMEIDATA, 1,
1079                 [symlink inode operations need struct nameidata argument])
1080 ])
1081 ]) # LC_SYMLINK_OPS_USE_NAMEIDATA
1082
1083 #
1084 # LC_BIO_ENDIO_USES_ONE_ARG
1085 #
1086 # 4.2 kernel bio_endio now only takes one argument
1087 #
1088 AC_DEFUN([LC_BIO_ENDIO_USES_ONE_ARG], [
1089 LB_CHECK_COMPILE([if 'bio_endio' with one argument exist],
1090 bio_endio, [
1091         #include <linux/bio.h>
1092 ],[
1093         bio_endio(NULL);
1094 ],[
1095         AC_DEFINE(HAVE_BIO_ENDIO_USES_ONE_ARG, 1,
1096                 [bio_endio takes only one argument])
1097 ])
1098 ]) # LC_BIO_ENDIO_USES_ONE_ARG
1099
1100 #
1101 # LC_ACCOUNT_PAGE_DIRTIED_3ARGS
1102 #
1103 # 4.2 [to 4.5] kernel page dirtied takes 3 arguments
1104 #
1105 AC_DEFUN([LC_ACCOUNT_PAGE_DIRTIED_3ARGS], [
1106 LB_CHECK_COMPILE([if 'account_page_dirtied' with 3 args exists],
1107 account_page_dirtied, [
1108         #include <linux/mm.h>
1109 ],[
1110         account_page_dirtied(NULL, NULL, NULL);
1111 ],[
1112         AC_DEFINE(HAVE_ACCOUNT_PAGE_DIRTIED_3ARGS, 1,
1113                 [account_page_dirtied takes three arguments])
1114 ])
1115 ]) # LC_ACCOUNT_PAGE_DIRTIED_3ARGS
1116
1117 #
1118 # LC_HAVE_INTERVAL_EXP_BLK_INTEGRITY
1119 #
1120 # 4.3 replace interval with interval_exp in 'struct blk_integrity'
1121 # 'struct blk_integrity_profile' is also added in this version,
1122 # thus use this to determine whether 'struct blk_integrity' has profile
1123 #
1124 AC_DEFUN([LC_HAVE_INTERVAL_EXP_BLK_INTEGRITY], [
1125 LB_CHECK_COMPILE([if 'blk_integrity.interval_exp' exist],
1126 blk_integrity_interval_exp, [
1127         #include <linux/blkdev.h>
1128 ],[
1129         ((struct blk_integrity *)0)->interval_exp = 0;
1130 ],[
1131         AC_DEFINE(HAVE_INTERVAL_EXP_BLK_INTEGRITY, 1,
1132                 [blk_integrity.interval_exp exist])
1133 ])
1134 ]) # LC_HAVE_INTERVAL_EXP_BLK_INTEGRITY
1135
1136 #
1137 # LC_HAVE_CACHE_HEAD_HLIST
1138 #
1139 # 4.3 kernel swiched to hlist for cache_head
1140 #
1141 AC_DEFUN([LC_HAVE_CACHE_HEAD_HLIST], [
1142 LB_CHECK_COMPILE([if 'struct cache_head' has 'cache_list' field],
1143 cache_head_has_hlist, [
1144         #include <linux/sunrpc/cache.h>
1145 ],[
1146         do {} while(sizeof(((struct cache_head *)0)->cache_list));
1147 ],[
1148         AC_DEFINE(HAVE_CACHE_HEAD_HLIST, 1,
1149                 [cache_head has hlist cache_list])
1150 ])
1151 ]) # LC_HAVE_CACHE_HEAD_HLIST
1152
1153 #
1154 # LC_HAVE_XATTR_HANDLER_SIMPLIFIED
1155 #
1156 # Kernel version 4.3 commit e409de992e3ea3674393465f07cc71c948edd87a
1157 # simplified xattr_handler handling by passing in the handler pointer
1158 #
1159 AC_DEFUN([LC_HAVE_XATTR_HANDLER_SIMPLIFIED], [
1160 tmp_flags="$EXTRA_KCFLAGS"
1161 EXTRA_KCFLAGS="-Werror"
1162 LB_CHECK_COMPILE([if 'struct xattr_handler' functions pass in handler pointer],
1163 xattr_handler_simplified, [
1164         #include <linux/xattr.h>
1165 ],[
1166         struct xattr_handler handler;
1167
1168         ((struct xattr_handler *)0)->get(&handler, NULL, NULL, NULL, 0);
1169         ((struct xattr_handler *)0)->set(&handler, NULL, NULL, NULL, 0, 0);
1170 ],[
1171         AC_DEFINE(HAVE_XATTR_HANDLER_SIMPLIFIED, 1, [handler pointer is parameter])
1172 ])
1173 EXTRA_KCFLAGS="$tmp_flags"
1174 ]) # LC_HAVE_XATTR_HANDLER_SIMPLIFIED
1175
1176 #
1177 # LC_HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD
1178 #
1179 # 4.3 replace interval with interval_exp in 'struct blk_integrity'.
1180 #
1181 AC_DEFUN([LC_HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD], [
1182 LB_CHECK_COMPILE([if 'bio_integrity_payload.bip_iter' exist],
1183 bio_integrity_payload_bip_iter, [
1184         #include <linux/bio.h>
1185 ],[
1186         ((struct bio_integrity_payload *)0)->bip_iter.bi_size = 0;
1187 ],[
1188         AC_DEFINE(HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD, 1,
1189                 [bio_integrity_payload.bip_iter exist])
1190 ])
1191 ]) # LC_HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD
1192
1193 #
1194 # LC_BIO_INTEGRITY_PREP_FN
1195 #
1196 # Lustre kernel patch extents bio_integrity_prep to accept optional
1197 # generate/verify_fn as extra args.
1198 #
1199 AC_DEFUN([LC_BIO_INTEGRITY_PREP_FN], [
1200 LB_CHECK_COMPILE([if 'bio_integrity_prep_fn' exists],
1201 bio_integrity_prep_fn, [
1202         #include <linux/bio.h>
1203 ],[
1204         bio_integrity_prep_fn(NULL, NULL, NULL);
1205 ],[
1206         AC_DEFINE(HAVE_BIO_INTEGRITY_PREP_FN, 1,
1207                 [kernel has bio_integrity_prep_fn])
1208         AC_SUBST(PATCHED_INTEGRITY_INTF)
1209 ],[
1210         AC_SUBST(PATCHED_INTEGRITY_INTF, [#])
1211 ])
1212 ]) # LC_BIO_INTEGRITY_PREP_FN
1213
1214 #
1215 # LC_HAVE_BI_OPF
1216 #
1217 # 4.4/4.8 redefined bi_rw as bi_opf (SLES12/kernel commit 4382e33ad37486)
1218 #
1219 AC_DEFUN([LC_HAVE_BI_OPF], [
1220 LB_CHECK_COMPILE([if Linux kernel has bi_opf in struct bio],
1221 have_bi_opf, [
1222         #include <linux/bio.h>
1223 ],[
1224         struct bio bio;
1225
1226         bio.bi_opf = 0;
1227 ], [
1228         AC_DEFINE(HAVE_BI_OPF, 1,
1229                 [struct bio has bi_opf])
1230 ])
1231 ]) # LC_HAVE_BI_OPF
1232
1233 #
1234 # LC_HAVE_SUBMIT_BIO_2ARGS
1235 #
1236 # 4.4 removed an argument from submit_bio
1237 #
1238 AC_DEFUN([LC_HAVE_SUBMIT_BIO_2ARGS], [
1239 LB_CHECK_COMPILE([if submit_bio takes two arguments],
1240 have_submit_bio_2args, [
1241         #include <linux/bio.h>
1242 ],[
1243         struct bio bio;
1244         submit_bio(READ, &bio);
1245 ], [
1246         AC_DEFINE(HAVE_SUBMIT_BIO_2ARGS, 1,
1247                 [submit_bio takes two arguments])
1248 ])
1249 ]) # LC_HAVE_SUBMIT_BIO_2_ARGS
1250
1251 #
1252 # LC_HAVE_CLEAN_BDEV_ALIASES
1253 #
1254 # 4.4/4.9 unmap_underlying_metadata was replaced by clean_bdev_aliases
1255 # (SLES12/kernel commit 29f3ad7d8380364c)
1256 #
1257 AC_DEFUN([LC_HAVE_CLEAN_BDEV_ALIASES], [
1258 LB_CHECK_COMPILE([if kernel has clean_bdev_aliases],
1259 have_clean_bdev_aliases, [
1260         #include <linux/buffer_head.h>
1261 ],[
1262         struct block_device bdev;
1263         clean_bdev_aliases(&bdev,1,1);
1264 ], [
1265         AC_DEFINE(HAVE_CLEAN_BDEV_ALIASES, 1,
1266                 [kernel has clean_bdev_aliases])
1267 ])
1268 ]) # LC_HAVE_CLEAN_BDEV_ALIASES
1269
1270 #
1271 # LC_HAVE_LOCKS_LOCK_FILE_WAIT
1272 #
1273 # 4.4 kernel have moved locks API users to
1274 # locks_lock_inode_wait()
1275 #
1276 AC_DEFUN([LC_HAVE_LOCKS_LOCK_FILE_WAIT], [
1277 LB_CHECK_COMPILE([if 'locks_lock_file_wait' exists],
1278 locks_lock_file_wait, [
1279         #include <linux/fs.h>
1280 ],[
1281         locks_lock_file_wait(NULL, NULL);
1282 ],[
1283         AC_DEFINE(HAVE_LOCKS_LOCK_FILE_WAIT, 1,
1284                 [kernel has locks_lock_file_wait])
1285 ])
1286 ]) # LC_HAVE_LOCKS_LOCK_FILE_WAIT
1287
1288 #
1289 # LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
1290 #
1291 # 4.4 kernel merged type-specific data with the payload data for keys
1292 #
1293 AC_DEFUN([LC_HAVE_KEY_PAYLOAD_DATA_ARRAY], [
1294 LB_CHECK_COMPILE([if 'struct key' has 'payload.data' as an array],
1295 key_payload_data_array, [
1296         #include <linux/key.h>
1297 ],[
1298         struct key key = { };
1299
1300         key.payload.data[0] = NULL;
1301 ],[
1302         AC_DEFINE(HAVE_KEY_PAYLOAD_DATA_ARRAY, 1, [payload.data is an array])
1303 ])
1304 ]) #LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
1305
1306 #
1307 # LC_HAVE_XATTR_HANDLER_NAME
1308 #
1309 # Kernel version 4.4 commit 98e9cb5711c68223f0e4d5201b9a6add255ec550
1310 # add a name member to struct xattr_handler
1311 #
1312 AC_DEFUN([LC_HAVE_XATTR_HANDLER_NAME], [
1313 tmp_flags="$EXTRA_KCFLAGS"
1314 EXTRA_KCFLAGS="-Werror"
1315 LB_CHECK_COMPILE([if 'struct xattr_handler' has a name member],
1316 xattr_handler_name, [
1317         #include <linux/xattr.h>
1318 ],[
1319         ((struct xattr_handler *)NULL)->name = NULL;
1320 ],[
1321         AC_DEFINE(HAVE_XATTR_HANDLER_NAME, 1, [xattr_handler has a name member])
1322 ])
1323 EXTRA_KCFLAGS="$tmp_flags"
1324 ]) # LC_HAVE_XATTR_HANDLER_NAME
1325
1326 #
1327 # LC_HAVE_FILE_DENTRY
1328 #
1329 # 4.5 adds wrapper file_dentry
1330 #
1331 AC_DEFUN([LC_HAVE_FILE_DENTRY], [
1332 LB_CHECK_COMPILE([if Linux kernel has 'file_dentry'],
1333 file_dentry, [
1334         #include <linux/fs.h>
1335 ],[
1336         file_dentry(NULL);
1337 ], [
1338         AC_DEFINE(HAVE_FILE_DENTRY, 1,
1339                 [kernel has file_dentry])
1340 ])
1341 ]) # LC_HAVE_FILE_DENTRY
1342
1343 #
1344 # LC_HAVE_INODE_LOCK
1345 #
1346 # 4.5 introduced inode_lock
1347 #
1348 AC_DEFUN([LC_HAVE_INODE_LOCK], [
1349 LB_CHECK_COMPILE([if 'inode_lock' is defined],
1350 inode_lock, [
1351         #include <linux/fs.h>
1352 ],[
1353         inode_lock(NULL);
1354 ], [
1355         AC_DEFINE(HAVE_INODE_LOCK, 1,
1356                   [inode_lock is defined])
1357 ])
1358 ]) # LC_HAVE_INODE_LOCK
1359
1360 #
1361 # LC_HAVE_IOP_GET_LINK
1362 #
1363 # 4.5 vfs replaced iop->follow_link with
1364 # iop->get_link
1365 #
1366 AC_DEFUN([LC_HAVE_IOP_GET_LINK], [
1367 LB_CHECK_COMPILE([if 'iop' has 'get_link'],
1368 inode_ops_get_link, [
1369         #include <linux/fs.h>
1370 ],[
1371         struct inode_operations iop;
1372         iop.get_link = NULL;
1373 ],[
1374         AC_DEFINE(HAVE_IOP_GET_LINK, 1,
1375                 [have iop get_link])
1376 ])
1377 ]) # LC_HAVE_IOP_GET_LINK
1378
1379 #
1380 # LC_HAVE_IN_COMPAT_SYSCALL
1381 #
1382 # 4.6 renamed is_compat_task to in_compat_syscall
1383 #
1384 AC_DEFUN([LC_HAVE_IN_COMPAT_SYSCALL], [
1385 LB_CHECK_COMPILE([if 'in_compat_syscall' is defined],
1386 in_compat_syscall, [
1387         #include <linux/compat.h>
1388 ],[
1389         in_compat_syscall();
1390 ],[
1391         AC_DEFINE(HAVE_IN_COMPAT_SYSCALL, 1,
1392                 [have in_compat_syscall])
1393 ])
1394 ]) # LC_HAVE_IN_COMPAT_SYSCALL
1395
1396 #
1397 # LC_HAVE_XATTR_HANDLER_INODE_PARAM
1398 #
1399 # Kernel version 4.6 commit b296821a7c42fa58baa17513b2b7b30ae66f3336
1400 # and commit 5930122683dff58f0846b0f0405b4bd598a3ba6a added inode parameter
1401 # to xattr_handler functions
1402 #
1403 AC_DEFUN([LC_HAVE_XATTR_HANDLER_INODE_PARAM], [
1404 tmp_flags="$EXTRA_KCFLAGS"
1405 EXTRA_KCFLAGS="-Werror"
1406 LB_CHECK_COMPILE([if 'struct xattr_handler' functions have inode parameter],
1407 xattr_handler_inode_param, [
1408         #include <linux/xattr.h>
1409 ],[
1410         const struct xattr_handler handler;
1411
1412         ((struct xattr_handler *)0)->get(&handler, NULL, NULL, NULL, NULL, 0);
1413         ((struct xattr_handler *)0)->set(&handler, NULL, NULL, NULL, NULL, 0, 0);
1414 ],[
1415         AC_DEFINE(HAVE_XATTR_HANDLER_INODE_PARAM, 1, [needs inode parameter])
1416 ])
1417 EXTRA_KCFLAGS="$tmp_flags"
1418 ]) # LC_HAVE_XATTR_HANDLER_INODE_PARAM
1419
1420 #
1421 # LC_D_IN_LOOKUP
1422 #
1423 # Kernel version 4.6 commit 85c7f81041d57cfe9dc97f4680d5586b54534a39
1424 # introduced parallel lookups in the VFS layer. The inline function
1425 # d_in_lookup was added to notify when the same item was being queried
1426 # at the same time.
1427 #
1428 AC_DEFUN([LC_D_IN_LOOKUP], [
1429 tmp_flags="$EXTRA_KCFLAGS"
1430 EXTRA_KCFLAGS="-Werror"
1431 LB_CHECK_COMPILE([if 'd_in_lookup' is defined],
1432 d_in_lookup, [
1433         #include <linux/dcache.h>
1434 ],[
1435         d_in_lookup(NULL);
1436 ],[
1437         AC_DEFINE(HAVE_D_IN_LOOKUP, 1, [d_in_lookup is defined])
1438 ])
1439 EXTRA_KCFLAGS="$tmp_flags"
1440 ]) # LC_D_IN_LOOKUP
1441
1442 #
1443 # LC_LOCK_PAGE_MEMCG
1444 #
1445 # Kernel version 4.6 adds lock_page_memcg
1446 #
1447 AC_DEFUN([LC_LOCK_PAGE_MEMCG], [
1448 LB_CHECK_COMPILE([if 'lock_page_memcg' is defined],
1449 lock_page_memcg, [
1450         #include <linux/memcontrol.h>
1451 ],[
1452         lock_page_memcg(NULL);
1453 ],[
1454         AC_DEFINE(HAVE_LOCK_PAGE_MEMCG, 1,
1455                 [lock_page_memcg is defined])
1456 ])
1457 ]) # LC_LOCK_PAGE_MEMCG
1458
1459 #
1460 # LC_DIRECTIO_2ARGS
1461 #
1462 # Kernel version 4.7 commit c8b8e32d700fe943a935e435ae251364d016c497
1463 # direct-io: eliminate the offset argument to ->direct_IO
1464 #
1465 AC_DEFUN([LC_DIRECTIO_2ARGS], [
1466 LB_CHECK_COMPILE([if '->direct_IO()' taken 2 arguments],
1467 direct_io_2args, [
1468         #include <linux/fs.h>
1469 ],[
1470         struct address_space_operations ops = { };
1471         struct iov_iter *iter = NULL;
1472         struct kiocb *iocb = NULL;
1473         int rc;
1474
1475         rc = ops.direct_IO(iocb, iter);
1476 ],[
1477         AC_DEFINE(HAVE_DIRECTIO_2ARGS, 1,
1478                 [direct_IO need 2 arguments])
1479 ])
1480 ]) # LC_DIRECTIO_2ARGS
1481
1482 #
1483 # LC_GENERIC_WRITE_SYNC_2ARGS
1484 #
1485 # Kernel version 4.7 commit dde0c2e79848298cc25621ad080d47f94dbd7cce
1486 # fs: add IOCB_SYNC and IOCB_DSYNC
1487 #
1488 AC_DEFUN([LC_GENERIC_WRITE_SYNC_2ARGS], [
1489 LB_CHECK_COMPILE([if 'generic_write_sync()' taken 2 arguments],
1490 generic_write_sync_2args, [
1491         #include <linux/fs.h>
1492 ],[
1493         struct kiocb *iocb = NULL;
1494         ssize_t rc;
1495
1496         rc = generic_write_sync(iocb, 0);
1497 ],[
1498         AC_DEFINE(HAVE_GENERIC_WRITE_SYNC_2ARGS, 1,
1499                 [generic_write_sync need 2 arguments])
1500 ])
1501 ]) # LC_GENERIC_WRITE_SYNC_2ARGS
1502
1503 #
1504 # LC_FOP_ITERATE_SHARED
1505 #
1506 # Kernel v4.6-rc3-29-g6192269 adds iterate_shared method to file_operations
1507 #
1508 AC_DEFUN([LC_FOP_ITERATE_SHARED], [
1509 LB_CHECK_COMPILE([if 'file_operations' has 'iterate_shared'],
1510 fop_iterate_shared, [
1511         #include <linux/fs.h>
1512 ],[
1513         struct file_operations fop;
1514         fop.iterate_shared = NULL;
1515 ],[
1516         AC_DEFINE(HAVE_FOP_ITERATE_SHARED, 1,
1517                 [file_operations has iterate_shared])
1518 ])
1519 ]) # LC_FOP_ITERATE_SHARED
1520
1521 #
1522 # LC_HAVE_POSIX_ACL_VALID_USER_NS
1523 #
1524 # 4.8 posix_acl_valid takes struct user_namespace
1525 #
1526 AC_DEFUN([LC_HAVE_POSIX_ACL_VALID_USER_NS], [
1527 LB_CHECK_COMPILE([if 'posix_acl_valid' takes 'struct user_namespace'],
1528 posix_acl_valid, [
1529         #include <linux/fs.h>
1530         #include <linux/posix_acl.h>
1531 ],[
1532         posix_acl_valid((struct user_namespace*)NULL, (const struct posix_acl*)NULL);
1533 ],[
1534         AC_DEFINE(HAVE_POSIX_ACL_VALID_USER_NS, 1,
1535                 [posix_acl_valid takes struct user_namespace])
1536 ])
1537 ]) # LC_HAVE_POSIX_ACL_VALID_USER_NS
1538
1539 #
1540 # LC_D_COMPARE_4ARGS
1541 #
1542 # Kernel version 4.8 commit 6fa67e707559303e086303aeecc9e8b91ef497d5
1543 # get rid of 'parent' argument of ->d_compare()
1544 #
1545 AC_DEFUN([LC_D_COMPARE_4ARGS], [
1546 LB_CHECK_COMPILE([if 'd_compare' taken 4 arguments],
1547 d_compare_4args, [
1548         #include <linux/dcache.h>
1549 ],[
1550         ((struct dentry_operations*)0)->d_compare(NULL,0,NULL,NULL);
1551 ],[
1552         AC_DEFINE(HAVE_D_COMPARE_4ARGS, 1,
1553                 [d_compare need 4 arguments])
1554 ])
1555 ]) # LC_D_COMPARE_4ARGS
1556
1557 #
1558 # LC_FULL_NAME_HASH_3ARGS
1559 #
1560 # Kernel version 4.8 commit 8387ff2577eb9ed245df9a39947f66976c6bcd02
1561 # vfs: make the string hashes salt the hash
1562 #
1563 AC_DEFUN([LC_FULL_NAME_HASH_3ARGS], [
1564 LB_CHECK_COMPILE([if 'full_name_hash' taken 3 arguments],
1565 full_name_hash_3args, [
1566         #include <linux/stringhash.h>
1567 ],[
1568         unsigned int hash;
1569         hash = full_name_hash(NULL,NULL,0);
1570 ],[
1571         AC_DEFINE(HAVE_FULL_NAME_HASH_3ARGS, 1,
1572                 [full_name_hash need 3 arguments])
1573 ])
1574 ]) # LC_FULL_NAME_HASH_3ARGS
1575
1576 #
1577 # LC_STRUCT_POSIX_ACL_XATTR
1578 #
1579 # Kernel version 4.8 commit 2211d5ba5c6c4e972ba6dbc912b2897425ea6621
1580 # posix_acl: xattr representation cleanups
1581 #
1582 AC_DEFUN([LC_STRUCT_POSIX_ACL_XATTR], [
1583 LB_CHECK_COMPILE([if 'struct posix_acl_xattr_{header,entry}' defined],
1584 struct_posix_acl_xattr, [
1585         #include <linux/fs.h>
1586         #include <linux/posix_acl_xattr.h>
1587 ],[
1588         struct posix_acl_xattr_header *h = NULL;
1589         struct posix_acl_xattr_entry  *e;
1590         e = (void *)(h + 1);
1591 ],[
1592         AC_DEFINE(HAVE_STRUCT_POSIX_ACL_XATTR, 1,
1593                 [struct posix_acl_xattr_{header,entry} defined])
1594 ])
1595 ]) # LC_STRUCT_POSIX_ACL_XATTR
1596
1597 #
1598 # LC_IOP_XATTR
1599 #
1600 # Kernel version 4.8 commit fd50ecaddf8372a1d96e0daeaac0f93cf04e4d42
1601 # removed {get,set,remove}xattr inode operations
1602 #
1603 AC_DEFUN([LC_IOP_XATTR], [
1604 LB_CHECK_COMPILE([if 'inode_operations' has {get,set,remove}xattr members],
1605 inode_ops_xattr, [
1606         #include <linux/fs.h>
1607 ],[
1608         struct inode_operations iop;
1609         iop.setxattr = NULL;
1610         iop.getxattr = NULL;
1611         iop.removexattr = NULL;
1612 ],[
1613         AC_DEFINE(HAVE_IOP_XATTR, 1,
1614                 [inode_operations has {get,set,remove}xattr members])
1615 ])
1616 ]) # LC_IOP_XATTR
1617
1618 #
1619 # LC_GROUP_INFO_GID
1620 #
1621 # Kernel version 4.9 commit 81243eacfa400f5f7b89f4c2323d0de9982bb0fb
1622 # cred: simpler, 1D supplementary groups
1623 #
1624 AC_DEFUN([LC_GROUP_INFO_GID], [
1625 LB_CHECK_COMPILE([if 'struct group_info' has member 'gid'],
1626 group_info_gid, [
1627         #include <linux/cred.h>
1628 ],[
1629         kgid_t *p;
1630         p = ((struct group_info *)0)->gid;
1631 ],[
1632         AC_DEFINE(HAVE_GROUP_INFO_GID, 1,
1633                 [struct group_info has member gid])
1634 ])
1635 ]) # LC_GROUP_INFO_GID
1636
1637 #
1638 # LC_VFS_SETXATTR
1639 #
1640 # Kernel version 4.9 commit 5d6c31910bc0713e37628dc0ce677dcb13c8ccf4
1641 # added __vfs_{get,set,remove}xattr helpers
1642 #
1643 AC_DEFUN([LC_VFS_SETXATTR], [
1644 LB_CHECK_COMPILE([if '__vfs_setxattr' helper is available],
1645 vfs_setxattr, [
1646         #include <linux/xattr.h>
1647 ],[
1648         __vfs_setxattr(NULL, NULL, NULL, NULL, 0, 0);
1649 ],[
1650         AC_DEFINE(HAVE_VFS_SETXATTR, 1,
1651                 ['__vfs_setxattr is available])
1652 ])
1653 ]) # LC_VFS_SETXATTR
1654
1655 #
1656 # LC_POSIX_ACL_UPDATE_MODE
1657 #
1658 # Kernel version 4.9 commit 073931017b49d9458aa351605b43a7e34598caef
1659 # posix_acl: Clear SGID bit when setting file permissions
1660 #
1661 AC_DEFUN([LC_POSIX_ACL_UPDATE_MODE], [
1662 LB_CHECK_COMPILE([if 'posix_acl_update_mode' exists],
1663 posix_acl_update_mode, [
1664         #include <linux/fs.h>
1665         #include <linux/posix_acl.h>
1666 ],[
1667         posix_acl_update_mode(NULL, NULL, NULL);
1668 ],[
1669         AC_DEFINE(HAVE_POSIX_ACL_UPDATE_MODE, 1,
1670                 ['posix_acl_update_mode' is available])
1671 ])
1672 ]) # LC_POSIX_ACL_UPDATE_MODE
1673
1674 #
1675 # LC_IOP_GENERIC_READLINK
1676 #
1677 # Kernel version 4.10 commit dfeef68862edd7d4bafe68ef7aeb5f658ef24bb5
1678 # removed generic_readlink from individual file systems
1679 #
1680 AC_DEFUN([LC_IOP_GENERIC_READLINK], [
1681 LB_CHECK_COMPILE([if 'generic_readlink' still exist],
1682 inode_ops_readlink, [
1683         #include <linux/fs.h>
1684 ],[
1685         struct inode_operations iop;
1686         iop.readlink = generic_readlink;
1687 ],[
1688         AC_DEFINE(HAVE_IOP_GENERIC_READLINK, 1,
1689                 [generic_readlink has been removed])
1690 ])
1691 ]) # LC_IOP_GENERIC_READLINK
1692
1693 #
1694 # LC_HAVE_VM_FAULT_ADDRESS
1695 #
1696 # Kernel version 4.10 commit 1a29d85eb0f19b7d8271923d8917d7b4f5540b3e
1697 # removed virtual_address field. Need to use address field instead
1698 #
1699 AC_DEFUN([LC_HAVE_VM_FAULT_ADDRESS], [
1700 LB_CHECK_COMPILE([if 'struct vm_fault' replaced virtual_address with address field],
1701 vm_fault_address, [
1702         #include <linux/mm.h>
1703 ],[
1704         struct vm_fault vmf;
1705         vmf.address = NULL;
1706 ],[
1707         AC_DEFINE(HAVE_VM_FAULT_ADDRESS, 1,
1708                 [virtual_address has been replaced by address field])
1709 ])
1710 ]) # LC_HAVE_VM_FAULT_ADDRESS
1711
1712 #
1713 # LC_INODEOPS_ENHANCED_GETATTR
1714 #
1715 # Kernel version 4.11 commit a528d35e8bfcc521d7cb70aaf03e1bd296c8493f
1716 # expanded getattr to be able to get more stat information.
1717 #
1718 AC_DEFUN([LC_INODEOPS_ENHANCED_GETATTR], [
1719 LB_CHECK_COMPILE([if 'inode_operations' getattr member can gather advance stats],
1720 getattr_path, [
1721         #include <linux/fs.h>
1722 ],[
1723         struct path path;
1724
1725         ((struct inode_operations *)1)->getattr(&path, NULL, 0, 0);
1726 ],[
1727         AC_DEFINE(HAVE_INODEOPS_ENHANCED_GETATTR, 1,
1728                 [inode_operations .getattr member function can gather advance stats])
1729 ])
1730 ]) # LC_INODEOPS_ENHANCED_GETATTR
1731
1732 #
1733 # LC_VM_OPERATIONS_REMOVE_VMF_ARG
1734 #
1735 # Kernel version 4.11 commit 11bac80004499ea59f361ef2a5516c84b6eab675
1736 # removed struct vm_area_struct as an argument for vm_operations since
1737 # in the same kernel version struct vma_area_struct was folded into
1738 # struct vm_fault.
1739 #
1740 AC_DEFUN([LC_VM_OPERATIONS_REMOVE_VMF_ARG], [
1741 LB_CHECK_COMPILE([if 'struct vm_operations' removed struct vm_area_struct],
1742 vm_operations_no_vm_area_struct, [
1743         #include <linux/mm.h>
1744 ],[
1745         struct vm_fault vmf;
1746
1747         ((struct vm_operations_struct *)0)->fault(&vmf);
1748         ((struct vm_operations_struct *)0)->page_mkwrite(&vmf);
1749 ],[
1750         AC_DEFINE(HAVE_VM_OPS_USE_VM_FAULT_ONLY, 1,
1751                 ['struct vm_operations' remove struct vm_area_struct argument])
1752 ])
1753 ]) # LC_VM_OPERATIONS_REMOVE_VMF_ARG
1754
1755 #
1756 # LC_HAVE_KEY_USAGE_REFCOUNT
1757 #
1758 # Kernel version 4.11 commit fff292914d3a2f1efd05ca71c2ba72a3c663201e
1759 # converted key.usage from atomic_t to refcount_t.
1760 #
1761 AC_DEFUN([LC_HAVE_KEY_USAGE_REFCOUNT], [
1762 LB_CHECK_COMPILE([if 'key.usage' is refcount_t],
1763 key_usage_refcount, [
1764         #include <linux/key.h>
1765 ],[
1766         struct key key = { };
1767
1768         refcount_read(&key.usage);
1769 ],[
1770         AC_DEFINE(HAVE_KEY_USAGE_REFCOUNT, 1, [key.usage is of type refcount_t])
1771 ])
1772 ]) #LC_HAVE_KEY_USAGE_REFCOUNT
1773
1774 #
1775 # LC_HAVE_CRYPTO_MAX_ALG_NAME_128
1776 #
1777 # Kernel version 4.11 commit f437a3f477cce402dbec6537b29e9e33962c9f73
1778 # switched CRYPTO_MAX_ALG_NAME from 64 to 128.
1779 #
1780 AC_DEFUN([LC_HAVE_CRYPTO_MAX_ALG_NAME_128], [
1781 LB_CHECK_COMPILE([if 'CRYPTO_MAX_ALG_NAME' is 128],
1782 crypto_max_alg_name, [
1783         #include <linux/crypto.h>
1784 ],[
1785         #if CRYPTO_MAX_ALG_NAME != 128
1786         exit(1);
1787         #endif
1788 ],[
1789         AC_DEFINE(HAVE_CRYPTO_MAX_ALG_NAME_128, 1,
1790                 ['CRYPTO_MAX_ALG_NAME' is 128])
1791 ])
1792 ]) # LC_HAVE_CRYPTO_MAX_ALG_NAME_128
1793
1794 #
1795 # Kernel version 4.12 commit 47f38c539e9a42344ff5a664942075bd4df93876
1796 # CURRENT_TIME is not 64 bit time safe so it was replaced with
1797 # current_time()
1798 #
1799 AC_DEFUN([LC_CURRENT_TIME], [
1800 LB_CHECK_COMPILE([if CURRENT_TIME has been replaced with current_time],
1801 current_time, [
1802         #include <linux/fs.h>
1803 ],[
1804         struct iattr attr;
1805
1806         attr.ia_atime = current_time(NULL);
1807 ],[
1808         AC_DEFINE(HAVE_CURRENT_TIME, 1,
1809                 [current_time() has replaced CURRENT_TIME])
1810 ])
1811 ]) # LIBCFS_CURRENT_TIME
1812
1813 #
1814 # Kernel version 4.12-rc3 85787090a21eb749d8b347eaf9ff1a455637473c
1815 # changed struct super_block s_uuid into a proper uuid_t
1816 #
1817 AC_DEFUN([LC_SUPER_BLOCK_S_UUID], [
1818 LB_CHECK_COMPILE([if 'struct super_block' s_uuid is uuid_t],
1819 super_block_s_uuid, [
1820         #include <linux/fs.h>
1821 ],[
1822         struct super_block sb;
1823
1824         uuid_parse(NULL, &sb.s_uuid);
1825 ],[
1826         AC_DEFINE(HAVE_S_UUID_AS_UUID_T, 1, ['s_uuid' is an uuid_t])
1827 ])
1828 ]) # LC_SUPER_BLOCK_S_UUID
1829
1830 #
1831 # LC_SUPER_SETUP_BDI_NAME
1832 #
1833 # Kernel version 4.12 commit 9594caf216dc0fe3e318b34af0127276db661241
1834 # unified bdi handling
1835 #
1836 AC_DEFUN([LC_SUPER_SETUP_BDI_NAME], [
1837 LB_CHECK_COMPILE([if 'super_setup_bdi_name' exist],
1838 super_setup_bdi_name, [
1839         #include <linux/fs.h>
1840 ],[
1841         super_setup_bdi_name(NULL, "lustre");
1842 ],[
1843         AC_DEFINE(HAVE_SUPER_SETUP_BDI_NAME, 1,
1844                 ['super_setup_bdi_name' is available])
1845 ])
1846 ]) # LC_SUPER_SETUP_BDI_NAME
1847
1848 #
1849 # LC_BI_STATUS
1850 #
1851 # 4.12 replace bi_error to bi_status
1852 #
1853 AC_DEFUN([LC_BI_STATUS], [
1854 LB_CHECK_COMPILE([if 'bi_status' exist],
1855 bi_status, [
1856         #include <linux/blk_types.h>
1857 ],[
1858         ((struct bio *)0)->bi_status = 0;
1859 ],[
1860         AC_DEFINE(HAVE_BI_STATUS, 1,
1861                 ['bi_status' is available])
1862 ])
1863 ]) # LC_BI_STATUS
1864
1865 #
1866 # LC_BIO_INTEGRITY_ENABLED
1867 #
1868 # 4.13 removed bio_integrity_enabled
1869 #
1870 AC_DEFUN([LC_BIO_INTEGRITY_ENABLED], [
1871 LB_CHECK_COMPILE([if 'bio_integrity_enabled' exist],
1872 bio_integrity_enabled, [
1873         #include <linux/bio.h>
1874 ],[
1875         bio_integrity_enabled(NULL);
1876 ],[
1877         AC_DEFINE(HAVE_BIO_INTEGRITY_ENABLED, 1,
1878                 ['bio_integrity_enabled' is available])
1879 ])
1880 ]) # LC_BIO_INTEGRITY_ENABLED
1881
1882 #
1883 # LC_PAGEVEC_INIT_ONE_PARAM
1884 #
1885 # 4.14 pagevec_init takes one parameter
1886 #
1887 AC_DEFUN([LC_PAGEVEC_INIT_ONE_PARAM], [
1888 LB_CHECK_COMPILE([if 'pagevec_init' takes one parameter],
1889 pagevec_init, [
1890         #include <linux/pagevec.h>
1891 ],[
1892         pagevec_init(NULL);
1893 ],[
1894         AC_DEFINE(HAVE_PAGEVEC_INIT_ONE_PARAM, 1,
1895                 ['pagevec_init' takes one parameter])
1896 ])
1897 ]) # LC_PAGEVEC_INIT_ONE_PARAM
1898
1899 #
1900 # LC_BI_BDEV
1901 #
1902 # 4.14 replaced bi_bdev to bi_disk
1903 #
1904 AC_DEFUN([LC_BI_BDEV], [
1905 LB_CHECK_COMPILE([if 'bi_bdev' exist],
1906 bi_bdev, [
1907         #include <linux/bio.h>
1908 ],[
1909         ((struct bio *)0)->bi_bdev = NULL;
1910 ],[
1911         AC_DEFINE(HAVE_BI_BDEV, 1,
1912                 ['bi_bdev' is available])
1913 ])
1914 ]) # LC_BI_BDEV
1915
1916 #
1917 # LC_I_PAGES
1918 #
1919 # kernel 4.17 commit b93b016313b3ba8003c3b8bb71f569af91f19fc7
1920 #
1921 AC_DEFUN([LC_I_PAGES], [
1922 LB_CHECK_COMPILE([if struct address_space has i_pages],
1923 i_pages, [
1924         #include <linux/fs.h>
1925 ],[
1926         struct address_space mapping = {};
1927         void *i_pages;
1928
1929         i_pages = &mapping.i_pages;
1930 ],[
1931         AC_DEFINE(HAVE_I_PAGES, 1,
1932                 [struct address_space has i_pages])
1933 ])
1934 ]) # LC_I_PAGES
1935
1936 #
1937 # LC_VM_FAULT_T
1938 #
1939 # kernel 4.17 commit 3d3539018d2cbd12e5af4a132636ee7fd8d43ef0
1940 # mm: create the new vm_fault_t type
1941 #
1942 AC_DEFUN([LC_VM_FAULT_T], [
1943 LB_CHECK_COMPILE([if vm_fault_t type exists],
1944 vm_fault_t, [
1945         #include <linux/mm_types.h>
1946 ],[
1947         vm_fault_t x = VM_FAULT_SIGBUS;
1948         (void)x
1949 ],[
1950         AC_DEFINE(HAVE_VM_FAULT_T, 1,
1951                 [if vm_fault_t type exists])
1952 ])
1953 ]) # LC_VM_FAULT_T
1954
1955 #
1956 # LC_INODE_TIMESPEC64
1957 #
1958 # kernel 4.17-rc7 commit 8efd6894ff089adeeac7cb9f32125b85d963d1bc
1959 # fs: add timespec64_truncate()
1960 # kernel 4.18 commit 95582b00838837fc07e042979320caf917ce3fe6
1961 # inode timestamps switched to timespec64
1962 # kernel 4.19-rc2 commit 976516404ff3fab2a8caa8bd6f5efc1437fed0b8
1963 # y2038: remove unused time interfaces
1964 # ...
1965 #  timespec_trunc
1966 # ...
1967 # When inode times are timespec64 stop using the deprecated
1968 # time interfaces.
1969 #
1970 AC_DEFUN([LC_INODE_TIMESPEC64], [
1971 tmp_flags="$EXTRA_KCFLAGS"
1972 EXTRA_KCFLAGS="-Werror"
1973 LB_CHECK_COMPILE([if inode timestamps are struct timespec64],
1974 inode_timespec64, [
1975         #include <linux/fs.h>
1976 ],[
1977         struct inode *inode = NULL;
1978         struct timespec64 ts = {};
1979
1980         inode->i_atime = timespec64_trunc(ts, 1);
1981         (void)inode;
1982 ],[
1983         AC_DEFINE(HAVE_INODE_TIMESPEC64, 1,
1984                 [inode times are using timespec64])
1985 ])
1986 EXTRA_KCFLAGS="$tmp_flags"
1987 ]) # LC_INODE_TIMESPEC64
1988
1989 #
1990 # LC_XA_IS_VALUE
1991 # kernel 4.19-rc6 commit 3159f943aafdbacb2f94c38fdaadabf2bbde2a14
1992 # xarray: Replace exceptional entries
1993 # adds xa_is_value
1994 #
1995 AC_DEFUN([LC_XA_IS_VALUE], [
1996 LB_CHECK_COMPILE([xa_is_value exist],
1997 xa_is_value, [
1998         #include <linux/xarray.h>
1999 ],[
2000         xa_is_value(NULL);
2001 ],[
2002         AC_DEFINE(HAVE_XA_IS_VALUE, 1, [xa_is_value exist])
2003 ])
2004 ]) # LC_XA_IS_VALUE
2005
2006 #
2007 # LC___XA_SET_MARK
2008 #
2009 # kernel 4.20 commit v4.19-rc5-248-g9b89a0355144
2010 # xarray: Add XArray marks
2011 #
2012 AC_DEFUN([LC___XA_SET_MARK], [
2013 LB_CHECK_COMPILE([if '__xa_set_mark' exists],
2014 __xa_set_mark, [
2015         #include <linux/xarray.h>
2016         #include <linux/fs.h>
2017 ],[
2018         struct xarray *xa = NULL;
2019
2020         __xa_set_mark(xa, 0, PAGECACHE_TAG_DIRTY);
2021 ],[
2022         AC_DEFINE(HAVE___XA_SET_MARK, 1,
2023                 [__xa_set_mark exists])
2024 ])
2025 ]) # LC___XA_SET_MARK
2026
2027 #
2028 # LC_UAPI_LINUX_MOUNT_H
2029 #
2030 # kernel 4.20 commit e262e32d6bde0f77fb0c95d977482fc872c51996
2031 # vfs: Suppress MS_* flag defs within the kernel ...
2032 #
2033 AC_DEFUN([LC_UAPI_LINUX_MOUNT_H], [
2034 tmp_flags="$EXTRA_KCFLAGS"
2035 EXTRA_KCFLAGS="-Werror"
2036 LB_CHECK_COMPILE([if MS_RDONLY was moved to uapi/linux/mount.h],
2037 uapi_linux_mount, [
2038         #include <uapi/linux/mount.h>
2039 ],[
2040         int x = MS_RDONLY;
2041         (void)x;
2042 ],[
2043         AC_DEFINE(HAVE_UAPI_LINUX_MOUNT_H, 1,
2044                 [if MS_RDONLY was moved to uapi/linux/mount.h])
2045 ])
2046 EXTRA_KCFLAGS="$tmp_flags"
2047 ]) # LC_UAPI_LINUX_MOUNT_H
2048
2049 #
2050 # LC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK
2051 #
2052 # kernel 4.20 commit 1863d77f15da0addcd293a1719fa5d3ef8cde3ca
2053 # SUNRPC: Replace the cache_detail->hash_lock with a regular spinlock
2054 #
2055 # Now that the reader functions are all RCU protected, use a regular
2056 # spinlock rather than a reader/writer lock.
2057 #
2058 AC_DEFUN([LC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK], [
2059 tmp_flags="$EXTRA_KCFLAGS"
2060 EXTRA_KCFLAGS="-Werror"
2061 LB_CHECK_COMPILE([if cache_detail->hash_lock is a spinlock],
2062 hash_lock_isa_spinlock_t, [
2063         #include <linux/sunrpc/cache.h>
2064 ],[
2065         spinlock_t *lock = &(((struct cache_detail *)0)->hash_lock);
2066         spin_lock(lock);
2067 ],[
2068         AC_DEFINE(HAVE_CACHE_HASH_SPINLOCK, 1,
2069                 [if cache_detail->hash_lock is a spinlock])
2070 ])
2071 EXTRA_KCFLAGS="$tmp_flags"
2072 ]) # LC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK
2073
2074 #
2075 # LC_HAS_LINUX_SELINUX_ENABLED
2076 #
2077 # kernel 5.1 commit 3d252529480c68bfd6a6774652df7c8968b28e41
2078 # SELinux: Remove unused selinux_is_enabled
2079 #
2080 AC_DEFUN([LC_HAS_LINUX_SELINUX_ENABLED], [
2081 tmp_flags="$EXTRA_KCFLAGS"
2082 EXTRA_KCFLAGS="-Werror"
2083 LB_CHECK_COMPILE([if linux/selinux.h exists],
2084 selinux_is_enabled, [
2085         #include <linux/selinux.h>
2086 ],[
2087         bool has_selinux = selinux_is_enabled();
2088         (void)has_selinux;
2089 ],[
2090         AC_DEFINE(HAVE_LINUX_SELINUX_IS_ENABLED, 1,
2091                 [if linux/selinux.h exists])
2092 ])
2093 EXTRA_KCFLAGS="$tmp_flags"
2094 ]) # LC_HAS_LINUX_SELINUX_ENABLED
2095
2096 #
2097 # LC_ACCOUNT_PAGE_DIRTIED
2098 #
2099 # After 5.2 kernel page dirtied is not exported
2100 #
2101 AC_DEFUN([LC_ACCOUNT_PAGE_DIRTIED], [
2102 LB_CHECK_EXPORT([account_page_dirtied], [mm/page-writeback.c],
2103         [AC_DEFINE(HAVE_ACCOUNT_PAGE_DIRTIED_EXPORT, 1,
2104                         [account_page_dirtied is exported])])
2105 ]) # LC_ACCOUNT_PAGE_DIRTIED
2106
2107 #
2108 # LC_BIO_BI_PHYS_SEGMENTS
2109 #
2110 # kernel 5.3-rc1 commit 14ccb66b3f585b2bc21e7256c96090abed5a512c
2111 # block: remove the bi_phys_segments field in struct bio
2112 #
2113 AC_DEFUN([LC_BIO_BI_PHYS_SEGMENTS], [
2114 tmp_flags="$EXTRA_KCFLAGS"
2115 EXTRA_KCFLAGS="-Werror"
2116 LB_CHECK_COMPILE([if struct bio has bi_phys_segments member],
2117 bye_bio_bi_phys_segments, [
2118         #include <linux/bio.h>
2119 ],[
2120         struct bio *bio = NULL;
2121         bio->bi_phys_segments++;
2122 ],[
2123         AC_DEFINE(HAVE_BIO_BI_PHYS_SEGMENTS, 1,
2124                 [struct bio has bi_phys_segments member])
2125 ])
2126 EXTRA_KCFLAGS="$tmp_flags"
2127 ]) # LC_BIO_BI_PHYS_SEGMENTS
2128
2129 #
2130 # LC_LM_COMPARE_OWNER_EXISTS
2131 #
2132 # kernel 5.3-rc3 commit f85d93385e9fe6886a751f647f6812a89bf6bee3
2133 # locks: Cleanup lm_compare_owner and lm_owner_key
2134 # removed lm_compare_owner
2135 #
2136 AC_DEFUN([LC_LM_COMPARE_OWNER_EXISTS], [
2137 tmp_flags="$EXTRA_KCFLAGS"
2138 EXTRA_KCFLAGS="-Werror"
2139 LB_CHECK_COMPILE([if lock_manager_operations has lm_compare_owner],
2140 lock_manager_ops_lm_compare_owner, [
2141         #include <linux/fs.h>
2142 ],[
2143         struct lock_manager_operations lm_ops;
2144         lm_ops.lm_compare_owner = NULL;
2145 ],[
2146         AC_DEFINE(HAVE_LM_COMPARE_OWNER, 1,
2147                 [lock_manager_operations has lm_compare_owner])
2148 ])
2149 EXTRA_KCFLAGS="$tmp_flags"
2150 ]) # LC_LM_COMPARE_OWNER_EXISTS
2151
2152 #
2153 # LC_PROG_LINUX
2154 #
2155 # Lustre linux kernel checks
2156 #
2157 AC_DEFUN([LC_PROG_LINUX], [
2158         AC_MSG_NOTICE([Lustre kernel checks
2159 ==============================================================================])
2160
2161         LC_CONFIG_PINGER
2162         LC_CONFIG_CHECKSUM
2163         LC_CONFIG_FLOCK
2164         LC_CONFIG_HEALTH_CHECK_WRITE
2165         LC_CONFIG_LRU_RESIZE
2166         LC_CONFIG_FHANDLE
2167         LC_CONFIG_GSS
2168
2169         LC_GLIBC_SUPPORT_FHANDLES
2170         LC_OPENSSL_SSK
2171         LC_OPENSSL_GETSEPOL
2172
2173         # 3.10
2174         LC_HAVE_PROJECT_QUOTA
2175
2176         # 3.11
2177         LC_INVALIDATE_RANGE
2178         LC_HAVE_DIR_CONTEXT
2179         LC_D_COMPARE_5ARGS
2180         LC_HAVE_DCOUNT
2181         LC_HAVE_DENTRY_D_U_D_ALIAS
2182         LC_HAVE_DENTRY_D_CHILD
2183         LC_PID_NS_FOR_CHILDREN
2184
2185         # 3.12
2186         LC_OLDSIZE_TRUNCATE_PAGECACHE
2187         LC_PTR_ERR_OR_ZERO_MISSING
2188         LC_KIOCB_KI_LEFT
2189
2190         # 3.13
2191         LC_VFS_RENAME_5ARGS
2192         LC_VFS_UNLINK_3ARGS
2193         LC_HAVE_D_IS_POSITIVE
2194
2195         # 3.14
2196         LC_HAVE_BVEC_ITER
2197         LC_HAVE_TRUNCATE_IPAGES_FINAL
2198         LC_IOPS_RENAME_WITH_FLAGS
2199         LC_IOP_SET_ACL
2200
2201         # 3.15
2202         LC_VFS_RENAME_6ARGS
2203
2204         # 3.16
2205         LC_DIRECTIO_USE_ITER
2206         LC_HAVE_IOV_ITER_INIT_DIRECTION
2207         LC_HAVE_IOV_ITER_TRUNCATE
2208         LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER
2209
2210         # 3.17
2211         LC_HAVE_INTERVAL_BLK_INTEGRITY
2212         LC_KEY_MATCH_DATA
2213
2214         # 3.18
2215         LC_PERCPU_COUNTER_INIT
2216         LC_NFS_FILLDIR_USE_CTX
2217
2218         # 3.19
2219         LC_KIOCB_HAS_NBYTES
2220         LC_HAVE_DQUOT_QC_DQBLK
2221         LC_HAVE_AIO_COMPLETE
2222
2223         # 3.20
2224         LC_BACKING_DEV_INFO_REMOVAL
2225         LC_HAVE_BDI_CAP_MAP_COPY
2226
2227         # 4.1.0
2228         LC_IOV_ITER_RW
2229         LC_HAVE_SYNC_READ_WRITE
2230         LC_HAVE___BI_CNT
2231
2232         # 4.2
2233         LC_BIO_ENDIO_USES_ONE_ARG
2234         LC_SYMLINK_OPS_USE_NAMEIDATA
2235         LC_ACCOUNT_PAGE_DIRTIED_3ARGS
2236
2237         # 4.3
2238         LC_HAVE_INTERVAL_EXP_BLK_INTEGRITY
2239         LC_HAVE_BIP_ITER_BIO_INTEGRITY_PAYLOAD
2240         LC_HAVE_CACHE_HEAD_HLIST
2241         LC_HAVE_XATTR_HANDLER_SIMPLIFIED
2242
2243         # 4.4
2244         LC_HAVE_LOCKS_LOCK_FILE_WAIT
2245         LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
2246         LC_HAVE_XATTR_HANDLER_NAME
2247         LC_HAVE_BI_OPF
2248         LC_HAVE_SUBMIT_BIO_2ARGS
2249         LC_HAVE_CLEAN_BDEV_ALIASES
2250
2251         # 4.5
2252         LC_HAVE_FILE_DENTRY
2253
2254         # 4.5
2255         LC_HAVE_INODE_LOCK
2256         LC_HAVE_IOP_GET_LINK
2257
2258         # 4.6
2259         LC_HAVE_IN_COMPAT_SYSCALL
2260         LC_HAVE_XATTR_HANDLER_INODE_PARAM
2261         LC_LOCK_PAGE_MEMCG
2262
2263         # 4.7
2264         LC_D_IN_LOOKUP
2265         LC_DIRECTIO_2ARGS
2266         LC_GENERIC_WRITE_SYNC_2ARGS
2267         LC_FOP_ITERATE_SHARED
2268
2269         # 4.8
2270         LC_HAVE_POSIX_ACL_VALID_USER_NS
2271         LC_D_COMPARE_4ARGS
2272         LC_FULL_NAME_HASH_3ARGS
2273         LC_STRUCT_POSIX_ACL_XATTR
2274         LC_IOP_XATTR
2275
2276         # 4.9
2277         LC_GROUP_INFO_GID
2278         LC_VFS_SETXATTR
2279         LC_POSIX_ACL_UPDATE_MODE
2280
2281         # 4.10
2282         LC_IOP_GENERIC_READLINK
2283         LC_HAVE_VM_FAULT_ADDRESS
2284
2285         # 4.11
2286         LC_INODEOPS_ENHANCED_GETATTR
2287         LC_VM_OPERATIONS_REMOVE_VMF_ARG
2288         LC_HAVE_KEY_USAGE_REFCOUNT
2289         LC_HAVE_CRYPTO_MAX_ALG_NAME_128
2290
2291         # 4.12
2292         LC_CURRENT_TIME
2293         LC_SUPER_BLOCK_S_UUID
2294         LC_SUPER_SETUP_BDI_NAME
2295         LC_BI_STATUS
2296
2297         # 4.13
2298         LC_BIO_INTEGRITY_ENABLED
2299
2300         # 4.14
2301         LC_PAGEVEC_INIT_ONE_PARAM
2302         LC_BI_BDEV
2303
2304         # 4.17
2305         LC_VM_FAULT_T
2306         LC_I_PAGES
2307
2308         # 4.18
2309         LC_INODE_TIMESPEC64
2310         LC_XA_IS_VALUE
2311
2312         # 4.20
2313         LC___XA_SET_MARK
2314         LC_UAPI_LINUX_MOUNT_H
2315         LC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK
2316         LC_REPLACE_EXCEPTIONAL_ENTRIES
2317
2318         # 5.1
2319         LC_HAS_LINUX_SELINUX_ENABLED
2320
2321         # 5.2
2322         LC_ACCOUNT_PAGE_DIRTIED
2323
2324         # 5.3
2325         LC_BIO_BI_PHYS_SEGMENTS
2326         LC_LM_COMPARE_OWNER_EXISTS
2327
2328         # kernel patch to extend integrity interface
2329         LC_BIO_INTEGRITY_PREP_FN
2330
2331         #
2332         AS_IF([test "x$enable_server" != xno], [
2333                 LC_STACK_SIZE
2334                 LC_QUOTA_CONFIG
2335         ])
2336         LC_POSIX_ACL_CONFIG
2337 ]) # LC_PROG_LINUX
2338
2339 #
2340 # LC_CONFIG_CLIENT
2341 #
2342 # Check whether to build the client side of Lustre
2343 #
2344 AC_DEFUN([LC_CONFIG_CLIENT], [
2345 AC_MSG_CHECKING([whether to build Lustre client support])
2346 AC_ARG_ENABLE([client],
2347         AC_HELP_STRING([--disable-client],
2348                 [disable Lustre client support]),
2349         [], [enable_client="yes"])
2350 AC_MSG_RESULT([$enable_client])
2351 ]) # LC_CONFIG_CLIENT
2352
2353 #
2354 # --enable-mpitests
2355 #
2356 AC_DEFUN([LB_CONFIG_MPITESTS], [
2357 AC_ARG_ENABLE([mpitests],
2358         AC_HELP_STRING([--enable-mpitests=<yes|no|mpicc wrapper>],
2359                        [include mpi tests]), [
2360                 enable_mpitests="yes"
2361                 case $enableval in
2362                 yes)
2363                         MPICC_WRAPPER="mpicc"
2364                         MPI_BIN=$(eval which $MPICC_WRAPPER | xargs dirname)
2365                         ;;
2366                 no)
2367                         enable_mpitests="no"
2368                         MPI_BIN=""
2369                         ;;
2370                 *)
2371                         MPICC_WRAPPER=$enableval
2372                         MPI_BIN=$(eval echo $MPICC_WRAPPER | xargs dirname)
2373                         ;;
2374                 esac
2375         ], [
2376                 enable_mpitests="yes"
2377                 MPICC_WRAPPER="mpicc"
2378                 MPI_BIN=$(eval which $MPICC_WRAPPER | xargs dirname)
2379         ])
2380
2381         if test "x$enable_mpitests" != "xno"; then
2382                 oldcc=$CC
2383                 CC=$MPICC_WRAPPER
2384                 AC_CACHE_CHECK([whether mpitests can be built],
2385                 lb_cv_mpi_tests, [AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2386                         #include <mpi.h>
2387                         int main(void) {
2388                                 int flag;
2389                                 MPI_Initialized(&flag);
2390                                 return 0;
2391                         }
2392                 ])], [lb_cv_mpi_tests="yes"], [lb_cv_mpi_tests="no"])
2393                 ])
2394                 enable_mpitests=$lb_cv_mpi_tests
2395                 CC=$oldcc
2396         fi
2397         AC_SUBST(MPI_BIN)
2398         AC_SUBST(MPICC_WRAPPER)
2399 ]) # LB_CONFIG_MPITESTS
2400
2401 #
2402 # LC_CONFIG_QUOTA
2403 #
2404 # whether to enable quota support global control
2405 #
2406 AC_DEFUN([LC_CONFIG_QUOTA], [
2407 AC_MSG_CHECKING([whether to enable quota support global control])
2408 AC_ARG_ENABLE([quota],
2409         AC_HELP_STRING([--enable-quota],
2410                 [enable quota support]),
2411         [], [enable_quota="yes"])
2412 AS_IF([test "x$enable_quota" = xyes],
2413         [AC_MSG_RESULT([yes])],
2414         [AC_MSG_RESULT([no])])
2415 ]) # LC_CONFIG_QUOTA
2416
2417 #
2418 # LC_QUOTA
2419 #
2420 AC_DEFUN([LC_QUOTA], [
2421 #check global
2422 LC_CONFIG_QUOTA
2423 #check for utils
2424 AS_IF([test "x$enable_quota" != xno -a "x$enable_utils" != xno], [
2425         AC_CHECK_HEADER([sys/quota.h],
2426                 [AC_DEFINE(HAVE_SYS_QUOTA_H, 1,
2427                         [Define to 1 if you have <sys/quota.h>.])],
2428                 [AC_MSG_ERROR([don't find <sys/quota.h> in your system])])
2429 ])
2430 ]) # LC_QUOTA
2431
2432 #
2433 # LC_OSD_ADDON
2434 #
2435 # configure support for optional OSD implementation
2436 #
2437 AC_DEFUN([LC_OSD_ADDON], [
2438 AC_MSG_CHECKING([whether to use OSD addon])
2439 AC_ARG_WITH([osd],
2440         AC_HELP_STRING([--with-osd=path],
2441                 [set path to optional osd]),
2442         [
2443         case "$with_osd" in
2444         no)
2445                 ENABLEOSDADDON=0
2446                 ;;
2447         *)
2448                 OSDADDON="$with_osd"
2449                 ENABLEOSDADDON=1
2450                 ;;
2451         esac
2452         ], [
2453                 ENABLEOSDADDON=0
2454         ])
2455 AS_IF([test $ENABLEOSDADDON -eq 0], [
2456         AC_MSG_RESULT([no])
2457         OSDADDON=""
2458 ], [
2459         OSDMODNAME=$(basename $OSDADDON)
2460         AS_IF([test -e $LUSTRE/$OSDMODNAME], [
2461                 AC_MSG_RESULT([can't link])
2462                 OSDADDON=""
2463         ], [ln -s $OSDADDON $LUSTRE/$OSDMODNAME], [
2464                 AC_MSG_RESULT([$OSDMODNAME])
2465                 OSDADDON="obj-m += $OSDMODNAME/"
2466         ], [
2467                 AC_MSG_RESULT([can't link])
2468                 OSDADDON=""
2469         ])
2470 ])
2471 AC_SUBST(OSDADDON)
2472 ]) # LC_OSD_ADDON
2473
2474 #
2475 # LC_CONFIGURE
2476 #
2477 # other configure checks
2478 #
2479 AC_DEFUN([LC_CONFIGURE], [
2480 AC_MSG_NOTICE([Lustre core checks
2481 ==============================================================================])
2482
2483 AS_IF([test $target_cpu == "i686" -o $target_cpu == "x86_64"],
2484         [CFLAGS="$CFLAGS -Wall -Werror"])
2485
2486 # maximum MDS thread count
2487 LC_MDS_MAX_THREADS
2488
2489 # lustre/utils/gss/gss_util.c
2490 # lustre/utils/gss/gssd_proc.c
2491 # lustre/utils/gss/krb5_util.c
2492 # lustre/utils/llog_reader.c
2493 # lustre/utils/create_iam.c
2494 # lustre/utils/libiam.c
2495 AC_CHECK_HEADERS([netdb.h endian.h])
2496 AC_CHECK_FUNCS([gethostbyname])
2497
2498 # lustre/utils/llverfs.c lustre/utils/libmount_utils_ldiskfs.c
2499 AC_CHECK_HEADERS([ext2fs/ext2fs.h], [], [
2500         AS_IF([test "x$enable_utils" = xyes -a "x$enable_ldiskfs" = xyes], [
2501                 AC_MSG_ERROR([
2502 ext2fs.h not found. Please install e2fsprogs development package.
2503                 ])
2504         ])
2505 ])
2506
2507 # lustre/utils/lfs.c
2508 AS_IF([test "$enable_dist" = "no"], [
2509                 AC_CHECK_LIB([z], [crc32], [
2510                                  AC_CHECK_HEADER([zlib.h], [], [
2511                                                  AC_MSG_ERROR([zlib.h not found.])])
2512                                  ], [
2513                                  AC_MSG_ERROR([
2514                 zlib library not found. Please install zlib development package.])
2515                 ])
2516 ])
2517
2518 SELINUX=""
2519
2520 AC_CHECK_LIB([selinux], [is_selinux_enabled],
2521         [AC_CHECK_HEADERS([selinux/selinux.h],
2522                         [SELINUX="-lselinux"
2523                         AC_DEFINE([HAVE_SELINUX], 1,
2524                                 [support for selinux ])],
2525                         [AC_MSG_WARN([
2526
2527 No libselinux-devel package found, unable to build selinux enabled tools
2528 ])
2529 ])],
2530         [AC_MSG_WARN([
2531
2532 No selinux package found, unable to build selinux enabled tools
2533 ])
2534 ])
2535 AC_SUBST(SELINUX)
2536
2537 # Super safe df
2538 AC_MSG_CHECKING([whether to report minimum OST free space])
2539 AC_ARG_ENABLE([mindf],
2540         AC_HELP_STRING([--enable-mindf],
2541                 [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
2542         [], [enable_mindf="no"])
2543 AC_MSG_RESULT([$enable_mindf])
2544 AS_IF([test "$enable_mindf" = "yes"],
2545         [AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])])
2546
2547 AC_MSG_CHECKING([whether to randomly failing memory alloc])
2548 AC_ARG_ENABLE([fail_alloc],
2549         AC_HELP_STRING([--disable-fail-alloc],
2550                 [disable randomly alloc failure]),
2551         [], [enable_fail_alloc="yes"])
2552 AC_MSG_RESULT([$enable_fail_alloc])
2553 AS_IF([test "x$enable_fail_alloc" != xno],
2554         [AC_DEFINE([RANDOM_FAIL_ALLOC], 1,
2555                 [enable randomly alloc failure])])
2556
2557 AC_MSG_CHECKING([whether to check invariants (expensive cpu-wise)])
2558 AC_ARG_ENABLE([invariants],
2559         AC_HELP_STRING([--enable-invariants],
2560                 [enable invariant checking (cpu intensive)]),
2561         [], [enable_invariants="no"])
2562 AC_MSG_RESULT([$enable_invariants])
2563 AS_IF([test "x$enable_invariants" = xyes],
2564         [AC_DEFINE([CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK], 1,
2565                 [enable invariant checking])])
2566
2567 AC_MSG_CHECKING([whether to track references with lu_ref])
2568 AC_ARG_ENABLE([lu_ref],
2569         AC_HELP_STRING([--enable-lu_ref],
2570                 [enable lu_ref reference tracking code]),
2571         [], [enable_lu_ref="no"])
2572 AC_MSG_RESULT([$enable_lu_ref])
2573 AS_IF([test "x$enable_lu_ref" = xyes],
2574         [AC_DEFINE([USE_LU_REF], 1,
2575                 [enable lu_ref reference tracking code])])
2576
2577 AC_MSG_CHECKING([whether to enable page state tracking])
2578 AC_ARG_ENABLE([pgstate-track],
2579         AC_HELP_STRING([--enable-pgstate-track],
2580                 [enable page state tracking]),
2581         [], [enable_pgstat_track="no"])
2582 AC_MSG_RESULT([$enable_pgstat_track])
2583 AS_IF([test "x$enable_pgstat_track" = xyes],
2584         [AC_DEFINE([CONFIG_DEBUG_PAGESTATE_TRACKING], 1,
2585                 [enable page state tracking code])])
2586
2587 PKG_PROG_PKG_CONFIG
2588 AC_MSG_CHECKING([systemd unit file directory])
2589 AC_ARG_WITH([systemdsystemunitdir],
2590         [AS_HELP_STRING([--with-systemdsystemunitdir=DIR],
2591                 [Directory for systemd service files])],
2592         [], [with_systemdsystemunitdir=auto])
2593 AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"],
2594         [def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)
2595         AS_IF([test "x$def_systemdsystemunitdir" = "x"],
2596                 [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"],
2597                 [AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])])
2598                 with_systemdsystemunitdir=no],
2599         [with_systemdsystemunitdir="$def_systemdsystemunitdir"])])
2600 AS_IF([test "x$with_systemdsystemunitdir" != "xno"],
2601         [AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])])
2602 AC_MSG_RESULT([$with_systemdsystemunitdir])
2603
2604 AC_MSG_CHECKING([bash-completion directory])
2605 AC_ARG_WITH([bash-completion-dir],
2606         AS_HELP_STRING([--with-bash-completion-dir[=PATH]],
2607                 [Install the bash auto-completion script in this directory.]),
2608         [],
2609         [with_bash_completion_dir=yes])
2610 AS_IF([test "x$with_bash_completion_dir" = "xyes"], [
2611         BASH_COMPLETION_DIR="`pkg-config --variable=completionsdir bash-completion`"
2612         AS_IF([test "x$BASH_COMPLETION_DIR" = "x"], [
2613                 [BASH_COMPLETION_DIR="$datadir/bash-completion/completions"]
2614         ])
2615 ], [
2616         BASH_COMPLETION_DIR="$with_bash_completion_dir"
2617 ])
2618 AC_SUBST([BASH_COMPLETION_DIR])
2619 AC_MSG_RESULT([$BASH_COMPLETION_DIR])
2620 ]) # LC_CONFIGURE
2621
2622 #
2623 # LC_CONDITIONALS
2624 #
2625 # AM_CONDITIONALS for lustre
2626 #
2627 AC_DEFUN([LC_CONDITIONALS], [
2628 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
2629 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
2630 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
2631 AM_CONDITIONAL(SPLIT, test x$enable_split = xyes)
2632 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
2633 AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
2634 AM_CONDITIONAL(GSS_KEYRING, test x$enable_gss_keyring = xyes)
2635 AM_CONDITIONAL(GSS_PIPEFS, test x$enable_gss_pipefs = xyes)
2636 AM_CONDITIONAL(GSS_SSK, test x$enable_ssk = xyes)
2637 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
2638 AM_CONDITIONAL(HAVE_SYSTEMD, test "x$with_systemdsystemunitdir" != "xno")
2639 AM_CONDITIONAL(ENABLE_BASH_COMPLETION, test "x$with_bash_completion_dir" != "xno")
2640 AM_CONDITIONAL(XATTR_HANDLER, test "x$lb_cv_compile_xattr_handler_flags" = xyes)
2641 AM_CONDITIONAL(SELINUX, test "$SELINUX" = "-lselinux")
2642 AM_CONDITIONAL(GETSEPOL, test x$enable_getsepol = xyes)
2643 ]) # LC_CONDITIONALS
2644
2645 #
2646 # LC_CONFIG_FILES
2647 #
2648 # files that should be generated with AC_OUTPUT
2649 #
2650 AC_DEFUN([LC_CONFIG_FILES],
2651 [AC_CONFIG_FILES([
2652 lustre/Makefile
2653 lustre/autoMakefile
2654 lustre/autoconf/Makefile
2655 lustre/conf/Makefile
2656 lustre/conf/resource/Makefile
2657 lustre/contrib/Makefile
2658 lustre/doc/Makefile
2659 lustre/include/Makefile
2660 lustre/include/lustre/Makefile
2661 lustre/include/uapi/linux/lustre/Makefile
2662 lustre/kernel_patches/targets/4.18-rhel8.1.target
2663 lustre/kernel_patches/targets/4.18-rhel8.target
2664 lustre/kernel_patches/targets/3.10-rhel7.7.target
2665 lustre/kernel_patches/targets/3.10-rhel7.6.target
2666 lustre/kernel_patches/targets/3.10-rhel7.5.target
2667 lustre/kernel_patches/targets/4.14-rhel7.5.target
2668 lustre/kernel_patches/targets/4.14-rhel7.6.target
2669 lustre/kernel_patches/targets/3.0-sles11.target
2670 lustre/kernel_patches/targets/3.0-sles11sp3.target
2671 lustre/kernel_patches/targets/3.0-sles11sp4.target
2672 lustre/kernel_patches/targets/3.12-sles12.target
2673 lustre/kernel_patches/targets/4.4-sles12.target
2674 lustre/kernel_patches/targets/4.4-sles12sp3.target
2675 lustre/kernel_patches/targets/4.12-sles12sp4.target
2676 lustre/kernel_patches/targets/4.12-sles15sp1.target
2677 lustre/kernel_patches/targets/3.x-fc18.target
2678 lustre/ldlm/Makefile
2679 lustre/fid/Makefile
2680 lustre/fid/autoMakefile
2681 lustre/llite/Makefile
2682 lustre/llite/autoMakefile
2683 lustre/lov/Makefile
2684 lustre/lov/autoMakefile
2685 lustre/mdc/Makefile
2686 lustre/mdc/autoMakefile
2687 lustre/lmv/Makefile
2688 lustre/lmv/autoMakefile
2689 lustre/lfsck/Makefile
2690 lustre/lfsck/autoMakefile
2691 lustre/mdt/Makefile
2692 lustre/mdt/autoMakefile
2693 lustre/mdd/Makefile
2694 lustre/mdd/autoMakefile
2695 lustre/fld/Makefile
2696 lustre/fld/autoMakefile
2697 lustre/obdclass/Makefile
2698 lustre/obdclass/autoMakefile
2699 lustre/obdecho/Makefile
2700 lustre/obdecho/autoMakefile
2701 lustre/ofd/Makefile
2702 lustre/ofd/autoMakefile
2703 lustre/osc/Makefile
2704 lustre/osc/autoMakefile
2705 lustre/ost/Makefile
2706 lustre/ost/autoMakefile
2707 lustre/osd-ldiskfs/Makefile
2708 lustre/osd-ldiskfs/autoMakefile
2709 lustre/osd-zfs/Makefile
2710 lustre/osd-zfs/autoMakefile
2711 lustre/mgc/Makefile
2712 lustre/mgc/autoMakefile
2713 lustre/mgs/Makefile
2714 lustre/mgs/autoMakefile
2715 lustre/target/Makefile
2716 lustre/ptlrpc/Makefile
2717 lustre/ptlrpc/autoMakefile
2718 lustre/ptlrpc/gss/Makefile
2719 lustre/ptlrpc/gss/autoMakefile
2720 lustre/quota/Makefile
2721 lustre/quota/autoMakefile
2722 lustre/scripts/Makefile
2723 lustre/scripts/systemd/Makefile
2724 lustre/tests/Makefile
2725 lustre/tests/mpi/Makefile
2726 lustre/tests/kernel/Makefile
2727 lustre/tests/kernel/autoMakefile
2728 lustre/utils/Makefile
2729 lustre/utils/gss/Makefile
2730 lustre/osp/Makefile
2731 lustre/osp/autoMakefile
2732 lustre/lod/Makefile
2733 lustre/lod/autoMakefile
2734 ])
2735 ]) # LC_CONFIG_FILES