]> git.proxmox.com Git - mirror_zfs.git/blobdiff - config/kernel-vfs-iov_iter.m4
Linux 6.5 compat: replace generic_file_splice_read with filemap_splice_read
[mirror_zfs.git] / config / kernel-vfs-iov_iter.m4
index bee6d0be96665cc9fe30633b2125766b7d2960a5..ff560ff3eef0fdb7c26217163ee4b9bbd6264428 100644 (file)
@@ -6,8 +6,7 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_IOV_ITER], [
                #include <linux/fs.h>
                #include <linux/uio.h>
        ],[
-               int type __attribute__ ((unused)) =
-                   ITER_IOVEC | ITER_KVEC | ITER_BVEC | ITER_PIPE;
+               int type __attribute__ ((unused)) = ITER_KVEC;
        ])
 
        ZFS_LINUX_TEST_SRC([iov_iter_advance], [
@@ -41,6 +40,17 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_IOV_ITER], [
                error = iov_iter_fault_in_readable(&iter, size);
        ])
 
+       ZFS_LINUX_TEST_SRC([fault_in_iov_iter_readable], [
+               #include <linux/fs.h>
+               #include <linux/uio.h>
+       ],[
+               struct iov_iter iter = { 0 };
+               size_t size = 512;
+               int error __attribute__ ((unused));
+
+               error = fault_in_iov_iter_readable(&iter, size);
+       ])
+
        ZFS_LINUX_TEST_SRC([iov_iter_count], [
                #include <linux/fs.h>
                #include <linux/uio.h>
@@ -74,6 +84,22 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_IOV_ITER], [
 
                bytes = copy_from_iter((void *)&buf, size, &iter);
        ])
+
+       ZFS_LINUX_TEST_SRC([iov_iter_type], [
+               #include <linux/fs.h>
+               #include <linux/uio.h>
+       ],[
+               struct iov_iter iter = { 0 };
+               __attribute__((unused)) enum iter_type i = iov_iter_type(&iter);
+       ])
+
+       ZFS_LINUX_TEST_SRC([iter_iov], [
+               #include <linux/fs.h>
+               #include <linux/uio.h>
+       ],[
+               struct iov_iter iter = { 0 };
+               __attribute__((unused)) const struct iovec *iov = iter_iov(&iter);
+       ])
 ])
 
 AC_DEFUN([ZFS_AC_KERNEL_VFS_IOV_ITER], [
@@ -116,7 +142,16 @@ AC_DEFUN([ZFS_AC_KERNEL_VFS_IOV_ITER], [
                    [iov_iter_fault_in_readable() is available])
        ],[
                AC_MSG_RESULT(no)
-               enable_vfs_iov_iter="no"
+
+               AC_MSG_CHECKING([whether fault_in_iov_iter_readable() is available])
+               ZFS_LINUX_TEST_RESULT([fault_in_iov_iter_readable], [
+                       AC_MSG_RESULT(yes)
+                       AC_DEFINE(HAVE_FAULT_IN_IOV_ITER_READABLE, 1,
+                           [fault_in_iov_iter_readable() is available])
+               ],[
+                       AC_MSG_RESULT(no)
+                       enable_vfs_iov_iter="no"
+               ])
        ])
 
        AC_MSG_CHECKING([whether iov_iter_count() is available])
@@ -149,6 +184,20 @@ AC_DEFUN([ZFS_AC_KERNEL_VFS_IOV_ITER], [
                enable_vfs_iov_iter="no"
        ])
 
+       dnl #
+       dnl # This checks for iov_iter_type() in linux/uio.h. It is not
+       dnl # required, however, and the module will compiled without it
+       dnl # using direct access of the member attribute
+       dnl #
+       AC_MSG_CHECKING([whether iov_iter_type() is available])
+       ZFS_LINUX_TEST_RESULT([iov_iter_type], [
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_IOV_ITER_TYPE, 1,
+                   [iov_iter_type() is available])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
+
        dnl #
        dnl # As of the 4.9 kernel support is provided for iovecs, kvecs,
        dnl # bvecs and pipes in the iov_iter structure.  As long as the
@@ -159,4 +208,19 @@ AC_DEFUN([ZFS_AC_KERNEL_VFS_IOV_ITER], [
                AC_DEFINE(HAVE_VFS_IOV_ITER, 1,
                    [All required iov_iter interfaces are available])
        ])
+
+       dnl #
+       dnl # Kernel 6.5 introduces the iter_iov() function that returns the
+       dnl # __iov member of an iov_iter*. The iov member was renamed to this
+       dnl # __iov member, and is intended to be accessed via the helper
+       dnl # function now.
+       dnl #
+       AC_MSG_CHECKING([whether iter_iov() is available])
+       ZFS_LINUX_TEST_RESULT([iter_iov], [
+               AC_MSG_RESULT(yes)
+               AC_DEFINE(HAVE_ITER_IOV, 1,
+                   [iter_iov() is available])
+       ],[
+               AC_MSG_RESULT(no)
+       ])
 ])