-#
-AC_DEFUN([LC_CONFIG_CHECKSUM],
-[AC_MSG_CHECKING([whether to enable data checksum support])
-AC_ARG_ENABLE([checksum],
- AC_HELP_STRING([--disable-checksum],
- [disable data checksum support]),
- [],[enable_checksum='yes'])
-AC_MSG_RESULT([$enable_checksum])
-if test x$enable_checksum != xno ; then
- AC_DEFINE(ENABLE_CHECKSUM, 1, do data checksums)
-fi
-])
-
-#
-# LC_CONFIG_LIBLUSTRE_RECOVERY
-#
-AC_DEFUN([LC_CONFIG_LIBLUSTRE_RECOVERY],
-[AC_MSG_CHECKING([whether to enable liblustre recovery support])
-AC_ARG_ENABLE([liblustre-recovery],
- AC_HELP_STRING([--disable-liblustre-recovery],
- [disable liblustre recovery support]),
- [],[enable_liblustre_recovery='yes'])
-AC_MSG_RESULT([$enable_liblustre_recovery])
-if test x$enable_liblustre_recovery != xno ; then
- AC_DEFINE(ENABLE_LIBLUSTRE_RECOVERY, 1, Liblustre Can Recover)
-fi
-])
-
-#
-# LC_CONFIG_HEALTH_CHECK_WRITE
-#
-# Turn off the actual write to the disk
-#
-AC_DEFUN([LC_CONFIG_HEALTH_CHECK_WRITE],
-[AC_MSG_CHECKING([whether to enable a write with the health check])
-AC_ARG_ENABLE([health_write],
- AC_HELP_STRING([--enable-health_write],
- [enable disk writes when doing health check]),
- [],[enable_health_write='no'])
-AC_MSG_RESULT([$enable_health_write])
-if test x$enable_health_write != xno ; then
- AC_DEFINE(USE_HEALTH_CHECK_WRITE, 1, Write when Checking Health)
-fi
-])
-
-AC_DEFUN([LC_CONFIG_LRU_RESIZE],
-[AC_MSG_CHECKING([whether to enable lru self-adjusting])
-AC_ARG_ENABLE([lru_resize],
- AC_HELP_STRING([--enable-lru-resize],
- [enable lru resize support]),
- [],[enable_lru_resize='yes'])
-AC_MSG_RESULT([$enable_lru_resize])
-if test x$enable_lru_resize != xno; then
- AC_DEFINE(HAVE_LRU_RESIZE_SUPPORT, 1, [Enable lru resize support])
-fi
-])
-
-#
-# Quota support. The kernel must support CONFIG_QUOTA.
-#
-AC_DEFUN([LC_QUOTA_CONFIG],
-[LB_LINUX_CONFIG_IM([QUOTA],[],[
- AC_MSG_ERROR([Lustre quota requires that CONFIG_QUOTA is enabled in your kernel.])
- ])
-])
-
-# truncate_complete_page() was exported from RHEL5/SLES10, but not in SLES11 SP0 (2.6.27)
-# remove_from_page_cache() was exported between 2.6.35 and 2.6.38
-# delete_from_page_cache() is exported from 2.6.39
-AC_DEFUN([LC_EXPORT_TRUNCATE_COMPLETE],
- [LB_CHECK_SYMBOL_EXPORT([truncate_complete_page],
- [mm/truncate.c],
- [AC_DEFINE(HAVE_TRUNCATE_COMPLETE_PAGE, 1,
- [kernel export truncate_complete_page])])
- LB_CHECK_SYMBOL_EXPORT([remove_from_page_cache],
- [mm/filemap.c],
- [AC_DEFINE(HAVE_REMOVE_FROM_PAGE_CACHE, 1,
- [kernel export remove_from_page_cache])])
- LB_CHECK_SYMBOL_EXPORT([delete_from_page_cache],
- [mm/filemap.c],
- [AC_DEFINE(HAVE_DELETE_FROM_PAGE_CACHE, 1,
- [kernel export delete_from_page_cache])])
- ])
-
-AC_DEFUN([LC_EXPORT_D_REHASH_COND],
-[LB_CHECK_SYMBOL_EXPORT([d_rehash_cond],
-[fs/dcache.c],[
-AC_DEFINE(HAVE_D_REHASH_COND, 1,
- [d_rehash_cond is exported by the kernel])
-],[
-])
-])
-
-AC_DEFUN([LC_EXPORT___D_REHASH],
-[LB_CHECK_SYMBOL_EXPORT([__d_rehash],
-[fs/dcache.c],[
-AC_DEFINE(HAVE___D_REHASH, 1,
- [__d_rehash is exported by the kernel])
-],[
-])
-])
-
-# The actual symbol exported varies among architectures, so we need
-# to check many symbols (but only in the current architecture.) No
-# matter what symbol is exported, the kernel #defines node_to_cpumask
-# to the appropriate function and that's what we use.
-AC_DEFUN([LC_EXPORT_NODE_TO_CPUMASK],
- [LB_CHECK_SYMBOL_EXPORT([node_to_cpumask],
- [arch/$LINUX_ARCH/mm/numa.c],
- [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
- [node_to_cpumask is exported by
- the kernel])]) # x86_64
- LB_CHECK_SYMBOL_EXPORT([node_to_cpu_mask],
- [arch/$LINUX_ARCH/kernel/smpboot.c],
- [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
- [node_to_cpumask is exported by
- the kernel])]) # ia64
- LB_CHECK_SYMBOL_EXPORT([node_2_cpu_mask],
- [arch/$LINUX_ARCH/kernel/smpboot.c],
- [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
- [node_to_cpumask is exported by
- the kernel])]) # i386
- ])
-
-#
-#
-# between 2.6.5 - 2.6.22 filemap_populate is exported in some kernels
-#
-AC_DEFUN([LC_FILEMAP_POPULATE],
-[AC_MSG_CHECKING([for exported filemap_populate])
-LB_LINUX_TRY_COMPILE([
- #include <asm/page.h>
- #include <linux/mm.h>
-],[
- filemap_populate(NULL, 0, 0, __pgprot(0), 0, 0);
-],[
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_FILEMAP_POPULATE, 1, [Kernel exports filemap_populate])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-#
-# added in 2.6.17
-#
-AC_DEFUN([LC_BIT_SPINLOCK_H],
-[LB_CHECK_FILE([$LINUX/include/linux/bit_spinlock.h],[
- AC_MSG_CHECKING([if bit_spinlock.h can be compiled])
- LB_LINUX_TRY_COMPILE([
- #include <asm/processor.h>
- #include <linux/spinlock.h>
- #include <linux/bit_spinlock.h>
- ],[],[
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_BIT_SPINLOCK_H, 1, [Kernel has bit_spinlock.h])
- ],[
- AC_MSG_RESULT([no])
- ])
-],
-[])
-])
-
-#
-# LC_CONST_ACL_SIZE
-#
-AC_DEFUN([LC_CONST_ACL_SIZE],
-[AC_MSG_CHECKING([calc acl size])
-tmp_flags="$CFLAGS"
-CFLAGS="$CFLAGS -I$LINUX/include -I$LINUX_OBJ/include -I$LINUX_OBJ/include2 -I$LINUX/arch/`echo $target_cpu|sed -e 's/powerpc64/powerpc/' -e 's/x86_64/x86/' -e 's/i.86/x86/'`/include -include $AUTOCONF_HDIR/autoconf.h $EXTRA_KCFLAGS"
-AC_TRY_RUN([
- #define __KERNEL__
- #include <linux/types.h>
- #undef __KERNEL__
- // block include
- #define __LINUX_POSIX_ACL_H
-
- #ifdef CONFIG_FS_POSIX_ACL
- # include <linux/posix_acl_xattr.h>
- #endif
-
- #include <stdio.h>
-
- int main(void)
- {
- /* LUSTRE_POSIX_ACL_MAX_ENTRIES = 32 */
- int size = posix_acl_xattr_size(32);
- FILE *f = fopen("acl.size","w+");
- fprintf(f,"%d", size);
- fclose(f);
-
- return 0;
- }
-],[
- acl_size=`cat acl.size`
- AC_MSG_RESULT([ACL size $acl_size])
- AC_DEFINE_UNQUOTED(XATTR_ACL_SIZE, AS_TR_SH([$acl_size]), [size of xattr acl])
-],[
- AC_ERROR([ACL size can't be computed])
-],[
- AC_MSG_RESULT([can't check ACL size, make it 260])
- AC_DEFINE_UNQUOTED(XATTR_ACL_SIZE,260)
-])
-CFLAGS="$tmp_flags"
-])
-
-#
-# LC_CAPA_CRYPTO
-#
-AC_DEFUN([LC_CAPA_CRYPTO],
-[LB_LINUX_CONFIG_IM([CRYPTO],[],[
- AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO is enabled in your kernel.])
-])
-LB_LINUX_CONFIG_IM([CRYPTO_HMAC],[],[
- AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_HMAC is enabled in your kernel.])
-])
-LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],[
- AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_SHA1 is enabled in your kernel.])
-])
-])
-
-#
-# LC_CONFIG_RMTCLIENT
-#
-dnl FIXME
-dnl the AES symbol usually tied with arch, e.g. CRYPTO_AES_586
-dnl FIXME
-AC_DEFUN([LC_CONFIG_RMTCLIENT],
-[LB_LINUX_CONFIG_IM([CRYPTO_AES],[],[
- AC_MSG_WARN([Lustre remote client require that CONFIG_CRYPTO_AES is enabled in your kernel.])
-])
-])
-
-#
-# LC_CONFIG_GSS_KEYRING (default enabled, if gss is enabled)
-#
-AC_DEFUN([LC_CONFIG_GSS_KEYRING],
-[AC_MSG_CHECKING([whether to enable gss keyring backend])
- AC_ARG_ENABLE([gss_keyring],
- [AC_HELP_STRING([--disable-gss-keyring],
- [disable gss keyring backend])],
- [],[enable_gss_keyring='yes'])
- AC_MSG_RESULT([$enable_gss_keyring])
-
- if test x$enable_gss_keyring != xno; then
- LB_LINUX_CONFIG_IM([KEYS],[],
- [AC_MSG_ERROR([GSS keyring backend require that CONFIG_KEYS be enabled in your kernel.])])
-
- AC_CHECK_LIB([keyutils], [keyctl_search], [],
- [AC_MSG_ERROR([libkeyutils is not found, which is required by gss keyring backend])],)
-
- AC_DEFINE([HAVE_GSS_KEYRING], [1],
- [Define this if you enable gss keyring backend])
- fi
-])
-
-AC_DEFUN([LC_CONFIG_SUNRPC],
-[LB_LINUX_CONFIG_IM([SUNRPC],[],
- [AC_MSG_ERROR([kernel SUNRPC support is required by using GSS.])])
-])
-
-#
-# LC_CONFIG_GSS (default disabled)
-#
-# Build gss and related tools of Lustre. Currently both kernel and user space
-# parts are depend on linux platform.
-#
-AC_DEFUN([LC_CONFIG_GSS],
-[AC_MSG_CHECKING([whether to enable gss/krb5 support])
- AC_ARG_ENABLE([gss],
- [AC_HELP_STRING([--enable-gss], [enable gss/krb5 support])],
- [],[enable_gss='no'])
- AC_MSG_RESULT([$enable_gss])
-
- if test x$enable_gss == xyes; then
- LC_CONFIG_GSS_KEYRING
- LC_CONFIG_SUNRPC
-
- AC_DEFINE([HAVE_GSS], [1], [Define this if you enable gss])
-
- LB_LINUX_CONFIG_IM([CRYPTO_MD5],[],
- [AC_MSG_WARN([kernel MD5 support is recommended by using GSS.])])
- LB_LINUX_CONFIG_IM([CRYPTO_SHA1],[],
- [AC_MSG_WARN([kernel SHA1 support is recommended by using GSS.])])
- LB_LINUX_CONFIG_IM([CRYPTO_SHA256],[],
- [AC_MSG_WARN([kernel SHA256 support is recommended by using GSS.])])
- LB_LINUX_CONFIG_IM([CRYPTO_SHA512],[],
- [AC_MSG_WARN([kernel SHA512 support is recommended by using GSS.])])
-
- AC_CHECK_LIB([gssapi], [gss_init_sec_context],
- [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssapi"],
- [AC_CHECK_LIB([gssglue], [gss_init_sec_context],
- [GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssglue"],
- [AC_MSG_ERROR([libgssapi or libgssglue is not found, which is required by GSS.])])],)
-
- AC_SUBST(GSSAPI_LIBS)
-
- AC_KERBEROS_V5
- fi
-])
-
-AC_DEFUN([LC_TASK_CLENV_STORE],
-[
- AC_MSG_CHECKING([if we can store cl_env in task_struct])
- if test x$have_task_clenv_store != xyes ; then
- LC_TASK_CLENV_TUX_INFO
- fi
-])
-
-# 2.6.12
-
-# ~2.6.12 merge patch from oracle to convert tree_lock from spinlock to rwlock
-# yet tree_lock is converted from rwlock to spin_lock since v2.6.26
-AC_DEFUN([LC_RW_TREE_LOCK],
-[AC_MSG_CHECKING([if kernel has tree_lock as rwlock])
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_LINUX_TRY_COMPILE([
- #include <linux/fs.h>
-],[
- struct address_space a;
-
- write_lock(&a.tree_lock);
-],[
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_RW_TREE_LOCK, 1, [kernel has tree_lock as rw_lock])
-],[
- AC_MSG_RESULT([no])
-])
-EXTRA_KCFLAGS="$tmp_flags"
-])
-
-# 2.6.18
-
-# LC_UMOUNTBEGIN_HAS_VFSMOUNT
-# 2.6.18~2.6.25 umount_begin has different parameters
-AC_DEFUN([LC_UMOUNTBEGIN_HAS_VFSMOUNT],
-[AC_MSG_CHECKING([if umount_begin needs vfsmount parameter instead of super_block])
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_LINUX_TRY_COMPILE([
- #include <linux/fs.h>
-
- struct vfsmount;
- static void cfg_umount_begin (struct vfsmount *v, int flags)
- {
- ;
- }
-
- static struct super_operations cfg_super_operations = {
- .umount_begin = cfg_umount_begin,
- };
-],[
- cfg_super_operations.umount_begin(NULL,0);
-],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_UMOUNTBEGIN_VFSMOUNT, 1,
- [Define umount_begin need second argument])
-],[
- AC_MSG_RESULT(no)
-])
-EXTRA_KCFLAGS="$tmp_flags"
-])
-
-#2.6.18 + RHEL5 (fc6)
-
-#
-# LC_LINUX_FIEMAP_H
-#
-# fiemap.h is added since v2.6.28
-# RHEL5 2.6.18 has it, while SLES10 2.6.27 does not
-#
-AC_DEFUN([LC_LINUX_FIEMAP_H],
-[LB_CHECK_FILE([$LINUX/include/linux/fiemap.h],[
- AC_MSG_CHECKING([if fiemap.h can be compiled])
- LB_LINUX_TRY_COMPILE([
- #include <linux/types.h>
- #include <linux/fiemap.h>
- ],[],[
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_LINUX_FIEMAP_H, 1, [Kernel has fiemap.h])
- ],[
- AC_MSG_RESULT([no])
- ])
-],
-[])
-])
-
-# 2.6.19
-
-# LC_FILE_WRITEV
-# 2.6.19 replaced writev with aio_write
-AC_DEFUN([LC_FILE_WRITEV],
-[AC_MSG_CHECKING([writev in fops])
-LB_LINUX_TRY_COMPILE([
- #include <linux/fs.h>
-],[
- struct file_operations *fops = NULL;
- fops->writev = NULL;
-],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_FILE_WRITEV, 1,
- [use fops->writev])
-],[
- AC_MSG_RESULT(no)
-])
-])
-
-# LC_FILE_READV
-# 2.6.19 replaced readv with aio_read
-AC_DEFUN([LC_FILE_READV],
-[AC_MSG_CHECKING([readv in fops])
-LB_LINUX_TRY_COMPILE([
- #include <linux/fs.h>
-],[
- struct file_operations *fops = NULL;
- fops->readv = NULL;
-],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_FILE_READV, 1,
- [use fops->readv])
-],[
- AC_MSG_RESULT(no)
-])
-])
-
-# 2.6.20
-
-# LC_CANCEL_DIRTY_PAGE
-# 2.6.20 introduced cancel_dirty_page instead of clear_page_dirty.
-AC_DEFUN([LC_CANCEL_DIRTY_PAGE],
- [AC_MSG_CHECKING([kernel has cancel_dirty_page])
- # the implementation of cancel_dirty_page in OFED 1.4.1's SLES10 SP2
- # backport is broken, so ignore it
- if test -f $OFED_BACKPORT_PATH/linux/mm.h &&
- test "$(sed -ne '/^static inline void cancel_dirty_page(struct page \*page, unsigned int account_size)$/,/^}$/p' $OFED_BACKPORT_PATH/linux/mm.h | md5sum)" = "c518cb32d6394760c5bca14cb7538d3e -"; then
- AC_MSG_RESULT(no)
- else
- LB_LINUX_TRY_COMPILE([
- #include <linux/mm.h>
- #include <linux/page-flags.h>
-],[
- cancel_dirty_page(NULL, 0);
-],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_CANCEL_DIRTY_PAGE, 1,
- [kernel has cancel_dirty_page instead of clear_page_dirty])
-],[
- AC_MSG_RESULT(no)
-])
- fi
-])
-
-# raid5-zerocopy patch
-
-#
-# LC_PAGE_CONSTANT
-#
-# In order to support raid5 zerocopy patch, we have to patch the kernel to make
-# it support constant page, which means the page won't be modified during the
-# IO.
-#
-AC_DEFUN([LC_PAGE_CONSTANT],
-[AC_MSG_CHECKING([if kernel have PageConstant defined])
-LB_LINUX_TRY_COMPILE([
- #include <linux/mm.h>
- #include <linux/page-flags.h>
-],[
- #ifndef PG_constant
- #error "Have no raid5 zcopy patch"
- #endif
-],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_PAGE_CONSTANT, 1, [kernel have PageConstant supported])
-],[
- AC_MSG_RESULT(no);
-])
-])
-
-# 2.6.22
-
-# 2.6.22 lost second parameter for invalidate_bdev
-AC_DEFUN([LC_INVALIDATE_BDEV_2ARG],
-[AC_MSG_CHECKING([if invalidate_bdev has second argument])
-LB_LINUX_TRY_COMPILE([
- #include <linux/buffer_head.h>
-],[
- invalidate_bdev(NULL,0);
-],[
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_INVALIDATE_BDEV_2ARG, 1,
- [invalidate_bdev has second argument])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-#
-# check for crypto API
-#
-AC_DEFUN([LC_ASYNC_BLOCK_CIPHER],
-[AC_MSG_CHECKING([if kernel has block cipher support])
-LB_LINUX_TRY_COMPILE([
- #include <linux/err.h>
- #include <linux/crypto.h>
-],[
- struct crypto_blkcipher *tfm;
- tfm = crypto_alloc_blkcipher("aes", 0, sizeof(tfm) );
-],[
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_ASYNC_BLOCK_CIPHER, 1, [kernel has block cipher support])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-#
-# check for struct hash_desc
-#
-AC_DEFUN([LC_STRUCT_HASH_DESC],
-[AC_MSG_CHECKING([if kernel has struct hash_desc])
-LB_LINUX_TRY_COMPILE([
- #include <linux/err.h>
- #include <linux/crypto.h>
-],[
- struct hash_desc foo __attribute__ ((unused));
-],[
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_STRUCT_HASH_DESC, 1, [kernel has struct hash_desc])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-#
-# check for struct blkcipher_desc
-#
-AC_DEFUN([LC_STRUCT_BLKCIPHER_DESC],
-[AC_MSG_CHECKING([if kernel has struct blkcipher_desc])
-LB_LINUX_TRY_COMPILE([
- #include <linux/err.h>
- #include <linux/crypto.h>
-],[
- struct blkcipher_desc foo __attribute__ ((unused));
-],[
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_STRUCT_BLKCIPHER_DESC, 1, [kernel has struct blkcipher_desc])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-#
-# 2.6.19 check for FS_RENAME_DOES_D_MOVE flag
-#
-AC_DEFUN([LC_FS_RENAME_DOES_D_MOVE],
-[AC_MSG_CHECKING([if kernel has FS_RENAME_DOES_D_MOVE flag])
-LB_LINUX_TRY_COMPILE([
- #include <linux/fs.h>
-],[
- int v __attribute__ ((unused));
- v = FS_RENAME_DOES_D_MOVE;
-],[
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_FS_RENAME_DOES_D_MOVE, 1, [kernel has FS_RENAME_DOES_D_MOVE flag])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-# 2.6.23
-
-# 2.6.23 have return type 'void' for unregister_blkdev
-AC_DEFUN([LC_UNREGISTER_BLKDEV_RETURN_INT],
-[AC_MSG_CHECKING([if unregister_blkdev return int])
-LB_LINUX_TRY_COMPILE([
- #include <linux/fs.h>
-],[
- int i __attribute__ ((unused));
- i = unregister_blkdev(0,NULL);
-],[
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_UNREGISTER_BLKDEV_RETURN_INT, 1,
- [unregister_blkdev return int])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-# 2.6.23 change .sendfile to .splice_read
-AC_DEFUN([LC_KERNEL_SPLICE_READ],
-[AC_MSG_CHECKING([if kernel has .splice_read])
-LB_LINUX_TRY_COMPILE([
- #include <linux/fs.h>
-],[
- struct file_operations file;
-
- file.splice_read = NULL;
-], [
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_KERNEL_SPLICE_READ, 1,
- [kernel has .slice_read])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-# 2.6.23 change .sendfile to .splice_read
-# RHEL4 (-92 kernel) have both sendfile and .splice_read API
-AC_DEFUN([LC_KERNEL_SENDFILE],
-[AC_MSG_CHECKING([if kernel has .sendfile])
-LB_LINUX_TRY_COMPILE([
- #include <linux/fs.h>
-],[
- struct file_operations file;
-
- file.sendfile = NULL;
-], [
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_KERNEL_SENDFILE, 1,
- [kernel has .sendfile])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-# 2.6.23 extract nfs export related data into exportfs.h
-AC_DEFUN([LC_HAVE_EXPORTFS_H],
-[LB_CHECK_FILE([$LINUX/include/linux/exportfs.h], [
- AC_DEFINE(HAVE_LINUX_EXPORTFS_H, 1,
- [kernel has include/exportfs.h])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-# 2.6.23 has new page fault handling API
-AC_DEFUN([LC_VM_OP_FAULT],
-[AC_MSG_CHECKING([kernel has .fault in vm_operation_struct])
-LB_LINUX_TRY_COMPILE([
- #include <linux/mm.h>
-],[
- struct vm_operations_struct op;
-
- op.fault = NULL;
-], [
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_VM_OP_FAULT, 1,
- [kernel has .fault in vm_operation_struct])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-# 2.6.23 add code to wait other users to complete before removing procfs entry
-AC_DEFUN([LC_PROCFS_USERS],
-[AC_MSG_CHECKING([if kernel has pde_users member in procfs entry struct])
-LB_LINUX_TRY_COMPILE([
- #include <linux/proc_fs.h>
-],[
- struct proc_dir_entry pde;
-
- pde.pde_users = 0;
-],[
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_PROCFS_USERS, 1,
- [kernel has pde_users member in procfs entry struct])
-],[
- LB_LINUX_TRY_COMPILE([
- #include "$LINUX/fs/proc/internal.h"
- ],[
- struct proc_dir_entry_aux pde_aux;
-
- pde_aux.pde_users = 0;
- ],[
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_PROCFS_USERS, 1,
- [kernel has pde_users member in proc_dir_entry_aux])
- ],[
- AC_MSG_RESULT([no])
- ])
-])
-])
-
-# 2.6.23 exports exportfs_decode_fh
-AC_DEFUN([LC_EXPORTFS_DECODE_FH],
-[LB_CHECK_SYMBOL_EXPORT([exportfs_decode_fh],
-[fs/exportfs/expfs.c],[
- AC_DEFINE(HAVE_EXPORTFS_DECODE_FH, 1,
- [exportfs_decode_fh has been export])
-],[
-])
-])
-
-# 2.6.24
-
-# 2.6.24 need linux/mm_types.h included
-AC_DEFUN([LC_HAVE_MMTYPES_H],
-[LB_CHECK_FILE([$LINUX/include/linux/mm_types.h], [
- AC_DEFINE(HAVE_LINUX_MMTYPES_H, 1,
- [kernel has include/mm_types.h])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-# 2.6.24 has bio_endio with 2 args
-AC_DEFUN([LC_BIO_ENDIO_2ARG],
-[AC_MSG_CHECKING([if kernel has bio_endio with 2 args])
-LB_LINUX_TRY_COMPILE([
- #include <linux/bio.h>
-],[
- bio_endio(NULL, 0);
-], [
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_BIO_ENDIO_2ARG, 1,
- [kernel has bio_endio with 2 args])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-# 2.6.24 has new members in exports struct.
-AC_DEFUN([LC_FH_TO_DENTRY],
-[AC_MSG_CHECKING([if kernel has .fh_to_dentry member in export_operations struct])
-LB_LINUX_TRY_COMPILE([
- #include <linux/fs.h>
-#ifdef HAVE_LINUX_EXPORTFS_H
- #include <linux/exportfs.h>
-#endif
-],[
- do{ }while(sizeof(((struct export_operations *)0)->fh_to_dentry));
-], [
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_FH_TO_DENTRY, 1,
- [kernel has .fh_to_dentry member in export_operations struct])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-# 2.6.24 removes long aged procfs entry -> deleted member
-AC_DEFUN([LC_PROCFS_DELETED],
-[AC_MSG_CHECKING([if kernel has deleted member in procfs entry struct])
-LB_LINUX_TRY_COMPILE([
- #include <linux/proc_fs.h>
-],[
- struct proc_dir_entry pde;
-
- pde.deleted = sizeof(pde);
-], [
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_PROCFS_DELETED, 1,
- [kernel has deleted member in procfs entry struct])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-# 2.6.24 has bdi_init()/bdi_destroy() functions.
-AC_DEFUN([LC_EXPORT_BDI_INIT],
-[LB_CHECK_SYMBOL_EXPORT([bdi_init],
-[mm/backing-dev.c],[
- AC_DEFINE(HAVE_BDI_INIT, 1,
- [bdi_init/bdi_destroy functions are present])
-],[
-])
-])
-
-# 2.6.26
-
-# 2.6.26 isn't export set_fs_pwd and change paramter in fs struct
-AC_DEFUN([LC_FS_STRUCT_USE_PATH],
-[AC_MSG_CHECKING([fs_struct use path structure])
-LB_LINUX_TRY_COMPILE([
- #include <asm/atomic.h>
- #include <linux/spinlock.h>
- #include <linux/fs_struct.h>
-],[
- struct fs_struct fs;
-
- fs.pwd = *((struct path *)sizeof(fs));
-], [
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_FS_STRUCT_USE_PATH, 1,
- [fs_struct use path structure])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-#
-# 2.6.27
-#
-
-# LC_SECURITY_PLUG # for SLES10 SP2 (2.6.27)
-# check security plug in sles10 sp2 kernel
-AC_DEFUN([LC_SECURITY_PLUG],
-[AC_MSG_CHECKING([If kernel has security plug support])
-LB_LINUX_TRY_COMPILE([
- #include <linux/fs.h>
- #include <linux/stddef.h>
-],[
- notify_change(NULL, NULL, NULL);
-],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_SECURITY_PLUG, 1,
- [SLES10 SP2 use extra parameter in vfs])
-],[
- AC_MSG_RESULT(no)
-])
-])
-
-AC_DEFUN([LC_PGMKWRITE_USE_VMFAULT],
-[AC_MSG_CHECKING([kernel .page_mkwrite uses struct vm_fault *])
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_LINUX_TRY_COMPILE([
- #include <linux/mm.h>
-],[
- ((struct vm_operations_struct *)0)->page_mkwrite((struct vm_area_struct *)0, (struct vm_fault *)0);
-], [
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_PGMKWRITE_USE_VMFAULT, 1,
- [kernel vm_operation_struct.page_mkwrite uses struct vm_fault * as second parameter])
-],[
- AC_MSG_RESULT([no])
-])
-EXTRA_KCFLAGS="$tmp_flags"
-])
-
-AC_DEFUN([LC_PGMKWRITE_COMPACT],
-[AC_MSG_CHECKING([if kernel .page_mkwrite is located in vm_operation_struct._pmkw])
-tmp_flags="$EXTRA_KCFLAGS"
-EXTRA_KCFLAGS="-Werror"
-LB_LINUX_TRY_COMPILE([
- #include <linux/mm.h>
-],[
- struct vm_operations_struct *vm_ops;
-
- vm_ops = NULL;
- vm_ops->_pmkw.page_mkwrite(NULL, NULL);
-], [
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_PGMKWRITE_COMPACT, 1,
- [kernel .page_mkwrite is located in vm_operation_struct._pmkw])
-],[
- AC_MSG_RESULT([no])
-])
-EXTRA_KCFLAGS="$tmp_flags"
-])
-
-AC_DEFUN([LC_INODE_PERMISION_2ARGS],
-[AC_MSG_CHECKING([inode_operations->permission has two args])
-LB_LINUX_TRY_COMPILE([
- #include <linux/fs.h>
-],[
- struct inode *inode __attribute__ ((unused));
-
- inode = NULL;
- inode->i_op->permission(NULL, 0);
-],[
- AC_DEFINE(HAVE_INODE_PERMISION_2ARGS, 1,
- [inode_operations->permission has two args])
- AC_MSG_RESULT([yes])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-# 2.6.27 have new page locking API
-AC_DEFUN([LC_TRYLOCKPAGE],
-[AC_MSG_CHECKING([kernel uses trylock_page for page lock])
-LB_LINUX_TRY_COMPILE([
- #include <linux/pagemap.h>
-],[
- trylock_page(NULL);
-],[
- AC_DEFINE(HAVE_TRYLOCK_PAGE, 1,
- [kernel uses trylock_page for page lock])
- AC_MSG_RESULT([yes])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-# 2.6.27 removed the read_inode from super_operations.
-AC_DEFUN([LC_READ_INODE_IN_SBOPS],
-[AC_MSG_CHECKING([super_operations has a read_inode field])
-LB_LINUX_TRY_COMPILE([
- #include <linux/fs.h>
-],[
- struct super_operations *sop;
- sop->read_inode(NULL);
-],[
- AC_DEFINE(HAVE_READ_INODE_IN_SBOPS, 1,
- [super_operations has a read_inode])
- AC_MSG_RESULT([yes])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-# 2.6.27 has inode_permission instead of permisson
-AC_DEFUN([LC_EXPORT_INODE_PERMISSION],
-[LB_CHECK_SYMBOL_EXPORT([inode_permission],
-[fs/namei.c],[
-AC_DEFINE(HAVE_EXPORT_INODE_PERMISSION, 1,
- [inode_permission is exported by the kernel])
-],[
-])
-])
-
-# 2.6.27 use 5th parameter in quota_on for remount.
-AC_DEFUN([LC_QUOTA_ON_5ARGS],
-[AC_MSG_CHECKING([quota_on needs 5 parameters])
-LB_LINUX_TRY_COMPILE([
- #include <linux/fs.h>
- #include <linux/quota.h>
-],[
- struct quotactl_ops *qop = NULL;
- qop->quota_on(NULL, 0, 0, NULL, 0);
-],[
- AC_DEFINE(HAVE_QUOTA_ON_5ARGS, 1,
- [quota_on needs 5 paramters])
- AC_MSG_RESULT([yes])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-# 2.6.27 use 3th parameter in quota_off for remount.
-AC_DEFUN([LC_QUOTA_OFF_3ARGS],
-[AC_MSG_CHECKING([quota_off needs 3 parameters])
-LB_LINUX_TRY_COMPILE([
- #include <linux/fs.h>
- #include <linux/quota.h>
-],[
- struct quotactl_ops *qop = NULL;
- qop->quota_off(NULL, 0, 0);
-],[
- AC_DEFINE(HAVE_QUOTA_OFF_3ARGS, 1,
- [quota_off needs 3 paramters])
- AC_MSG_RESULT([yes])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-# 2.6.27 has vfs_dq_off inline function.
-AC_DEFUN([LC_VFS_DQ_OFF],
-[AC_MSG_CHECKING([vfs_dq_off is defined])
-LB_LINUX_TRY_COMPILE([
- #include <linux/quotaops.h>
-],[
- vfs_dq_off(NULL, 0);
-],[
- AC_DEFINE(HAVE_VFS_DQ_OFF, 1, [vfs_dq_off is defined])
- AC_MSG_RESULT([yes])
-],[
- AC_MSG_RESULT([no])
-])
-])
-
-# LC_LOCK_MAP_ACQUIRE
-# after 2.6.27 lock_map_acquire replaces lock_acquire
-AC_DEFUN([LC_LOCK_MAP_ACQUIRE],
-[AC_MSG_CHECKING([if lock_map_acquire is defined])
-LB_LINUX_TRY_COMPILE([
- #include <linux/lockdep.h>
-],[
- lock_map_acquire(NULL);
-],[
- AC_MSG_RESULT(yes)
- AC_DEFINE(HAVE_LOCK_MAP_ACQUIRE, 1,
- [lock_map_acquire is defined])
-],[
- AC_MSG_RESULT(no)
-])
-])
-
-# 2.6.27.15-2 sles11
-
-# 2.6.27 sles11 remove the bi_hw_segments
-AC_DEFUN([LC_BI_HW_SEGMENTS],
-[AC_MSG_CHECKING([struct bio has a bi_hw_segments field])
-LB_LINUX_TRY_COMPILE([
- #include <linux/bio.h>
-],[
- struct bio io;
- io.bi_hw_segments = sizeof(io);
-],[
- AC_DEFINE(HAVE_BI_HW_SEGMENTS, 1,
- [struct bio has a bi_hw_segments field])
- AC_MSG_RESULT([yes])
-],[
- AC_MSG_RESULT([no])
-])
-])