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)) = ITER_KVEC;
12 ZFS_LINUX_TEST_SRC([iov_iter_advance], [
14 #include <linux/uio.h>
16 struct iov_iter iter = { 0 };
19 iov_iter_advance(&iter, advance);
22 ZFS_LINUX_TEST_SRC([iov_iter_revert], [
24 #include <linux/uio.h>
26 struct iov_iter iter = { 0 };
29 iov_iter_revert(&iter, revert);
32 ZFS_LINUX_TEST_SRC([iov_iter_fault_in_readable], [
34 #include <linux/uio.h>
36 struct iov_iter iter = { 0 };
38 int error __attribute__ ((unused));
40 error = iov_iter_fault_in_readable(&iter, size);
43 ZFS_LINUX_TEST_SRC([fault_in_iov_iter_readable], [
45 #include <linux/uio.h>
47 struct iov_iter iter = { 0 };
49 int error __attribute__ ((unused));
51 error = fault_in_iov_iter_readable(&iter, size);
54 ZFS_LINUX_TEST_SRC([iov_iter_count], [
56 #include <linux/uio.h>
58 struct iov_iter iter = { 0 };
59 size_t bytes __attribute__ ((unused));
61 bytes = iov_iter_count(&iter);
64 ZFS_LINUX_TEST_SRC([copy_to_iter], [
66 #include <linux/uio.h>
68 struct iov_iter iter = { 0 };
69 char buf[512] = { 0 };
71 size_t bytes __attribute__ ((unused));
73 bytes = copy_to_iter((const void *)&buf, size, &iter);
76 ZFS_LINUX_TEST_SRC([copy_from_iter], [
78 #include <linux/uio.h>
80 struct iov_iter iter = { 0 };
81 char buf[512] = { 0 };
83 size_t bytes __attribute__ ((unused));
85 bytes = copy_from_iter((void *)&buf, size, &iter);
88 ZFS_LINUX_TEST_SRC([iov_iter_type], [
90 #include <linux/uio.h>
92 struct iov_iter iter = { 0 };
93 __attribute__((unused)) enum iter_type i = iov_iter_type(&iter);
96 ZFS_LINUX_TEST_SRC([iter_iov], [
98 #include <linux/uio.h>
100 struct iov_iter iter = { 0 };
101 __attribute__((unused)) const struct iovec *iov = iter_iov(&iter);
105 AC_DEFUN([ZFS_AC_KERNEL_VFS_IOV_ITER], [
106 enable_vfs_iov_iter="yes"
108 AC_MSG_CHECKING([whether iov_iter types are available])
109 ZFS_LINUX_TEST_RESULT([iov_iter_types], [
111 AC_DEFINE(HAVE_IOV_ITER_TYPES, 1,
112 [iov_iter types are available])
115 enable_vfs_iov_iter="no"
118 AC_MSG_CHECKING([whether iov_iter_advance() is available])
119 ZFS_LINUX_TEST_RESULT([iov_iter_advance], [
121 AC_DEFINE(HAVE_IOV_ITER_ADVANCE, 1,
122 [iov_iter_advance() is available])
125 enable_vfs_iov_iter="no"
128 AC_MSG_CHECKING([whether iov_iter_revert() is available])
129 ZFS_LINUX_TEST_RESULT([iov_iter_revert], [
131 AC_DEFINE(HAVE_IOV_ITER_REVERT, 1,
132 [iov_iter_revert() is available])
135 enable_vfs_iov_iter="no"
138 AC_MSG_CHECKING([whether iov_iter_fault_in_readable() is available])
139 ZFS_LINUX_TEST_RESULT([iov_iter_fault_in_readable], [
141 AC_DEFINE(HAVE_IOV_ITER_FAULT_IN_READABLE, 1,
142 [iov_iter_fault_in_readable() is available])
146 AC_MSG_CHECKING([whether fault_in_iov_iter_readable() is available])
147 ZFS_LINUX_TEST_RESULT([fault_in_iov_iter_readable], [
149 AC_DEFINE(HAVE_FAULT_IN_IOV_ITER_READABLE, 1,
150 [fault_in_iov_iter_readable() is available])
153 enable_vfs_iov_iter="no"
157 AC_MSG_CHECKING([whether iov_iter_count() is available])
158 ZFS_LINUX_TEST_RESULT([iov_iter_count], [
160 AC_DEFINE(HAVE_IOV_ITER_COUNT, 1,
161 [iov_iter_count() is available])
164 enable_vfs_iov_iter="no"
167 AC_MSG_CHECKING([whether copy_to_iter() is available])
168 ZFS_LINUX_TEST_RESULT([copy_to_iter], [
170 AC_DEFINE(HAVE_COPY_TO_ITER, 1,
171 [copy_to_iter() is available])
174 enable_vfs_iov_iter="no"
177 AC_MSG_CHECKING([whether copy_from_iter() is available])
178 ZFS_LINUX_TEST_RESULT([copy_from_iter], [
180 AC_DEFINE(HAVE_COPY_FROM_ITER, 1,
181 [copy_from_iter() is available])
184 enable_vfs_iov_iter="no"
188 dnl # This checks for iov_iter_type() in linux/uio.h. It is not
189 dnl # required, however, and the module will compiled without it
190 dnl # using direct access of the member attribute
192 AC_MSG_CHECKING([whether iov_iter_type() is available])
193 ZFS_LINUX_TEST_RESULT([iov_iter_type], [
195 AC_DEFINE(HAVE_IOV_ITER_TYPE, 1,
196 [iov_iter_type() is available])
202 dnl # As of the 4.9 kernel support is provided for iovecs, kvecs,
203 dnl # bvecs and pipes in the iov_iter structure. As long as the
204 dnl # other support interfaces are all available the iov_iter can
205 dnl # be correctly used in the uio structure.
207 AS_IF([test "x$enable_vfs_iov_iter" = "xyes"], [
208 AC_DEFINE(HAVE_VFS_IOV_ITER, 1,
209 [All required iov_iter interfaces are available])
213 dnl # Kernel 6.5 introduces the iter_iov() function that returns the
214 dnl # __iov member of an iov_iter*. The iov member was renamed to this
215 dnl # __iov member, and is intended to be accessed via the helper
218 AC_MSG_CHECKING([whether iter_iov() is available])
219 ZFS_LINUX_TEST_RESULT([iter_iov], [
221 AC_DEFINE(HAVE_ITER_IOV, 1,
222 [iter_iov() is available])