]> git.proxmox.com Git - mirror_zfs.git/blob - config/kernel-vfs-direct_IO.m4
Improve error message for zfs create with @ or # in name
[mirror_zfs.git] / config / kernel-vfs-direct_IO.m4
1 dnl #
2 dnl # Linux 4.6.x API change
3 dnl #
4 AC_DEFUN([ZFS_AC_KERNEL_VFS_DIRECT_IO_ITER], [
5 AC_MSG_CHECKING([whether aops->direct_IO() uses iov_iter])
6 ZFS_LINUX_TRY_COMPILE([
7 #include <linux/fs.h>
8
9 ssize_t test_direct_IO(struct kiocb *kiocb,
10 struct iov_iter *iter) { return 0; }
11
12 static const struct address_space_operations
13 aops __attribute__ ((unused)) = {
14 .direct_IO = test_direct_IO,
15 };
16 ],[
17 ],[
18 AC_MSG_RESULT([yes])
19 AC_DEFINE(HAVE_VFS_DIRECT_IO_ITER, 1,
20 [aops->direct_IO() uses iov_iter without rw])
21 zfs_ac_direct_io="yes"
22 ],[
23 AC_MSG_RESULT([no])
24 ])
25 ])
26
27 dnl #
28 dnl # Linux 4.1.x API change
29 dnl #
30 AC_DEFUN([ZFS_AC_KERNEL_VFS_DIRECT_IO_ITER_OFFSET], [
31 AC_MSG_CHECKING(
32 [whether aops->direct_IO() uses iov_iter with offset])
33 ZFS_LINUX_TRY_COMPILE([
34 #include <linux/fs.h>
35
36 ssize_t test_direct_IO(struct kiocb *kiocb,
37 struct iov_iter *iter, loff_t offset) { return 0; }
38
39 static const struct address_space_operations
40 aops __attribute__ ((unused)) = {
41 .direct_IO = test_direct_IO,
42 };
43 ],[
44 ],[
45 AC_MSG_RESULT([yes])
46 AC_DEFINE(HAVE_VFS_DIRECT_IO_ITER_OFFSET, 1,
47 [aops->direct_IO() uses iov_iter with offset])
48 zfs_ac_direct_io="yes"
49 ],[
50 AC_MSG_RESULT([no])
51 ])
52 ])
53
54 dnl #
55 dnl # Linux 3.16.x API change
56 dnl #
57 AC_DEFUN([ZFS_AC_KERNEL_VFS_DIRECT_IO_ITER_RW_OFFSET], [
58 AC_MSG_CHECKING(
59 [whether aops->direct_IO() uses iov_iter with rw and offset])
60 ZFS_LINUX_TRY_COMPILE([
61 #include <linux/fs.h>
62
63 ssize_t test_direct_IO(int rw, struct kiocb *kiocb,
64 struct iov_iter *iter, loff_t offset) { return 0; }
65
66 static const struct address_space_operations
67 aops __attribute__ ((unused)) = {
68 .direct_IO = test_direct_IO,
69 };
70 ],[
71 ],[
72 AC_MSG_RESULT([yes])
73 AC_DEFINE(HAVE_VFS_DIRECT_IO_ITER_RW_OFFSET, 1,
74 [aops->direct_IO() uses iov_iter with rw and offset])
75 zfs_ac_direct_io="yes"
76 ],[
77 AC_MSG_RESULT([no])
78 ])
79 ])
80
81 dnl #
82 dnl # Ancient Linux API (predates git)
83 dnl #
84 AC_DEFUN([ZFS_AC_KERNEL_VFS_DIRECT_IO_IOVEC], [
85 AC_MSG_CHECKING([whether aops->direct_IO() uses iovec])
86 ZFS_LINUX_TRY_COMPILE([
87 #include <linux/fs.h>
88
89 ssize_t test_direct_IO(int rw, struct kiocb *kiocb,
90 const struct iovec *iov, loff_t offset,
91 unsigned long nr_segs) { return 0; }
92
93 static const struct address_space_operations
94 aops __attribute__ ((unused)) = {
95 .direct_IO = test_direct_IO,
96 };
97 ],[
98 ],[
99 AC_MSG_RESULT([yes])
100 AC_DEFINE(HAVE_VFS_DIRECT_IO_IOVEC, 1,
101 [aops->direct_IO() uses iovec])
102 zfs_ac_direct_io="yes"
103 ],[
104 AC_MSG_RESULT([no])
105 ])
106 ])
107
108 AC_DEFUN([ZFS_AC_KERNEL_VFS_DIRECT_IO], [
109 zfs_ac_direct_io="no"
110
111 if test "$zfs_ac_direct_io" = "no"; then
112 ZFS_AC_KERNEL_VFS_DIRECT_IO_ITER
113 fi
114
115 if test "$zfs_ac_direct_io" = "no"; then
116 ZFS_AC_KERNEL_VFS_DIRECT_IO_ITER_OFFSET
117 fi
118
119 if test "$zfs_ac_direct_io" = "no"; then
120 ZFS_AC_KERNEL_VFS_DIRECT_IO_ITER_RW_OFFSET
121 fi
122
123 if test "$zfs_ac_direct_io" = "no"; then
124 ZFS_AC_KERNEL_VFS_DIRECT_IO_IOVEC
125 fi
126
127 if test "$zfs_ac_direct_io" = "no"; then
128 AC_MSG_ERROR([no; unknown direct IO interface])
129 fi
130 ])