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([fault_in_iov_iter_readable], [ 45 #include <linux/fs.h> 46 #include <linux/uio.h> 47 ],[ 48 struct iov_iter iter = { 0 }; 49 size_t size = 512; 50 int error __attribute__ ((unused)); 51 52 error = fault_in_iov_iter_readable(&iter, size); 53 ]) 54 55 ZFS_LINUX_TEST_SRC([iov_iter_count], [ 56 #include <linux/fs.h> 57 #include <linux/uio.h> 58 ],[ 59 struct iov_iter iter = { 0 }; 60 size_t bytes __attribute__ ((unused)); 61 62 bytes = iov_iter_count(&iter); 63 ]) 64 65 ZFS_LINUX_TEST_SRC([copy_to_iter], [ 66 #include <linux/fs.h> 67 #include <linux/uio.h> 68 ],[ 69 struct iov_iter iter = { 0 }; 70 char buf[512] = { 0 }; 71 size_t size = 512; 72 size_t bytes __attribute__ ((unused)); 73 74 bytes = copy_to_iter((const void *)&buf, size, &iter); 75 ]) 76 77 ZFS_LINUX_TEST_SRC([copy_from_iter], [ 78 #include <linux/fs.h> 79 #include <linux/uio.h> 80 ],[ 81 struct iov_iter iter = { 0 }; 82 char buf[512] = { 0 }; 83 size_t size = 512; 84 size_t bytes __attribute__ ((unused)); 85 86 bytes = copy_from_iter((void *)&buf, size, &iter); 87 ]) 88 89 ZFS_LINUX_TEST_SRC([iov_iter_type], [ 90 #include <linux/fs.h> 91 #include <linux/uio.h> 92 ],[ 93 struct iov_iter iter = { 0 }; 94 __attribute__((unused)) enum iter_type i = iov_iter_type(&iter); 95 ]) 96]) 97 98AC_DEFUN([ZFS_AC_KERNEL_VFS_IOV_ITER], [ 99 enable_vfs_iov_iter="yes" 100 101 AC_MSG_CHECKING([whether iov_iter types are available]) 102 ZFS_LINUX_TEST_RESULT([iov_iter_types], [ 103 AC_MSG_RESULT(yes) 104 AC_DEFINE(HAVE_IOV_ITER_TYPES, 1, 105 [iov_iter types are available]) 106 ],[ 107 AC_MSG_RESULT(no) 108 enable_vfs_iov_iter="no" 109 ]) 110 111 AC_MSG_CHECKING([whether iov_iter_advance() is available]) 112 ZFS_LINUX_TEST_RESULT([iov_iter_advance], [ 113 AC_MSG_RESULT(yes) 114 AC_DEFINE(HAVE_IOV_ITER_ADVANCE, 1, 115 [iov_iter_advance() is available]) 116 ],[ 117 AC_MSG_RESULT(no) 118 enable_vfs_iov_iter="no" 119 ]) 120 121 AC_MSG_CHECKING([whether iov_iter_revert() is available]) 122 ZFS_LINUX_TEST_RESULT([iov_iter_revert], [ 123 AC_MSG_RESULT(yes) 124 AC_DEFINE(HAVE_IOV_ITER_REVERT, 1, 125 [iov_iter_revert() is available]) 126 ],[ 127 AC_MSG_RESULT(no) 128 enable_vfs_iov_iter="no" 129 ]) 130 131 AC_MSG_CHECKING([whether iov_iter_fault_in_readable() is available]) 132 ZFS_LINUX_TEST_RESULT([iov_iter_fault_in_readable], [ 133 AC_MSG_RESULT(yes) 134 AC_DEFINE(HAVE_IOV_ITER_FAULT_IN_READABLE, 1, 135 [iov_iter_fault_in_readable() is available]) 136 ],[ 137 AC_MSG_RESULT(no) 138 139 AC_MSG_CHECKING([whether fault_in_iov_iter_readable() is available]) 140 ZFS_LINUX_TEST_RESULT([fault_in_iov_iter_readable], [ 141 AC_MSG_RESULT(yes) 142 AC_DEFINE(HAVE_FAULT_IN_IOV_ITER_READABLE, 1, 143 [fault_in_iov_iter_readable() is available]) 144 ],[ 145 AC_MSG_RESULT(no) 146 enable_vfs_iov_iter="no" 147 ]) 148 ]) 149 150 AC_MSG_CHECKING([whether iov_iter_count() is available]) 151 ZFS_LINUX_TEST_RESULT([iov_iter_count], [ 152 AC_MSG_RESULT(yes) 153 AC_DEFINE(HAVE_IOV_ITER_COUNT, 1, 154 [iov_iter_count() is available]) 155 ],[ 156 AC_MSG_RESULT(no) 157 enable_vfs_iov_iter="no" 158 ]) 159 160 AC_MSG_CHECKING([whether copy_to_iter() is available]) 161 ZFS_LINUX_TEST_RESULT([copy_to_iter], [ 162 AC_MSG_RESULT(yes) 163 AC_DEFINE(HAVE_COPY_TO_ITER, 1, 164 [copy_to_iter() is available]) 165 ],[ 166 AC_MSG_RESULT(no) 167 enable_vfs_iov_iter="no" 168 ]) 169 170 AC_MSG_CHECKING([whether copy_from_iter() is available]) 171 ZFS_LINUX_TEST_RESULT([copy_from_iter], [ 172 AC_MSG_RESULT(yes) 173 AC_DEFINE(HAVE_COPY_FROM_ITER, 1, 174 [copy_from_iter() is available]) 175 ],[ 176 AC_MSG_RESULT(no) 177 enable_vfs_iov_iter="no" 178 ]) 179 180 dnl # 181 dnl # This checks for iov_iter_type() in linux/uio.h. It is not 182 dnl # required, however, and the module will compiled without it 183 dnl # using direct access of the member attribute 184 dnl # 185 AC_MSG_CHECKING([whether iov_iter_type() is available]) 186 ZFS_LINUX_TEST_RESULT([iov_iter_type], [ 187 AC_MSG_RESULT(yes) 188 AC_DEFINE(HAVE_IOV_ITER_TYPE, 1, 189 [iov_iter_type() is available]) 190 ],[ 191 AC_MSG_RESULT(no) 192 ]) 193 194 dnl # 195 dnl # As of the 4.9 kernel support is provided for iovecs, kvecs, 196 dnl # bvecs and pipes in the iov_iter structure. As long as the 197 dnl # other support interfaces are all available the iov_iter can 198 dnl # be correctly used in the uio structure. 199 dnl # 200 AS_IF([test "x$enable_vfs_iov_iter" = "xyes"], [ 201 AC_DEFINE(HAVE_VFS_IOV_ITER, 1, 202 [All required iov_iter interfaces are available]) 203 ]) 204]) 205