]> git.proxmox.com Git - mirror_zfs-debian.git/blame - config/kernel-vfs-iterate.m4
New upstream version 0.7.9
[mirror_zfs-debian.git] / config / kernel-vfs-iterate.m4
CommitLineData
c06d4368 1AC_DEFUN([ZFS_AC_KERNEL_VFS_ITERATE], [
87dac73d
AX
2 dnl #
3 dnl # 4.7 API change
4 dnl #
5 AC_MSG_CHECKING([whether fops->iterate_shared() is available])
c06d4368
AX
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)) = {
87dac73d 13 .iterate_shared = iterate,
c06d4368
AX
14 };
15 ],[
16 ],[
17 AC_MSG_RESULT(yes)
87dac73d
AX
18 AC_DEFINE(HAVE_VFS_ITERATE_SHARED, 1,
19 [fops->iterate_shared() is available])
c06d4368
AX
20 ],[
21 AC_MSG_RESULT(no)
22
87dac73d
AX
23 dnl #
24 dnl # 3.11 API change
25 dnl #
42f7b73b
AX
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 #
87dac73d 33 AC_MSG_CHECKING([whether fops->iterate() is available])
c06d4368
AX
34 ZFS_LINUX_TRY_COMPILE([
35 #include <linux/fs.h>
42f7b73b
AX
36 int iterate(struct file *filp,
37 struct dir_context *context) { return 0; }
c06d4368
AX
38
39 static const struct file_operations fops
40 __attribute__ ((unused)) = {
87dac73d 41 .iterate = iterate,
c06d4368 42 };
42f7b73b
AX
43
44 #if defined(FMODE_KABI_ITERATE)
45 #error "RHEL 7.5, FMODE_KABI_ITERATE interface"
46 #endif
c06d4368
AX
47 ],[
48 ],[
49 AC_MSG_RESULT(yes)
87dac73d
AX
50 AC_DEFINE(HAVE_VFS_ITERATE, 1,
51 [fops->iterate() is available])
c06d4368 52 ],[
87dac73d
AX
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>
42f7b73b
AX
58 int readdir(struct file *filp, void *entry,
59 filldir_t func) { return 0; }
c06d4368 60
87dac73d
AX
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 ],[
42f7b73b 71 AC_MSG_ERROR(no; file a bug report with ZoL)
87dac73d
AX
72 ])
73 ])
c06d4368
AX
74 ])
75])