]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - zfs/config/kernel-acl.m4
UBUNTU: SAUCE: Update zfs to e02aaf17f15ad274fa1f24c9c826f1477911ea3f
[mirror_ubuntu-zesty-kernel.git] / zfs / config / kernel-acl.m4
CommitLineData
7bdf406d
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])
7bdf406d 19
51d97d8f
TG
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>
7bdf406d 26
51d97d8f
TG
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 ])
7bdf406d
TG
38 ],[
39 AC_MSG_RESULT(no)
7bdf406d
TG
40 ])
41])
42
43dnl #
44dnl # 3.1 API change,
45dnl # posix_acl_chmod_masq() is not exported anymore and posix_acl_chmod()
46dnl # was introduced to replace it.
47dnl #
48dnl # 3.14 API change,
49dnl # posix_acl_chmod() is changed to __posix_acl_chmod()
50dnl #
51AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_CHMOD], [
52 AC_MSG_CHECKING([whether posix_acl_chmod exists])
53 ZFS_LINUX_TRY_COMPILE([
54 #include <linux/fs.h>
55 #include <linux/posix_acl.h>
56 ],[
57 posix_acl_chmod(NULL, 0, 0)
58 ],[
59 AC_MSG_RESULT(yes)
60 AC_DEFINE(HAVE_POSIX_ACL_CHMOD, 1, [posix_acl_chmod() exists])
61 ],[
62 AC_MSG_RESULT(no)
63 ])
64
65 AC_MSG_CHECKING([whether __posix_acl_chmod exists])
66 ZFS_LINUX_TRY_COMPILE([
67 #include <linux/fs.h>
68 #include <linux/posix_acl.h>
69 ],[
70 __posix_acl_chmod(NULL, 0, 0)
71 ],[
72 AC_MSG_RESULT(yes)
73 AC_DEFINE(HAVE___POSIX_ACL_CHMOD, 1, [__posix_acl_chmod() exists])
74 ],[
75 AC_MSG_RESULT(no)
76 ])
77])
78
79dnl #
80dnl # 3.1 API change,
81dnl # posix_acl_equiv_mode now wants an umode_t* instead of a mode_t*
82dnl #
83AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T], [
84 AC_MSG_CHECKING([whether posix_acl_equiv_mode() wants umode_t])
85 ZFS_LINUX_TRY_COMPILE([
86 #include <linux/fs.h>
87 #include <linux/posix_acl.h>
88 ],[
89 umode_t tmp;
90 posix_acl_equiv_mode(NULL,&tmp);
91 ],[
92 AC_MSG_RESULT(yes)
93 AC_DEFINE(HAVE_POSIX_ACL_EQUIV_MODE_UMODE_T, 1,
94 [ posix_acl_equiv_mode wants umode_t*])
95 ],[
96 AC_MSG_RESULT(no)
97 ])
98])
99
100dnl #
101dnl # 4.8 API change,
102dnl # The function posix_acl_valid now must be passed a namespace.
103dnl #
104AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_VALID_WITH_NS], [
105 AC_MSG_CHECKING([whether posix_acl_valid() wants user namespace])
106 ZFS_LINUX_TRY_COMPILE([
107 #include <linux/fs.h>
108 #include <linux/posix_acl.h>
109 ],[
110 struct user_namespace *user_ns = NULL;
111 const struct posix_acl *acl = NULL;
112 int error;
113
114 error = posix_acl_valid(user_ns, acl);
115 ],[
116 AC_MSG_RESULT(yes)
117 AC_DEFINE(HAVE_POSIX_ACL_VALID_WITH_NS, 1,
118 [posix_acl_valid() wants user namespace])
119 ],[
120 AC_MSG_RESULT(no)
121 ])
122])
123
124dnl #
125dnl # 2.6.27 API change,
126dnl # Check if inode_operations contains the function permission
127dnl # and expects the nameidata structure to have been removed.
128dnl #
129AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION], [
130 AC_MSG_CHECKING([whether iops->permission() exists])
131 ZFS_LINUX_TRY_COMPILE([
132 #include <linux/fs.h>
133
134 int permission_fn(struct inode *inode, int mask) { return 0; }
135
136 static const struct inode_operations
137 iops __attribute__ ((unused)) = {
138 .permission = permission_fn,
139 };
140 ],[
141 ],[
142 AC_MSG_RESULT(yes)
143 AC_DEFINE(HAVE_PERMISSION, 1, [iops->permission() exists])
144 ],[
145 AC_MSG_RESULT(no)
146 ])
147])
148
149dnl #
150dnl # 2.6.26 API change,
151dnl # Check if inode_operations contains the function permission
152dnl # and expects the nameidata structure to be passed.
153dnl #
154AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION_WITH_NAMEIDATA], [
155 AC_MSG_CHECKING([whether iops->permission() wants nameidata])
156 ZFS_LINUX_TRY_COMPILE([
157 #include <linux/fs.h>
158
159 int permission_fn(struct inode *inode, int mask,
160 struct nameidata *nd) { return 0; }
161
162 static const struct inode_operations
163 iops __attribute__ ((unused)) = {
164 .permission = permission_fn,
165 };
166 ],[
167 ],[
168 AC_MSG_RESULT(yes)
169 AC_DEFINE(HAVE_PERMISSION, 1, [iops->permission() exists])
170 AC_DEFINE(HAVE_PERMISSION_WITH_NAMEIDATA, 1,
171 [iops->permission() with nameidata exists])
172 ],[
173 AC_MSG_RESULT(no)
174 ])
175])
176
177dnl #
178dnl # 2.6.32 API change,
179dnl # Check if inode_operations contains the function check_acl
180dnl #
181AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_CHECK_ACL], [
182 AC_MSG_CHECKING([whether iops->check_acl() exists])
183 ZFS_LINUX_TRY_COMPILE([
184 #include <linux/fs.h>
185
186 int check_acl_fn(struct inode *inode, int mask) { return 0; }
187
188 static const struct inode_operations
189 iops __attribute__ ((unused)) = {
190 .check_acl = check_acl_fn,
191 };
192 ],[
193 ],[
194 AC_MSG_RESULT(yes)
195 AC_DEFINE(HAVE_CHECK_ACL, 1, [iops->check_acl() exists])
196 ],[
197 AC_MSG_RESULT(no)
198 ])
199])
200
201dnl #
202dnl # 2.6.38 API change,
203dnl # The function check_acl gained a new parameter: flags
204dnl #
205AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_CHECK_ACL_WITH_FLAGS], [
206 AC_MSG_CHECKING([whether iops->check_acl() wants flags])
207 ZFS_LINUX_TRY_COMPILE([
208 #include <linux/fs.h>
209
210 int check_acl_fn(struct inode *inode, int mask,
211 unsigned int flags) { return 0; }
212
213 static const struct inode_operations
214 iops __attribute__ ((unused)) = {
215 .check_acl = check_acl_fn,
216 };
217 ],[
218 ],[
219 AC_MSG_RESULT(yes)
220 AC_DEFINE(HAVE_CHECK_ACL, 1, [iops->check_acl() exists])
221 AC_DEFINE(HAVE_CHECK_ACL_WITH_FLAGS, 1,
222 [iops->check_acl() wants flags])
223 ],[
224 AC_MSG_RESULT(no)
225 ])
226])
227
228dnl #
229dnl # 3.1 API change,
230dnl # Check if inode_operations contains the function get_acl
231dnl #
232AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL], [
233 AC_MSG_CHECKING([whether iops->get_acl() exists])
234 ZFS_LINUX_TRY_COMPILE([
235 #include <linux/fs.h>
236
237 struct posix_acl *get_acl_fn(struct inode *inode, int type)
238 { return NULL; }
239
240 static const struct inode_operations
241 iops __attribute__ ((unused)) = {
242 .get_acl = get_acl_fn,
243 };
244 ],[
245 ],[
246 AC_MSG_RESULT(yes)
247 AC_DEFINE(HAVE_GET_ACL, 1, [iops->get_acl() exists])
248 ],[
249 AC_MSG_RESULT(no)
250 ])
251])
252
253dnl #
254dnl # 4.7 API change,
255dnl # The kernel get_acl will now check cache before calling i_op->get_acl and
256dnl # do set_cached_acl after that, so i_op->get_acl don't need to do that
257dnl # anymore.
258dnl #
259AC_DEFUN([ZFS_AC_KERNE_GET_ACL_HANDLE_CACHE], [
260 AC_MSG_CHECKING([whether uncached_acl_sentinel() exists])
261 ZFS_LINUX_TRY_COMPILE([
262 #include <linux/fs.h>
263 ],[
264 void *sentinel __attribute__ ((unused)) = uncached_acl_sentinel(NULL);
265 ],[
266 AC_MSG_RESULT(yes)
267 AC_DEFINE(HAVE_KERNEL_GET_ACL_HANDLE_CACHE, 1, [uncached_acl_sentinel() exists])
268 ],[
269 AC_MSG_RESULT(no)
270 ])
271])