Ubuntu 22.04 integration: Cppcheck
[zfs.git] / config / kernel-vfs-rw-iterate.m4
blob000353ec15b06b2ab3f60d72173dacf90b37ac94
1 dnl #
2 dnl # Linux 3.16 API
3 dnl #
4 AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_RW_ITERATE], [
5         ZFS_LINUX_TEST_SRC([file_operations_rw], [
6                 #include <linux/fs.h>
8                 ssize_t test_read(struct kiocb *kiocb, struct iov_iter *to)
9                     { return 0; }
10                 ssize_t test_write(struct kiocb *kiocb, struct iov_iter *from)
11                     { return 0; }
13                 static const struct file_operations
14                     fops __attribute__ ((unused)) = {
15                     .read_iter = test_read,
16                     .write_iter = test_write,
17                 };
18         ],[])
20         ZFS_LINUX_TEST_SRC([new_sync_rw], [
21                 #include <linux/fs.h>
22         ],[
23                 ssize_t ret __attribute__ ((unused));
24                 struct file *filp = NULL;
25                 char __user *rbuf = NULL;
26                 const char __user *wbuf = NULL;
27                 size_t len = 0;
28                 loff_t ppos;
30                 ret = new_sync_read(filp, rbuf, len, &ppos);
31                 ret = new_sync_write(filp, wbuf, len, &ppos);
32         ])
35 AC_DEFUN([ZFS_AC_KERNEL_VFS_RW_ITERATE], [
36         AC_MSG_CHECKING([whether fops->read/write_iter() are available])
37         ZFS_LINUX_TEST_RESULT([file_operations_rw], [
38                 AC_MSG_RESULT(yes)
39                 AC_DEFINE(HAVE_VFS_RW_ITERATE, 1,
40                     [fops->read/write_iter() are available])
42                 dnl #
43                 dnl # Linux 4.1 API
44                 dnl #
45                 AC_MSG_CHECKING([whether new_sync_read/write() are available])
46                 ZFS_LINUX_TEST_RESULT([new_sync_rw], [
47                         AC_MSG_RESULT(yes)
48                         AC_DEFINE(HAVE_NEW_SYNC_READ, 1,
49                             [new_sync_read()/new_sync_write() are available])
50                 ],[
51                         AC_MSG_RESULT(no)
52                 ])
53         ],[
54                 AC_MSG_RESULT(no)
55         ])
58 dnl #
59 dnl # Linux 4.1.x API
60 dnl #
61 AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_GENERIC_WRITE_CHECKS], [
62         ZFS_LINUX_TEST_SRC([generic_write_checks], [
63                 #include <linux/fs.h>
64         ],[
65                 struct kiocb *iocb = NULL;
66                 struct iov_iter *iov = NULL;
67                 generic_write_checks(iocb, iov);
68         ])
71 AC_DEFUN([ZFS_AC_KERNEL_VFS_GENERIC_WRITE_CHECKS], [
72         AC_MSG_CHECKING([whether generic_write_checks() takes kiocb])
73         ZFS_LINUX_TEST_RESULT([generic_write_checks], [
74                 AC_MSG_RESULT(yes)
75                 AC_DEFINE(HAVE_GENERIC_WRITE_CHECKS_KIOCB, 1,
76                     [generic_write_checks() takes kiocb])
77         ],[
78                 AC_MSG_RESULT(no)
79         ])