Fix dependency install on Debian 11 (#16683)
[zfs.git] / config / kernel-inode-getattr.m4
blob73b8213109fb9ed720d4c1df3c2f331275619649
1 AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_GETATTR], [
2         dnl #
3         dnl # Linux 6.3 API
4         dnl # The first arg of getattr I/O operations handler type
5         dnl # is changed to struct mnt_idmap*
6         dnl #
7         ZFS_LINUX_TEST_SRC([inode_operations_getattr_mnt_idmap], [
8                 #include <linux/fs.h>
10                 static int test_getattr(
11                     struct mnt_idmap *idmap,
12                     const struct path *p, struct kstat *k,
13                     u32 request_mask, unsigned int query_flags)
14                     { return 0; }
16                 static const struct inode_operations
17                     iops __attribute__ ((unused)) = {
18                         .getattr = test_getattr,
19                 };
20         ],[])
22         dnl #
23         dnl # Linux 5.12 API
24         dnl # The getattr I/O operations handler type was extended to require
25         dnl # a struct user_namespace* as its first arg, to support idmapped
26         dnl # mounts.
27         dnl #
28         ZFS_LINUX_TEST_SRC([inode_operations_getattr_userns], [
29                 #include <linux/fs.h>
31                 static int test_getattr(
32                         struct user_namespace *userns,
33                     const struct path *p, struct kstat *k,
34                     u32 request_mask, unsigned int query_flags)
35                     { return 0; }
37                 static const struct inode_operations
38                     iops __attribute__ ((unused)) = {
39                         .getattr = test_getattr,
40                 };
41         ],[])
43         dnl #
44         dnl # Linux 4.11 API
45         dnl # See torvalds/linux@a528d35
46         dnl #
47         ZFS_LINUX_TEST_SRC([inode_operations_getattr_path], [
48                 #include <linux/fs.h>
50                 static int test_getattr(
51                     const struct path *p, struct kstat *k,
52                     u32 request_mask, unsigned int query_flags)
53                     { return 0; }
55                 static const struct inode_operations
56                     iops __attribute__ ((unused)) = {
57                         .getattr = test_getattr,
58                 };
59         ],[])
62 AC_DEFUN([ZFS_AC_KERNEL_INODE_GETATTR], [
63         dnl #
64         dnl # Kernel 6.3 test
65         dnl #
66         AC_MSG_CHECKING([whether iops->getattr() takes mnt_idmap])
67         ZFS_LINUX_TEST_RESULT([inode_operations_getattr_mnt_idmap], [
68                 AC_MSG_RESULT(yes)
69                 AC_DEFINE(HAVE_IDMAP_IOPS_GETATTR, 1,
70                     [iops->getattr() takes struct mnt_idmap*])
71         ],[
72                 AC_MSG_RESULT(no)
73                 dnl #
74                 dnl # Kernel 5.12 test
75                 dnl #
76                 AC_MSG_CHECKING([whether iops->getattr() takes user_namespace])
77                 ZFS_LINUX_TEST_RESULT([inode_operations_getattr_userns], [
78                         AC_MSG_RESULT(yes)
79                         AC_DEFINE(HAVE_USERNS_IOPS_GETATTR, 1,
80                             [iops->getattr() takes struct user_namespace*])
81                 ],[
82                         AC_MSG_RESULT(no)
84                         dnl #
85                         dnl # Kernel 4.11 test
86                         dnl #
87                         AC_MSG_CHECKING([whether iops->getattr() takes a path])
88                         ZFS_LINUX_TEST_RESULT([inode_operations_getattr_path], [
89                                 AC_MSG_RESULT(yes)
90                                 AC_DEFINE(HAVE_PATH_IOPS_GETATTR, 1,
91                                         [iops->getattr() takes a path])
92                         ],[
93                                 AC_MSG_RESULT(no)
94                         ])
95                 ])
96         ])