2 dnl # Check if posix_acl_release can be used from a ZFS_META_LICENSED
3 dnl # module. The is_owner_or_cap macro was replaced by
4 dnl # inode_owner_or_capable
6 AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_RELEASE], [
7 ZFS_LINUX_TEST_SRC([posix_acl_release], [
8 #include <linux/cred.h>
10 #include <linux/posix_acl.h>
12 struct posix_acl *tmp = posix_acl_alloc(1, 0);
13 posix_acl_release(tmp);
14 ], [], [ZFS_META_LICENSE])
17 AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_RELEASE], [
18 AC_MSG_CHECKING([whether posix_acl_release() is available])
19 ZFS_LINUX_TEST_RESULT([posix_acl_release], [
21 AC_DEFINE(HAVE_POSIX_ACL_RELEASE, 1,
22 [posix_acl_release() is available])
24 AC_MSG_CHECKING([whether posix_acl_release() is GPL-only])
25 ZFS_LINUX_TEST_RESULT([posix_acl_release_license], [
29 AC_DEFINE(HAVE_POSIX_ACL_RELEASE_GPL_ONLY, 1,
30 [posix_acl_release() is GPL-only])
38 dnl # 3.14 API change,
39 dnl # set_cached_acl() and forget_cached_acl() changed from inline to
40 dnl # EXPORT_SYMBOL. In the former case, they may not be usable because of
41 dnl # posix_acl_release. In the latter case, we can always use them.
43 AC_DEFUN([ZFS_AC_KERNEL_SRC_SET_CACHED_ACL_USABLE], [
44 ZFS_LINUX_TEST_SRC([set_cached_acl], [
45 #include <linux/cred.h>
47 #include <linux/posix_acl.h>
49 struct inode *ip = NULL;
50 struct posix_acl *acl = posix_acl_alloc(1, 0);
51 set_cached_acl(ip, ACL_TYPE_ACCESS, acl);
52 forget_cached_acl(ip, ACL_TYPE_ACCESS);
53 ], [], [ZFS_META_LICENSE])
56 AC_DEFUN([ZFS_AC_KERNEL_SET_CACHED_ACL_USABLE], [
57 AC_MSG_CHECKING([whether set_cached_acl() is usable])
58 ZFS_LINUX_TEST_RESULT([set_cached_acl_license], [
60 AC_DEFINE(HAVE_SET_CACHED_ACL_USABLE, 1,
61 [set_cached_acl() is usable])
69 dnl # posix_acl_chmod() was added as the preferred interface.
71 dnl # 3.14 API change,
72 dnl # posix_acl_chmod() was changed to __posix_acl_chmod()
74 AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_CHMOD], [
75 ZFS_LINUX_TEST_SRC([posix_acl_chmod], [
77 #include <linux/posix_acl.h>
79 posix_acl_chmod(NULL, 0, 0)
82 ZFS_LINUX_TEST_SRC([__posix_acl_chmod], [
84 #include <linux/posix_acl.h>
86 __posix_acl_chmod(NULL, 0, 0)
90 AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_CHMOD], [
91 AC_MSG_CHECKING([whether __posix_acl_chmod exists])
92 ZFS_LINUX_TEST_RESULT([__posix_acl_chmod], [
94 AC_DEFINE(HAVE___POSIX_ACL_CHMOD, 1,
95 [__posix_acl_chmod() exists])
99 AC_MSG_CHECKING([whether posix_acl_chmod exists])
100 ZFS_LINUX_TEST_RESULT([posix_acl_chmod], [
102 AC_DEFINE(HAVE_POSIX_ACL_CHMOD, 1,
103 [posix_acl_chmod() exists])
105 ZFS_LINUX_TEST_ERROR([posix_acl_chmod()])
111 dnl # 3.1 API change,
112 dnl # posix_acl_equiv_mode now wants an umode_t instead of a mode_t
114 AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T], [
115 ZFS_LINUX_TEST_SRC([posix_acl_equiv_mode], [
116 #include <linux/fs.h>
117 #include <linux/posix_acl.h>
120 posix_acl_equiv_mode(NULL, &tmp);
124 AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T], [
125 AC_MSG_CHECKING([whether posix_acl_equiv_mode() wants umode_t])
126 ZFS_LINUX_TEST_RESULT([posix_acl_equiv_mode], [
129 ZFS_LINUX_TEST_ERROR([posix_acl_equiv_mode()])
134 dnl # 4.8 API change,
135 dnl # The function posix_acl_valid now must be passed a namespace.
137 AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_VALID_WITH_NS], [
138 ZFS_LINUX_TEST_SRC([posix_acl_valid_with_ns], [
139 #include <linux/fs.h>
140 #include <linux/posix_acl.h>
142 struct user_namespace *user_ns = NULL;
143 const struct posix_acl *acl = NULL;
146 error = posix_acl_valid(user_ns, acl);
150 AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_VALID_WITH_NS], [
151 AC_MSG_CHECKING([whether posix_acl_valid() wants user namespace])
152 ZFS_LINUX_TEST_RESULT([posix_acl_valid_with_ns], [
154 AC_DEFINE(HAVE_POSIX_ACL_VALID_WITH_NS, 1,
155 [posix_acl_valid() wants user namespace])
162 dnl # 3.1 API change,
163 dnl # Check if inode_operations contains the function get_acl
165 dnl # 5.15 API change,
166 dnl # Added the bool rcu argument to get_acl for rcu path walk.
168 AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_GET_ACL], [
169 ZFS_LINUX_TEST_SRC([inode_operations_get_acl], [
170 #include <linux/fs.h>
172 struct posix_acl *get_acl_fn(struct inode *inode, int type)
175 static const struct inode_operations
176 iops __attribute__ ((unused)) = {
177 .get_acl = get_acl_fn,
181 ZFS_LINUX_TEST_SRC([inode_operations_get_acl_rcu], [
182 #include <linux/fs.h>
184 struct posix_acl *get_acl_fn(struct inode *inode, int type,
185 bool rcu) { return NULL; }
187 static const struct inode_operations
188 iops __attribute__ ((unused)) = {
189 .get_acl = get_acl_fn,
194 AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL], [
195 AC_MSG_CHECKING([whether iops->get_acl() exists])
196 ZFS_LINUX_TEST_RESULT([inode_operations_get_acl], [
198 AC_DEFINE(HAVE_GET_ACL, 1, [iops->get_acl() exists])
200 ZFS_LINUX_TEST_RESULT([inode_operations_get_acl_rcu], [
202 AC_DEFINE(HAVE_GET_ACL_RCU, 1, [iops->get_acl() takes rcu])
204 ZFS_LINUX_TEST_ERROR([iops->get_acl()])
210 dnl # 3.14 API change,
211 dnl # Check if inode_operations contains the function set_acl
213 dnl # 5.12 API change,
214 dnl # set_acl() added a user_namespace* parameter first
216 AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_SET_ACL], [
217 ZFS_LINUX_TEST_SRC([inode_operations_set_acl_userns], [
218 #include <linux/fs.h>
220 int set_acl_fn(struct user_namespace *userns,
221 struct inode *inode, struct posix_acl *acl,
222 int type) { return 0; }
224 static const struct inode_operations
225 iops __attribute__ ((unused)) = {
226 .set_acl = set_acl_fn,
229 ZFS_LINUX_TEST_SRC([inode_operations_set_acl], [
230 #include <linux/fs.h>
232 int set_acl_fn(struct inode *inode, struct posix_acl *acl,
233 int type) { return 0; }
235 static const struct inode_operations
236 iops __attribute__ ((unused)) = {
237 .set_acl = set_acl_fn,
242 AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL], [
243 AC_MSG_CHECKING([whether iops->set_acl() exists])
244 ZFS_LINUX_TEST_RESULT([inode_operations_set_acl_userns], [
246 AC_DEFINE(HAVE_SET_ACL, 1, [iops->set_acl() exists])
247 AC_DEFINE(HAVE_SET_ACL_USERNS, 1, [iops->set_acl() takes 4 args])
249 ZFS_LINUX_TEST_RESULT([inode_operations_set_acl], [
251 AC_DEFINE(HAVE_SET_ACL, 1, [iops->set_acl() exists, takes 3 args])
259 dnl # 4.7 API change,
260 dnl # The kernel get_acl will now check cache before calling i_op->get_acl and
261 dnl # do set_cached_acl after that, so i_op->get_acl don't need to do that
264 AC_DEFUN([ZFS_AC_KERNEL_SRC_GET_ACL_HANDLE_CACHE], [
265 ZFS_LINUX_TEST_SRC([get_acl_handle_cache], [
266 #include <linux/fs.h>
268 void *sentinel __attribute__ ((unused)) =
269 uncached_acl_sentinel(NULL);
273 AC_DEFUN([ZFS_AC_KERNEL_GET_ACL_HANDLE_CACHE], [
274 AC_MSG_CHECKING([whether uncached_acl_sentinel() exists])
275 ZFS_LINUX_TEST_RESULT([get_acl_handle_cache], [
277 AC_DEFINE(HAVE_KERNEL_GET_ACL_HANDLE_CACHE, 1,
278 [uncached_acl_sentinel() exists])
285 dnl # 4.16 kernel: check if struct posix_acl acl.a_refcount is a refcount_t.
286 dnl # It's an atomic_t on older kernels.
288 AC_DEFUN([ZFS_AC_KERNEL_SRC_ACL_HAS_REFCOUNT], [
289 ZFS_LINUX_TEST_SRC([acl_refcount], [
290 #include <linux/backing-dev.h>
291 #include <linux/refcount.h>
292 #include <linux/posix_acl.h>
294 struct posix_acl acl;
295 refcount_t *r __attribute__ ((unused)) = &acl.a_refcount;
299 AC_DEFUN([ZFS_AC_KERNEL_ACL_HAS_REFCOUNT], [
300 AC_MSG_CHECKING([whether posix_acl has refcount_t])
301 ZFS_LINUX_TEST_RESULT([acl_refcount], [
303 AC_DEFINE(HAVE_ACL_REFCOUNT, 1, [posix_acl has refcount_t])
309 AC_DEFUN([ZFS_AC_KERNEL_SRC_ACL], [
310 ZFS_AC_KERNEL_SRC_POSIX_ACL_RELEASE
311 ZFS_AC_KERNEL_SRC_SET_CACHED_ACL_USABLE
312 ZFS_AC_KERNEL_SRC_POSIX_ACL_CHMOD
313 ZFS_AC_KERNEL_SRC_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T
314 ZFS_AC_KERNEL_SRC_POSIX_ACL_VALID_WITH_NS
315 ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_GET_ACL
316 ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_SET_ACL
317 ZFS_AC_KERNEL_SRC_GET_ACL_HANDLE_CACHE
318 ZFS_AC_KERNEL_SRC_ACL_HAS_REFCOUNT
321 AC_DEFUN([ZFS_AC_KERNEL_ACL], [
322 ZFS_AC_KERNEL_POSIX_ACL_RELEASE
323 ZFS_AC_KERNEL_SET_CACHED_ACL_USABLE
324 ZFS_AC_KERNEL_POSIX_ACL_CHMOD
325 ZFS_AC_KERNEL_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T
326 ZFS_AC_KERNEL_POSIX_ACL_VALID_WITH_NS
327 ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL
328 ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL
329 ZFS_AC_KERNEL_GET_ACL_HANDLE_CACHE
330 ZFS_AC_KERNEL_ACL_HAS_REFCOUNT