1dnl #
2dnl # Linux 3.16 API
3dnl #
4AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_RW_ITERATE], [
5	ZFS_LINUX_TEST_SRC([file_operations_rw], [
6		#include <linux/fs.h>
7
8		static ssize_t test_read(struct kiocb *kiocb, struct iov_iter *to)
9		    { return 0; }
10		static ssize_t test_write(struct kiocb *kiocb, struct iov_iter *from)
11		    { return 0; }
12
13		static const struct file_operations
14		    fops __attribute__ ((unused)) = {
15		    .read_iter = test_read,
16		    .write_iter = test_write,
17		};
18	],[])
19
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;
29
30		ret = new_sync_read(filp, rbuf, len, &ppos);
31		ret = new_sync_write(filp, wbuf, len, &ppos);
32	])
33])
34
35AC_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])
41
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	])
56])
57
58dnl #
59dnl # Linux 4.1.x API
60dnl #
61AC_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	])
69])
70
71AC_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	])
80])
81