862b89782e2a235675f2871ea1ad1834f9b3ed4e
[zfs.git] / config / kernel-fsync.m4
1 dnl #
2 dnl # Linux 2.6.x - 2.6.34 API
3 dnl #
4 AC_DEFUN([ZFS_AC_KERNEL_FSYNC_WITH_DENTRY], [
5         ZFS_LINUX_TRY_COMPILE([
6                 #include <linux/fs.h>
7         ],[
8                 int (*fsync) (struct file *, struct dentry *, int) = NULL;
9                 struct file_operations fops __attribute__ ((unused));
10
11                 fops.fsync = fsync;
12         ],[
13                 AC_MSG_RESULT([dentry])
14                 AC_DEFINE(HAVE_FSYNC_WITH_DENTRY, 1,
15                         [fops->fsync() with dentry])
16         ],[
17         ])
18 ])
19
20 dnl #
21 dnl # Linux 2.6.35 - Linux 3.0 API
22 dnl #
23 AC_DEFUN([ZFS_AC_KERNEL_FSYNC_WITHOUT_DENTRY], [
24         ZFS_LINUX_TRY_COMPILE([
25                 #include <linux/fs.h>
26         ],[
27                 int (*fsync) (struct file *, int) = NULL;
28                 struct file_operations fops __attribute__ ((unused));
29
30                 fops.fsync = fsync;
31         ],[
32                 AC_MSG_RESULT([no dentry])
33                 AC_DEFINE(HAVE_FSYNC_WITHOUT_DENTRY, 1,
34                         [fops->fsync() without dentry])
35         ],[
36         ])
37 ])
38
39 dnl #
40 dnl # Linux 3.1 -x 3.x API
41 dnl #
42 AC_DEFUN([ZFS_AC_KERNEL_FSYNC_RANGE], [
43         ZFS_LINUX_TRY_COMPILE([
44                 #include <linux/fs.h>
45         ],[
46                 int (*fsync) (struct file *, loff_t, loff_t, int) = NULL;
47                 struct file_operations fops __attribute__ ((unused));
48
49                 fops.fsync = fsync;
50         ],[
51                 AC_MSG_RESULT([range])
52                 AC_DEFINE(HAVE_FSYNC_RANGE, 1,
53                         [fops->fsync() with range])
54         ],[
55         ])
56 ])
57
58 AC_DEFUN([ZFS_AC_KERNEL_FSYNC], [
59         AC_MSG_CHECKING([whether fops->fsync() wants])
60         ZFS_AC_KERNEL_FSYNC_WITH_DENTRY
61         ZFS_AC_KERNEL_FSYNC_WITHOUT_DENTRY
62         ZFS_AC_KERNEL_FSYNC_RANGE
63 ])