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_get_pages2], [ 17 #include <linux/uio.h> 18 ], [ 19 struct iov_iter iter = { 0 }; 20 struct page **pages = NULL; 21 size_t maxsize = 4096; 22 unsigned maxpages = 1; 23 size_t start; 24 size_t ret __attribute__ ((unused)); 25 26 ret = iov_iter_get_pages2(&iter, pages, maxsize, maxpages, 27 &start); 28 ]) 29 30 ZFS_LINUX_TEST_SRC([iov_iter_get_pages], [ 31 #include <linux/uio.h> 32 ], [ 33 struct iov_iter iter = { 0 }; 34 struct page **pages = NULL; 35 size_t maxsize = 4096; 36 unsigned maxpages = 1; 37 size_t start; 38 size_t ret __attribute__ ((unused)); 39 40 ret = iov_iter_get_pages(&iter, pages, maxsize, maxpages, 41 &start); 42 ]) 43 44 ZFS_LINUX_TEST_SRC([iov_iter_type], [ 45 #include <linux/fs.h> 46 #include <linux/uio.h> 47 ],[ 48 struct iov_iter iter = { 0 }; 49 __attribute__((unused)) enum iter_type i = iov_iter_type(&iter); 50 ]) 51 52 ZFS_LINUX_TEST_SRC([iter_iov], [ 53 #include <linux/fs.h> 54 #include <linux/uio.h> 55 ],[ 56 struct iov_iter iter = { 0 }; 57 __attribute__((unused)) const struct iovec *iov = iter_iov(&iter); 58 ]) 59]) 60 61AC_DEFUN([ZFS_AC_KERNEL_VFS_IOV_ITER], [ 62 enable_vfs_iov_iter="yes" 63 64 AC_MSG_CHECKING([whether fault_in_iov_iter_readable() is available]) 65 ZFS_LINUX_TEST_RESULT([fault_in_iov_iter_readable], [ 66 AC_MSG_RESULT(yes) 67 AC_DEFINE(HAVE_FAULT_IN_IOV_ITER_READABLE, 1, 68 [fault_in_iov_iter_readable() is available]) 69 ],[ 70 AC_MSG_RESULT(no) 71 ]) 72 73 dnl # 74 dnl # Kernel 6.0 changed iov_iter_get_pages() to iov_iter_page_pages2(). 75 dnl # 76 AC_MSG_CHECKING([whether iov_iter_get_pages2() is available]) 77 ZFS_LINUX_TEST_RESULT([iov_iter_get_pages2], [ 78 AC_MSG_RESULT(yes) 79 AC_DEFINE(HAVE_IOV_ITER_GET_PAGES2, 1, 80 [iov_iter_get_pages2() is available]) 81 ], [ 82 AC_MSG_RESULT(no) 83 AC_MSG_CHECKING([whether iov_iter_get_pages() is available]) 84 ZFS_LINUX_TEST_RESULT([iov_iter_get_pages], [ 85 AC_MSG_RESULT(yes) 86 AC_DEFINE(HAVE_IOV_ITER_GET_PAGES, 1, 87 [iov_iter_get_pages() is available]) 88 ], [ 89 AC_MSG_RESULT(no) 90 enable_vfs_iov_iter="no" 91 ]) 92 ]) 93 94 dnl # 95 dnl # This checks for iov_iter_type() in linux/uio.h. It is not 96 dnl # required, however, and the module will compiled without it 97 dnl # using direct access of the member attribute 98 dnl # 99 AC_MSG_CHECKING([whether iov_iter_type() is available]) 100 ZFS_LINUX_TEST_RESULT([iov_iter_type], [ 101 AC_MSG_RESULT(yes) 102 AC_DEFINE(HAVE_IOV_ITER_TYPE, 1, 103 [iov_iter_type() is available]) 104 ],[ 105 AC_MSG_RESULT(no) 106 ]) 107 108 dnl # 109 dnl # As of the 4.9 kernel support is provided for iovecs, kvecs, 110 dnl # bvecs and pipes in the iov_iter structure. As long as the 111 dnl # other support interfaces are all available the iov_iter can 112 dnl # be correctly used in the uio structure. 113 dnl # 114 AS_IF([test "x$enable_vfs_iov_iter" = "xyes"], [ 115 AC_DEFINE(HAVE_VFS_IOV_ITER, 1, 116 [All required iov_iter interfaces are available]) 117 ]) 118 119 dnl # 120 dnl # Kernel 6.5 introduces the iter_iov() function that returns the 121 dnl # __iov member of an iov_iter*. The iov member was renamed to this 122 dnl # __iov member, and is intended to be accessed via the helper 123 dnl # function now. 124 dnl # 125 AC_MSG_CHECKING([whether iter_iov() is available]) 126 ZFS_LINUX_TEST_RESULT([iter_iov], [ 127 AC_MSG_RESULT(yes) 128 AC_DEFINE(HAVE_ITER_IOV, 1, 129 [iter_iov() is available]) 130 ],[ 131 AC_MSG_RESULT(no) 132 ]) 133]) 134