-# 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 + 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)
-])
-])
-
-# 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])
-])
-])
-
-#
-# 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 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.24
-
-# 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 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.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)
-])
-])
-