2 dnl # Check for available iov_iter functionality.
4 AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_IOV_ITER], [
5 ZFS_LINUX_TEST_SRC([iov_iter_types], [
9 int type __attribute__ ((unused)) =
10 ITER_IOVEC | ITER_KVEC | ITER_BVEC | ITER_PIPE;
13 ZFS_LINUX_TEST_SRC([iov_iter_advance], [
15 #include <linux/uio.h>
17 struct iov_iter iter = { 0 };
20 iov_iter_advance(&iter, advance);
23 ZFS_LINUX_TEST_SRC([iov_iter_revert], [
25 #include <linux/uio.h>
27 struct iov_iter iter = { 0 };
30 iov_iter_revert(&iter, revert);
33 ZFS_LINUX_TEST_SRC([iov_iter_fault_in_readable], [
35 #include <linux/uio.h>
37 struct iov_iter iter = { 0 };
39 int error __attribute__ ((unused));
41 error = iov_iter_fault_in_readable(&iter, size);
44 ZFS_LINUX_TEST_SRC([fault_in_iov_iter_readable], [
46 #include <linux/uio.h>
48 struct iov_iter iter = { 0 };
50 int error __attribute__ ((unused));
52 error = fault_in_iov_iter_readable(&iter, size);
55 ZFS_LINUX_TEST_SRC([iov_iter_count], [
57 #include <linux/uio.h>
59 struct iov_iter iter = { 0 };
60 size_t bytes __attribute__ ((unused));
62 bytes = iov_iter_count(&iter);
65 ZFS_LINUX_TEST_SRC([copy_to_iter], [
67 #include <linux/uio.h>
69 struct iov_iter iter = { 0 };
70 char buf[512] = { 0 };
72 size_t bytes __attribute__ ((unused));
74 bytes = copy_to_iter((const void *)&buf, size, &iter);
77 ZFS_LINUX_TEST_SRC([copy_from_iter], [
79 #include <linux/uio.h>
81 struct iov_iter iter = { 0 };
82 char buf[512] = { 0 };
84 size_t bytes __attribute__ ((unused));
86 bytes = copy_from_iter((void *)&buf, size, &iter);
89 ZFS_LINUX_TEST_SRC([iov_iter_type], [
91 #include <linux/uio.h>
93 struct iov_iter iter = { 0 };
94 __attribute__((unused)) enum iter_type i = iov_iter_type(&iter);
98 AC_DEFUN([ZFS_AC_KERNEL_VFS_IOV_ITER], [
99 enable_vfs_iov_iter="yes"
101 AC_MSG_CHECKING([whether iov_iter types are available])
102 ZFS_LINUX_TEST_RESULT([iov_iter_types], [
104 AC_DEFINE(HAVE_IOV_ITER_TYPES, 1,
105 [iov_iter types are available])
108 enable_vfs_iov_iter="no"
111 AC_MSG_CHECKING([whether iov_iter_advance() is available])
112 ZFS_LINUX_TEST_RESULT([iov_iter_advance], [
114 AC_DEFINE(HAVE_IOV_ITER_ADVANCE, 1,
115 [iov_iter_advance() is available])
118 enable_vfs_iov_iter="no"
121 AC_MSG_CHECKING([whether iov_iter_revert() is available])
122 ZFS_LINUX_TEST_RESULT([iov_iter_revert], [
124 AC_DEFINE(HAVE_IOV_ITER_REVERT, 1,
125 [iov_iter_revert() is available])
128 enable_vfs_iov_iter="no"
131 AC_MSG_CHECKING([whether iov_iter_fault_in_readable() is available])
132 ZFS_LINUX_TEST_RESULT([iov_iter_fault_in_readable], [
134 AC_DEFINE(HAVE_IOV_ITER_FAULT_IN_READABLE, 1,
135 [iov_iter_fault_in_readable() is available])
139 AC_MSG_CHECKING([whether fault_in_iov_iter_readable() is available])
140 ZFS_LINUX_TEST_RESULT([fault_in_iov_iter_readable], [
142 AC_DEFINE(HAVE_FAULT_IN_IOV_ITER_READABLE, 1,
143 [fault_in_iov_iter_readable() is available])
146 enable_vfs_iov_iter="no"
150 AC_MSG_CHECKING([whether iov_iter_count() is available])
151 ZFS_LINUX_TEST_RESULT([iov_iter_count], [
153 AC_DEFINE(HAVE_IOV_ITER_COUNT, 1,
154 [iov_iter_count() is available])
157 enable_vfs_iov_iter="no"
160 AC_MSG_CHECKING([whether copy_to_iter() is available])
161 ZFS_LINUX_TEST_RESULT([copy_to_iter], [
163 AC_DEFINE(HAVE_COPY_TO_ITER, 1,
164 [copy_to_iter() is available])
167 enable_vfs_iov_iter="no"
170 AC_MSG_CHECKING([whether copy_from_iter() is available])
171 ZFS_LINUX_TEST_RESULT([copy_from_iter], [
173 AC_DEFINE(HAVE_COPY_FROM_ITER, 1,
174 [copy_from_iter() is available])
177 enable_vfs_iov_iter="no"
181 dnl # This checks for iov_iter_type() in linux/uio.h. It is not
182 dnl # required, however, and the module will compiled without it
183 dnl # using direct access of the member attribute
185 AC_MSG_CHECKING([whether iov_iter_type() is available])
186 ZFS_LINUX_TEST_RESULT([iov_iter_type], [
188 AC_DEFINE(HAVE_IOV_ITER_TYPE, 1,
189 [iov_iter_type() is available])
195 dnl # As of the 4.9 kernel support is provided for iovecs, kvecs,
196 dnl # bvecs and pipes in the iov_iter structure. As long as the
197 dnl # other support interfaces are all available the iov_iter can
198 dnl # be correctly used in the uio structure.
200 AS_IF([test "x$enable_vfs_iov_iter" = "xyes"], [
201 AC_DEFINE(HAVE_VFS_IOV_ITER, 1,
202 [All required iov_iter interfaces are available])