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