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