]> granicus.if.org Git - zfs/blob - config/kernel-vfs-iterate.m4
Fix changelist mounted-dataset iteration
[zfs] / config / kernel-vfs-iterate.m4
1 AC_DEFUN([ZFS_AC_KERNEL_VFS_ITERATE], [
2         dnl #
3         dnl # 4.7 API change
4         dnl #
5         AC_MSG_CHECKING([whether fops->iterate_shared() is available])
6         ZFS_LINUX_TRY_COMPILE([
7                 #include <linux/fs.h>
8                 int iterate(struct file *filp, struct dir_context * context)
9                     { return 0; }
10
11                 static const struct file_operations fops
12                     __attribute__ ((unused)) = {
13                         .iterate_shared  = iterate,
14                 };
15         ],[
16         ],[
17                 AC_MSG_RESULT(yes)
18                 AC_DEFINE(HAVE_VFS_ITERATE_SHARED, 1,
19                           [fops->iterate_shared() is available])
20         ],[
21                 AC_MSG_RESULT(no)
22
23                 dnl #
24                 dnl # 3.11 API change
25                 dnl #
26                 dnl # RHEL 7.5 compatibility; the fops.iterate() method was
27                 dnl # added to the file_operations structure but in order to
28                 dnl # maintain KABI compatibility all callers must set
29                 dnl # FMODE_KABI_ITERATE which is checked in iterate_dir().
30                 dnl # When detected ignore this interface and fallback to
31                 dnl # to using fops.readdir() to retain KABI compatibility.
32                 dnl #
33                 AC_MSG_CHECKING([whether fops->iterate() is available])
34                 ZFS_LINUX_TRY_COMPILE([
35                         #include <linux/fs.h>
36                         int iterate(struct file *filp,
37                             struct dir_context *context) { return 0; }
38
39                         static const struct file_operations fops
40                             __attribute__ ((unused)) = {
41                                 .iterate         = iterate,
42                         };
43
44                         #if defined(FMODE_KABI_ITERATE)
45                         #error "RHEL 7.5, FMODE_KABI_ITERATE interface"
46                         #endif
47                 ],[
48                 ],[
49                         AC_MSG_RESULT(yes)
50                         AC_DEFINE(HAVE_VFS_ITERATE, 1,
51                                   [fops->iterate() is available])
52                 ],[
53                         AC_MSG_RESULT(no)
54
55                         AC_MSG_CHECKING([whether fops->readdir() is available])
56                         ZFS_LINUX_TRY_COMPILE([
57                                 #include <linux/fs.h>
58                                 int readdir(struct file *filp, void *entry,
59                                     filldir_t func) { return 0; }
60
61                                 static const struct file_operations fops
62                                     __attribute__ ((unused)) = {
63                                         .readdir = readdir,
64                                 };
65                         ],[
66                         ],[
67                                 AC_MSG_RESULT(yes)
68                                 AC_DEFINE(HAVE_VFS_READDIR, 1,
69                                           [fops->readdir() is available])
70                         ],[
71                                 AC_MSG_ERROR(no; file a bug report with ZoL)
72                         ])
73                 ])
74         ])
75 ])