ztest: Fix scrub check in ztest_raidz_expand_check()
[zfs.git] / config / kernel-acl.m4
blob3dbd97948189c1af6487a3ce1d035b46fc0e993e
1 dnl #
2 dnl # 3.1 API change,
3 dnl # posix_acl_equiv_mode now wants an umode_t instead of a mode_t
4 dnl #
5 AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T], [
6         ZFS_LINUX_TEST_SRC([posix_acl_equiv_mode], [
7                 #include <linux/fs.h>
8                 #include <linux/posix_acl.h>
9         ],[
10                 umode_t tmp;
11                 posix_acl_equiv_mode(NULL, &tmp);
12         ])
15 AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T], [
16         AC_MSG_CHECKING([whether posix_acl_equiv_mode() wants umode_t])
17         ZFS_LINUX_TEST_RESULT([posix_acl_equiv_mode], [
18                 AC_MSG_RESULT(yes)
19         ],[
20                 ZFS_LINUX_TEST_ERROR([posix_acl_equiv_mode()])
21         ])
24 dnl #
25 dnl # 3.1 API change,
26 dnl # Check if inode_operations contains the function get_acl
27 dnl #
28 dnl # 5.15 API change,
29 dnl # Added the bool rcu argument to get_acl for rcu path walk.
30 dnl #
31 dnl # 6.2 API change,
32 dnl # get_acl() was renamed to get_inode_acl()
33 dnl #
34 AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_GET_ACL], [
35         ZFS_LINUX_TEST_SRC([inode_operations_get_acl], [
36                 #include <linux/fs.h>
38                 static struct posix_acl *get_acl_fn(struct inode *inode, int type)
39                     { return NULL; }
41                 static const struct inode_operations
42                     iops __attribute__ ((unused)) = {
43                         .get_acl = get_acl_fn,
44                 };
45         ],[])
47         ZFS_LINUX_TEST_SRC([inode_operations_get_acl_rcu], [
48                 #include <linux/fs.h>
50                 static struct posix_acl *get_acl_fn(struct inode *inode, int type,
51                     bool rcu) { return NULL; }
53                 static const struct inode_operations
54                     iops __attribute__ ((unused)) = {
55                         .get_acl = get_acl_fn,
56                 };
57         ],[])
59         ZFS_LINUX_TEST_SRC([inode_operations_get_inode_acl], [
60                 #include <linux/fs.h>
62                 static struct posix_acl *get_inode_acl_fn(struct inode *inode, int type,
63                     bool rcu) { return NULL; }
65                 static const struct inode_operations
66                     iops __attribute__ ((unused)) = {
67                         .get_inode_acl = get_inode_acl_fn,
68                 };
69         ],[])
72 AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL], [
73         AC_MSG_CHECKING([whether iops->get_acl() exists])
74         ZFS_LINUX_TEST_RESULT([inode_operations_get_acl], [
75                 AC_MSG_RESULT(yes)
76                 AC_DEFINE(HAVE_GET_ACL, 1, [iops->get_acl() exists])
77         ],[
78                 ZFS_LINUX_TEST_RESULT([inode_operations_get_acl_rcu], [
79                         AC_MSG_RESULT(yes)
80                         AC_DEFINE(HAVE_GET_ACL_RCU, 1, [iops->get_acl() takes rcu])
81                 ],[
82                         ZFS_LINUX_TEST_RESULT([inode_operations_get_inode_acl], [
83                                 AC_MSG_RESULT(yes)
84                                 AC_DEFINE(HAVE_GET_INODE_ACL, 1, [has iops->get_inode_acl()])
85                         ],[
86                                 ZFS_LINUX_TEST_ERROR([iops->get_acl() or iops->get_inode_acl()])
87                         ])
88                 ])
89         ])
92 dnl #
93 dnl # 5.12 API change,
94 dnl # set_acl() added a user_namespace* parameter first
95 dnl #
96 dnl # 6.2 API change,
97 dnl # set_acl() second paramter changed to a struct dentry *
98 dnl #
99 dnl # 6.3 API change,
100 dnl # set_acl() first parameter changed to struct mnt_idmap *
101 dnl #
102 AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_SET_ACL], [
103         ZFS_LINUX_TEST_SRC([inode_operations_set_acl_mnt_idmap_dentry], [
104                 #include <linux/fs.h>
106                 static int set_acl_fn(struct mnt_idmap *idmap,
107                     struct dentry *dent, struct posix_acl *acl,
108                     int type) { return 0; }
110                 static const struct inode_operations
111                     iops __attribute__ ((unused)) = {
112                         .set_acl = set_acl_fn,
113                 };
114         ],[])
115         ZFS_LINUX_TEST_SRC([inode_operations_set_acl_userns_dentry], [
116                 #include <linux/fs.h>
118                 static int set_acl_fn(struct user_namespace *userns,
119                     struct dentry *dent, struct posix_acl *acl,
120                     int type) { return 0; }
122                 static const struct inode_operations
123                     iops __attribute__ ((unused)) = {
124                         .set_acl = set_acl_fn,
125                 };
126         ],[])
127         ZFS_LINUX_TEST_SRC([inode_operations_set_acl_userns], [
128                 #include <linux/fs.h>
130                 static int set_acl_fn(struct user_namespace *userns,
131                     struct inode *inode, struct posix_acl *acl,
132                     int type) { return 0; }
134                 static const struct inode_operations
135                     iops __attribute__ ((unused)) = {
136                         .set_acl = set_acl_fn,
137                 };
138         ],[])
139         ZFS_LINUX_TEST_SRC([inode_operations_set_acl], [
140                 #include <linux/fs.h>
142                 static int set_acl_fn(struct inode *inode, struct posix_acl *acl,
143                     int type) { return 0; }
145                 static const struct inode_operations
146                     iops __attribute__ ((unused)) = {
147                         .set_acl = set_acl_fn,
148                 };
149         ],[])
152 AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL], [
153         AC_MSG_CHECKING([whether iops->set_acl() with 4 args exists])
154         ZFS_LINUX_TEST_RESULT([inode_operations_set_acl_userns], [
155                 AC_MSG_RESULT(yes)
156                 AC_DEFINE(HAVE_SET_ACL_USERNS, 1, [iops->set_acl() takes 4 args])
157         ],[
158                 ZFS_LINUX_TEST_RESULT([inode_operations_set_acl_mnt_idmap_dentry], [
159                         AC_MSG_RESULT(yes)
160                         AC_DEFINE(HAVE_SET_ACL_IDMAP_DENTRY, 1,
161                             [iops->set_acl() takes 4 args, arg1 is struct mnt_idmap *])
162                 ],[
163                         ZFS_LINUX_TEST_RESULT([inode_operations_set_acl_userns_dentry], [
164                                 AC_MSG_RESULT(yes)
165                                 AC_DEFINE(HAVE_SET_ACL_USERNS_DENTRY_ARG2, 1,
166                                     [iops->set_acl() takes 4 args, arg2 is struct dentry *])
167                         ],[
168                                 AC_MSG_RESULT(no)
169                         ])
170                 ])
171         ])
174 AC_DEFUN([ZFS_AC_KERNEL_SRC_ACL], [
175         ZFS_AC_KERNEL_SRC_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T
176         ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_GET_ACL
177         ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_SET_ACL
180 AC_DEFUN([ZFS_AC_KERNEL_ACL], [
181         ZFS_AC_KERNEL_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T
182         ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL
183         ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL