17877fdebSMatt Macydnl # 27877fdebSMatt Macydnl # Check for available iov_iter functionality. 37877fdebSMatt Macydnl # 47877fdebSMatt MacyAC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_IOV_ITER], [ 5c03c5b1cSMartin Matuska ZFS_LINUX_TEST_SRC([fault_in_iov_iter_readable], [ 6c03c5b1cSMartin Matuska #include <linux/fs.h> 7c03c5b1cSMartin Matuska #include <linux/uio.h> 8c03c5b1cSMartin Matuska ],[ 9c03c5b1cSMartin Matuska struct iov_iter iter = { 0 }; 10c03c5b1cSMartin Matuska size_t size = 512; 11c03c5b1cSMartin Matuska int error __attribute__ ((unused)); 12c03c5b1cSMartin Matuska 13c03c5b1cSMartin Matuska error = fault_in_iov_iter_readable(&iter, size); 14c03c5b1cSMartin Matuska ]) 15c03c5b1cSMartin Matuska 16*7a7741afSMartin Matuska ZFS_LINUX_TEST_SRC([iov_iter_get_pages2], [ 177877fdebSMatt Macy #include <linux/uio.h> 187877fdebSMatt Macy ], [ 197877fdebSMatt Macy struct iov_iter iter = { 0 }; 20*7a7741afSMartin Matuska struct page **pages = NULL; 21*7a7741afSMartin Matuska size_t maxsize = 4096; 22*7a7741afSMartin Matuska unsigned maxpages = 1; 23*7a7741afSMartin Matuska size_t start; 24*7a7741afSMartin Matuska size_t ret __attribute__ ((unused)); 257877fdebSMatt Macy 26*7a7741afSMartin Matuska ret = iov_iter_get_pages2(&iter, pages, maxsize, maxpages, 27*7a7741afSMartin Matuska &start); 287877fdebSMatt Macy ]) 297877fdebSMatt Macy 30*7a7741afSMartin Matuska ZFS_LINUX_TEST_SRC([iov_iter_get_pages], [ 317877fdebSMatt Macy #include <linux/uio.h> 327877fdebSMatt Macy ], [ 337877fdebSMatt Macy struct iov_iter iter = { 0 }; 34*7a7741afSMartin Matuska struct page **pages = NULL; 35*7a7741afSMartin Matuska size_t maxsize = 4096; 36*7a7741afSMartin Matuska unsigned maxpages = 1; 37*7a7741afSMartin Matuska size_t start; 38*7a7741afSMartin Matuska size_t ret __attribute__ ((unused)); 397877fdebSMatt Macy 40*7a7741afSMartin Matuska ret = iov_iter_get_pages(&iter, pages, maxsize, maxpages, 41*7a7741afSMartin Matuska &start); 427877fdebSMatt Macy ]) 43681ce946SMartin Matuska 44681ce946SMartin Matuska ZFS_LINUX_TEST_SRC([iov_iter_type], [ 45681ce946SMartin Matuska #include <linux/fs.h> 46681ce946SMartin Matuska #include <linux/uio.h> 47681ce946SMartin Matuska ],[ 48681ce946SMartin Matuska struct iov_iter iter = { 0 }; 49681ce946SMartin Matuska __attribute__((unused)) enum iter_type i = iov_iter_type(&iter); 50681ce946SMartin Matuska ]) 51315ee00fSMartin Matuska 52315ee00fSMartin Matuska ZFS_LINUX_TEST_SRC([iter_iov], [ 53315ee00fSMartin Matuska #include <linux/fs.h> 54315ee00fSMartin Matuska #include <linux/uio.h> 55315ee00fSMartin Matuska ],[ 56315ee00fSMartin Matuska struct iov_iter iter = { 0 }; 57315ee00fSMartin Matuska __attribute__((unused)) const struct iovec *iov = iter_iov(&iter); 58315ee00fSMartin Matuska ]) 597877fdebSMatt Macy]) 607877fdebSMatt Macy 617877fdebSMatt MacyAC_DEFUN([ZFS_AC_KERNEL_VFS_IOV_ITER], [ 627877fdebSMatt Macy enable_vfs_iov_iter="yes" 637877fdebSMatt Macy 64c03c5b1cSMartin Matuska AC_MSG_CHECKING([whether fault_in_iov_iter_readable() is available]) 65c03c5b1cSMartin Matuska ZFS_LINUX_TEST_RESULT([fault_in_iov_iter_readable], [ 66c03c5b1cSMartin Matuska AC_MSG_RESULT(yes) 67c03c5b1cSMartin Matuska AC_DEFINE(HAVE_FAULT_IN_IOV_ITER_READABLE, 1, 68c03c5b1cSMartin Matuska [fault_in_iov_iter_readable() is available]) 69c03c5b1cSMartin Matuska ],[ 707877fdebSMatt Macy AC_MSG_RESULT(no) 71c03c5b1cSMartin Matuska ]) 727877fdebSMatt Macy 73*7a7741afSMartin Matuska dnl # 74*7a7741afSMartin Matuska dnl # Kernel 6.0 changed iov_iter_get_pages() to iov_iter_page_pages2(). 75*7a7741afSMartin Matuska dnl # 76*7a7741afSMartin Matuska AC_MSG_CHECKING([whether iov_iter_get_pages2() is available]) 77*7a7741afSMartin Matuska ZFS_LINUX_TEST_RESULT([iov_iter_get_pages2], [ 787877fdebSMatt Macy AC_MSG_RESULT(yes) 79*7a7741afSMartin Matuska AC_DEFINE(HAVE_IOV_ITER_GET_PAGES2, 1, 80*7a7741afSMartin Matuska [iov_iter_get_pages2() is available]) 81*7a7741afSMartin Matuska ], [ 82*7a7741afSMartin Matuska AC_MSG_RESULT(no) 83*7a7741afSMartin Matuska AC_MSG_CHECKING([whether iov_iter_get_pages() is available]) 84*7a7741afSMartin Matuska ZFS_LINUX_TEST_RESULT([iov_iter_get_pages], [ 85*7a7741afSMartin Matuska AC_MSG_RESULT(yes) 86*7a7741afSMartin Matuska AC_DEFINE(HAVE_IOV_ITER_GET_PAGES, 1, 87*7a7741afSMartin Matuska [iov_iter_get_pages() is available]) 887877fdebSMatt Macy ], [ 897877fdebSMatt Macy AC_MSG_RESULT(no) 907877fdebSMatt Macy enable_vfs_iov_iter="no" 917877fdebSMatt Macy ]) 927877fdebSMatt Macy ]) 937877fdebSMatt Macy 947877fdebSMatt Macy dnl # 95681ce946SMartin Matuska dnl # This checks for iov_iter_type() in linux/uio.h. It is not 96681ce946SMartin Matuska dnl # required, however, and the module will compiled without it 97681ce946SMartin Matuska dnl # using direct access of the member attribute 98681ce946SMartin Matuska dnl # 99681ce946SMartin Matuska AC_MSG_CHECKING([whether iov_iter_type() is available]) 100681ce946SMartin Matuska ZFS_LINUX_TEST_RESULT([iov_iter_type], [ 101681ce946SMartin Matuska AC_MSG_RESULT(yes) 102681ce946SMartin Matuska AC_DEFINE(HAVE_IOV_ITER_TYPE, 1, 103681ce946SMartin Matuska [iov_iter_type() is available]) 104681ce946SMartin Matuska ],[ 105681ce946SMartin Matuska AC_MSG_RESULT(no) 106681ce946SMartin Matuska ]) 107681ce946SMartin Matuska 108681ce946SMartin Matuska dnl # 1097877fdebSMatt Macy dnl # As of the 4.9 kernel support is provided for iovecs, kvecs, 1107877fdebSMatt Macy dnl # bvecs and pipes in the iov_iter structure. As long as the 1117877fdebSMatt Macy dnl # other support interfaces are all available the iov_iter can 1127877fdebSMatt Macy dnl # be correctly used in the uio structure. 1137877fdebSMatt Macy dnl # 1147877fdebSMatt Macy AS_IF([test "x$enable_vfs_iov_iter" = "xyes"], [ 1157877fdebSMatt Macy AC_DEFINE(HAVE_VFS_IOV_ITER, 1, 1167877fdebSMatt Macy [All required iov_iter interfaces are available]) 1177877fdebSMatt Macy ]) 118315ee00fSMartin Matuska 119315ee00fSMartin Matuska dnl # 120315ee00fSMartin Matuska dnl # Kernel 6.5 introduces the iter_iov() function that returns the 121315ee00fSMartin Matuska dnl # __iov member of an iov_iter*. The iov member was renamed to this 122315ee00fSMartin Matuska dnl # __iov member, and is intended to be accessed via the helper 123315ee00fSMartin Matuska dnl # function now. 124315ee00fSMartin Matuska dnl # 125315ee00fSMartin Matuska AC_MSG_CHECKING([whether iter_iov() is available]) 126315ee00fSMartin Matuska ZFS_LINUX_TEST_RESULT([iter_iov], [ 127315ee00fSMartin Matuska AC_MSG_RESULT(yes) 128315ee00fSMartin Matuska AC_DEFINE(HAVE_ITER_IOV, 1, 129315ee00fSMartin Matuska [iter_iov() is available]) 130315ee00fSMartin Matuska ],[ 131315ee00fSMartin Matuska AC_MSG_RESULT(no) 132315ee00fSMartin Matuska ]) 1337877fdebSMatt Macy]) 134