]> git.proxmox.com Git - mirror_zfs.git/blame - config/kernel-acl.m4
Linux 5.0 compat: Disable vector instructions on 5.0+ kernels
[mirror_zfs.git] / config / kernel-acl.m4
CommitLineData
023699cd 1dnl #
e33045ee
BB
2dnl # Check if posix_acl_release can be used from a ZFS_META_LICENSED
3dnl # module. The is_owner_or_cap macro was replaced by
023699cd
MM
4dnl # inode_owner_or_capable
5dnl #
6AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_RELEASE], [
7 AC_MSG_CHECKING([whether posix_acl_release() is available])
8 ZFS_LINUX_TRY_COMPILE([
9 #include <linux/cred.h>
10 #include <linux/fs.h>
11 #include <linux/posix_acl.h>
12 ],[
13 struct posix_acl* tmp = posix_acl_alloc(1, 0);
14 posix_acl_release(tmp);
15 ],[
16 AC_MSG_RESULT(yes)
17 AC_DEFINE(HAVE_POSIX_ACL_RELEASE, 1,
18 [posix_acl_release() is available])
023699cd 19
e42d4666
CC
20 AC_MSG_CHECKING([whether posix_acl_release() is GPL-only])
21 ZFS_LINUX_TRY_COMPILE([
22 #include <linux/module.h>
23 #include <linux/cred.h>
24 #include <linux/fs.h>
25 #include <linux/posix_acl.h>
023699cd 26
e42d4666
CC
27 MODULE_LICENSE("$ZFS_META_LICENSE");
28 ],[
29 struct posix_acl* tmp = posix_acl_alloc(1, 0);
30 posix_acl_release(tmp);
31 ],[
32 AC_MSG_RESULT(no)
33 ],[
34 AC_MSG_RESULT(yes)
35 AC_DEFINE(HAVE_POSIX_ACL_RELEASE_GPL_ONLY, 1,
36 [posix_acl_release() is GPL-only])
37 ])
023699cd
MM
38 ],[
39 AC_MSG_RESULT(no)
023699cd
MM
40 ])
41])
42
3779913b
CC
43dnl #
44dnl # 3.14 API change,
45dnl # set_cached_acl() and forget_cached_acl() changed from inline to
46dnl # EXPORT_SYMBOL. In the former case, they may not be usable because of
47dnl # posix_acl_release. In the latter case, we can always use them.
48dnl #
49AC_DEFUN([ZFS_AC_KERNEL_SET_CACHED_ACL_USABLE], [
50 AC_MSG_CHECKING([whether set_cached_acl() is usable])
51 ZFS_LINUX_TRY_COMPILE([
52 #include <linux/module.h>
53 #include <linux/cred.h>
54 #include <linux/fs.h>
55 #include <linux/posix_acl.h>
56
57 MODULE_LICENSE("$ZFS_META_LICENSE");
58 ],[
59 struct inode *ip = NULL;
60 struct posix_acl *acl = posix_acl_alloc(1, 0);
7e5ea7be
GN
61 set_cached_acl(ip, ACL_TYPE_ACCESS, acl);
62 forget_cached_acl(ip, ACL_TYPE_ACCESS);
3779913b
CC
63 ],[
64 AC_MSG_RESULT(yes)
65 AC_DEFINE(HAVE_SET_CACHED_ACL_USABLE, 1,
66 [posix_acl_release() is usable])
67 ],[
68 AC_MSG_RESULT(no)
69 ])
70])
71
023699cd
MM
72dnl #
73dnl # 3.1 API change,
74dnl # posix_acl_chmod_masq() is not exported anymore and posix_acl_chmod()
75dnl # was introduced to replace it.
76dnl #
408ec0d2
CC
77dnl # 3.14 API change,
78dnl # posix_acl_chmod() is changed to __posix_acl_chmod()
79dnl #
023699cd
MM
80AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_CHMOD], [
81 AC_MSG_CHECKING([whether posix_acl_chmod exists])
82 ZFS_LINUX_TRY_COMPILE([
83 #include <linux/fs.h>
84 #include <linux/posix_acl.h>
85 ],[
86 posix_acl_chmod(NULL, 0, 0)
87 ],[
88 AC_MSG_RESULT(yes)
89 AC_DEFINE(HAVE_POSIX_ACL_CHMOD, 1, [posix_acl_chmod() exists])
90 ],[
91 AC_MSG_RESULT(no)
92 ])
408ec0d2
CC
93
94 AC_MSG_CHECKING([whether __posix_acl_chmod exists])
95 ZFS_LINUX_TRY_COMPILE([
96 #include <linux/fs.h>
97 #include <linux/posix_acl.h>
98 ],[
99 __posix_acl_chmod(NULL, 0, 0)
100 ],[
101 AC_MSG_RESULT(yes)
102 AC_DEFINE(HAVE___POSIX_ACL_CHMOD, 1, [__posix_acl_chmod() exists])
103 ],[
104 AC_MSG_RESULT(no)
105 ])
023699cd
MM
106])
107
023699cd
MM
108dnl #
109dnl # 3.1 API change,
110dnl # posix_acl_equiv_mode now wants an umode_t* instead of a mode_t*
111dnl #
112AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T], [
113 AC_MSG_CHECKING([whether posix_acl_equiv_mode() wants umode_t])
114 ZFS_LINUX_TRY_COMPILE([
115 #include <linux/fs.h>
116 #include <linux/posix_acl.h>
117 ],[
118 umode_t tmp;
119 posix_acl_equiv_mode(NULL,&tmp);
120 ],[
121 AC_MSG_RESULT(yes)
122 AC_DEFINE(HAVE_POSIX_ACL_EQUIV_MODE_UMODE_T, 1,
123 [ posix_acl_equiv_mode wants umode_t*])
124 ],[
125 AC_MSG_RESULT(no)
126 ])
127])
128
4b908d32
BB
129dnl #
130dnl # 4.8 API change,
131dnl # The function posix_acl_valid now must be passed a namespace.
132dnl #
133AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_VALID_WITH_NS], [
134 AC_MSG_CHECKING([whether posix_acl_valid() wants user namespace])
135 ZFS_LINUX_TRY_COMPILE([
136 #include <linux/fs.h>
137 #include <linux/posix_acl.h>
138 ],[
139 struct user_namespace *user_ns = NULL;
140 const struct posix_acl *acl = NULL;
141 int error;
142
143 error = posix_acl_valid(user_ns, acl);
144 ],[
145 AC_MSG_RESULT(yes)
146 AC_DEFINE(HAVE_POSIX_ACL_VALID_WITH_NS, 1,
147 [posix_acl_valid() wants user namespace])
148 ],[
149 AC_MSG_RESULT(no)
150 ])
151])
152
023699cd
MM
153dnl #
154dnl # 2.6.27 API change,
155dnl # Check if inode_operations contains the function permission
156dnl # and expects the nameidata structure to have been removed.
157dnl #
158AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION], [
159 AC_MSG_CHECKING([whether iops->permission() exists])
160 ZFS_LINUX_TRY_COMPILE([
161 #include <linux/fs.h>
162
163 int permission_fn(struct inode *inode, int mask) { return 0; }
164
165 static const struct inode_operations
166 iops __attribute__ ((unused)) = {
167 .permission = permission_fn,
168 };
169 ],[
170 ],[
171 AC_MSG_RESULT(yes)
172 AC_DEFINE(HAVE_PERMISSION, 1, [iops->permission() exists])
173 ],[
174 AC_MSG_RESULT(no)
175 ])
176])
177
178dnl #
179dnl # 2.6.26 API change,
180dnl # Check if inode_operations contains the function permission
181dnl # and expects the nameidata structure to be passed.
182dnl #
183AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION_WITH_NAMEIDATA], [
184 AC_MSG_CHECKING([whether iops->permission() wants nameidata])
185 ZFS_LINUX_TRY_COMPILE([
186 #include <linux/fs.h>
e921f650 187 #include <linux/sched.h>
023699cd
MM
188
189 int permission_fn(struct inode *inode, int mask,
190 struct nameidata *nd) { return 0; }
191
192 static const struct inode_operations
193 iops __attribute__ ((unused)) = {
194 .permission = permission_fn,
195 };
196 ],[
197 ],[
198 AC_MSG_RESULT(yes)
199 AC_DEFINE(HAVE_PERMISSION, 1, [iops->permission() exists])
200 AC_DEFINE(HAVE_PERMISSION_WITH_NAMEIDATA, 1,
201 [iops->permission() with nameidata exists])
202 ],[
203 AC_MSG_RESULT(no)
204 ])
205])
206
207dnl #
208dnl # 2.6.32 API change,
209dnl # Check if inode_operations contains the function check_acl
210dnl #
211AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_CHECK_ACL], [
212 AC_MSG_CHECKING([whether iops->check_acl() exists])
213 ZFS_LINUX_TRY_COMPILE([
214 #include <linux/fs.h>
215
216 int check_acl_fn(struct inode *inode, int mask) { return 0; }
217
218 static const struct inode_operations
219 iops __attribute__ ((unused)) = {
220 .check_acl = check_acl_fn,
221 };
222 ],[
223 ],[
224 AC_MSG_RESULT(yes)
225 AC_DEFINE(HAVE_CHECK_ACL, 1, [iops->check_acl() exists])
226 ],[
227 AC_MSG_RESULT(no)
228 ])
229])
230
231dnl #
232dnl # 2.6.38 API change,
233dnl # The function check_acl gained a new parameter: flags
234dnl #
235AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_CHECK_ACL_WITH_FLAGS], [
236 AC_MSG_CHECKING([whether iops->check_acl() wants flags])
237 ZFS_LINUX_TRY_COMPILE([
238 #include <linux/fs.h>
239
240 int check_acl_fn(struct inode *inode, int mask,
241 unsigned int flags) { return 0; }
242
243 static const struct inode_operations
244 iops __attribute__ ((unused)) = {
245 .check_acl = check_acl_fn,
246 };
247 ],[
248 ],[
249 AC_MSG_RESULT(yes)
250 AC_DEFINE(HAVE_CHECK_ACL, 1, [iops->check_acl() exists])
251 AC_DEFINE(HAVE_CHECK_ACL_WITH_FLAGS, 1,
252 [iops->check_acl() wants flags])
253 ],[
254 AC_MSG_RESULT(no)
255 ])
256])
257
258dnl #
259dnl # 3.1 API change,
260dnl # Check if inode_operations contains the function get_acl
261dnl #
262AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL], [
263 AC_MSG_CHECKING([whether iops->get_acl() exists])
264 ZFS_LINUX_TRY_COMPILE([
265 #include <linux/fs.h>
266
267 struct posix_acl *get_acl_fn(struct inode *inode, int type)
268 { return NULL; }
269
270 static const struct inode_operations
271 iops __attribute__ ((unused)) = {
272 .get_acl = get_acl_fn,
273 };
274 ],[
275 ],[
276 AC_MSG_RESULT(yes)
277 AC_DEFINE(HAVE_GET_ACL, 1, [iops->get_acl() exists])
278 ],[
279 AC_MSG_RESULT(no)
280 ])
281])
afb6c031 282
0420c126 283dnl #
284dnl # 3.14 API change,
285dnl # Check if inode_operations contains the function set_acl
286dnl #
287AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL], [
288 AC_MSG_CHECKING([whether iops->set_acl() exists])
289 ZFS_LINUX_TRY_COMPILE([
290 #include <linux/fs.h>
291
292 int set_acl_fn(struct inode *inode, struct posix_acl *acl, int type)
293 { return 0; }
294
295 static const struct inode_operations
296 iops __attribute__ ((unused)) = {
297 .set_acl = set_acl_fn,
298 };
299 ],[
300 ],[
301 AC_MSG_RESULT(yes)
302 AC_DEFINE(HAVE_SET_ACL, 1, [iops->set_acl() exists])
303 ],[
304 AC_MSG_RESULT(no)
305 ])
306])
307
afb6c031
CC
308dnl #
309dnl # 4.7 API change,
310dnl # The kernel get_acl will now check cache before calling i_op->get_acl and
311dnl # do set_cached_acl after that, so i_op->get_acl don't need to do that
312dnl # anymore.
313dnl #
3779913b 314AC_DEFUN([ZFS_AC_KERNEL_GET_ACL_HANDLE_CACHE], [
afb6c031
CC
315 AC_MSG_CHECKING([whether uncached_acl_sentinel() exists])
316 ZFS_LINUX_TRY_COMPILE([
317 #include <linux/fs.h>
318 ],[
319 void *sentinel __attribute__ ((unused)) = uncached_acl_sentinel(NULL);
320 ],[
321 AC_MSG_RESULT(yes)
322 AC_DEFINE(HAVE_KERNEL_GET_ACL_HANDLE_CACHE, 1, [uncached_acl_sentinel() exists])
323 ],[
324 AC_MSG_RESULT(no)
325 ])
326])