+ AC_DEFINE(HAVE_DIR_CONTEXT, 1,
+ [dir_context exist])
+])
+]) # LC_HAVE_DIR_CONTEXT
+
+#
+# LC_D_COMPARE_5ARGS
+#
+# 3.11 dentry_operations.d_compare() taken 5 arguments.
+#
+AC_DEFUN([LC_D_COMPARE_5ARGS], [
+LB_CHECK_COMPILE([if 'd_compare' taken 5 arguments],
+d_compare_5args, [
+ #include <linux/dcache.h>
+],[
+ ((struct dentry_operations*)0)->d_compare(NULL,NULL,0,NULL,NULL);
+],[
+ AC_DEFINE(HAVE_D_COMPARE_5ARGS, 1,
+ [d_compare need 5 arguments])
+])
+]) # LC_D_COMPARE_5ARGS
+
+#
+# LC_HAVE_DCOUNT
+#
+# 3.11 need to access d_count to get dentry reference count
+#
+AC_DEFUN([LC_HAVE_DCOUNT], [
+LB_CHECK_COMPILE([if 'd_count' exist],
+d_count, [
+ #include <linux/dcache.h>
+],[
+ struct dentry de;
+ d_count(&de);
+],[
+ AC_DEFINE(HAVE_D_COUNT, 1,
+ [d_count exist])
+])
+]) # LC_HAVE_DCOUNT
+
+#
+# LC_OLDSIZE_TRUNCATE_PAGECACHE
+#
+# 3.12 truncate_pagecache without oldsize parameter
+#
+AC_DEFUN([LC_OLDSIZE_TRUNCATE_PAGECACHE], [
+LB_CHECK_COMPILE([if 'truncate_pagecache' with 'old_size' parameter],
+truncate_pagecache_old_size, [
+ #include <linux/mm.h>
+],[
+ truncate_pagecache(NULL, 0, 0);
+],[
+ AC_DEFINE(HAVE_OLDSIZE_TRUNCATE_PAGECACHE, 1,
+ [with oldsize])
+])
+]) # LC_OLDSIZE_TRUNCATE_PAGECACHE
+
+#
+# LC_HAVE_DENTRY_D_U_D_ALIAS
+#
+# 3.11 kernel moved d_alias to the union d_u in struct dentry
+#
+# Some distros move d_alias to d_u but it is still a struct list
+#
+AC_DEFUN([LC_HAVE_DENTRY_D_U_D_ALIAS], [
+AS_IF([test "x$lb_cv_compile_i_dentry_d_alias_list" = xyes], [
+ LB_CHECK_COMPILE([if list 'dentry.d_u.d_alias' exist],
+ d_alias, [
+ #include <linux/list.h>
+ #include <linux/dcache.h>
+ ],[
+ struct dentry de;
+ INIT_LIST_HEAD(&de.d_u.d_alias);
+ ],[
+ AC_DEFINE(HAVE_DENTRY_D_U_D_ALIAS, 1,
+ [list dentry.d_u.d_alias exist])
+ ])
+],[
+ LB_CHECK_COMPILE([if hlist 'dentry.d_u.d_alias' exist],
+ d_alias, [
+ #include <linux/list.h>
+ #include <linux/dcache.h>
+ ],[
+ struct dentry de;
+ INIT_HLIST_NODE(&de.d_u.d_alias);
+ ],[
+ AC_DEFINE(HAVE_DENTRY_D_U_D_ALIAS, 1,
+ [hlist dentry.d_u.d_alias exist])
+ ])
+])
+]) # LC_HAVE_DENTRY_D_U_D_ALIAS
+
+#
+# LC_HAVE_DENTRY_D_CHILD
+#
+# 3.11 kernel d_child has been moved out of the union d_u
+# in struct dentry
+#
+AC_DEFUN([LC_HAVE_DENTRY_D_CHILD], [
+LB_CHECK_COMPILE([if 'dentry.d_child' exist],
+d_child, [
+ #include <linux/list.h>
+ #include <linux/dcache.h>
+],[
+ struct dentry de;
+ INIT_LIST_HEAD(&de.d_child);
+],[
+ AC_DEFINE(HAVE_DENTRY_D_CHILD, 1,
+ [dentry.d_child exist])
+])
+]) # LC_HAVE_DENTRY_D_CHILD
+
+#
+# LC_KIOCB_KI_LEFT
+#
+# 3.12 ki_left removed from struct kiocb
+#
+AC_DEFUN([LC_KIOCB_KI_LEFT], [
+LB_CHECK_COMPILE([if 'struct kiocb' with 'ki_left' member],
+kiocb_ki_left, [
+ #include <linux/aio.h>
+],[
+ ((struct kiocb*)0)->ki_left = 0;
+],[
+ AC_DEFINE(HAVE_KIOCB_KI_LEFT, 1,
+ [ki_left exist])
+])
+]) # LC_KIOCB_KI_LEFT
+
+#
+# LC_VFS_RENAME_5ARGS
+#
+# 3.13 has vfs_rename with 5 args
+#
+AC_DEFUN([LC_VFS_RENAME_5ARGS], [
+LB_CHECK_COMPILE([if Linux kernel has 'vfs_rename' with 5 args],
+vfs_rename_5args, [
+ #include <linux/fs.h>
+],[
+ vfs_rename(NULL, NULL, NULL, NULL, NULL);
+], [
+ AC_DEFINE(HAVE_VFS_RENAME_5ARGS, 1,
+ [kernel has vfs_rename with 5 args])
+])
+]) # LC_VFS_RENAME_5ARGS
+
+#
+# LC_VFS_UNLINK_3ARGS
+#
+# 3.13 has vfs_unlink with 3 args
+#
+AC_DEFUN([LC_VFS_UNLINK_3ARGS], [
+LB_CHECK_COMPILE([if Linux kernel has 'vfs_unlink' with 3 args],
+vfs_unlink_3args, [
+ #include <linux/fs.h>
+],[
+ vfs_unlink(NULL, NULL, NULL);
+], [
+ AC_DEFINE(HAVE_VFS_UNLINK_3ARGS, 1,
+ [kernel has vfs_unlink with 3 args])
+])
+]) # LC_VFS_UNLINK_3ARGS
+
+#
+# LC_HAVE_BVEC_ITER
+#
+# 3.14 move some of its data in struct bio into the new
+# struct bvec_iter
+#
+AC_DEFUN([LC_HAVE_BVEC_ITER], [
+LB_CHECK_COMPILE([if Linux kernel has struct bvec_iter],
+have_bvec_iter, [
+ #include <linux/bio.h>
+],[
+ struct bvec_iter iter;
+ iter.bi_bvec_done = 0;
+], [
+ AC_DEFINE(HAVE_BVEC_ITER, 1,
+ [kernel has struct bvec_iter])
+])
+]) # LC_HAVE_BVEC_ITER
+
+#
+# LC_HAVE_TRUNCATE_IPAGE_FINAL
+#
+# 3.14 bring truncate_inode_pages_final for evict_inode
+#
+AC_DEFUN([LC_HAVE_TRUNCATE_IPAGES_FINAL], [
+LB_CHECK_COMPILE([if Linux kernel has truncate_inode_pages_final],
+truncate_ipages_final, [
+ #include <linux/mm.h>
+],[
+ truncate_inode_pages_final(NULL);
+], [
+ AC_DEFINE(HAVE_TRUNCATE_INODE_PAGES_FINAL, 1,
+ [kernel has truncate_inode_pages_final])
+])
+]) # LC_HAVE_TRUNCATE_IPAGES_FINAL
+
+#
+# LC_VFS_RENAME_6ARGS
+#
+# 3.15 has vfs_rename with 6 args
+#
+AC_DEFUN([LC_VFS_RENAME_6ARGS], [
+LB_CHECK_COMPILE([if Linux kernel has 'vfs_rename' with 6 args],
+vfs_rename_6args, [
+ #include <linux/fs.h>
+],[
+ vfs_rename(NULL, NULL, NULL, NULL, NULL, NULL);
+], [
+ AC_DEFINE(HAVE_VFS_RENAME_6ARGS, 1,
+ [kernel has vfs_rename with 6 args])
+])
+]) # LC_VFS_RENAME_6ARGS
+
+#
+# LC_DIRECTIO_USE_ITER
+#
+# 3.16 kernel changes direct IO to use iov_iter
+#
+AC_DEFUN([LC_DIRECTIO_USE_ITER], [
+LB_CHECK_COMPILE([if direct IO uses iov_iter],
+direct_io_iter, [
+ #include <linux/fs.h>
+],[
+ struct address_space_operations ops;
+ struct iov_iter *iter = NULL;
+ loff_t offset = 0;
+
+ ops.direct_IO(0, NULL, iter, offset);
+],[
+ AC_DEFINE(HAVE_DIRECTIO_ITER, 1,
+ [direct IO uses iov_iter])
+])
+]) # LC_DIRECTIO_USE_ITER
+
+#
+# LC_HAVE_IOV_ITER_INIT_DIRECTION
+#
+#
+# 3.16 linux commit 71d8e532b1549a478e6a6a8a44f309d050294d00
+# changed iov_iter_init api to start accepting a tag
+# that defines if its a read or write operation
+#
+AC_DEFUN([LC_HAVE_IOV_ITER_INIT_DIRECTION], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_CHECK_COMPILE([if 'iov_iter_init' takes a tag],
+iter_init, [
+ #include <linux/uio.h>
+ #include <linux/fs.h>
+],[
+ const struct iovec *iov = NULL;
+
+ iov_iter_init(NULL, READ, iov, 1, 0);
+],[
+ AC_DEFINE(HAVE_IOV_ITER_INIT_DIRECTION, 1,
+ [iov_iter_init handles directional tag])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+]) # LC_HAVE_IOV_ITER_INIT_DIRECTION
+
+#
+# LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER
+#
+# 3.16 introduces [read|write]_iter to struct file_operations
+#
+AC_DEFUN([LC_HAVE_FILE_OPERATIONS_READ_WRITE_ITER], [
+LB_CHECK_COMPILE([if 'file_operations.[read|write]_iter' exist],
+file_function_iter, [
+ #include <linux/fs.h>
+],[
+ ((struct file_operations *)NULL)->read_iter(NULL, NULL);
+ ((struct file_operations *)NULL)->write_iter(NULL, NULL);
+],[
+ AC_DEFINE(HAVE_FILE_OPERATIONS_READ_WRITE_ITER, 1,
+ [file_operations.[read|write]_iter functions exist])