]>
Commit | Line | Data |
---|---|---|
023699cd | 1 | dnl # |
e33045ee BB |
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 | |
023699cd MM |
4 | dnl # inode_owner_or_capable |
5 | dnl # | |
608f8749 BB |
6 | AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_RELEASE], [ |
7 | ZFS_LINUX_TEST_SRC([posix_acl_release], [ | |
023699cd MM |
8 | #include <linux/cred.h> |
9 | #include <linux/fs.h> | |
10 | #include <linux/posix_acl.h> | |
608f8749 BB |
11 | ], [ |
12 | struct posix_acl *tmp = posix_acl_alloc(1, 0); | |
023699cd | 13 | posix_acl_release(tmp); |
c347fac5 | 14 | ], [], [ZFS_META_LICENSE]) |
608f8749 BB |
15 | ]) |
16 | ||
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], [ | |
023699cd MM |
20 | AC_MSG_RESULT(yes) |
21 | AC_DEFINE(HAVE_POSIX_ACL_RELEASE, 1, | |
22 | [posix_acl_release() is available]) | |
023699cd | 23 | |
e42d4666 | 24 | AC_MSG_CHECKING([whether posix_acl_release() is GPL-only]) |
608f8749 | 25 | ZFS_LINUX_TEST_RESULT([posix_acl_release_license], [ |
e42d4666 CC |
26 | AC_MSG_RESULT(no) |
27 | ],[ | |
28 | AC_MSG_RESULT(yes) | |
29 | AC_DEFINE(HAVE_POSIX_ACL_RELEASE_GPL_ONLY, 1, | |
30 | [posix_acl_release() is GPL-only]) | |
31 | ]) | |
023699cd MM |
32 | ],[ |
33 | AC_MSG_RESULT(no) | |
023699cd MM |
34 | ]) |
35 | ]) | |
36 | ||
3779913b CC |
37 | dnl # |
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. | |
42 | dnl # | |
608f8749 BB |
43 | AC_DEFUN([ZFS_AC_KERNEL_SRC_SET_CACHED_ACL_USABLE], [ |
44 | ZFS_LINUX_TEST_SRC([set_cached_acl], [ | |
3779913b CC |
45 | #include <linux/cred.h> |
46 | #include <linux/fs.h> | |
47 | #include <linux/posix_acl.h> | |
608f8749 | 48 | ], [ |
3779913b CC |
49 | struct inode *ip = NULL; |
50 | struct posix_acl *acl = posix_acl_alloc(1, 0); | |
7e5ea7be GN |
51 | set_cached_acl(ip, ACL_TYPE_ACCESS, acl); |
52 | forget_cached_acl(ip, ACL_TYPE_ACCESS); | |
c347fac5 | 53 | ], [], [ZFS_META_LICENSE]) |
608f8749 BB |
54 | ]) |
55 | ||
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], [ | |
3779913b CC |
59 | AC_MSG_RESULT(yes) |
60 | AC_DEFINE(HAVE_SET_CACHED_ACL_USABLE, 1, | |
608f8749 | 61 | [set_cached_acl() is usable]) |
3779913b CC |
62 | ],[ |
63 | AC_MSG_RESULT(no) | |
64 | ]) | |
65 | ]) | |
66 | ||
023699cd MM |
67 | dnl # |
68 | dnl # 3.1 API change, | |
066e8252 | 69 | dnl # posix_acl_chmod() was added as the preferred interface. |
023699cd | 70 | dnl # |
408ec0d2 | 71 | dnl # 3.14 API change, |
066e8252 | 72 | dnl # posix_acl_chmod() was changed to __posix_acl_chmod() |
408ec0d2 | 73 | dnl # |
608f8749 BB |
74 | AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_CHMOD], [ |
75 | ZFS_LINUX_TEST_SRC([posix_acl_chmod], [ | |
023699cd MM |
76 | #include <linux/fs.h> |
77 | #include <linux/posix_acl.h> | |
78 | ],[ | |
79 | posix_acl_chmod(NULL, 0, 0) | |
608f8749 BB |
80 | ]) |
81 | ||
82 | ZFS_LINUX_TEST_SRC([__posix_acl_chmod], [ | |
83 | #include <linux/fs.h> | |
84 | #include <linux/posix_acl.h> | |
023699cd | 85 | ],[ |
608f8749 BB |
86 | __posix_acl_chmod(NULL, 0, 0) |
87 | ]) | |
88 | ]) | |
89 | ||
90 | AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_CHMOD], [ | |
408ec0d2 | 91 | AC_MSG_CHECKING([whether __posix_acl_chmod exists]) |
608f8749 | 92 | ZFS_LINUX_TEST_RESULT([__posix_acl_chmod], [ |
408ec0d2 | 93 | AC_MSG_RESULT(yes) |
608f8749 BB |
94 | AC_DEFINE(HAVE___POSIX_ACL_CHMOD, 1, |
95 | [__posix_acl_chmod() exists]) | |
408ec0d2 CC |
96 | ],[ |
97 | AC_MSG_RESULT(no) | |
066e8252 BB |
98 | |
99 | AC_MSG_CHECKING([whether posix_acl_chmod exists]) | |
100 | ZFS_LINUX_TEST_RESULT([posix_acl_chmod], [ | |
101 | AC_MSG_RESULT(yes) | |
102 | AC_DEFINE(HAVE_POSIX_ACL_CHMOD, 1, | |
103 | [posix_acl_chmod() exists]) | |
104 | ],[ | |
105 | ZFS_LINUX_TEST_ERROR([posix_acl_chmod()]) | |
106 | ]) | |
408ec0d2 | 107 | ]) |
023699cd MM |
108 | ]) |
109 | ||
023699cd MM |
110 | dnl # |
111 | dnl # 3.1 API change, | |
066e8252 | 112 | dnl # posix_acl_equiv_mode now wants an umode_t instead of a mode_t |
023699cd | 113 | dnl # |
608f8749 BB |
114 | AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T], [ |
115 | ZFS_LINUX_TEST_SRC([posix_acl_equiv_mode], [ | |
023699cd MM |
116 | #include <linux/fs.h> |
117 | #include <linux/posix_acl.h> | |
118 | ],[ | |
119 | umode_t tmp; | |
066e8252 | 120 | posix_acl_equiv_mode(NULL, &tmp); |
608f8749 BB |
121 | ]) |
122 | ]) | |
123 | ||
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], [ | |
023699cd | 127 | AC_MSG_RESULT(yes) |
023699cd | 128 | ],[ |
066e8252 | 129 | ZFS_LINUX_TEST_ERROR([posix_acl_equiv_mode()]) |
023699cd MM |
130 | ]) |
131 | ]) | |
132 | ||
4b908d32 BB |
133 | dnl # |
134 | dnl # 4.8 API change, | |
135 | dnl # The function posix_acl_valid now must be passed a namespace. | |
136 | dnl # | |
608f8749 BB |
137 | AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_VALID_WITH_NS], [ |
138 | ZFS_LINUX_TEST_SRC([posix_acl_valid_with_ns], [ | |
4b908d32 BB |
139 | #include <linux/fs.h> |
140 | #include <linux/posix_acl.h> | |
141 | ],[ | |
142 | struct user_namespace *user_ns = NULL; | |
143 | const struct posix_acl *acl = NULL; | |
144 | int error; | |
145 | ||
146 | error = posix_acl_valid(user_ns, acl); | |
608f8749 BB |
147 | ]) |
148 | ]) | |
149 | ||
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], [ | |
4b908d32 BB |
153 | AC_MSG_RESULT(yes) |
154 | AC_DEFINE(HAVE_POSIX_ACL_VALID_WITH_NS, 1, | |
155 | [posix_acl_valid() wants user namespace]) | |
156 | ],[ | |
157 | AC_MSG_RESULT(no) | |
158 | ]) | |
159 | ]) | |
160 | ||
023699cd MM |
161 | dnl # |
162 | dnl # 3.1 API change, | |
163 | dnl # Check if inode_operations contains the function get_acl | |
164 | dnl # | |
2079111f BB |
165 | dnl # 5.15 API change, |
166 | dnl # Added the bool rcu argument to get_acl for rcu path walk. | |
167 | dnl # | |
9cd71c86 CK |
168 | dnl # 6.2 API change, |
169 | dnl # get_acl() was renamed to get_inode_acl() | |
170 | dnl # | |
608f8749 BB |
171 | AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_GET_ACL], [ |
172 | ZFS_LINUX_TEST_SRC([inode_operations_get_acl], [ | |
023699cd MM |
173 | #include <linux/fs.h> |
174 | ||
a41d0b29 | 175 | static struct posix_acl *get_acl_fn(struct inode *inode, int type) |
023699cd MM |
176 | { return NULL; } |
177 | ||
178 | static const struct inode_operations | |
179 | iops __attribute__ ((unused)) = { | |
180 | .get_acl = get_acl_fn, | |
181 | }; | |
608f8749 | 182 | ],[]) |
2079111f BB |
183 | |
184 | ZFS_LINUX_TEST_SRC([inode_operations_get_acl_rcu], [ | |
185 | #include <linux/fs.h> | |
186 | ||
a41d0b29 | 187 | static struct posix_acl *get_acl_fn(struct inode *inode, int type, |
2079111f BB |
188 | bool rcu) { return NULL; } |
189 | ||
190 | static const struct inode_operations | |
191 | iops __attribute__ ((unused)) = { | |
192 | .get_acl = get_acl_fn, | |
193 | }; | |
194 | ],[]) | |
884a6935 CK |
195 | |
196 | ZFS_LINUX_TEST_SRC([inode_operations_get_inode_acl], [ | |
197 | #include <linux/fs.h> | |
198 | ||
a41d0b29 | 199 | static struct posix_acl *get_inode_acl_fn(struct inode *inode, int type, |
884a6935 CK |
200 | bool rcu) { return NULL; } |
201 | ||
202 | static const struct inode_operations | |
203 | iops __attribute__ ((unused)) = { | |
204 | .get_inode_acl = get_inode_acl_fn, | |
205 | }; | |
206 | ],[]) | |
608f8749 BB |
207 | ]) |
208 | ||
209 | AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL], [ | |
210 | AC_MSG_CHECKING([whether iops->get_acl() exists]) | |
211 | ZFS_LINUX_TEST_RESULT([inode_operations_get_acl], [ | |
023699cd | 212 | AC_MSG_RESULT(yes) |
2079111f | 213 | AC_DEFINE(HAVE_GET_ACL, 1, [iops->get_acl() exists]) |
023699cd | 214 | ],[ |
2079111f BB |
215 | ZFS_LINUX_TEST_RESULT([inode_operations_get_acl_rcu], [ |
216 | AC_MSG_RESULT(yes) | |
217 | AC_DEFINE(HAVE_GET_ACL_RCU, 1, [iops->get_acl() takes rcu]) | |
218 | ],[ | |
884a6935 CK |
219 | ZFS_LINUX_TEST_RESULT([inode_operations_get_inode_acl], [ |
220 | AC_MSG_RESULT(yes) | |
221 | AC_DEFINE(HAVE_GET_INODE_ACL, 1, [has iops->get_inode_acl()]) | |
222 | ],[ | |
223 | ZFS_LINUX_TEST_ERROR([iops->get_acl() or iops->get_inode_acl()]) | |
224 | ]) | |
2079111f | 225 | ]) |
023699cd MM |
226 | ]) |
227 | ]) | |
afb6c031 | 228 | |
0420c126 | 229 | dnl # |
230 | dnl # 3.14 API change, | |
231 | dnl # Check if inode_operations contains the function set_acl | |
232 | dnl # | |
ba646e3e RE |
233 | dnl # 5.12 API change, |
234 | dnl # set_acl() added a user_namespace* parameter first | |
235 | dnl # | |
9cd71c86 CK |
236 | dnl # 6.2 API change, |
237 | dnl # set_acl() second paramter changed to a struct dentry * | |
238 | dnl # | |
d4dc53da YY |
239 | dnl # 6.3 API change, |
240 | dnl # set_acl() first parameter changed to struct mnt_idmap * | |
241 | dnl # | |
608f8749 | 242 | AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_SET_ACL], [ |
d4dc53da YY |
243 | ZFS_LINUX_TEST_SRC([inode_operations_set_acl_mnt_idmap_dentry], [ |
244 | #include <linux/fs.h> | |
245 | ||
a41d0b29 | 246 | static int set_acl_fn(struct mnt_idmap *idmap, |
d4dc53da YY |
247 | struct dentry *dent, struct posix_acl *acl, |
248 | int type) { return 0; } | |
249 | ||
250 | static const struct inode_operations | |
251 | iops __attribute__ ((unused)) = { | |
252 | .set_acl = set_acl_fn, | |
253 | }; | |
254 | ],[]) | |
9cd71c86 CK |
255 | ZFS_LINUX_TEST_SRC([inode_operations_set_acl_userns_dentry], [ |
256 | #include <linux/fs.h> | |
257 | ||
a41d0b29 | 258 | static int set_acl_fn(struct user_namespace *userns, |
9cd71c86 CK |
259 | struct dentry *dent, struct posix_acl *acl, |
260 | int type) { return 0; } | |
261 | ||
262 | static const struct inode_operations | |
263 | iops __attribute__ ((unused)) = { | |
264 | .set_acl = set_acl_fn, | |
265 | }; | |
266 | ],[]) | |
ba646e3e RE |
267 | ZFS_LINUX_TEST_SRC([inode_operations_set_acl_userns], [ |
268 | #include <linux/fs.h> | |
269 | ||
a41d0b29 | 270 | static int set_acl_fn(struct user_namespace *userns, |
ba646e3e RE |
271 | struct inode *inode, struct posix_acl *acl, |
272 | int type) { return 0; } | |
273 | ||
274 | static const struct inode_operations | |
275 | iops __attribute__ ((unused)) = { | |
276 | .set_acl = set_acl_fn, | |
277 | }; | |
278 | ],[]) | |
608f8749 | 279 | ZFS_LINUX_TEST_SRC([inode_operations_set_acl], [ |
0420c126 | 280 | #include <linux/fs.h> |
281 | ||
a41d0b29 | 282 | static int set_acl_fn(struct inode *inode, struct posix_acl *acl, |
608f8749 | 283 | int type) { return 0; } |
0420c126 | 284 | |
285 | static const struct inode_operations | |
286 | iops __attribute__ ((unused)) = { | |
287 | .set_acl = set_acl_fn, | |
288 | }; | |
608f8749 BB |
289 | ],[]) |
290 | ]) | |
291 | ||
292 | AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL], [ | |
293 | AC_MSG_CHECKING([whether iops->set_acl() exists]) | |
ba646e3e | 294 | ZFS_LINUX_TEST_RESULT([inode_operations_set_acl_userns], [ |
0420c126 | 295 | AC_MSG_RESULT(yes) |
296 | AC_DEFINE(HAVE_SET_ACL, 1, [iops->set_acl() exists]) | |
ba646e3e | 297 | AC_DEFINE(HAVE_SET_ACL_USERNS, 1, [iops->set_acl() takes 4 args]) |
0420c126 | 298 | ],[ |
d4dc53da | 299 | ZFS_LINUX_TEST_RESULT([inode_operations_set_acl_mnt_idmap_dentry], [ |
ba646e3e | 300 | AC_MSG_RESULT(yes) |
9cd71c86 | 301 | AC_DEFINE(HAVE_SET_ACL, 1, [iops->set_acl() exists]) |
d4dc53da YY |
302 | AC_DEFINE(HAVE_SET_ACL_IDMAP_DENTRY, 1, |
303 | [iops->set_acl() takes 4 args, arg1 is struct mnt_idmap *]) | |
ba646e3e | 304 | ],[ |
d4dc53da | 305 | ZFS_LINUX_TEST_RESULT([inode_operations_set_acl_userns_dentry], [ |
9cd71c86 | 306 | AC_MSG_RESULT(yes) |
d4dc53da YY |
307 | AC_DEFINE(HAVE_SET_ACL, 1, [iops->set_acl() exists]) |
308 | AC_DEFINE(HAVE_SET_ACL_USERNS_DENTRY_ARG2, 1, | |
309 | [iops->set_acl() takes 4 args, arg2 is struct dentry *]) | |
9cd71c86 | 310 | ],[ |
d4dc53da YY |
311 | ZFS_LINUX_TEST_RESULT([inode_operations_set_acl], [ |
312 | AC_MSG_RESULT(yes) | |
313 | AC_DEFINE(HAVE_SET_ACL, 1, [iops->set_acl() exists, takes 3 args]) | |
314 | ],[ | |
315 | ZFS_LINUX_REQUIRE_API([i_op->set_acl()], [3.14]) | |
316 | ]) | |
9cd71c86 | 317 | ]) |
ba646e3e | 318 | ]) |
0420c126 | 319 | ]) |
320 | ]) | |
321 | ||
afb6c031 CC |
322 | dnl # |
323 | dnl # 4.7 API change, | |
324 | dnl # The kernel get_acl will now check cache before calling i_op->get_acl and | |
325 | dnl # do set_cached_acl after that, so i_op->get_acl don't need to do that | |
326 | dnl # anymore. | |
327 | dnl # | |
608f8749 BB |
328 | AC_DEFUN([ZFS_AC_KERNEL_SRC_GET_ACL_HANDLE_CACHE], [ |
329 | ZFS_LINUX_TEST_SRC([get_acl_handle_cache], [ | |
330 | #include <linux/fs.h> | |
331 | ],[ | |
332 | void *sentinel __attribute__ ((unused)) = | |
333 | uncached_acl_sentinel(NULL); | |
334 | ]) | |
335 | ]) | |
336 | ||
3779913b | 337 | AC_DEFUN([ZFS_AC_KERNEL_GET_ACL_HANDLE_CACHE], [ |
afb6c031 | 338 | AC_MSG_CHECKING([whether uncached_acl_sentinel() exists]) |
608f8749 BB |
339 | ZFS_LINUX_TEST_RESULT([get_acl_handle_cache], [ |
340 | AC_MSG_RESULT(yes) | |
341 | AC_DEFINE(HAVE_KERNEL_GET_ACL_HANDLE_CACHE, 1, | |
342 | [uncached_acl_sentinel() exists]) | |
afb6c031 | 343 | ],[ |
608f8749 BB |
344 | AC_MSG_RESULT(no) |
345 | ]) | |
346 | ]) | |
347 | ||
348 | dnl # | |
349 | dnl # 4.16 kernel: check if struct posix_acl acl.a_refcount is a refcount_t. | |
350 | dnl # It's an atomic_t on older kernels. | |
351 | dnl # | |
352 | AC_DEFUN([ZFS_AC_KERNEL_SRC_ACL_HAS_REFCOUNT], [ | |
353 | ZFS_LINUX_TEST_SRC([acl_refcount], [ | |
354 | #include <linux/backing-dev.h> | |
355 | #include <linux/refcount.h> | |
356 | #include <linux/posix_acl.h> | |
afb6c031 | 357 | ],[ |
608f8749 BB |
358 | struct posix_acl acl; |
359 | refcount_t *r __attribute__ ((unused)) = &acl.a_refcount; | |
360 | ]) | |
361 | ]) | |
362 | ||
363 | AC_DEFUN([ZFS_AC_KERNEL_ACL_HAS_REFCOUNT], [ | |
364 | AC_MSG_CHECKING([whether posix_acl has refcount_t]) | |
365 | ZFS_LINUX_TEST_RESULT([acl_refcount], [ | |
afb6c031 | 366 | AC_MSG_RESULT(yes) |
608f8749 | 367 | AC_DEFINE(HAVE_ACL_REFCOUNT, 1, [posix_acl has refcount_t]) |
afb6c031 CC |
368 | ],[ |
369 | AC_MSG_RESULT(no) | |
370 | ]) | |
371 | ]) | |
608f8749 BB |
372 | |
373 | AC_DEFUN([ZFS_AC_KERNEL_SRC_ACL], [ | |
374 | ZFS_AC_KERNEL_SRC_POSIX_ACL_RELEASE | |
375 | ZFS_AC_KERNEL_SRC_SET_CACHED_ACL_USABLE | |
376 | ZFS_AC_KERNEL_SRC_POSIX_ACL_CHMOD | |
377 | ZFS_AC_KERNEL_SRC_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T | |
378 | ZFS_AC_KERNEL_SRC_POSIX_ACL_VALID_WITH_NS | |
608f8749 BB |
379 | ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_GET_ACL |
380 | ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_SET_ACL | |
381 | ZFS_AC_KERNEL_SRC_GET_ACL_HANDLE_CACHE | |
382 | ZFS_AC_KERNEL_SRC_ACL_HAS_REFCOUNT | |
383 | ]) | |
384 | ||
385 | AC_DEFUN([ZFS_AC_KERNEL_ACL], [ | |
386 | ZFS_AC_KERNEL_POSIX_ACL_RELEASE | |
387 | ZFS_AC_KERNEL_SET_CACHED_ACL_USABLE | |
388 | ZFS_AC_KERNEL_POSIX_ACL_CHMOD | |
389 | ZFS_AC_KERNEL_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T | |
390 | ZFS_AC_KERNEL_POSIX_ACL_VALID_WITH_NS | |
608f8749 BB |
391 | ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL |
392 | ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL | |
393 | ZFS_AC_KERNEL_GET_ACL_HANDLE_CACHE | |
394 | ZFS_AC_KERNEL_ACL_HAS_REFCOUNT | |
395 | ]) |