ZIL: Assert record sizes in different places
[zfs.git] / config / kernel-vfs-iterate.m4
blob172118eac87b444593f7805b618c2707ac0e7fd6
1 AC_DEFUN([ZFS_AC_KERNEL_SRC_VFS_ITERATE], [
2         ZFS_LINUX_TEST_SRC([file_operations_iterate_shared], [
3                 #include <linux/fs.h>
4                 int iterate(struct file *filp, struct dir_context * context)
5                     { return 0; }
7                 static const struct file_operations fops
8                     __attribute__ ((unused)) = {
9                         .iterate_shared  = iterate,
10                 };
11         ],[])
13         ZFS_LINUX_TEST_SRC([file_operations_iterate], [
14                 #include <linux/fs.h>
15                 int iterate(struct file *filp,
16                     struct dir_context *context) { return 0; }
18                 static const struct file_operations fops
19                     __attribute__ ((unused)) = {
20                         .iterate         = iterate,
21                 };
23                 #if defined(FMODE_KABI_ITERATE)
24                 #error "RHEL 7.5, FMODE_KABI_ITERATE interface"
25                 #endif
26         ],[])
28         ZFS_LINUX_TEST_SRC([file_operations_readdir], [
29                 #include <linux/fs.h>
30                 int readdir(struct file *filp, void *entry,
31                     filldir_t func) { return 0; }
33                 static const struct file_operations fops
34                     __attribute__ ((unused)) = {
35                         .readdir = readdir,
36                 };
37         ],[])
40 AC_DEFUN([ZFS_AC_KERNEL_VFS_ITERATE], [
41         dnl #
42         dnl # 4.7 API change
43         dnl #
44         AC_MSG_CHECKING([whether fops->iterate_shared() is available])
45         ZFS_LINUX_TEST_RESULT([file_operations_iterate_shared], [
46                 AC_MSG_RESULT(yes)
47                 AC_DEFINE(HAVE_VFS_ITERATE_SHARED, 1,
48                     [fops->iterate_shared() is available])
49         ],[
50                 AC_MSG_RESULT(no)
52                 dnl #
53                 dnl # 3.11 API change
54                 dnl #
55                 dnl # RHEL 7.5 compatibility; the fops.iterate() method was
56                 dnl # added to the file_operations structure but in order to
57                 dnl # maintain KABI compatibility all callers must set
58                 dnl # FMODE_KABI_ITERATE which is checked in iterate_dir().
59                 dnl # When detected ignore this interface and fallback to
60                 dnl # to using fops.readdir() to retain KABI compatibility.
61                 dnl #
62                 AC_MSG_CHECKING([whether fops->iterate() is available])
63                 ZFS_LINUX_TEST_RESULT([file_operations_iterate], [
64                         AC_MSG_RESULT(yes)
65                         AC_DEFINE(HAVE_VFS_ITERATE, 1,
66                             [fops->iterate() is available])
67                 ],[
68                         AC_MSG_RESULT(no)
70                         dnl #
71                         dnl # readdir interface introduced
72                         dnl #
73                         AC_MSG_CHECKING([whether fops->readdir() is available])
74                         ZFS_LINUX_TEST_RESULT([file_operations_readdir], [
75                                 AC_MSG_RESULT(yes)
76                                 AC_DEFINE(HAVE_VFS_READDIR, 1,
77                                     [fops->readdir() is available])
78                         ],[
79                                 ZFS_LINUX_TEST_ERROR([vfs_iterate])
80                         ])
81                 ])
82         ])