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_init], [ 14 #include <linux/fs.h> 15 #include <linux/uio.h> 16 ],[ 17 struct iov_iter iter = { 0 }; 18 struct iovec iov; 19 unsigned long nr_segs = 1; 20 size_t count = 1024; 21 22 iov_iter_init(&iter, WRITE, &iov, nr_segs, count); 23 ]) 24 25 ZFS_LINUX_TEST_SRC([iov_iter_init_legacy], [ 26 #include <linux/fs.h> 27 #include <linux/uio.h> 28 ],[ 29 struct iov_iter iter = { 0 }; 30 struct iovec iov; 31 unsigned long nr_segs = 1; 32 size_t count = 1024; 33 size_t written = 0; 34 35 iov_iter_init(&iter, &iov, nr_segs, count, written); 36 ]) 37 38 ZFS_LINUX_TEST_SRC([iov_iter_advance], [ 39 #include <linux/fs.h> 40 #include <linux/uio.h> 41 ],[ 42 struct iov_iter iter = { 0 }; 43 size_t advance = 512; 44 45 iov_iter_advance(&iter, advance); 46 ]) 47 48 ZFS_LINUX_TEST_SRC([iov_iter_revert], [ 49 #include <linux/fs.h> 50 #include <linux/uio.h> 51 ],[ 52 struct iov_iter iter = { 0 }; 53 size_t revert = 512; 54 55 iov_iter_revert(&iter, revert); 56 ]) 57 58 ZFS_LINUX_TEST_SRC([iov_iter_fault_in_readable], [ 59 #include <linux/fs.h> 60 #include <linux/uio.h> 61 ],[ 62 struct iov_iter iter = { 0 }; 63 size_t size = 512; 64 int error __attribute__ ((unused)); 65 66 error = iov_iter_fault_in_readable(&iter, size); 67 ]) 68 69 ZFS_LINUX_TEST_SRC([iov_iter_count], [ 70 #include <linux/fs.h> 71 #include <linux/uio.h> 72 ],[ 73 struct iov_iter iter = { 0 }; 74 size_t bytes __attribute__ ((unused)); 75 76 bytes = iov_iter_count(&iter); 77 ]) 78 79 ZFS_LINUX_TEST_SRC([copy_to_iter], [ 80 #include <linux/fs.h> 81 #include <linux/uio.h> 82 ],[ 83 struct iov_iter iter = { 0 }; 84 char buf[512] = { 0 }; 85 size_t size = 512; 86 size_t bytes __attribute__ ((unused)); 87 88 bytes = copy_to_iter((const void *)&buf, size, &iter); 89 ]) 90 91 ZFS_LINUX_TEST_SRC([copy_from_iter], [ 92 #include <linux/fs.h> 93 #include <linux/uio.h> 94 ],[ 95 struct iov_iter iter = { 0 }; 96 char buf[512] = { 0 }; 97 size_t size = 512; 98 size_t bytes __attribute__ ((unused)); 99 100 bytes = copy_from_iter((void *)&buf, size, &iter); 101 ]) 102]) 103 104AC_DEFUN([ZFS_AC_KERNEL_VFS_IOV_ITER], [ 105 enable_vfs_iov_iter="yes" 106 107 AC_MSG_CHECKING([whether iov_iter types are available]) 108 ZFS_LINUX_TEST_RESULT([iov_iter_types], [ 109 AC_MSG_RESULT(yes) 110 AC_DEFINE(HAVE_IOV_ITER_TYPES, 1, 111 [iov_iter types are available]) 112 ],[ 113 AC_MSG_RESULT(no) 114 enable_vfs_iov_iter="no" 115 ]) 116 117 dnl # 118 dnl # 'iov_iter_init' available in Linux 3.16 and newer. 119 dnl # 'iov_iter_init_legacy' available in Linux 3.15 and older. 120 dnl # 121 AC_MSG_CHECKING([whether iov_iter_init() is available]) 122 ZFS_LINUX_TEST_RESULT([iov_iter_init], [ 123 AC_MSG_RESULT(yes) 124 AC_DEFINE(HAVE_IOV_ITER_INIT, 1, 125 [iov_iter_init() is available]) 126 ],[ 127 ZFS_LINUX_TEST_RESULT([iov_iter_init_legacy], [ 128 AC_MSG_RESULT(yes) 129 AC_DEFINE(HAVE_IOV_ITER_INIT_LEGACY, 1, 130 [iov_iter_init() is available]) 131 ],[ 132 ZFS_LINUX_TEST_ERROR([iov_iter_init()]) 133 ]) 134 ]) 135 136 AC_MSG_CHECKING([whether iov_iter_advance() is available]) 137 ZFS_LINUX_TEST_RESULT([iov_iter_advance], [ 138 AC_MSG_RESULT(yes) 139 AC_DEFINE(HAVE_IOV_ITER_ADVANCE, 1, 140 [iov_iter_advance() is available]) 141 ],[ 142 AC_MSG_RESULT(no) 143 enable_vfs_iov_iter="no" 144 ]) 145 146 AC_MSG_CHECKING([whether iov_iter_revert() is available]) 147 ZFS_LINUX_TEST_RESULT([iov_iter_revert], [ 148 AC_MSG_RESULT(yes) 149 AC_DEFINE(HAVE_IOV_ITER_REVERT, 1, 150 [iov_iter_revert() is available]) 151 ],[ 152 AC_MSG_RESULT(no) 153 enable_vfs_iov_iter="no" 154 ]) 155 156 AC_MSG_CHECKING([whether iov_iter_fault_in_readable() is available]) 157 ZFS_LINUX_TEST_RESULT([iov_iter_fault_in_readable], [ 158 AC_MSG_RESULT(yes) 159 AC_DEFINE(HAVE_IOV_ITER_FAULT_IN_READABLE, 1, 160 [iov_iter_fault_in_readable() is available]) 161 ],[ 162 AC_MSG_RESULT(no) 163 enable_vfs_iov_iter="no" 164 ]) 165 166 AC_MSG_CHECKING([whether iov_iter_count() is available]) 167 ZFS_LINUX_TEST_RESULT([iov_iter_count], [ 168 AC_MSG_RESULT(yes) 169 AC_DEFINE(HAVE_IOV_ITER_COUNT, 1, 170 [iov_iter_count() is available]) 171 ],[ 172 AC_MSG_RESULT(no) 173 enable_vfs_iov_iter="no" 174 ]) 175 176 AC_MSG_CHECKING([whether copy_to_iter() is available]) 177 ZFS_LINUX_TEST_RESULT([copy_to_iter], [ 178 AC_MSG_RESULT(yes) 179 AC_DEFINE(HAVE_COPY_TO_ITER, 1, 180 [copy_to_iter() is available]) 181 ],[ 182 AC_MSG_RESULT(no) 183 enable_vfs_iov_iter="no" 184 ]) 185 186 AC_MSG_CHECKING([whether copy_from_iter() is available]) 187 ZFS_LINUX_TEST_RESULT([copy_from_iter], [ 188 AC_MSG_RESULT(yes) 189 AC_DEFINE(HAVE_COPY_FROM_ITER, 1, 190 [copy_from_iter() is available]) 191 ],[ 192 AC_MSG_RESULT(no) 193 enable_vfs_iov_iter="no" 194 ]) 195 196 dnl # 197 dnl # As of the 4.9 kernel support is provided for iovecs, kvecs, 198 dnl # bvecs and pipes in the iov_iter structure. As long as the 199 dnl # other support interfaces are all available the iov_iter can 200 dnl # be correctly used in the uio structure. 201 dnl # 202 AS_IF([test "x$enable_vfs_iov_iter" = "xyes"], [ 203 AC_DEFINE(HAVE_VFS_IOV_ITER, 1, 204 [All required iov_iter interfaces are available]) 205 ]) 206]) 207