Whamcloud - gitweb
LU-4287 autoconf: Improve test for proc write and read functions
[fs/lustre-release.git] / lustre / autoconf / lustre-core.m4
index 583d759..f47bc5f 100644 (file)
@@ -403,14 +403,26 @@ LB_LINUX_TRY_COMPILE([
        #include <linux/fs.h>
        #include <linux/quota.h>
 ],[
-       struct quotactl_ops qops = {};
-       struct fs_disk_quota fdq;
-       qops.set_dqblk(NULL, 0, 0, &fdq);
+       ((struct quotactl_ops *)0)->set_dqblk(NULL, 0, 0, (struct fs_disk_quota*)0);
 ],[
        AC_DEFINE(HAVE_DQUOT_FS_DISK_QUOTA, 1, [quotactl_ops.set_dqblk takes struct fs_disk_quota])
        AC_MSG_RESULT([yes])
 ],[
        AC_MSG_RESULT([no])
+       AC_MSG_CHECKING([if quotactl_ops.set_dqblk takes struct kqid & fs_disk_quota])
+       LB_LINUX_TRY_COMPILE([
+               #include <linux/fs.h>
+               #include <linux/quota.h>
+       ],[
+               ((struct quotactl_ops *)0)->set_dqblk((struct super_block*)0, *((struct kqid*)0), (struct fs_disk_quota*)0);
+       ],[
+               AC_DEFINE(HAVE_DQUOT_FS_DISK_QUOTA, 1, [quotactl_ops.set_dqblk takes struct fs_disk_quota])
+               AC_DEFINE(HAVE_DQUOT_KQID, 1, [quotactl_ops.set_dqblk takes struct kqid])
+               AC_MSG_RESULT([yes])
+       ],[
+               AC_MSG_RESULT([no])
+               AC_MSG_CHECKING([if quotactl_ops.set_dqblk takes struct kqid&fs_disk_quota])
+       ])
 ])
 EXTRA_KCFLAGS="$tmp_flags"
 ])
@@ -654,6 +666,24 @@ AC_DEFINE(HAVE_SIMPLE_SETATTR, 1,
 ])
 
 #
+# truncate callback removed since 2.6.39
+#
+AC_DEFUN([LC_IOP_TRUNCATE],
+[AC_MSG_CHECKING([inode_operations has .truncate member function])
+LB_LINUX_TRY_COMPILE([
+        #include <linux/fs.h>
+],[
+        ((struct inode_operations *)0)->truncate(NULL);
+],[
+        AC_DEFINE(HAVE_INODEOPS_TRUNCATE, 1,
+                  [inode_operations has .truncate member function])
+        AC_MSG_RESULT([yes])
+],[
+        AC_MSG_RESULT([no])
+])
+])
+
+#
 # 2.6.39 remove unplug_fn from request_queue.
 #
 AC_DEFUN([LC_REQUEST_QUEUE_UNPLUG_FN],
@@ -1221,6 +1251,61 @@ LB_LINUX_TRY_COMPILE([
 ])
 
 #
+# 3.10+ only supports procfs seq_files handling
+#
+AC_DEFUN([LC_HAVE_ONLY_PROCFS_SEQ],
+[AC_MSG_CHECKING([if procfs only supports using seq_files])
+LB_LINUX_TRY_COMPILE([
+       #include <linux/proc_fs.h>
+],[
+       ((struct proc_dir_entry *)0)->write_proc(NULL, NULL, 0, NULL);
+],[
+       AC_MSG_RESULT([no])
+],[
+       AC_DEFINE(HAVE_ONLY_PROCFS_SEQ, 1, [only seq_files supported])
+       AC_MSG_RESULT([yes])
+])
+])
+
+# 3.10 release for block device doesn't return int
+AC_DEFUN([LC_BLKDEV_RELEASE_RETURN_INT],
+[AC_MSG_CHECKING([if block_device_operations release returns int])
+LB_LINUX_TRY_COMPILE([
+       #include <linux/blkdev.h>
+],[
+       struct block_device_operations fops;
+       int i __attribute__ ((unused));
+
+       i = fops.release(NULL,0);
+],[
+       AC_MSG_RESULT([yes])
+       AC_DEFINE(HAVE_BLKDEV_RELEASE_RETURN_INT, 1,
+                 [block device release returns int])
+],[
+       AC_MSG_RESULT([no])
+])
+])
+
+#
+# 3.11 need to access d_count to get dentry reference count
+#
+AC_DEFUN([LC_HAVE_DCOUNT],
+[AC_MSG_CHECKING([if d_count exist])
+LB_LINUX_TRY_COMPILE([
+       #include <linux/dcache.h>
+],[
+       struct dentry de;
+
+       d_count(&de);
+],[
+       AC_DEFINE(HAVE_D_COUNT, 1, [d_count exist])
+       AC_MSG_RESULT([yes])
+],[
+       AC_MSG_RESULT([no])
+])
+])
+
+#
 # LC_PROG_LINUX
 #
 # Lustre linux kernel checks
@@ -1268,6 +1353,7 @@ AC_DEFUN([LC_PROG_LINUX],
          # 2.6.39
          LC_REQUEST_QUEUE_UNPLUG_FN
         LC_HAVE_FSTYPE_MOUNT
+        LC_IOP_TRUNCATE
 
         # 3.0
         LC_DIRTY_INODE_WITH_FLAG
@@ -1314,6 +1400,13 @@ AC_DEFUN([LC_PROG_LINUX],
         LC_HAVE_HLIST_FOR_EACH_3ARG
         LC_HAVE_F_PATH_MNT
 
+        # 3.10
+        LC_HAVE_ONLY_PROCFS_SEQ
+        LC_BLKDEV_RELEASE_RETURN_INT
+
+        # 3.11
+        LC_HAVE_DCOUNT
+
         #
         if test x$enable_server != xno ; then
                LC_FUNC_DEV_SET_RDONLY