xref: /freebsd/sys/contrib/openzfs/config/kernel-vfs-iov_iter.m4 (revision 6c05f3a74f30934ee60919cc97e16ec69b542b06)
1dnl #
2dnl # Check for available iov_iter functionality.
3dnl #
4AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_IOV_ITER], [
5	ZFS_LINUX_TEST_SRC([fault_in_iov_iter_readable], [
6		#include <linux/fs.h>
7		#include <linux/uio.h>
8	],[
9		struct iov_iter iter = { 0 };
10		size_t size = 512;
11		int error __attribute__ ((unused));
12
13		error = fault_in_iov_iter_readable(&iter, size);
14	])
15
16	ZFS_LINUX_TEST_SRC([iov_iter_type], [
17		#include <linux/fs.h>
18		#include <linux/uio.h>
19	],[
20		struct iov_iter iter = { 0 };
21		__attribute__((unused)) enum iter_type i = iov_iter_type(&iter);
22	])
23
24	ZFS_LINUX_TEST_SRC([iter_is_ubuf], [
25		#include <linux/uio.h>
26	],[
27		struct iov_iter iter = { 0 };
28		bool ret __attribute__((unused));
29
30		ret = iter_is_ubuf(&iter);
31	])
32
33	ZFS_LINUX_TEST_SRC([iter_iov], [
34		#include <linux/fs.h>
35		#include <linux/uio.h>
36	],[
37		struct iov_iter iter = { 0 };
38		__attribute__((unused)) const struct iovec *iov = iter_iov(&iter);
39	])
40])
41
42AC_DEFUN([ZFS_AC_KERNEL_VFS_IOV_ITER], [
43
44	AC_MSG_CHECKING([whether fault_in_iov_iter_readable() is available])
45	ZFS_LINUX_TEST_RESULT([fault_in_iov_iter_readable], [
46		AC_MSG_RESULT(yes)
47		AC_DEFINE(HAVE_FAULT_IN_IOV_ITER_READABLE, 1,
48		    [fault_in_iov_iter_readable() is available])
49	],[
50		AC_MSG_RESULT(no)
51	])
52
53	dnl #
54	dnl # This checks for iov_iter_type() in linux/uio.h. It is not
55	dnl # required, however, and the module will compiled without it
56	dnl # using direct access of the member attribute
57	dnl #
58	AC_MSG_CHECKING([whether iov_iter_type() is available])
59	ZFS_LINUX_TEST_RESULT([iov_iter_type], [
60		AC_MSG_RESULT(yes)
61		AC_DEFINE(HAVE_IOV_ITER_TYPE, 1,
62		    [iov_iter_type() is available])
63	],[
64		AC_MSG_RESULT(no)
65	])
66
67	dnl #
68	dnl # Kernel 6.0 introduced the ITER_UBUF iov_iter type. iter_is_ubuf()
69	dnl # was also added to determine if the iov_iter is an ITER_UBUF.
70	dnl #
71	AC_MSG_CHECKING([whether iter_is_ubuf() is available])
72	ZFS_LINUX_TEST_RESULT([iter_is_ubuf], [
73		AC_MSG_RESULT(yes)
74		AC_DEFINE(HAVE_ITER_IS_UBUF, 1, [iter_is_ubuf() is available])
75	],[
76		AC_MSG_RESULT(no)
77	])
78
79	dnl #
80	dnl # Kernel 6.5 introduces the iter_iov() function that returns the
81	dnl # __iov member of an iov_iter*. The iov member was renamed to this
82	dnl # __iov member, and is intended to be accessed via the helper
83	dnl # function now.
84	dnl #
85	AC_MSG_CHECKING([whether iter_iov() is available])
86	ZFS_LINUX_TEST_RESULT([iter_iov], [
87		AC_MSG_RESULT(yes)
88		AC_DEFINE(HAVE_ITER_IOV, 1,
89		    [iter_iov() is available])
90	],[
91		AC_MSG_RESULT(no)
92	])
93])
94