1dnl # 2dnl # Check for available iov_iter functionality. 3dnl # 4AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_IOV_ITER], [ 5 ZFS_LINUX_TEST_SRC([iov_iter_types], [ 6 #include <linux/fs.h> 7 #include <linux/uio.h> 8 ],[ 9 int type __attribute__ ((unused)) = 10 ITER_IOVEC | ITER_KVEC | ITER_BVEC | ITER_PIPE; 11 ]) 12 13 ZFS_LINUX_TEST_SRC([iov_iter_advance], [ 14 #include <linux/fs.h> 15 #include <linux/uio.h> 16 ],[ 17 struct iov_iter iter = { 0 }; 18 size_t advance = 512; 19 20 iov_iter_advance(&iter, advance); 21 ]) 22 23 ZFS_LINUX_TEST_SRC([iov_iter_revert], [ 24 #include <linux/fs.h> 25 #include <linux/uio.h> 26 ],[ 27 struct iov_iter iter = { 0 }; 28 size_t revert = 512; 29 30 iov_iter_revert(&iter, revert); 31 ]) 32 33 ZFS_LINUX_TEST_SRC([iov_iter_fault_in_readable], [ 34 #include <linux/fs.h> 35 #include <linux/uio.h> 36 ],[ 37 struct iov_iter iter = { 0 }; 38 size_t size = 512; 39 int error __attribute__ ((unused)); 40 41 error = iov_iter_fault_in_readable(&iter, size); 42 ]) 43 44 ZFS_LINUX_TEST_SRC([iov_iter_count], [ 45 #include <linux/fs.h> 46 #include <linux/uio.h> 47 ],[ 48 struct iov_iter iter = { 0 }; 49 size_t bytes __attribute__ ((unused)); 50 51 bytes = iov_iter_count(&iter); 52 ]) 53 54 ZFS_LINUX_TEST_SRC([copy_to_iter], [ 55 #include <linux/fs.h> 56 #include <linux/uio.h> 57 ],[ 58 struct iov_iter iter = { 0 }; 59 char buf[512] = { 0 }; 60 size_t size = 512; 61 size_t bytes __attribute__ ((unused)); 62 63 bytes = copy_to_iter((const void *)&buf, size, &iter); 64 ]) 65 66 ZFS_LINUX_TEST_SRC([copy_from_iter], [ 67 #include <linux/fs.h> 68 #include <linux/uio.h> 69 ],[ 70 struct iov_iter iter = { 0 }; 71 char buf[512] = { 0 }; 72 size_t size = 512; 73 size_t bytes __attribute__ ((unused)); 74 75 bytes = copy_from_iter((void *)&buf, size, &iter); 76 ]) 77 78 ZFS_LINUX_TEST_SRC([iov_iter_type], [ 79 #include <linux/fs.h> 80 #include <linux/uio.h> 81 ],[ 82 struct iov_iter iter = { 0 }; 83 __attribute__((unused)) enum iter_type i = iov_iter_type(&iter); 84 ]) 85]) 86 87AC_DEFUN([ZFS_AC_KERNEL_VFS_IOV_ITER], [ 88 enable_vfs_iov_iter="yes" 89 90 AC_MSG_CHECKING([whether iov_iter types are available]) 91 ZFS_LINUX_TEST_RESULT([iov_iter_types], [ 92 AC_MSG_RESULT(yes) 93 AC_DEFINE(HAVE_IOV_ITER_TYPES, 1, 94 [iov_iter types are available]) 95 ],[ 96 AC_MSG_RESULT(no) 97 enable_vfs_iov_iter="no" 98 ]) 99 100 AC_MSG_CHECKING([whether iov_iter_advance() is available]) 101 ZFS_LINUX_TEST_RESULT([iov_iter_advance], [ 102 AC_MSG_RESULT(yes) 103 AC_DEFINE(HAVE_IOV_ITER_ADVANCE, 1, 104 [iov_iter_advance() is available]) 105 ],[ 106 AC_MSG_RESULT(no) 107 enable_vfs_iov_iter="no" 108 ]) 109 110 AC_MSG_CHECKING([whether iov_iter_revert() is available]) 111 ZFS_LINUX_TEST_RESULT([iov_iter_revert], [ 112 AC_MSG_RESULT(yes) 113 AC_DEFINE(HAVE_IOV_ITER_REVERT, 1, 114 [iov_iter_revert() is available]) 115 ],[ 116 AC_MSG_RESULT(no) 117 enable_vfs_iov_iter="no" 118 ]) 119 120 AC_MSG_CHECKING([whether iov_iter_fault_in_readable() is available]) 121 ZFS_LINUX_TEST_RESULT([iov_iter_fault_in_readable], [ 122 AC_MSG_RESULT(yes) 123 AC_DEFINE(HAVE_IOV_ITER_FAULT_IN_READABLE, 1, 124 [iov_iter_fault_in_readable() is available]) 125 ],[ 126 AC_MSG_RESULT(no) 127 enable_vfs_iov_iter="no" 128 ]) 129 130 AC_MSG_CHECKING([whether iov_iter_count() is available]) 131 ZFS_LINUX_TEST_RESULT([iov_iter_count], [ 132 AC_MSG_RESULT(yes) 133 AC_DEFINE(HAVE_IOV_ITER_COUNT, 1, 134 [iov_iter_count() is available]) 135 ],[ 136 AC_MSG_RESULT(no) 137 enable_vfs_iov_iter="no" 138 ]) 139 140 AC_MSG_CHECKING([whether copy_to_iter() is available]) 141 ZFS_LINUX_TEST_RESULT([copy_to_iter], [ 142 AC_MSG_RESULT(yes) 143 AC_DEFINE(HAVE_COPY_TO_ITER, 1, 144 [copy_to_iter() is available]) 145 ],[ 146 AC_MSG_RESULT(no) 147 enable_vfs_iov_iter="no" 148 ]) 149 150 AC_MSG_CHECKING([whether copy_from_iter() is available]) 151 ZFS_LINUX_TEST_RESULT([copy_from_iter], [ 152 AC_MSG_RESULT(yes) 153 AC_DEFINE(HAVE_COPY_FROM_ITER, 1, 154 [copy_from_iter() is available]) 155 ],[ 156 AC_MSG_RESULT(no) 157 enable_vfs_iov_iter="no" 158 ]) 159 160 dnl # 161 dnl # This checks for iov_iter_type() in linux/uio.h. It is not 162 dnl # required, however, and the module will compiled without it 163 dnl # using direct access of the member attribute 164 dnl # 165 AC_MSG_CHECKING([whether iov_iter_type() is available]) 166 ZFS_LINUX_TEST_RESULT([iov_iter_type], [ 167 AC_MSG_RESULT(yes) 168 AC_DEFINE(HAVE_IOV_ITER_TYPE, 1, 169 [iov_iter_type() is available]) 170 ],[ 171 AC_MSG_RESULT(no) 172 ]) 173 174 dnl # 175 dnl # As of the 4.9 kernel support is provided for iovecs, kvecs, 176 dnl # bvecs and pipes in the iov_iter structure. As long as the 177 dnl # other support interfaces are all available the iov_iter can 178 dnl # be correctly used in the uio structure. 179 dnl # 180 AS_IF([test "x$enable_vfs_iov_iter" = "xyes"], [ 181 AC_DEFINE(HAVE_VFS_IOV_ITER, 1, 182 [All required iov_iter interfaces are available]) 183 ]) 184]) 185