4 # Wrapper for AC_CONFIG_SUBDIR
6 AC_DEFUN([LC_CONFIG_SRCDIR], [
7 AC_CONFIG_SRCDIR([lustre/obdclass/obdo.c])
15 # lustre specific paths
17 AC_DEFUN([LC_PATH_DEFAULTS], [
18 # ptlrpc kernel build requires this
26 demodir='$(docdir)/demo'
29 pkgexampledir='${pkgdatadir}/examples'
30 AC_SUBST(pkgexampledir)
36 # is the target os supported?
38 AC_DEFUN([LC_TARGET_SUPPORTED], [
47 ]) # LC_TARGET_SUPPORTED
50 # LC_CONFIG_OBD_BUFFER_SIZE
52 # the maximum buffer size of lctl ioctls
54 AC_DEFUN([LC_CONFIG_OBD_BUFFER_SIZE], [
55 AC_MSG_CHECKING([for maximum OBD ioctl size])
56 AC_ARG_WITH([obd-buffer-size],
57 AC_HELP_STRING([--with-obd-buffer-size=[size]],
58 [set lctl ioctl maximum bytes (default=8192)]),
59 [OBD_BUFFER_SIZE=$with_obd_buffer_size],
60 [OBD_BUFFER_SIZE=8192])
61 AC_MSG_RESULT([$OBD_BUFFER_SIZE bytes])
62 AC_DEFINE_UNQUOTED(CONFIG_LUSTRE_OBD_MAX_IOCTL_BUFFER, $OBD_BUFFER_SIZE,
64 ]) # LC_CONFIG_OBD_BUFFER_SIZE
67 # LC_GLIBC_SUPPORT_FHANDLES
69 AC_DEFUN([LC_GLIBC_SUPPORT_FHANDLES], [
70 AC_CHECK_FUNCS([name_to_handle_at],
71 [AC_DEFINE(HAVE_FHANDLE_GLIBC_SUPPORT, 1,
72 [file handle and related syscalls are supported])],
73 [AC_MSG_WARN([file handle and related syscalls are not supported])])
74 ]) # LC_GLIBC_SUPPORT_FHANDLES
77 # LC_FUNC_DEV_SET_RDONLY
79 # check whether dev_set_rdonly is exported. This is needed until we
80 # have another mechanism to fence IO from the underlying device.
82 AC_DEFUN([LC_FUNC_DEV_SET_RDONLY], [
83 LB_CHECK_EXPORT([dev_set_rdonly], [block/ll_rw_block.c block/blk-core.c],
84 [AC_DEFINE(HAVE_DEV_SET_RDONLY, 1,
85 [kernel exports dev_set_rdonly])],
86 [AC_MSG_WARN([kernel missing dev_set_rdonly patch for testing])])
87 ]) # LC_FUNC_DEV_SET_RDONLY
92 # Ensure the stack size is at least 8k in Lustre server (all kernels)
94 AC_DEFUN([LC_STACK_SIZE], [
95 LB_CHECK_COMPILE([if stack size is at least 8k],
97 #include <linux/thread_info.h>
99 #if THREAD_SIZE < 8192
100 #error "stack size < 8192"
102 ], [], [AC_MSG_ERROR([
104 Lustre requires that Linux is configured with at least a 8KB stack.
111 # Allow the user to set the MDS thread upper limit
113 AC_DEFUN([LC_MDS_MAX_THREADS], [
114 AC_MSG_CHECKING([for maximum number of MDS threads])
115 AC_ARG_WITH([mds_max_threads],
116 AC_HELP_STRING([--with-mds-max-threads=count],
117 [maximum threads available on the MDS: (default=512)]),
118 [AC_DEFINE_UNQUOTED(MDS_MAX_THREADS, $with_mds_max_threads,
119 [maximum number of MDS threads])])
120 AC_MSG_RESULT([$with_mds_max_threads])
121 ]) # LC_MDS_MAX_THREADS
126 # the pinger is temporary, until we have the recovery node in place
128 AC_DEFUN([LC_CONFIG_PINGER], [
129 AC_MSG_CHECKING([whether to enable Lustre pinger support])
130 AC_ARG_ENABLE([pinger],
131 AC_HELP_STRING([--disable-pinger],
132 [disable recovery pinger support]),
133 [], [enable_pinger="yes"])
134 AC_MSG_RESULT([$enable_pinger])
135 AS_IF([test "x$enable_pinger" != xno],
136 [AC_DEFINE(ENABLE_PINGER, 1,[Use the Pinger])])
137 ]) # LC_CONFIG_PINGER
142 # do checksum of bulk data between client and OST
144 AC_DEFUN([LC_CONFIG_CHECKSUM], [
145 AC_MSG_CHECKING([whether to enable data checksum support])
146 AC_ARG_ENABLE([checksum],
147 AC_HELP_STRING([--disable-checksum],
148 [disable data checksum support]),
149 [], [enable_checksum="yes"])
150 AC_MSG_RESULT([$enable_checksum])
151 AS_IF([test "x$enable_checksum" != xno],
152 [AC_DEFINE(ENABLE_CHECKSUM, 1, [do data checksums])])
153 ]) # LC_CONFIG_CHECKSUM
156 # LC_CONFIG_HEALTH_CHECK_WRITE
158 # Turn off the actual write to the disk
160 AC_DEFUN([LC_CONFIG_HEALTH_CHECK_WRITE], [
161 AC_MSG_CHECKING([whether to enable a write with the health check])
162 AC_ARG_ENABLE([health_write],
163 AC_HELP_STRING([--enable-health_write],
164 [enable disk writes when doing health check]),
165 [], [enable_health_write="no"])
166 AC_MSG_RESULT([$enable_health_write])
167 AS_IF([test "x$enable_health_write" != xno],
168 [AC_DEFINE(USE_HEALTH_CHECK_WRITE, 1, [Write when Checking Health])])
169 ]) # LC_CONFIG_HEALTH_CHECK_WRITE
172 # LC_CONFIG_LRU_RESIZE
174 AC_DEFUN([LC_CONFIG_LRU_RESIZE], [
175 AC_MSG_CHECKING([whether to enable lru self-adjusting])
176 AC_ARG_ENABLE([lru_resize],
177 AC_HELP_STRING([--enable-lru-resize],
178 [enable lru resize support]),
179 [], [enable_lru_resize="yes"])
180 AC_MSG_RESULT([$enable_lru_resize])
181 AS_IF([test "x$enable_lru_resize" != xno],
182 [AC_DEFINE(HAVE_LRU_RESIZE_SUPPORT, 1, [Enable lru resize support])])
183 ]) # LC_CONFIG_LRU_RESIZE
188 # Quota support. The kernel must support CONFIG_QUOTA.
190 AC_DEFUN([LC_QUOTA_CONFIG], [
191 LB_CHECK_CONFIG_IM([QUOTA], [],
194 Lustre quota requires that CONFIG_QUOTA is enabled in your kernel.
199 # LC_EXPORT_TRUNCATE_COMPLETE_PAGE
201 # truncate_complete_page() has never been exported from an upstream kernel
202 # remove_from_page_cache() was exported between 2.6.35 and 2.6.38
203 # delete_from_page_cache() is exported from 2.6.39
205 AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE_PAGE], [
206 LB_CHECK_EXPORT([truncate_complete_page], [mm/truncate.c],
207 [AC_DEFINE(HAVE_TRUNCATE_COMPLETE_PAGE, 1,
208 [kernel export truncate_complete_page])])
209 LB_CHECK_EXPORT([remove_from_page_cache], [mm/filemap.c],
210 [AC_DEFINE(HAVE_REMOVE_FROM_PAGE_CACHE, 1,
211 [kernel export remove_from_page_cache])])
212 LB_CHECK_EXPORT([delete_from_page_cache], [mm/filemap.c],
213 [AC_DEFINE(HAVE_DELETE_FROM_PAGE_CACHE, 1,
214 [kernel export delete_from_page_cache])])
215 ]) # LC_EXPORT_TRUNCATE_COMPLETE_PAGE
218 # LC_CONFIG_GSS_KEYRING
220 # default 'auto', tests for dependencies, if found, enables;
221 # only called if gss is enabled
223 AC_DEFUN([LC_CONFIG_GSS_KEYRING], [
224 AC_MSG_CHECKING([whether to enable gss keyring backend])
225 AC_ARG_ENABLE([gss_keyring],
226 [AC_HELP_STRING([--disable-gss-keyring],
227 [disable gss keyring backend])],
228 [], [enable_gss_keyring="auto"])
229 AC_MSG_RESULT([$enable_gss_keyring])
230 AS_IF([test "x$enable_gss_keyring" != xno], [
231 LB_CHECK_CONFIG_IM([KEYS], [], [
232 gss_keyring_conf_test="fail"
233 AC_MSG_WARN([GSS keyring backend requires that CONFIG_KEYS be enabled in your kernel.])])
235 AC_CHECK_LIB([keyutils], [keyctl_search], [], [
236 gss_keyring_conf_test="fail"
237 AC_MSG_WARN([GSS keyring backend requires libkeyutils])])
239 AS_IF([test "x$gss_keyring_conf_test" != xfail], [
240 AC_DEFINE([HAVE_GSS_KEYRING], [1],
241 [Define this if you enable gss keyring backend])
242 enable_gss_keyring="yes"
244 AS_IF([test "x$enable_gss_keyring" = xyes], [
245 AC_MSG_ERROR([Cannot enable gss_keyring. See above for details.])
249 ]) # LC_CONFIG_GSS_KEYRING
252 # LC_HAVE_CRED_TGCRED
254 # rhel7 struct cred has no member tgcred
256 AC_DEFUN([LC_HAVE_CRED_TGCRED], [
257 LB_CHECK_COMPILE([if 'struct cred' has member 'tgcred'],
259 #include <linux/cred.h>
261 ((struct cred *)0)->tgcred = NULL;
263 AC_DEFINE(HAVE_CRED_TGCRED, 1,
264 [struct cred has member tgcred])
266 ]) # LC_HAVE_CRED_TGCRED
269 # LC_KEY_TYPE_INSTANTIATE_2ARGS
271 # rhel7 key_type->instantiate takes 2 args (struct key, struct key_preparsed_payload)
273 AC_DEFUN([LC_KEY_TYPE_INSTANTIATE_2ARGS], [
274 LB_CHECK_COMPILE([if 'key_type->instantiate' has two args],
275 key_type_instantiate_2args, [
276 #include <linux/key-type.h>
278 ((struct key_type *)0)->instantiate(0, NULL);
280 AC_DEFINE(HAVE_KEY_TYPE_INSTANTIATE_2ARGS, 1,
281 [key_type->instantiate has two args])
283 ]) # LC_KEY_TYPE_INSTANTIATE_2ARGS
288 AC_DEFUN([LC_CONFIG_SUNRPC], [
289 LB_CHECK_CONFIG_IM([SUNRPC], [], [
290 AS_IF([test "x$sunrpc_required" = xyes], [
293 kernel SUNRPC support is required by using GSS.
296 ]) # LC_CONFIG_SUNRPC
299 # LC_CONFIG_GSS (default 'auto' (tests for dependencies, if found, enables))
301 # Build gss and related tools of Lustre. Currently both kernel and user space
302 # parts are depend on linux platform.
304 AC_DEFUN([LC_CONFIG_GSS], [
305 AC_MSG_CHECKING([whether to enable gss support])
307 [AC_HELP_STRING([--enable-gss], [enable gss support])],
308 [], [enable_gss="auto"])
309 AC_MSG_RESULT([$enable_gss])
311 AS_IF([test "x$enable_gss" != xno], [
312 LC_CONFIG_GSS_KEYRING
314 LC_KEY_TYPE_INSTANTIATE_2ARGS
315 sunrpc_required=$enable_gss
319 LB_CHECK_CONFIG_IM([CRYPTO_MD5], [],
320 [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
321 LB_CHECK_CONFIG_IM([CRYPTO_SHA1], [],
322 [AC_MSG_WARN([kernel SHA1 support is recommended by using GSS.])])
323 LB_CHECK_CONFIG_IM([CRYPTO_SHA256], [],
324 [AC_MSG_WARN([kernel SHA256 support is recommended by using GSS.])])
325 LB_CHECK_CONFIG_IM([CRYPTO_SHA512], [],
326 [AC_MSG_WARN([kernel SHA512 support is recommended by using GSS.])])
328 require_krb5=$enable_gss
332 AS_IF([test -n "$KRBDIR"], [
333 gss_conf_test="success"
335 gss_conf_test="failure"
338 AS_IF([test "x$gss_conf_test" = xsuccess], [
339 AC_DEFINE([HAVE_GSS], [1], [Define this is if you enable gss])
345 enable_ssk=$enable_gss
351 # OpenSSL 1.0+ return int for HMAC functions but older SLES11 versions do not
352 AC_DEFUN([LC_OPENSSL_SSK], [
353 AC_MSG_CHECKING([whether OpenSSL has functions needed for SSK])
354 AS_IF([test "x$enable_ssk" != xno], [
355 AC_COMPILE_IFELSE([AC_LANG_SOURCE([
356 #include <openssl/hmac.h>
357 #include <openssl/evp.h>
363 rc = HMAC_Init_ex(&ctx, "test", 4, EVP_md_null(), NULL);
365 ])],[AC_DEFINE(HAVE_OPENSSL_SSK, 1,
366 [OpenSSL HMAC functions needed for SSK])],
369 AC_MSG_RESULT([$enable_ssk])
372 # LC_INODE_PERMISION_2ARGS
374 # up to v2.6.27 had a 3 arg version (inode, mask, nameidata)
375 # v2.6.27->v2.6.37 had a 2 arg version (inode, mask)
376 # v2.6.37->v3.0 had a 3 arg version (inode, mask, nameidata)
377 # v3.1 onward have a 2 arg version (inode, mask)
379 AC_DEFUN([LC_INODE_PERMISION_2ARGS], [
380 LB_CHECK_COMPILE([if 'inode_operations->permission' has two args],
381 inode_ops_permission_2args, [
382 #include <linux/fs.h>
384 struct inode *inode __attribute__ ((unused));
387 inode->i_op->permission(NULL, 0);
389 AC_DEFINE(HAVE_INODE_PERMISION_2ARGS, 1,
390 [inode_operations->permission has two args])
392 ]) # LC_INODE_PERMISION_2ARGS
395 # LC_BLK_QUEUE_MAX_SEGMENTS
397 # 2.6.32 replaces 2 functions blk_queue_max_phys_segments and blk_queue_max_hw_segments by blk_queue_max_segments
399 AC_DEFUN([LC_BLK_QUEUE_MAX_SEGMENTS], [
400 LB_CHECK_COMPILE([if 'blk_queue_max_segments' is defined],
401 blk_queue_max_segments, [
402 #include <linux/blkdev.h>
404 blk_queue_max_segments(NULL, 0);
406 AC_DEFINE(HAVE_BLK_QUEUE_MAX_SEGMENTS, 1,
407 [blk_queue_max_segments is defined])
409 ]) # LC_BLK_QUEUE_MAX_SEGMENTS
412 # LC_HAVE_DQUOT_FS_DISK_QUOTA
414 # 2.6.34 has quotactl_ops->[sg]et_dqblk that take struct fs_disk_quota
416 AC_DEFUN([LC_HAVE_DQUOT_FS_DISK_QUOTA], [
417 tmp_flags="$EXTRA_KCFLAGS"
418 EXTRA_KCFLAGS="-Werror"
419 LB_CHECK_COMPILE([if 'quotactl_ops.set_dqblk' takes struct fs_disk_quota],
421 #include <linux/fs.h>
422 #include <linux/quota.h>
424 ((struct quotactl_ops *)0)->set_dqblk(NULL, 0, 0, (struct fs_disk_quota*)0);
426 AC_DEFINE(HAVE_DQUOT_FS_DISK_QUOTA, 1,
427 [quotactl_ops.set_dqblk takes struct fs_disk_quota])
429 LB_CHECK_COMPILE([if 'quotactl_ops.set_dqblk' takes struct kqid & fs_disk_quota],
430 kqid_fs_disk_quota, [
431 #include <linux/fs.h>
432 #include <linux/quota.h>
434 ((struct quotactl_ops *)0)->set_dqblk((struct super_block*)0, *((struct kqid*)0), (struct fs_disk_quota*)0);
436 AC_DEFINE(HAVE_DQUOT_FS_DISK_QUOTA, 1,
437 [quotactl_ops.set_dqblk takes struct fs_disk_quota])
438 AC_DEFINE(HAVE_DQUOT_KQID, 1,
439 [quotactl_ops.set_dqblk takes struct kqid])
442 EXTRA_KCFLAGS="$tmp_flags"
443 ]) # LC_HAVE_DQUOT_FS_DISK_QUOTA
446 # LC_HAVE_DQUOT_SUSPEND
448 # 2.6.34 has renamed dquot options to dquot_*, check for dquot_suspend
450 AC_DEFUN([LC_HAVE_DQUOT_SUSPEND], [
451 LB_CHECK_COMPILE([if 'dquot_suspend' is defined],
453 #include <linux/quotaops.h>
455 dquot_suspend(NULL, -1);
457 AC_DEFINE(HAVE_DQUOT_SUSPEND, 1, [dquot_suspend is defined])
459 ]) # LC_HAVE_DQUOT_SUSPEND
464 # Check if kernel has been patched for 64-bit quota limits support.
465 # The upstream version of this patch in RHEL6 2.6.32 kernels introduces
466 # the constant QFMT_VFS_V1 in include/linux/quota.h, so we can check for
467 # that in the absence of quotaio_v1.h in the kernel headers.
469 AC_DEFUN([LC_QUOTA64], [
470 tmp_flags="$EXTRA_KCFLAGS"
471 EXTRA_KCFLAGS="-I$LINUX/fs"
472 LB_CHECK_COMPILE([if kernel has 64-bit quota limits support],
474 #include <linux/kernel.h>
475 #include <linux/fs.h>
476 #if defined(HAVE_FS_QUOTA_QUOTAIO_H)
477 #include <quota/quotaio_v2.h>
478 struct v2r1_disk_dqblk dqblk_r1;
480 #include <linux/quota.h>
481 int ver = QFMT_VFS_V1;
484 AC_DEFINE(HAVE_QUOTA64, 1, [have quota64])
486 LB_CHECK_FILE([$LINUX/include/linux/lustre_version.h],
487 [AC_MSG_ERROR([You have got no 64-bit kernel quota support.])])
489 EXTRA_KCFLAGS=$tmp_flags
493 # LC_HAVE_ADD_WAIT_QUEUE_EXCLUSIVE
495 # 2.6.34 adds __add_wait_queue_exclusive
497 AC_DEFUN([LC_HAVE_ADD_WAIT_QUEUE_EXCLUSIVE], [
498 LB_CHECK_COMPILE([if '__add_wait_queue_exclusive' exists],
499 __add_wait_queue_exclusive, [
500 #include <linux/wait.h>
502 wait_queue_head_t queue;
504 __add_wait_queue_exclusive(&queue, &wait);
506 AC_DEFINE(HAVE___ADD_WAIT_QUEUE_EXCLUSIVE, 1,
507 [__add_wait_queue_exclusive exists])
509 ]) # LC_HAVE_ADD_WAIT_QUEUE_EXCLUSIVE
512 # LC_FS_STRUCT_RWLOCK
514 # 2.6.36 fs_struct.lock use spinlock instead of rwlock.
516 AC_DEFUN([LC_FS_STRUCT_RWLOCK], [
517 LB_CHECK_COMPILE([if 'fs_struct.lock' use rwlock],
519 #include <asm/atomic.h>
520 #include <linux/spinlock.h>
521 #include <linux/fs_struct.h>
523 ((struct fs_struct *)0)->lock = (rwlock_t){ 0 };
525 AC_DEFINE(HAVE_FS_STRUCT_RWLOCK, 1, [fs_struct.lock use rwlock])
527 ]) # LC_FS_STRUCT_RWLOCK
530 # LC_SBOPS_EVICT_INODE
532 # 2.6.36 super_operations add evict_inode method. it hybird of
533 # delete_inode & clear_inode.
535 AC_DEFUN([LC_SBOPS_EVICT_INODE], [
536 LB_CHECK_COMPILE([if 'super_operations.evict_inode' exist],
537 super_ops_evict_inode, [
538 #include <linux/fs.h>
540 ((struct super_operations *)0)->evict_inode(NULL);
542 AC_DEFINE(HAVE_SBOPS_EVICT_INODE, 1,
543 [super_operations.evict_inode() is exist in kernel])
545 ]) # LC_SBOPS_EVICT_INODE
550 # 2.6.35 file_operations.fsync taken 2 arguments.
551 # 3.0.0 file_operations.fsync takes 4 arguments.
553 AC_DEFUN([LC_FILE_FSYNC], [
554 LB_CHECK_COMPILE([if 'file_operations.fsync' takes 4 arguments],
555 file_ops_fsync_4args, [
556 #include <linux/fs.h>
558 ((struct file_operations *)0)->fsync(NULL, 0, 0, 0);
560 AC_DEFINE(HAVE_FILE_FSYNC_4ARGS, 1,
561 [file_operations.fsync takes 4 arguments])
563 LB_CHECK_COMPILE([if 'file_operations.fsync' takes 2 arguments],
564 file_ops_fsync_2args, [
565 #include <linux/fs.h>
567 ((struct file_operations *)0)->fsync(NULL, 0);
569 AC_DEFINE(HAVE_FILE_FSYNC_2ARGS, 1,
570 [file_operations.fsync takes 2 arguments])
578 # 2.6.37 remove kernel_locked
580 AC_DEFUN([LC_KERNEL_LOCKED], [
581 LB_CHECK_COMPILE([if 'kernel_locked' is defined],
583 #include <linux/smp_lock.h>
587 AC_DEFINE(HAVE_KERNEL_LOCKED, 1, [kernel_locked is defined])
589 ]) # LC_KERNEL_LOCKED
594 # 2.6.38 dentry_operations.d_compare() taken 7 arguments.
596 AC_DEFUN([LC_D_COMPARE_7ARGS], [
597 LB_CHECK_COMPILE([if 'dentry_operations.d_compare()' taken 7 arguments],
598 dentry_ops_d_compare_7arg, [
599 #include <linux/dcache.h>
601 ((struct dentry_operations*)0)->d_compare(NULL,NULL,NULL,NULL,0,NULL,NULL);
603 AC_DEFINE(HAVE_D_COMPARE_7ARGS, 1, [d_compare need 7 arguments])
605 ]) # LC_D_COMPARE_7ARGS
610 # 2.6.38 dentry_operations.d_delete() defined 'const' for 1st parameter.
612 AC_DEFUN([LC_D_DELETE_CONST], [
613 tmp_flags="$EXTRA_KCFLAGS"
614 EXTRA_KCFLAGS="-Werror"
615 LB_CHECK_COMPILE([if 'dentry_operations.d_delete()' has const declare on first parameter],
616 dentry_ops_d_delete_1st_const, [
617 #include <linux/dcache.h>
619 const struct dentry *d = NULL;
620 ((struct dentry_operations*)0)->d_delete(d);
622 AC_DEFINE(HAVE_D_DELETE_CONST, const,
623 [d_delete first parameter declared const])
625 AC_DEFINE(HAVE_D_DELETE_CONST, [],
626 [d_delete first parameter declared is not const])
628 EXTRA_KCFLAGS="$tmp_flags"
629 ]) # LC_D_DELETE_CONST
634 # 2.6.38 dcache_lock removed. rcu-walk committed.
636 AC_DEFUN([LC_DCACHE_LOCK], [
637 LB_CHECK_COMPILE([if 'dcache_lock' is exist],
639 #include <linux/dcache.h>
641 spin_lock(&dcache_lock);
643 AC_DEFINE(HAVE_DCACHE_LOCK, 1,
644 [dcache_lock is exist])
651 # 2.6.38 inode.i_rcu added.
653 AC_DEFUN([LC_INODE_I_RCU], [
654 LB_CHECK_COMPILE([if 'inode.i_rcu' exists],
656 #include <linux/fs.h>
659 struct rcu_head rcu = {};
662 AC_DEFINE(HAVE_INODE_I_RCU, 1,
663 [inode.i_rcu exists])
668 # LC_BLKDEV_GET_BY_DEV
670 # 2.6.38 export blkdev_get_by_dev
672 AC_DEFUN([LC_BLKDEV_GET_BY_DEV], [
673 LB_CHECK_EXPORT([blkdev_get_by_dev], [fs/block_dev.c],
674 [AC_DEFINE(HAVE_BLKDEV_GET_BY_DEV, 1,
675 [blkdev_get_by_dev is exported by the kernel])])
676 ]) # LC_BLKDEV_GET_BY_DEV
679 # LC_EXPORT_SIMPLE_SETATTR
681 # 2.6.38 export simple_setattr
683 AC_DEFUN([LC_EXPORT_SIMPLE_SETATTR], [
684 LB_CHECK_EXPORT([simple_setattr], [fs/libfs.c],
685 [AC_DEFINE(HAVE_SIMPLE_SETATTR, 1,
686 [simple_setattr is exported by the kernel])])
687 ]) # LC_EXPORT_SIMPLE_SETATTR
692 # truncate callback removed since 2.6.39
694 AC_DEFUN([LC_IOP_TRUNCATE], [
695 LB_CHECK_COMPILE([if 'inode_operations' has '.truncate' member function],
696 inode_ops_truncate, [
697 #include <linux/fs.h>
699 ((struct inode_operations *)0)->truncate(NULL);
701 AC_DEFINE(HAVE_INODEOPS_TRUNCATE, 1,
702 [inode_operations has .truncate member function])
707 # LC_REQUEST_QUEUE_UNPLUG_FN
709 # 2.6.39 remove unplug_fn from request_queue.
711 AC_DEFUN([LC_REQUEST_QUEUE_UNPLUG_FN], [
712 LB_CHECK_COMPILE([if 'request_queue' has 'unplug_fn' field],
713 request_queue_unplug_fn, [
714 #include <linux/blkdev.h>
716 do {} while(sizeof(((struct request_queue *)0)->unplug_fn));
718 AC_DEFINE(HAVE_REQUEST_QUEUE_UNPLUG_FN, 1,
719 [request_queue has unplug_fn field])
721 ]) # LC_REQUEST_QUEUE_UNPLUG_FN
724 # LC_HAVE_FSTYPE_MOUNT
726 # 2.6.39 replace get_sb with mount in struct file_system_type
728 AC_DEFUN([LC_HAVE_FSTYPE_MOUNT], [
729 LB_CHECK_COMPILE([if 'file_system_type' has 'mount' field],
730 file_system_type_mount, [
731 #include <linux/fs.h>
733 struct file_system_type fst;
734 void *i = (void *) fst.mount;
736 AC_DEFINE(HAVE_FSTYPE_MOUNT, 1,
737 [struct file_system_type has mount field])
739 ]) # LC_HAVE_FSTYPE_MOUNT
742 # LC_HAVE_FHANDLE_SYSCALLS
744 # 2.6.39 The open_by_handle_at() and name_to_handle_at() system calls were
745 # added to Linux kernel 2.6.39.
746 # Check if client supports these functions
748 AC_DEFUN([LC_HAVE_FHANDLE_SYSCALLS], [
749 LB_CHECK_CONFIG_IM([FHANDLE],[
750 AC_DEFINE(HAVE_FHANDLE_SYSCALLS, 1,
751 [kernel supports fhandles and related syscalls])
753 ]) # LC_HAVE_FHANDLE_SYSCALLS
756 # LC_HAVE_INODE_OWNER_OR_CAPABLE
758 # 2.6.39 renames is_owner_or_cap to inode_owner_or_capable
760 AC_DEFUN([LC_HAVE_INODE_OWNER_OR_CAPABLE], [
761 LB_CHECK_COMPILE([if 'inode_owner_or_capable' exist],
762 inode_owner_or_capable, [
763 #include <linux/fs.h>
765 inode_owner_or_capable(NULL);
767 AC_DEFINE(HAVE_INODE_OWNER_OR_CAPABLE, 1,
768 [inode_owner_or_capable exist])
770 ]) # LC_HAVE_INODE_OWNER_OR_CAPABLE
773 # LC_DIRTY_INODE_WITH_FLAG
775 # 3.0 dirty_inode() has a flag parameter
776 # see kernel commit aa38572954ade525817fe88c54faebf85e5a61c0
778 AC_DEFUN([LC_DIRTY_INODE_WITH_FLAG], [
779 LB_CHECK_COMPILE([if 'dirty_inode' super_operation takes flag],
780 dirty_inode_super_operation_flag, [
781 #include <linux/fs.h>
784 inode->i_sb->s_op->dirty_inode(NULL, 0);
786 AC_DEFINE(HAVE_DIRTY_INODE_HAS_FLAG, 1,
787 [dirty_inode super_operation takes flag])
789 ]) # LC_DIRTY_INODE_WITH_FLAG
792 # LC_GENERIC_PERMISSION
794 # 2.6.38 generic_permission taken 4 parameters.
795 # in fact, it means rcu-walk aware permission bring.
797 # 3.1 generic_permission taken 2 parameters.
798 # see kernel commit 2830ba7f34ebb27c4e5b8b6ef408cd6d74860890
800 AC_DEFUN([LC_GENERIC_PERMISSION], [
801 LB_CHECK_COMPILE([if 'generic_permission' take 2 arguments],
802 generic_permission_2args, [
803 #include <linux/fs.h>
805 generic_permission(NULL, 0);
807 AC_DEFINE(HAVE_GENERIC_PERMISSION_2ARGS, 1,
808 [generic_permission taken 2 arguments])
810 LB_CHECK_COMPILE([if 'generic_permission' take 4 arguments],
811 generic_permission_4args, [
812 #include <linux/fs.h>
814 generic_permission(NULL, 0, 0, NULL);
816 AC_DEFINE(HAVE_GENERIC_PERMISSION_4ARGS, 1,
817 [generic_permission taken 4 arguments])
820 ]) # LC_GENERIC_PERMISSION
823 # LC_LM_XXX_LOCK_MANAGER_OPS
825 # 3.1 renames lock-manager ops(lock_manager_operations) from fl_xxx to lm_xxx
826 # see kernel commit 8fb47a4fbf858a164e973b8ea8ef5e83e61f2e50
828 AC_DEFUN([LC_LM_XXX_LOCK_MANAGER_OPS], [
829 LB_CHECK_COMPILE([if 'lock-manager' ops renamed to 'lm_xxx'],
830 lock_manager_ops_lm_xxx, [
831 #include <linux/fs.h>
833 struct lock_manager_operations lm_ops;
834 lm_ops.lm_compare_owner = NULL;
836 AC_DEFINE(HAVE_LM_XXX_LOCK_MANAGER_OPS, 1,
837 [lock-manager ops renamed to lm_xxx])
839 ]) # LC_LM_XXX_LOCK_MANAGER_OPS
844 # 3.1 kills inode->i_alloc_sem, use i_dio_count and inode_dio_wait
846 # see kernel commit bd5fe6c5eb9c548d7f07fe8f89a150bb6705e8e3
848 AC_DEFUN([LC_INODE_DIO_WAIT], [
849 LB_CHECK_COMPILE([if 'inode->i_alloc_sem' is killed and use inode_dio_wait],
851 #include <linux/fs.h>
853 inode_dio_wait((struct inode *)0);
855 AC_DEFINE(HAVE_INODE_DIO_WAIT, 1,
856 [inode->i_alloc_sem is killed and use inode_dio_wait])
858 ]) # LC_INODE_DIO_WAIT
863 # 3.1 adds get_acl method to inode_operations to read ACL from disk.
864 # see kernel commit 4e34e719e457f2e031297175410fc0bd4016a085
866 AC_DEFUN([LC_IOP_GET_ACL], [
867 LB_CHECK_COMPILE([if 'inode_operations' has '.get_acl' member function],
869 #include <linux/fs.h>
871 struct inode_operations iop;
874 AC_DEFINE(HAVE_IOP_GET_ACL, 1,
875 [inode_operations has .get_acl member function])
880 # LC_FILE_LLSEEK_SIZE
882 # 3.1 introduced generic_file_llseek_size()
884 AC_DEFUN([LC_FILE_LLSEEK_SIZE], [
885 LB_CHECK_EXPORT([generic_file_llseek_size], [fs/read_write.c],
886 [AC_DEFINE(HAVE_FILE_LLSEEK_SIZE, 1,
887 [generic_file_llseek_size is exported by the kernel])])
888 ]) # LC_FILE_LLSEEK_SIZE
891 # LC_RADIX_EXCEPTION_ENTRY
892 # 3.1 adds radix_tree_exception_entry.
894 AC_DEFUN([LC_RADIX_EXCEPTION_ENTRY], [
895 LB_CHECK_COMPILE([radix_tree_exceptional_entry exist],
896 radix_tree_exceptional_entry, [
897 #include <linux/radix-tree.h>
899 radix_tree_exceptional_entry(NULL);
901 AC_DEFINE(HAVE_RADIX_EXCEPTION_ENTRY, 1,
902 [radix_tree_exceptional_entry exist])
904 ]) # LC_RADIX_EXCEPTION_ENTRY
907 # LC_HAVE_VOID_MAKE_REQUEST_FN
909 # 3.2 request_queue.make_request_fn defined as function returns with void
910 # see kernel commit 5a7bbad27a410350e64a2d7f5ec18fc73836c14f
912 AC_DEFUN([LC_HAVE_VOID_MAKE_REQUEST_FN], [
913 LB_CHECK_COMPILE([if 'request_queue.make_request_fn' returns void but not int],
914 make_request_fn_void, [
915 #include <linux/blkdev.h>
918 make_request_fn *mrf;
919 ret = mrf(NULL, NULL);
921 AC_DEFINE(HAVE_VOID_MAKE_REQUEST_FN, 1,
922 [request_queue.make_request_fn returns void but not int])
924 ]) # LC_HAVE_VOID_MAKE_REQUEST_FN
927 # LC_HAVE_PROTECT_I_NLINK
929 # 3.2 protects inode->i_nlink from direct modification
930 # see kernel commit a78ef704a8dd430225955f0709b22d4a6ba21deb
931 # at the same time adds set_nlink(), so checks set_nlink() for it.
933 AC_DEFUN([LC_HAVE_PROTECT_I_NLINK], [
934 LB_CHECK_COMPILE([if 'inode->i_nlink' is protected from direct modification],
935 inode_i_nlink_protected, [
936 #include <linux/fs.h>
941 AC_DEFINE(HAVE_PROTECT_I_NLINK, 1,
942 [inode->i_nlink is protected from direct modification])
944 ]) # LC_HAVE_PROTECT_I_NLINK
947 # 2.6.39 security_inode_init_security takes a 'struct qstr' parameter
949 # 3.2 security_inode_init_security takes a callback to set xattrs
951 AC_DEFUN([LC_HAVE_SECURITY_IINITSEC], [
952 LB_CHECK_COMPILE([if security_inode_init_security takes a callback],
953 security_inode_init_security_callback, [
954 #include <linux/security.h>
956 security_inode_init_security(NULL, NULL, NULL, (const initxattrs)NULL, NULL);
958 AC_DEFINE(HAVE_SECURITY_IINITSEC_CALLBACK, 1,
959 [security_inode_init_security takes a callback to set xattrs])
961 LB_CHECK_COMPILE([if security_inode_init_security takes a 'struct qstr' parameter],
962 security_inode_init_security_qstr, [
963 #include <linux/security.h>
965 security_inode_init_security(NULL, NULL, (struct qstr *)NULL, NULL, NULL, NULL);
967 AC_DEFINE(HAVE_SECURITY_IINITSEC_QSTR, 1,
968 [security_inode_init_security takes a 'struct qstr' parameter])
971 ]) # LC_HAVE_SECURITY_IINITSEC
974 # LC_HAVE_MIGRATE_HEADER
976 # 3.3 introduces migrate_mode.h and migratepage has 4 args
978 AC_DEFUN([LC_HAVE_MIGRATE_HEADER], [
979 LB_CHECK_FILE([$LINUX/include/linux/migrate.h], [
980 AC_DEFINE(HAVE_MIGRATE_H, 1,
981 [kernel has include/linux/migrate.h])
983 LB_CHECK_FILE([$LINUX/include/linux/migrate_mode.h], [
984 AC_DEFINE(HAVE_MIGRATE_MODE_H, 1,
985 [kernel has include/linux/migrate_mode.h])
988 ]) # LC_HAVE_MIGRATE_HEADER
991 # LC_MIGRATEPAGE_4ARGS
993 AC_DEFUN([LC_MIGRATEPAGE_4ARGS], [
994 LB_CHECK_COMPILE([if 'address_space_operations.migratepage' has 4 args],
995 address_space_ops_migratepage_4args, [
996 #include <linux/fs.h>
997 #ifdef HAVE_MIGRATE_H
998 #include <linux/migrate.h>
999 #elif defined(HAVE_MIGRATE_MODE_H)
1000 #include <linux/migrate_mode.h>
1003 struct address_space_operations aops;
1004 aops.migratepage(NULL, NULL, NULL, MIGRATE_ASYNC);
1006 AC_DEFINE(HAVE_MIGRATEPAGE_4ARGS, 1,
1007 [address_space_operations.migratepage has 4 args])
1009 ]) # LC_MIGRATEPAGE_4ARGS
1012 # LC_SUPEROPS_USE_DENTRY
1014 # 3.3 switchs super_operations to use dentry as parameter (but not vfsmount)
1015 # see kernel commit 34c80b1d93e6e20ca9dea0baf583a5b5510d92d4
1017 AC_DEFUN([LC_SUPEROPS_USE_DENTRY], [
1018 tmp_flags="$EXTRA_KCFLAGS"
1019 EXTRA_KCFLAGS="-Werror"
1020 LB_CHECK_COMPILE([if 'super_operations' use 'dentry' as parameter],
1022 #include <linux/fs.h>
1023 int show_options(struct seq_file *seq, struct dentry *root) {
1027 struct super_operations ops;
1028 ops.show_options = show_options;
1030 AC_DEFINE(HAVE_SUPEROPS_USE_DENTRY, 1,
1031 [super_operations use dentry as parameter])
1033 EXTRA_KCFLAGS="$tmp_flags"
1034 ]) # LC_SUPEROPS_USE_DENTRY
1037 # LC_INODEOPS_USE_UMODE_T
1039 # 3.3 switchs inode_operations to use umode_t as parameter (but not int)
1040 # see kernel commit 1a67aafb5f72a436ca044293309fa7e6351d6a35
1042 AC_DEFUN([LC_INODEOPS_USE_UMODE_T], [
1043 tmp_flags="$EXTRA_KCFLAGS"
1044 EXTRA_KCFLAGS="-Werror"
1045 LB_CHECK_COMPILE([if 'inode_operations' use 'umode_t' as parameter],
1046 inode_ops_umode_t, [
1047 #include <linux/fs.h>
1048 #include <linux/types.h>
1049 int my_mknod(struct inode *dir, struct dentry *dchild,
1050 umode_t mode, dev_t dev)
1055 struct inode_operations ops;
1056 ops.mknod = my_mknod;
1058 AC_DEFINE(HAVE_INODEOPS_USE_UMODE_T, 1,
1059 [inode_operations use umode_t as parameter])
1061 EXTRA_KCFLAGS="$tmp_flags"
1062 ]) # LC_INODEOPS_USE_UMODE_T
1065 # LC_KMAP_ATOMIC_HAS_1ARG
1067 # 3.4 kmap_atomic removes second argument
1068 # see kernel commit 1ec9c5ddc17aa398f05646abfcbaf315b544e62f
1070 AC_DEFUN([LC_KMAP_ATOMIC_HAS_1ARG], [
1071 LB_CHECK_COMPILE([if 'kmap_atomic' has only 1 argument],
1073 #include <linux/highmem.h>
1077 AC_DEFINE(HAVE_KMAP_ATOMIC_HAS_1ARG, 1,
1078 [have kmap_atomic has only 1 argument])
1080 ]) # LC_KMAP_ATOMIC_HAS_1ARG
1083 # LC_HAVE_D_MAKE_ROOT
1085 # 3.4 converts d_alloc_root to d_make_root
1086 # see kernel commit 32991ab305ace7017c62f8eecbe5eb36dc32e13b
1088 AC_DEFUN([LC_HAVE_D_MAKE_ROOT], [
1089 LB_CHECK_COMPILE([if have 'd_make_root'],
1091 #include <linux/fs.h>
1093 d_make_root((struct inode *)NULL);
1095 AC_DEFINE(HAVE_D_MAKE_ROOT, 1,
1098 ]) # LC_HAVE_D_MAKE_ROOT
1101 # LC_HAVE_CACHE_REGISTER
1103 # 3.4 cache_register/cache_unregister are removed
1104 # see kernel commit 2c5f846747526e2b83c5f1b8e69016be0e2e87c0
1105 # Note, since 2.6.37 cache_register_net/cache_unregister_net
1106 # are defined, but not exported.
1107 # 3.3 cache_register_net/cache_unregister_net are
1108 # exported and replacing cache_register/cache_unregister in 3.4
1110 AC_DEFUN([LC_HAVE_CACHE_REGISTER], [
1111 LB_CHECK_COMPILE([if have 'cache_register'],
1113 #include <linux/sunrpc/cache.h>
1115 cache_register(NULL);
1117 AC_DEFINE(HAVE_CACHE_REGISTER, 1,
1118 [have cache_register])
1120 ]) # LC_HAVE_CACHE_REGISTER
1123 # LC_HAVE_CLEAR_INODE
1125 # 3.5 renames end_writeback() back to clear_inode()...
1126 # see kernel commit dbd5768f87ff6fb0a4fe09c4d7b6c4a24de99430
1128 AC_DEFUN([LC_HAVE_CLEAR_INODE], [
1129 LB_CHECK_COMPILE([if have 'clear_inode'],
1131 #include <linux/fs.h>
1133 clear_inode((struct inode *)NULL);
1135 AC_DEFINE(HAVE_CLEAR_INODE, 1,
1138 ]) # LC_HAVE_CLEAR_INODE
1141 # LC_HAVE_ENCODE_FH_PARENT
1143 # 3.5 encode_fh has parent inode passed in directly
1144 # see kernel commit b0b0382b
1146 AC_DEFUN([LC_HAVE_ENCODE_FH_PARENT], [
1147 tmp_flags="$EXTRA_KCFLAGS"
1148 EXTRA_KCFLAGS="-Werror"
1149 LB_CHECK_COMPILE([if 'encode_fh' have parent inode as parameter],
1150 encode_fh_parent_inode, [
1151 #include <linux/exportfs.h>
1152 #include <linux/fs.h>
1153 #include <linux/types.h>
1154 int ll_encode_fh(struct inode *i, __u32 *a, int *b, struct inode *p)
1159 struct export_operations exp_op;
1160 exp_op.encode_fh = ll_encode_fh;
1162 AC_DEFINE(HAVE_ENCODE_FH_PARENT, 1,
1163 [have parent inode as parameter])
1165 EXTRA_KCFLAGS="$tmp_flags"
1166 ]) # LC_HAVE_ENCODE_FH_PARENT
1169 # LC_FILE_LLSEEK_SIZE_5ARG
1171 # 3.5 has generic_file_llseek_size with 5 args
1173 AC_DEFUN([LC_FILE_LLSEEK_SIZE_5ARG], [
1174 LB_CHECK_COMPILE([if Linux kernel has 'generic_file_llseek_size' with 5 args],
1175 generic_file_llseek_size_5args, [
1176 #include <linux/fs.h>
1178 generic_file_llseek_size(NULL, 0, 0, 0, 0);
1180 AC_DEFINE(HAVE_FILE_LLSEEK_SIZE_5ARGS, 1,
1181 [kernel has generic_file_llseek_size with 5 args])
1183 ]) # LC_FILE_LLSEEK_SIZE_5ARG
1186 # LC_LLITE_DATA_IS_LIST
1188 # 3.6 switch i_dentry/d_alias from list to hlist
1190 # In the upstream kernels d_alias first changes
1191 # to a hlist and then in later version, 3.11, gets
1192 # moved to the union d_u. Due to some distros having
1193 # d_alias in the d_u union as a struct list, which
1194 # has never existed upstream stream, we can't test
1195 # if d_alias is a list or hlist directly. If ever
1196 # i_dentry and d_alias even up different combos then
1197 # the build will fail. In that case then we will need
1198 # to separate out the i_dentry and d_alias test below.
1200 AC_DEFUN([LC_DATA_FOR_LLITE_IS_LIST], [
1201 tmp_flags="$EXTRA_KCFLAGS"
1202 EXTRA_KCFLAGS="-Werror"
1203 LB_CHECK_COMPILE([if 'i_dentry/d_alias' uses 'list'],
1204 i_dentry_d_alias_list, [
1205 #include <linux/fs.h>
1208 INIT_LIST_HEAD(&inode.i_dentry);
1210 AC_DEFINE(DATA_FOR_LLITE_IS_LIST, 1,
1211 [both i_dentry/d_alias uses list])
1213 EXTRA_KCFLAGS="$tmp_flags"
1214 ]) # LC_DATA_FOR_LLITE_IS_LIST
1217 # LC_DENTRY_OPEN_USE_PATH
1219 # 3.6 dentry_open uses struct path as first argument
1220 # see kernel commit 765927b2
1222 AC_DEFUN([LC_DENTRY_OPEN_USE_PATH], [
1223 tmp_flags="$EXTRA_KCFLAGS"
1224 EXTRA_KCFLAGS="-Werror"
1225 LB_CHECK_COMPILE([if 'dentry_open' uses 'struct path' as first argument],
1227 #include <linux/fs.h>
1228 #include <linux/path.h>
1231 dentry_open(&path, 0, NULL);
1233 AC_DEFINE(HAVE_DENTRY_OPEN_USE_PATH, 1,
1234 [dentry_open uses struct path as first argument])
1236 EXTRA_KCFLAGS="$tmp_flags"
1237 ]) # LC_DENTRY_OPEN_USE_PATH
1240 # LC_HAVE_IOP_ATOMIC_OPEN
1242 # 3.6 vfs adds iop->atomic_open
1244 AC_DEFUN([LC_HAVE_IOP_ATOMIC_OPEN], [
1245 LB_CHECK_COMPILE([if 'iop' has 'atomic_open'],
1246 inode_ops_atomic_open, [
1247 #include <linux/fs.h>
1249 struct inode_operations iop;
1250 iop.atomic_open = NULL;
1252 AC_DEFINE(HAVE_IOP_ATOMIC_OPEN, 1,
1253 [have iop atomic_open])
1255 ]) # LC_HAVE_IOP_ATOMIC_OPEN
1258 # LC_HAVE_SB_START_WRITE
1260 # RHEL6 2.6.32, 3.6 or newer support wrapped FS freeze functions
1262 AC_DEFUN([LC_HAVE_SB_START_WRITE], [
1263 LB_CHECK_COMPILE([if kernel supports wrapped FS freeze functions],
1265 #include <linux/fs.h>
1267 sb_start_write(NULL);
1269 AC_DEFINE(HAVE_SB_START_WRITE, 1,
1270 [kernel supports wrapped FS freeze functions])
1272 ]) # LC_HAVE_SB_START_WRITE
1275 # LC_HAVE_POSIXACL_USER_NS
1277 # 3.7 posix_acl_{to,from}_xattr take struct user_namespace
1279 AC_DEFUN([LC_HAVE_POSIXACL_USER_NS], [
1280 LB_CHECK_COMPILE([if 'posix_acl_to_xattr' takes 'struct user_namespace'],
1281 posix_acl_to_xattr_user_namespace, [
1282 #include <linux/fs.h>
1283 #include <linux/posix_acl_xattr.h>
1285 posix_acl_to_xattr((struct user_namespace *)NULL, NULL, NULL, 0);
1287 AC_DEFINE(HAVE_POSIXACL_USER_NS, 1,
1288 [posix_acl_to_xattr takes struct user_namespace])
1290 ]) # LC_HAVE_POSIXACL_USER_NS
1293 # LC_HAVE_FILE_F_INODE
1295 # 3.8 struct file has new member f_inode
1297 AC_DEFUN([LC_HAVE_FILE_F_INODE], [
1298 LB_CHECK_COMPILE([if 'struct file' has member 'f_inode'],
1300 #include <linux/fs.h>
1302 ((struct file *)0)->f_inode = NULL;
1304 AC_DEFINE(HAVE_FILE_F_INODE, 1,
1305 [struct file has member f_inode])
1307 ]) # LC_HAVE_FILE_F_INODE
1310 # LC_HAVE_FILE_INODE
1312 # 3.8 has introduced inline function file_inode
1314 AC_DEFUN([LC_HAVE_FILE_INODE], [
1315 LB_CHECK_COMPILE([if file_inode() exists],
1317 #include <linux/fs.h>
1321 AC_DEFINE(HAVE_FILE_INODE, 1,
1322 [file_inode() has been defined])
1324 ]) # LC_HAVE_FILE_INODE
1327 # LC_HAVE_SUNRPC_UPCALL_HAS_3ARGS
1329 AC_DEFUN([LC_HAVE_SUNRPC_UPCALL_HAS_3ARGS], [
1330 LB_CHECK_COMPILE([if 'sunrpc_cache_pipe_upcall' takes 3 args],
1331 sunrpc_cache_pipe_upcall_3args, [
1332 #include <linux/sunrpc/cache.h>
1334 sunrpc_cache_pipe_upcall(NULL, NULL, NULL);
1336 AC_DEFINE(HAVE_SUNRPC_UPCALL_HAS_3ARGS, 1,
1337 [sunrpc_cache_pipe_upcall takes 3 args])
1339 ]) # LC_HAVE_SUNRPC_UPCALL_HAS_3ARGS
1342 # LC_HAVE_HLIST_FOR_EACH_3ARG
1344 # 3.9 uses hlist_for_each_entry with 3 args
1345 # b67bfe0d42cac56c512dd5da4b1b347a23f4b70a
1347 AC_DEFUN([LC_HAVE_HLIST_FOR_EACH_3ARG], [
1348 LB_CHECK_COMPILE([if 'hlist_for_each_entry' has 3 args],
1349 hlist_for_each_entry_3args, [
1350 #include <linux/list.h>
1351 #include <linux/fs.h>
1353 struct hlist_head *head = NULL;
1354 struct inode *inode;
1356 hlist_for_each_entry(inode, head, i_hash) {
1360 AC_DEFINE(HAVE_HLIST_FOR_EACH_3ARG, 1,
1361 [hlist_for_each_entry has 3 args])
1363 ]) # LC_HAVE_HLIST_FOR_EACH_3ARG
1366 # LC_HAVE_BIO_END_SECTOR
1368 # 3.9 introduces bio_end_sector macro
1369 # f73a1c7d117d07a96d89475066188a2b79e53c48
1371 AC_DEFUN([LC_HAVE_BIO_END_SECTOR], [
1372 LB_CHECK_COMPILE([if 'bio_end_sector' is defined],
1374 #include <linux/bio.h>
1378 bio_end_sector(&bio);
1380 AC_DEFINE(HAVE_BIO_END_SECTOR, 1,
1381 [bio_end_sector is defined])
1383 ]) # LC_HAVE_BIO_END_SECTOR
1386 # 3.9 created is_sxid
1388 AC_DEFUN([LC_HAVE_IS_SXID], [
1389 LB_CHECK_COMPILE([if 'is_sxid' is defined],
1391 #include <linux/fs.h>
1395 is_sxid(inode.i_mode);
1397 AC_DEFINE(HAVE_IS_SXID, 1, [is_sxid is defined])
1399 ]) # LC_HAVE_IS_SXID
1402 # LC_HAVE_REMOVE_PROC_SUBTREE
1404 # 3.10 introduced remove_proc_subtree
1406 AC_DEFUN([LC_HAVE_REMOVE_PROC_SUBTREE], [
1407 LB_CHECK_COMPILE([if 'remove_proc_subtree' is defined],
1408 remove_proc_subtree, [
1409 #include <linux/proc_fs.h>
1411 remove_proc_subtree(NULL, NULL);
1413 AC_DEFINE(HAVE_REMOVE_PROC_SUBTREE, 1,
1414 [remove_proc_subtree is defined])
1416 ]) # LC_HAVE_REMOVE_PROC_SUBTREE
1419 # LC_HAVE_PROC_REMOVE
1421 # 3.10 introduced proc_remove
1423 AC_DEFUN([LC_HAVE_PROC_REMOVE], [
1424 LB_CHECK_COMPILE([if 'proc_remove' is defined],
1426 #include <linux/proc_fs.h>
1430 AC_DEFINE(HAVE_PROC_REMOVE, 1,
1431 [proc_remove is defined])
1433 ]) # LC_HAVE_PROC_REMOVE
1436 # LC_BLKDEV_RELEASE_RETURN_INT
1438 # 3.10 release for block device doesn't return int
1440 AC_DEFUN([LC_BLKDEV_RELEASE_RETURN_INT], [
1441 LB_CHECK_COMPILE([if 'block_device_operations' release returns 'int'],
1442 block_device_ops_release_return_int, [
1443 #include <linux/blkdev.h>
1445 struct block_device_operations fops;
1446 int i __attribute__ ((unused));
1448 i = fops.release(NULL, 0);
1450 AC_DEFINE(HAVE_BLKDEV_RELEASE_RETURN_INT, 1,
1451 [block device release returns int])
1453 ]) # LC_BLKDEV_RELEASE_RETURN_INT
1456 # LC_HAVE_SECURITY_DENTRY_INIT_SECURITY
1458 # 3.10 introduced security_dentry_init_security()
1460 AC_DEFUN([LC_HAVE_SECURITY_DENTRY_INIT_SECURITY], [
1461 LB_CHECK_COMPILE([if 'security_dentry_init_security' is defined],
1462 security_dentry_init_security, [
1463 #include <linux/security.h>
1465 security_dentry_init_security(NULL, 0, NULL, NULL, NULL);
1467 AC_DEFINE(HAVE_SECURITY_DENTRY_INIT_SECURITY, 1,
1468 [security_dentry_init_security' is defined])
1470 ]) # LC_HAVE_SECURITY_DENTRY_INIT_SECURITY
1473 # LC_INVALIDATE_RANGE
1475 # 3.11 invalidatepage requires the length of the range to invalidate
1477 AC_DEFUN([LC_INVALIDATE_RANGE], [
1478 LB_CHECK_COMPILE([if 'address_space_operations.invalidatepage' requires 3 arguments],
1479 address_space_ops_invalidatepage_3args, [
1480 #include <linux/fs.h>
1482 struct address_space_operations a_ops;
1483 a_ops.invalidatepage(NULL, 0, 0);
1485 AC_DEFINE(HAVE_INVALIDATE_RANGE, 1,
1486 [address_space_operations.invalidatepage needs 3 arguments])
1488 ]) # LC_INVALIDATE_RANGE
1491 # LC_HAVE_DIR_CONTEXT
1493 # 3.11 readdir now takes the new struct dir_context
1495 AC_DEFUN([LC_HAVE_DIR_CONTEXT], [
1496 LB_CHECK_COMPILE([if 'dir_context' exist],
1498 #include <linux/fs.h>
1500 struct dir_context ctx;
1503 AC_DEFINE(HAVE_DIR_CONTEXT, 1,
1504 [dir_context exist])
1506 ]) # LC_HAVE_DIR_CONTEXT
1509 # LC_D_COMPARE_5ARGS
1511 # 3.11 dentry_operations.d_compare() taken 5 arguments.
1513 AC_DEFUN([LC_D_COMPARE_5ARGS], [
1514 LB_CHECK_COMPILE([if 'd_compare' taken 5 arguments],
1516 #include <linux/dcache.h>
1518 ((struct dentry_operations*)0)->d_compare(NULL,NULL,0,NULL,NULL);
1520 AC_DEFINE(HAVE_D_COMPARE_5ARGS, 1,
1521 [d_compare need 5 arguments])
1523 ]) # LC_D_COMPARE_5ARGS
1528 # 3.11 need to access d_count to get dentry reference count
1530 AC_DEFUN([LC_HAVE_DCOUNT], [
1531 LB_CHECK_COMPILE([if 'd_count' exist],
1533 #include <linux/dcache.h>
1538 AC_DEFINE(HAVE_D_COUNT, 1,
1544 # LC_OLDSIZE_TRUNCATE_PAGECACHE
1546 # 3.12 truncate_pagecache without oldsize parameter
1548 AC_DEFUN([LC_OLDSIZE_TRUNCATE_PAGECACHE], [
1549 LB_CHECK_COMPILE([if 'truncate_pagecache' with 'old_size' parameter],
1550 truncate_pagecache_old_size, [
1551 #include <linux/mm.h>
1553 truncate_pagecache(NULL, 0, 0);
1555 AC_DEFINE(HAVE_OLDSIZE_TRUNCATE_PAGECACHE, 1,
1558 ]) # LC_OLDSIZE_TRUNCATE_PAGECACHE
1561 # LC_HAVE_DENTRY_D_U_D_ALIAS
1563 # 3.11 kernel moved d_alias to the union d_u in struct dentry
1565 # Some distros move d_alias to d_u but it is still a struct list
1567 AC_DEFUN([LC_HAVE_DENTRY_D_U_D_ALIAS], [
1568 AS_IF([test "x$lb_cv_compile_i_dentry_d_alias_list" = xyes], [
1569 LB_CHECK_COMPILE([if list 'dentry.d_u.d_alias' exist],
1571 #include <linux/list.h>
1572 #include <linux/dcache.h>
1575 INIT_LIST_HEAD(&de.d_u.d_alias);
1577 AC_DEFINE(HAVE_DENTRY_D_U_D_ALIAS, 1,
1578 [list dentry.d_u.d_alias exist])
1581 LB_CHECK_COMPILE([if hlist 'dentry.d_u.d_alias' exist],
1583 #include <linux/list.h>
1584 #include <linux/dcache.h>
1587 INIT_HLIST_NODE(&de.d_u.d_alias);
1589 AC_DEFINE(HAVE_DENTRY_D_U_D_ALIAS, 1,
1590 [hlist dentry.d_u.d_alias exist])
1593 ]) # LC_HAVE_DENTRY_D_U_D_ALIAS
1596 # LC_HAVE_DENTRY_D_CHILD
1598 # 3.11 kernel d_child has been moved out of the union d_u
1601 AC_DEFUN([LC_HAVE_DENTRY_D_CHILD], [
1602 LB_CHECK_COMPILE([if 'dentry.d_child' exist],
1604 #include <linux/list.h>
1605 #include <linux/dcache.h>
1608 INIT_LIST_HEAD(&de.d_child);
1610 AC_DEFINE(HAVE_DENTRY_D_CHILD, 1,
1611 [dentry.d_child exist])
1613 ]) # LC_HAVE_DENTRY_D_CHILD
1618 # 3.12 ki_left removed from struct kiocb
1620 AC_DEFUN([LC_KIOCB_KI_LEFT], [
1621 LB_CHECK_COMPILE([if 'struct kiocb' with 'ki_left' member],
1623 #include <linux/aio.h>
1625 ((struct kiocb*)0)->ki_left = 0;
1627 AC_DEFINE(HAVE_KIOCB_KI_LEFT, 1,
1630 ]) # LC_KIOCB_KI_LEFT
1633 # LC_VFS_RENAME_5ARGS
1635 # 3.13 has vfs_rename with 5 args
1637 AC_DEFUN([LC_VFS_RENAME_5ARGS], [
1638 LB_CHECK_COMPILE([if Linux kernel has 'vfs_rename' with 5 args],
1640 #include <linux/fs.h>
1642 vfs_rename(NULL, NULL, NULL, NULL, NULL);
1644 AC_DEFINE(HAVE_VFS_RENAME_5ARGS, 1,
1645 [kernel has vfs_rename with 5 args])
1647 ]) # LC_VFS_RENAME_5ARGS
1650 # LC_VFS_UNLINK_3ARGS
1652 # 3.13 has vfs_unlink with 3 args
1654 AC_DEFUN([LC_VFS_UNLINK_3ARGS], [
1655 LB_CHECK_COMPILE([if Linux kernel has 'vfs_unlink' with 3 args],
1657 #include <linux/fs.h>
1659 vfs_unlink(NULL, NULL, NULL);
1661 AC_DEFINE(HAVE_VFS_UNLINK_3ARGS, 1,
1662 [kernel has vfs_unlink with 3 args])
1664 ]) # LC_VFS_UNLINK_3ARGS
1669 # 3.14 move some of its data in struct bio into the new
1672 AC_DEFUN([LC_HAVE_BVEC_ITER], [
1673 LB_CHECK_COMPILE([if Linux kernel has struct bvec_iter],
1675 #include <linux/bio.h>
1677 struct bvec_iter iter;
1678 iter.bi_bvec_done = 0;
1680 AC_DEFINE(HAVE_BVEC_ITER, 1,
1681 [kernel has struct bvec_iter])
1683 ]) # LC_HAVE_BVEC_ITER
1686 # LC_HAVE_TRUNCATE_IPAGE_FINAL
1688 # 3.14 bring truncate_inode_pages_final for evict_inode
1690 AC_DEFUN([LC_HAVE_TRUNCATE_IPAGES_FINAL], [
1691 LB_CHECK_COMPILE([if Linux kernel has truncate_inode_pages_final],
1692 truncate_ipages_final, [
1693 #include <linux/mm.h>
1695 truncate_inode_pages_final(NULL);
1697 AC_DEFINE(HAVE_TRUNCATE_INODE_PAGES_FINAL, 1,
1698 [kernel has truncate_inode_pages_final])
1700 ]) # LC_HAVE_TRUNCATE_IPAGES_FINAL
1703 # LC_VFS_RENAME_6ARGS
1705 # 3.15 has vfs_rename with 6 args
1707 AC_DEFUN([LC_VFS_RENAME_6ARGS], [
1708 LB_CHECK_COMPILE([if Linux kernel has 'vfs_rename' with 6 args],
1710 #include <linux/fs.h>
1712 vfs_rename(NULL, NULL, NULL, NULL, NULL, NULL);
1714 AC_DEFINE(HAVE_VFS_RENAME_6ARGS, 1,
1715 [kernel has vfs_rename with 6 args])
1717 ]) # LC_VFS_RENAME_6ARGS
1720 # LC_DIRECTIO_USE_ITER
1722 # 3.16 kernel changes direct IO to use iov_iter
1724 AC_DEFUN([LC_DIRECTIO_USE_ITER], [
1725 LB_CHECK_COMPILE([if direct IO uses iov_iter],
1727 #include <linux/fs.h>
1729 struct address_space_operations ops;
1730 struct iov_iter *iter = NULL;
1733 ops.direct_IO(0, NULL, iter, offset);
1735 AC_DEFINE(HAVE_DIRECTIO_ITER, 1,
1736 [direct IO uses iov_iter])
1738 ]) # LC_DIRECTIO_USE_ITER
1741 # LC_HAVE_IOV_ITER_INIT_DIRECTION
1744 # 3.16 linux commit 71d8e532b1549a478e6a6a8a44f309d050294d00
1745 # changed iov_iter_init api to start accepting a tag
1746 # that defines if its a read or write operation
1748 AC_DEFUN([LC_HAVE_IOV_ITER_INIT_DIRECTION], [
1749 tmp_flags="$EXTRA_KCFLAGS"
1750 EXTRA_KCFLAGS="-Werror"
1751 LB_CHECK_COMPILE([if 'iov_iter_init' takes a tag],
1753 #include <linux/uio.h>
1754 #include <linux/fs.h>
1756 const struct iovec *iov = NULL;
1758 iov_iter_init(NULL, READ, iov, 1, 0);
1760 AC_DEFINE(HAVE_IOV_ITER_INIT_DIRECTION, 1,
1761 [iov_iter_init handles directional tag])
1763 EXTRA_KCFLAGS="$tmp_flags"
1764 ]) # LC_HAVE_IOV_ITER_INIT_DIRECTION
1767 # LC_HAVE_IOV_ITER_TRUNCATE
1770 # 3.16 introduces a new API iov_iter_truncate()
1772 AC_DEFUN([LC_HAVE_IOV_ITER_TRUNCATE], [
1773 tmp_flags="$EXTRA_KCFLAGS"
1774 EXTRA_KCFLAGS="-Werror"
1775 LB_CHECK_COMPILE([if 'iov_iter_truncate' exists ],
1777 #include <linux/uio.h>
1778 #include <linux/fs.h>
1780 struct iov_iter *i = NULL;
1782 iov_iter_truncate(i, 0);
1784 AC_DEFINE(HAVE_IOV_ITER_TRUNCATE, 1, [iov_iter_truncate exists])
1786 EXTRA_KCFLAGS="$tmp_flags"
1787 ]) # LC_HAVE_IOV_ITER_TRUNCATE
1790 # LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER
1792 # 3.16 introduces [read|write]_iter to struct file_operations
1794 AC_DEFUN([LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER], [
1795 LB_CHECK_COMPILE([if 'file_operations.[read|write]_iter' exist],
1796 file_function_iter, [
1797 #include <linux/fs.h>
1799 ((struct file_operations *)NULL)->read_iter(NULL, NULL);
1800 ((struct file_operations *)NULL)->write_iter(NULL, NULL);
1802 AC_DEFINE(HAVE_FILE_OPERATIONS_READ_WRITE_ITER, 1,
1803 [file_operations.[read|write]_iter functions exist])
1805 ]) # LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER
1810 # 3.17 replaces key_type::match with match_preparse
1811 # and has new struct key_match_data
1813 AC_DEFUN([LC_KEY_MATCH_DATA], [
1814 LB_CHECK_COMPILE([if struct key_match field exist],
1816 #include <linux/key-type.h>
1818 struct key_match_data data;
1820 AC_DEFINE(HAVE_KEY_MATCH_DATA, 1,
1821 [struct key_match_data exist])
1823 ]) # LC_KEY_MATCH_DATA
1826 # LC_NFS_FILLDIR_USE_CTX
1828 # 3.18 kernel moved from void cookie to struct dir_context
1830 AC_DEFUN([LC_NFS_FILLDIR_USE_CTX], [
1831 tmp_flags="$EXTRA_KCFLAGS"
1832 EXTRA_KCFLAGS="-Werror"
1833 LB_CHECK_COMPILE([if filldir_t uses struct dir_context],
1835 #include <linux/fs.h>
1837 int filldir(struct dir_context *ctx, const char* name,
1838 int i, loff_t off, u64 tmp, unsigned temp)
1843 struct dir_context ctx = {
1847 ctx.actor(NULL, "test", 0, (loff_t) 0, 0, 0);
1849 AC_DEFINE(HAVE_FILLDIR_USE_CTX, 1,
1850 [filldir_t needs struct dir_context as argument])
1852 EXTRA_KCFLAGS="$tmp_flags"
1853 ]) # LC_NFS_FILLDIR_USE_CTX
1856 # LC_PERCPU_COUNTER_INIT
1858 # 3.18 For kernels 3.18 and after percpu_counter_init starts
1859 # to pass a GFP_* memory allocation flag for internal
1860 # memory allocation purposes.
1862 AC_DEFUN([LC_PERCPU_COUNTER_INIT], [
1863 LB_CHECK_COMPILE([if percpu_counter_init uses GFP_* flag as argument],
1864 percpu_counter_init, [
1865 #include <linux/percpu_counter.h>
1867 percpu_counter_init(NULL, 0, GFP_KERNEL);
1869 AC_DEFINE(HAVE_PERCPU_COUNTER_INIT_GFP_FLAG, 1,
1870 [percpu_counter_init uses GFP_* flag])
1872 ]) # LC_PERCPU_COUNTER_INIT
1875 # LC_KIOCB_HAS_NBYTES
1877 # 3.19 kernel removed ki_nbytes from struct kiocb
1879 AC_DEFUN([LC_KIOCB_HAS_NBYTES], [
1880 LB_CHECK_COMPILE([if struct kiocb has ki_nbytes field],
1882 #include <linux/fs.h>
1888 AC_DEFINE(HAVE_KI_NBYTES, 1, [ki_nbytes field exist])
1890 ]) # LC_KIOCB_HAS_NBYTES
1893 # LC_HAVE_DQUOT_QC_DQBLK
1895 # 3.19 has quotactl_ops->[sg]et_dqblk that take struct kqid and qc_dqblk
1896 # Added in commit 14bf61ffe
1898 AC_DEFUN([LC_HAVE_DQUOT_QC_DQBLK], [
1899 tmp_flags="$EXTRA_KCFLAGS"
1900 EXTRA_KCFLAGS="-Werror"
1901 LB_CHECK_COMPILE([if 'quotactl_ops.set_dqblk' takes struct qc_dqblk],
1903 #include <linux/fs.h>
1904 #include <linux/quota.h>
1906 ((struct quotactl_ops *)0)->set_dqblk(NULL, *((struct kqid*)0), (struct qc_dqblk*)0);
1908 AC_DEFINE(HAVE_DQUOT_QC_DQBLK, 1,
1909 [quotactl_ops.set_dqblk takes struct qc_dqblk])
1910 AC_DEFINE(HAVE_DQUOT_KQID, 1,
1911 [quotactl_ops.set_dqblk takes struct kqid])
1913 EXTRA_KCFLAGS="$tmp_flags"
1914 ]) # LC_HAVE_DQUOT_QC_DQBLK
1917 # LC_BACKING_DEV_INFO_REMOVAL
1919 # 3.20 kernel removed backing_dev_info from address_space
1921 AC_DEFUN([LC_BACKING_DEV_INFO_REMOVAL], [
1922 LB_CHECK_COMPILE([if struct address_space has backing_dev_info],
1924 #include <linux/fs.h>
1926 struct address_space mapping;
1928 mapping.backing_dev_info = NULL;
1930 AC_DEFINE(HAVE_BACKING_DEV_INFO, 1, [backing_dev_info exist])
1932 ]) # LC_BACKING_DEV_INFO_REMOVAL
1935 # LC_HAVE_BDI_CAP_MAP_COPY
1937 # 3.20 removed mmap handling for backing devices since
1938 # it breaks on non-MMU systems. See kernel commit
1939 # b4caecd48005fbed3949dde6c1cb233142fd69e9
1941 AC_DEFUN([LC_HAVE_BDI_CAP_MAP_COPY], [
1942 LB_CHECK_COMPILE([if have 'BDI_CAP_MAP_COPY'],
1944 #include <linux/backing-dev.h>
1946 struct backing_dev_info info;
1948 info.capabilities = BDI_CAP_MAP_COPY;
1950 AC_DEFINE(HAVE_BDI_CAP_MAP_COPY, 1,
1951 [BDI_CAP_MAP_COPY exist])
1953 ]) # LC_HAVE_BDI_CAP_MAP_COPY
1956 # LC_CANCEL_DIRTY_PAGE
1958 # 4.0.0 kernel removed cancel_dirty_page
1960 AC_DEFUN([LC_CANCEL_DIRTY_PAGE], [
1961 LB_CHECK_COMPILE([if cancel_dirty_page still exist],
1962 cancel_dirty_page, [
1963 #include <linux/mm.h>
1965 cancel_dirty_page(NULL, PAGE_SIZE);
1967 AC_DEFINE(HAVE_CANCEL_DIRTY_PAGE, 1,
1968 [cancel_dirty_page is still available])
1970 ]) # LC_CANCEL_DIRTY_PAGE
1975 # 4.1 kernel has iov_iter_rw
1977 AC_DEFUN([LC_IOV_ITER_RW], [
1978 LB_CHECK_COMPILE([if iov_iter_rw exist],
1980 #include <linux/fs.h>
1981 #include <linux/uio.h>
1983 struct iov_iter *iter = NULL;
1987 AC_DEFINE(HAVE_IOV_ITER_RW, 1,
1988 [iov_iter_rw exist])
1993 # LC_HAVE_SYNC_READ_WRITE
1995 # 4.1 new_sync_[read|write] no longer exported
1997 AC_DEFUN([LC_HAVE_SYNC_READ_WRITE], [
1998 LB_CHECK_EXPORT([new_sync_read], [fs/read_write.c],
1999 [AC_DEFINE(HAVE_SYNC_READ_WRITE, 1,
2000 [new_sync_[read|write] is exported by the kernel])])
2001 ]) # LC_HAVE_SYNC_READ_WRITE
2004 # LC_NEW_CANCEL_DIRTY_PAGE
2006 # 4.2 kernel has new cancel_dirty_page
2008 AC_DEFUN([LC_NEW_CANCEL_DIRTY_PAGE], [
2009 LB_CHECK_COMPILE([if cancel_dirty_page with one argument exist],
2010 new_cancel_dirty_page, [
2011 #include <linux/mm.h>
2013 cancel_dirty_page(NULL);
2015 AC_DEFINE(HAVE_NEW_CANCEL_DIRTY_PAGE, 1,
2016 [cancel_dirty_page with one arguement is available])
2018 ]) # LC_NEW_CANCEL_DIRTY_PAGE
2021 # LC_SYMLINK_OPS_USE_NAMEIDATA
2023 # For the 4.2+ kernels the file system internal symlink api no
2024 # longer uses struct nameidata as a argument
2026 AC_DEFUN([LC_SYMLINK_OPS_USE_NAMEIDATA], [
2027 LB_CHECK_COMPILE([if symlink inode operations have struct nameidata argument],
2028 symlink_use_nameidata, [
2029 #include <linux/namei.h>
2030 #include <linux/fs.h>
2032 struct nameidata *nd = NULL;
2034 ((struct inode_operations *)0)->follow_link(NULL, nd);
2035 ((struct inode_operations *)0)->put_link(NULL, nd, NULL);
2037 AC_DEFINE(HAVE_SYMLINK_OPS_USE_NAMEIDATA, 1,
2038 [symlink inode operations need struct nameidata argument])
2040 ]) # LC_SYMLINK_OPS_USE_NAMEIDATA
2043 # LC_BIO_ENDIO_USES_ONE_ARG
2045 # 4.2 kernel bio_endio now only takes one argument
2047 AC_DEFUN([LC_BIO_ENDIO_USES_ONE_ARG], [
2048 LB_CHECK_COMPILE([if 'bio_endio' with one argument exist],
2050 #include <linux/bio.h>
2054 AC_DEFINE(HAVE_BIO_ENDIO_USES_ONE_ARG, 1,
2055 [bio_endio takes only one argument])
2057 ]) # LC_BIO_ENDIO_USES_ONE_ARG
2060 # LC_HAVE_LOOP_CTL_GET_FREE
2062 # 4.x kernel have moved userspace APIs to
2063 # the separate directory and all of them
2064 # support LOOP_CTL_GET_FREE
2066 AC_DEFUN([LC_HAVE_LOOP_CTL_GET_FREE], [
2067 LB_CHECK_FILE([$LINUX/include/linux/loop.h], [
2068 LB_CHECK_COMPILE([if have 'HAVE_LOOP_CTL_GET_FREE'],
2069 LOOP_CTL_GET_FREE, [
2070 #include <linux/loop.h>
2074 i = LOOP_CTL_GET_FREE;
2076 AC_DEFINE(HAVE_LOOP_CTL_GET_FREE, 1,
2077 [LOOP_CTL_GET_FREE exist])
2080 AC_DEFINE(HAVE_LOOP_CTL_GET_FREE, 1,
2081 [kernel has LOOP_CTL_GET_FREE])
2083 ]) # LC_HAVE_LOOP_CTL_GET_FREE
2086 # LC_HAVE_CACHE_HEAD_HLIST
2088 # 4.3 kernel swiched to hlist for cache_head
2090 AC_DEFUN([LC_HAVE_CACHE_HEAD_HLIST], [
2091 LB_CHECK_COMPILE([if 'struct cache_head' has 'cache_list' field],
2092 cache_head_has_hlist, [
2093 #include <linux/sunrpc/cache.h>
2095 do {} while(sizeof(((struct cache_head *)0)->cache_list));
2097 AC_DEFINE(HAVE_CACHE_HEAD_HLIST, 1,
2098 [cache_head has hlist cache_list])
2100 ]) # LC_HAVE_CACHE_HEAD_HLIST
2103 # LC_HAVE_LOCKS_LOCK_FILE_WAIT
2105 # 4.4 kernel have moved locks API users to
2106 # locks_lock_inode_wait()
2108 AC_DEFUN([LC_HAVE_LOCKS_LOCK_FILE_WAIT], [
2109 LB_CHECK_COMPILE([if 'locks_lock_file_wait' exists],
2110 locks_lock_file_wait, [
2111 #include <linux/fs.h>
2113 locks_lock_file_wait(NULL, NULL);
2115 AC_DEFINE(HAVE_LOCKS_LOCK_FILE_WAIT, 1,
2116 [kernel has locks_lock_file_wait])
2118 ]) # LC_HAVE_LOCKS_LOCK_FILE_WAIT
2121 # LC_HAVE_QC_MAKE_REQUEST_FN
2123 # 4.4 request_queue.make_request_fn defined as function returns with blk_qc_t
2124 # see kernel commit dece16353ef47d8d33f5302bc158072a9d65e26f
2126 AC_DEFUN([LC_HAVE_QC_MAKE_REQUEST_FN], [
2127 LB_CHECK_COMPILE([if 'request_queue.make_request_fn' returns blk_qc_t],
2128 make_request_fn_blk_qc_t, [
2129 #include <linux/blkdev.h>
2132 make_request_fn *mrf;
2133 ret = mrf(NULL, NULL);
2135 AC_DEFINE(HAVE_QC_MAKE_REQUEST_FN, 1,
2136 [request_queue.make_request_fn returns blk_qc_t])
2138 ]) # LC_HAVE_QC_MAKE_REQUEST_FN
2141 # LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
2143 # 4.4 kernel merged type-specific data with the payload data for keys
2145 AC_DEFUN([LC_HAVE_KEY_PAYLOAD_DATA_ARRAY], [
2146 LB_CHECK_COMPILE([if 'struct key' has 'payload.data' as an array],
2147 key_payload_data_array, [
2148 #include <linux/key.h>
2150 ((struct key *)0)->payload.data[0] = NULL;
2152 AC_DEFINE(HAVE_KEY_PAYLOAD_DATA_ARRAY, 1, [payload.data is an array])
2154 ]) #LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
2157 # LC_HAVE_FILE_DENTRY
2159 # 4.5 adds wrapper file_dentry
2161 AC_DEFUN([LC_HAVE_FILE_DENTRY], [
2162 LB_CHECK_COMPILE([if Linux kernel has 'file_dentry'],
2164 #include <linux/fs.h>
2168 AC_DEFINE(HAVE_FILE_DENTRY, 1,
2169 [kernel has file_dentry])
2171 ]) # LC_HAVE_FILE_DENTRY
2174 # LC_HAVE_INODE_LOCK
2176 # 4.5 introduced inode_lock
2178 AC_DEFUN([LC_HAVE_INODE_LOCK], [
2179 LB_CHECK_COMPILE([if 'inode_lock' is defined],
2181 #include <linux/fs.h>
2185 AC_DEFINE(HAVE_INODE_LOCK, 1,
2186 [inode_lock is defined])
2188 ]) # LC_HAVE_INODE_LOCK
2191 # LC_HAVE_IOP_GET_LINK
2193 # 4.5 vfs replaced iop->follow_link with
2196 AC_DEFUN([LC_HAVE_IOP_GET_LINK], [
2197 LB_CHECK_COMPILE([if 'iop' has 'get_link'],
2198 inode_ops_get_link, [
2199 #include <linux/fs.h>
2201 struct inode_operations iop;
2202 iop.get_link = NULL;
2204 AC_DEFINE(HAVE_IOP_GET_LINK, 1,
2205 [have iop get_link])
2207 ]) # LC_HAVE_IOP_GET_LINK
2210 # LC_HAVE_IN_COMPAT_SYSCALL
2212 # 4.6 renamed is_compat_task to in_compat_syscall
2214 AC_DEFUN([LC_HAVE_IN_COMPAT_SYSCALL], [
2215 LB_CHECK_COMPILE([if 'in_compat_syscall' is defined],
2216 in_compat_syscall, [
2217 #include <linux/compat.h>
2219 in_compat_syscall();
2221 AC_DEFINE(HAVE_IN_COMPAT_SYSCALL, 1,
2222 [have in_compat_syscall])
2224 ]) # LC_HAVE_IN_COMPAT_SYSCALL
2229 # Lustre linux kernel checks
2231 AC_DEFUN([LC_PROG_LINUX], [
2232 AC_MSG_NOTICE([Lustre kernel checks
2233 ==============================================================================])
2237 LC_CONFIG_HEALTH_CHECK_WRITE
2238 LC_CONFIG_LRU_RESIZE
2239 LC_LLITE_LLOOP_MODULE
2241 LC_GLIBC_SUPPORT_FHANDLES
2246 LC_BLK_QUEUE_MAX_SEGMENTS
2249 LC_HAVE_DQUOT_FS_DISK_QUOTA
2250 LC_HAVE_DQUOT_SUSPEND
2251 LC_HAVE_ADD_WAIT_QUEUE_EXCLUSIVE
2255 LC_EXPORT_SIMPLE_SETATTR
2256 LC_EXPORT_TRUNCATE_COMPLETE_PAGE
2260 LC_SBOPS_EVICT_INODE
2266 LC_BLKDEV_GET_BY_DEV
2267 LC_GENERIC_PERMISSION
2274 LC_REQUEST_QUEUE_UNPLUG_FN
2275 LC_HAVE_FHANDLE_SYSCALLS
2276 LC_HAVE_FSTYPE_MOUNT
2278 LC_HAVE_INODE_OWNER_OR_CAPABLE
2279 LC_HAVE_SECURITY_IINITSEC
2282 LC_DIRTY_INODE_WITH_FLAG
2285 LC_LM_XXX_LOCK_MANAGER_OPS
2289 LC_INODE_PERMISION_2ARGS
2290 LC_RADIX_EXCEPTION_ENTRY
2291 LC_HAVE_LOOP_CTL_GET_FREE
2294 LC_HAVE_VOID_MAKE_REQUEST_FN
2295 LC_HAVE_PROTECT_I_NLINK
2298 LC_HAVE_MIGRATE_HEADER
2299 LC_MIGRATEPAGE_4ARGS
2300 LC_SUPEROPS_USE_DENTRY
2301 LC_INODEOPS_USE_UMODE_T
2302 LC_HAVE_CACHE_REGISTER
2306 LC_KMAP_ATOMIC_HAS_1ARG
2310 LC_HAVE_ENCODE_FH_PARENT
2311 LC_FILE_LLSEEK_SIZE_5ARG
2314 LC_DATA_FOR_LLITE_IS_LIST
2315 LC_DENTRY_OPEN_USE_PATH
2316 LC_HAVE_IOP_ATOMIC_OPEN
2317 LC_HAVE_SB_START_WRITE
2320 LC_HAVE_POSIXACL_USER_NS
2323 LC_HAVE_FILE_F_INODE
2325 LC_HAVE_SUNRPC_UPCALL_HAS_3ARGS
2328 LC_HAVE_HLIST_FOR_EACH_3ARG
2329 LC_HAVE_BIO_END_SECTOR
2333 LC_BLKDEV_RELEASE_RETURN_INT
2334 LC_HAVE_REMOVE_PROC_SUBTREE
2336 LC_HAVE_SECURITY_DENTRY_INIT_SECURITY
2343 LC_HAVE_DENTRY_D_U_D_ALIAS
2344 LC_HAVE_DENTRY_D_CHILD
2347 LC_OLDSIZE_TRUNCATE_PAGECACHE
2356 LC_HAVE_TRUNCATE_IPAGES_FINAL
2362 LC_DIRECTIO_USE_ITER
2363 LC_HAVE_IOV_ITER_INIT_DIRECTION
2364 LC_HAVE_IOV_ITER_TRUNCATE
2365 LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER
2371 LC_PERCPU_COUNTER_INIT
2372 LC_NFS_FILLDIR_USE_CTX
2376 LC_HAVE_DQUOT_QC_DQBLK
2379 LC_BACKING_DEV_INFO_REMOVAL
2380 LC_HAVE_BDI_CAP_MAP_COPY
2383 LC_CANCEL_DIRTY_PAGE
2387 LC_HAVE_SYNC_READ_WRITE
2390 LC_NEW_CANCEL_DIRTY_PAGE
2391 LC_BIO_ENDIO_USES_ONE_ARG
2392 LC_SYMLINK_OPS_USE_NAMEIDATA
2395 LC_HAVE_CACHE_HEAD_HLIST
2398 LC_HAVE_LOCKS_LOCK_FILE_WAIT
2399 LC_HAVE_QC_MAKE_REQUEST_FN
2400 LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
2407 LC_HAVE_IOP_GET_LINK
2410 LC_HAVE_IN_COMPAT_SYSCALL
2413 AS_IF([test "x$enable_server" != xno], [
2414 LC_FUNC_DEV_SET_RDONLY
2424 # Check whether to build the client side of Lustre
2426 AC_DEFUN([LC_CONFIG_CLIENT], [
2427 AC_MSG_CHECKING([whether to build Lustre client support])
2428 AC_ARG_ENABLE([client],
2429 AC_HELP_STRING([--disable-client],
2430 [disable Lustre client support]),
2431 [], [enable_client="yes"])
2432 AC_MSG_RESULT([$enable_client])
2433 ]) # LC_CONFIG_CLIENT
2438 AC_DEFUN([LB_CONFIG_MPITESTS], [
2439 AC_ARG_ENABLE([mpitests],
2440 AC_HELP_STRING([--enable-mpitests=<yes|no|mpicc wrapper>],
2441 [include mpi tests]), [
2442 enable_mpitests="yes"
2445 MPICC_WRAPPER="mpicc"
2448 enable_mpitests="no"
2451 MPICC_WRAPPER=$enableval
2455 enable_mpitests="yes"
2456 MPICC_WRAPPER="mpicc"
2459 if test "x$enable_mpitests" != "xno"; then
2462 AC_CACHE_CHECK([whether mpitests can be built],
2463 lb_cv_mpi_tests, [AC_COMPILE_IFELSE([AC_LANG_SOURCE([
2467 MPI_Initialized(&flag);
2470 ])], [lb_cv_mpi_tests="yes"], [lb_cv_mpi_tests="no"])
2472 enable_mpitests=$lb_cv_mpi_tests
2475 AC_SUBST(MPICC_WRAPPER)
2476 ]) # LB_CONFIG_MPITESTS
2481 # whether to enable quota support global control
2483 AC_DEFUN([LC_CONFIG_QUOTA], [
2484 AC_MSG_CHECKING([whether to enable quota support global control])
2485 AC_ARG_ENABLE([quota],
2486 AC_HELP_STRING([--enable-quota],
2487 [enable quota support]),
2488 [], [enable_quota="yes"])
2489 AS_IF([test "x$enable_quota" = xyes],
2490 [AC_MSG_RESULT([yes])],
2491 [AC_MSG_RESULT([no])])
2492 ]) # LC_CONFIG_QUOTA
2497 AC_DEFUN([LC_QUOTA], [
2501 AS_IF([test "x$enable_quota" != xno -a "x$enable_utils" != xno], [
2502 AC_CHECK_HEADER([sys/quota.h],
2503 [AC_DEFINE(HAVE_SYS_QUOTA_H, 1,
2504 [Define to 1 if you have <sys/quota.h>.])],
2505 [AC_MSG_ERROR([don't find <sys/quota.h> in your system])])
2510 # LC_CONFIG_NODEMAP_PROC_DEBUG
2512 # enable nodemap proc file debugging
2514 AC_DEFUN([LC_NODEMAP_PROC_DEBUG], [
2515 AC_MSG_CHECKING([whether to enable nodemap proc debug])
2516 AC_ARG_ENABLE([nodemap_proc_debug],
2517 AC_HELP_STRING([--enable-nodemap-proc-debug],
2518 [enable nodemap proc debug]),
2519 [], [enable_nodemap_proc_debug="no"])
2520 AC_MSG_RESULT([$enable_nodemap_proc_debug])
2521 AS_IF([test "x$enable_nodemap_proc_debug" != xno],
2522 [AC_DEFINE(NODEMAP_PROC_DEBUG, 1,
2523 [enable nodemap proc debug support])])
2524 ]) # LC_NODEMAP_PROC_DEBUG
2527 # LC_LLITE_LLOOP_MODULE
2529 # lloop_llite.ko does not currently work with page sizes
2532 AC_DEFUN([LC_LLITE_LLOOP_MODULE], [
2533 LB_CHECK_COMPILE([whether to enable 'llite_lloop' module],
2534 enable_llite_lloop_module, [
2535 #include <asm/page.h>
2537 #if PAGE_SIZE >= 65536
2538 #error "PAGE_SIZE >= 65536"
2541 [enable_llite_lloop_module="yes"],
2542 [enable_llite_lloop_module="no"])
2543 ]) # LC_LLITE_LLOOP_MODULE
2548 # configure support for optional OSD implementation
2550 AC_DEFUN([LC_OSD_ADDON], [
2551 AC_MSG_CHECKING([whether to use OSD addon])
2553 AC_HELP_STRING([--with-osd=path],
2554 [set path to optional osd]),
2561 OSDADDON="$with_osd"
2568 AS_IF([test $ENABLEOSDADDON -eq 0], [
2572 OSDMODNAME=$(basename $OSDADDON)
2573 AS_IF([test -e $LUSTRE/$OSDMODNAME], [
2574 AC_MSG_RESULT([can't link])
2576 ], [ln -s $OSDADDON $LUSTRE/$OSDMODNAME], [
2577 AC_MSG_RESULT([$OSDMODNAME])
2578 OSDADDON="subdir-m += $OSDMODNAME"
2580 AC_MSG_RESULT([can't link])
2590 # other configure checks
2592 AC_DEFUN([LC_CONFIGURE], [
2593 AC_MSG_NOTICE([Lustre core checks
2594 ==============================================================================])
2596 LC_CONFIG_OBD_BUFFER_SIZE
2598 AS_IF([test $target_cpu == "i686" -o $target_cpu == "x86_64"],
2599 [CFLAGS="$CFLAGS -Wall -Werror"])
2601 # maximum MDS thread count
2604 # lustre/utils/gss/gss_util.c
2605 # lustre/utils/gss/gssd_proc.c
2606 # lustre/utils/gss/krb5_util.c
2607 # lustre/utils/llog_reader.c
2608 # lustre/utils/create_iam.c
2609 # lustre/utils/libiam.c
2610 AC_CHECK_HEADERS([netdb.h endian.h])
2611 AC_CHECK_FUNCS([gethostbyname])
2613 # lustre/utils/llverdev.c
2614 AC_CHECK_HEADERS([blkid/blkid.h])
2616 # lustre/utils/llverfs.c
2617 AC_CHECK_HEADERS([ext2fs/ext2fs.h])
2620 AC_CHECK_LIB([selinux], [is_selinux_enabled],
2621 [AC_CHECK_HEADERS([selinux/selinux.h],
2622 [SELINUX="-lselinux"
2623 AC_DEFINE([HAVE_SELINUX], 1,
2624 [support for selinux ])],
2627 No libselinux-devel package found, unable to build selinux enabled tools
2632 No selinux package found, unable to build selinux enabled tools
2638 AC_MSG_CHECKING([whether to report minimum OST free space])
2639 AC_ARG_ENABLE([mindf],
2640 AC_HELP_STRING([--enable-mindf],
2641 [Make statfs report the minimum available space on any single OST instead of the sum of free space on all OSTs]),
2642 [], [enable_mindf="no"])
2643 AC_MSG_RESULT([$enable_mindf])
2644 AS_IF([test "$enable_mindf" = "yes"],
2645 [AC_DEFINE([MIN_DF], 1, [Report minimum OST free space])])
2647 AC_MSG_CHECKING([whether to randomly failing memory alloc])
2648 AC_ARG_ENABLE([fail_alloc],
2649 AC_HELP_STRING([--disable-fail-alloc],
2650 [disable randomly alloc failure]),
2651 [], [enable_fail_alloc="yes"])
2652 AC_MSG_RESULT([$enable_fail_alloc])
2653 AS_IF([test "x$enable_fail_alloc" != xno],
2654 [AC_DEFINE([RANDOM_FAIL_ALLOC], 1,
2655 [enable randomly alloc failure])])
2657 AC_MSG_CHECKING([whether to check invariants (expensive cpu-wise)])
2658 AC_ARG_ENABLE([invariants],
2659 AC_HELP_STRING([--enable-invariants],
2660 [enable invariant checking (cpu intensive)]),
2661 [], [enable_invariants="no"])
2662 AC_MSG_RESULT([$enable_invariants])
2663 AS_IF([test "x$enable_invariants" = xyes],
2664 [AC_DEFINE([CONFIG_LUSTRE_DEBUG_EXPENSIVE_CHECK], 1,
2665 [enable invariant checking])])
2667 AC_MSG_CHECKING([whether to track references with lu_ref])
2668 AC_ARG_ENABLE([lu_ref],
2669 AC_HELP_STRING([--enable-lu_ref],
2670 [enable lu_ref reference tracking code]),
2671 [], [enable_lu_ref="no"])
2672 AC_MSG_RESULT([$enable_lu_ref])
2673 AS_IF([test "x$enable_lu_ref" = xyes],
2674 [AC_DEFINE([USE_LU_REF], 1,
2675 [enable lu_ref reference tracking code])])
2677 AC_MSG_CHECKING([whether to enable page state tracking])
2678 AC_ARG_ENABLE([pgstate-track],
2679 AC_HELP_STRING([--enable-pgstate-track],
2680 [enable page state tracking]),
2681 [], [enable_pgstat_track="no"])
2682 AC_MSG_RESULT([$enable_pgstat_track])
2683 AS_IF([test "x$enable_pgstat_track" = xyes],
2684 [AC_DEFINE([CONFIG_DEBUG_PAGESTATE_TRACKING], 1,
2685 [enable page state tracking code])])
2691 # AM_CONDITIONALS for lustre
2693 AC_DEFUN([LC_CONDITIONALS], [
2694 AM_CONDITIONAL(MPITESTS, test x$enable_mpitests = xyes, Build MPI Tests)
2695 AM_CONDITIONAL(CLIENT, test x$enable_client = xyes)
2696 AM_CONDITIONAL(SERVER, test x$enable_server = xyes)
2697 AM_CONDITIONAL(SPLIT, test x$enable_split = xyes)
2698 AM_CONDITIONAL(BLKID, test x$ac_cv_header_blkid_blkid_h = xyes)
2699 AM_CONDITIONAL(EXT2FS_DEVEL, test x$ac_cv_header_ext2fs_ext2fs_h = xyes)
2700 AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
2701 AM_CONDITIONAL(GSS_KEYRING, test x$enable_gss_keyring = xyes)
2702 AM_CONDITIONAL(GSS_PIPEFS, test x$enable_gss_pipefs = xyes)
2703 AM_CONDITIONAL(GSS_SSK, test x$enable_ssk = xyes)
2704 AM_CONDITIONAL(LIBPTHREAD, test x$enable_libpthread = xyes)
2705 AM_CONDITIONAL(LLITE_LLOOP, test x$enable_llite_lloop_module = xyes)
2706 ]) # LC_CONDITIONALS
2711 # files that should be generated with AC_OUTPUT
2713 AC_DEFUN([LC_CONFIG_FILES],
2717 lustre/autoconf/Makefile
2718 lustre/conf/Makefile
2719 lustre/contrib/Makefile
2721 lustre/include/Makefile
2722 lustre/include/lustre/Makefile
2723 lustre/kernel_patches/targets/3.10-rhel7.target
2724 lustre/kernel_patches/targets/2.6-rhel6.8.target
2725 lustre/kernel_patches/targets/2.6-rhel6.7.target
2726 lustre/kernel_patches/targets/2.6-rhel6.6.target
2727 lustre/kernel_patches/targets/2.6-rhel6.target
2728 lustre/kernel_patches/targets/2.6-rhel5.target
2729 lustre/kernel_patches/targets/2.6-sles11.target
2730 lustre/kernel_patches/targets/3.0-sles11.target
2731 lustre/kernel_patches/targets/3.0-sles11sp3.target
2732 lustre/kernel_patches/targets/3.0-sles11sp4.target
2733 lustre/kernel_patches/targets/3.12-sles12.target
2734 lustre/kernel_patches/targets/2.6-fc11.target
2735 lustre/kernel_patches/targets/2.6-fc12.target
2736 lustre/kernel_patches/targets/2.6-fc15.target
2737 lustre/kernel_patches/targets/3.x-fc18.target
2738 lustre/ldlm/Makefile
2740 lustre/fid/autoMakefile
2741 lustre/llite/Makefile
2742 lustre/llite/autoMakefile
2744 lustre/lov/autoMakefile
2746 lustre/mdc/autoMakefile
2748 lustre/lmv/autoMakefile
2749 lustre/lfsck/Makefile
2750 lustre/lfsck/autoMakefile
2752 lustre/mdt/autoMakefile
2754 lustre/mdd/autoMakefile
2756 lustre/fld/autoMakefile
2757 lustre/obdclass/Makefile
2758 lustre/obdclass/autoMakefile
2759 lustre/obdclass/linux/Makefile
2760 lustre/obdecho/Makefile
2761 lustre/obdecho/autoMakefile
2763 lustre/ofd/autoMakefile
2765 lustre/osc/autoMakefile
2767 lustre/ost/autoMakefile
2768 lustre/osd-ldiskfs/Makefile
2769 lustre/osd-ldiskfs/autoMakefile
2770 lustre/osd-zfs/Makefile
2771 lustre/osd-zfs/autoMakefile
2773 lustre/mgc/autoMakefile
2775 lustre/mgs/autoMakefile
2776 lustre/target/Makefile
2777 lustre/ptlrpc/Makefile
2778 lustre/ptlrpc/autoMakefile
2779 lustre/ptlrpc/gss/Makefile
2780 lustre/ptlrpc/gss/autoMakefile
2781 lustre/quota/Makefile
2782 lustre/quota/autoMakefile
2783 lustre/scripts/Makefile
2784 lustre/tests/Makefile
2785 lustre/tests/mpi/Makefile
2786 lustre/utils/Makefile
2787 lustre/utils/gss/Makefile
2789 lustre/osp/autoMakefile
2791 lustre/lod/autoMakefile
2793 ]) # LC_CONFIG_FILES