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