]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - config/kernel-vfs-rw-iterate.m4
Fix allocation_classes GUID in zpool-features(5)
[FreeBSD/FreeBSD.git] / config / kernel-vfs-rw-iterate.m4
1 dnl #
2 dnl # Linux 3.16 API
3 dnl #
4 AC_DEFUN([ZFS_AC_KERNEL_VFS_RW_ITERATE],
5         [AC_MSG_CHECKING([whether fops->read/write_iter() are available])
6         ZFS_LINUX_TRY_COMPILE([
7                 #include <linux/fs.h>
8
9                 ssize_t test_read(struct kiocb *kiocb, struct iov_iter *to)
10                     { return 0; }
11                 ssize_t test_write(struct kiocb *kiocb, struct iov_iter *from)
12                     { return 0; }
13
14                 static const struct file_operations
15                     fops __attribute__ ((unused)) = {
16                     .read_iter = test_read,
17                     .write_iter = test_write,
18                 };
19         ],[
20         ],[
21                 AC_MSG_RESULT(yes)
22                 AC_DEFINE(HAVE_VFS_RW_ITERATE, 1,
23                         [fops->read/write_iter() are available])
24
25                 ZFS_AC_KERNEL_NEW_SYNC_READ
26         ],[
27                 AC_MSG_RESULT(no)
28         ])
29 ])
30
31 dnl #
32 dnl # Linux 4.1 API
33 dnl #
34 AC_DEFUN([ZFS_AC_KERNEL_NEW_SYNC_READ],
35         [AC_MSG_CHECKING([whether new_sync_read/write() are available])
36         ZFS_LINUX_TRY_COMPILE([
37                 #include <linux/fs.h>
38         ],[
39                         ssize_t ret __attribute__ ((unused));
40                         struct file *filp = NULL;
41                         char __user *rbuf = NULL;
42                         const char __user *wbuf = NULL;
43                         size_t len = 0;
44                         loff_t ppos;
45
46                         ret = new_sync_read(filp, rbuf, len, &ppos);
47                         ret = new_sync_write(filp, wbuf, len, &ppos);
48         ],[
49                 AC_MSG_RESULT(yes)
50                 AC_DEFINE(HAVE_NEW_SYNC_READ, 1,
51                         [new_sync_read()/new_sync_write() are available])
52         ],[
53                 AC_MSG_RESULT(no)
54         ])
55 ])
56
57 dnl #
58 dnl # Linux 4.1.x API
59 dnl #
60 AC_DEFUN([ZFS_AC_KERNEL_GENERIC_WRITE_CHECKS],
61         [AC_MSG_CHECKING([whether generic_write_checks() takes kiocb])
62         ZFS_LINUX_TRY_COMPILE([
63                 #include <linux/fs.h>
64
65         ],[
66                 struct kiocb *iocb = NULL;
67                 struct iov_iter *iov = NULL;
68                 generic_write_checks(iocb, iov);
69         ],[
70                 AC_MSG_RESULT(yes)
71                 AC_DEFINE(HAVE_GENERIC_WRITE_CHECKS_KIOCB, 1,
72                         [generic_write_checks() takes kiocb])
73         ],[
74                 AC_MSG_RESULT(no)
75         ])
76 ])