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