]> git.proxmox.com Git - mirror_zfs-debian.git/blame - config/kernel-acl.m4
Imported Upstream version 0.6.5.4
[mirror_zfs-debian.git] / config / kernel-acl.m4
CommitLineData
a08ee875 1dnl #
ea04106b
AX
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
a08ee875
LG
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
ea04106b 29 MODULE_LICENSE("$ZFS_META_LICENSE");
a08ee875
LG
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.1 API change,
44dnl # posix_acl_chmod_masq() is not exported anymore and posix_acl_chmod()
45dnl # was introduced to replace it.
46dnl #
ea04106b
AX
47dnl # 3.14 API change,
48dnl # posix_acl_chmod() is changed to __posix_acl_chmod()
49dnl #
a08ee875
LG
50AC_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 ])
ea04106b
AX
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 ])
a08ee875
LG
76])
77
78dnl #
79dnl # 2.6.30 API change,
80dnl # caching of ACL into the inode was added in this version.
81dnl #
82AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_CACHING], [
83 AC_MSG_CHECKING([whether inode has i_acl and i_default_acl])
84 ZFS_LINUX_TRY_COMPILE([
85 #include <linux/fs.h>
86 ],[
87 struct inode ino;
88 ino.i_acl = NULL;
89 ino.i_default_acl = NULL;
90 ],[
91 AC_MSG_RESULT(yes)
92 AC_DEFINE(HAVE_POSIX_ACL_CACHING, 1,
93 [inode contains i_acl and i_default_acl])
94 ],[
95 AC_MSG_RESULT(no)
96 ])
97])
98
99dnl #
100dnl # 3.1 API change,
101dnl # posix_acl_equiv_mode now wants an umode_t* instead of a mode_t*
102dnl #
103AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T], [
104 AC_MSG_CHECKING([whether posix_acl_equiv_mode() wants umode_t])
105 ZFS_LINUX_TRY_COMPILE([
106 #include <linux/fs.h>
107 #include <linux/posix_acl.h>
108 ],[
109 umode_t tmp;
110 posix_acl_equiv_mode(NULL,&tmp);
111 ],[
112 AC_MSG_RESULT(yes)
113 AC_DEFINE(HAVE_POSIX_ACL_EQUIV_MODE_UMODE_T, 1,
114 [ posix_acl_equiv_mode wants umode_t*])
115 ],[
116 AC_MSG_RESULT(no)
117 ])
118])
119
120dnl #
121dnl # 2.6.27 API change,
122dnl # Check if inode_operations contains the function permission
123dnl # and expects the nameidata structure to have been removed.
124dnl #
125AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION], [
126 AC_MSG_CHECKING([whether iops->permission() exists])
127 ZFS_LINUX_TRY_COMPILE([
128 #include <linux/fs.h>
129
130 int permission_fn(struct inode *inode, int mask) { return 0; }
131
132 static const struct inode_operations
133 iops __attribute__ ((unused)) = {
134 .permission = permission_fn,
135 };
136 ],[
137 ],[
138 AC_MSG_RESULT(yes)
139 AC_DEFINE(HAVE_PERMISSION, 1, [iops->permission() exists])
140 ],[
141 AC_MSG_RESULT(no)
142 ])
143])
144
145dnl #
146dnl # 2.6.26 API change,
147dnl # Check if inode_operations contains the function permission
148dnl # and expects the nameidata structure to be passed.
149dnl #
150AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION_WITH_NAMEIDATA], [
151 AC_MSG_CHECKING([whether iops->permission() wants nameidata])
152 ZFS_LINUX_TRY_COMPILE([
153 #include <linux/fs.h>
154
155 int permission_fn(struct inode *inode, int mask,
156 struct nameidata *nd) { return 0; }
157
158 static const struct inode_operations
159 iops __attribute__ ((unused)) = {
160 .permission = permission_fn,
161 };
162 ],[
163 ],[
164 AC_MSG_RESULT(yes)
165 AC_DEFINE(HAVE_PERMISSION, 1, [iops->permission() exists])
166 AC_DEFINE(HAVE_PERMISSION_WITH_NAMEIDATA, 1,
167 [iops->permission() with nameidata exists])
168 ],[
169 AC_MSG_RESULT(no)
170 ])
171])
172
173dnl #
174dnl # 2.6.32 API change,
175dnl # Check if inode_operations contains the function check_acl
176dnl #
177AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_CHECK_ACL], [
178 AC_MSG_CHECKING([whether iops->check_acl() exists])
179 ZFS_LINUX_TRY_COMPILE([
180 #include <linux/fs.h>
181
182 int check_acl_fn(struct inode *inode, int mask) { return 0; }
183
184 static const struct inode_operations
185 iops __attribute__ ((unused)) = {
186 .check_acl = check_acl_fn,
187 };
188 ],[
189 ],[
190 AC_MSG_RESULT(yes)
191 AC_DEFINE(HAVE_CHECK_ACL, 1, [iops->check_acl() exists])
192 ],[
193 AC_MSG_RESULT(no)
194 ])
195])
196
197dnl #
198dnl # 2.6.38 API change,
199dnl # The function check_acl gained a new parameter: flags
200dnl #
201AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_CHECK_ACL_WITH_FLAGS], [
202 AC_MSG_CHECKING([whether iops->check_acl() wants flags])
203 ZFS_LINUX_TRY_COMPILE([
204 #include <linux/fs.h>
205
206 int check_acl_fn(struct inode *inode, int mask,
207 unsigned int flags) { return 0; }
208
209 static const struct inode_operations
210 iops __attribute__ ((unused)) = {
211 .check_acl = check_acl_fn,
212 };
213 ],[
214 ],[
215 AC_MSG_RESULT(yes)
216 AC_DEFINE(HAVE_CHECK_ACL, 1, [iops->check_acl() exists])
217 AC_DEFINE(HAVE_CHECK_ACL_WITH_FLAGS, 1,
218 [iops->check_acl() wants flags])
219 ],[
220 AC_MSG_RESULT(no)
221 ])
222])
223
224dnl #
225dnl # 3.1 API change,
226dnl # Check if inode_operations contains the function get_acl
227dnl #
228AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL], [
229 AC_MSG_CHECKING([whether iops->get_acl() exists])
230 ZFS_LINUX_TRY_COMPILE([
231 #include <linux/fs.h>
232
233 struct posix_acl *get_acl_fn(struct inode *inode, int type)
234 { return NULL; }
235
236 static const struct inode_operations
237 iops __attribute__ ((unused)) = {
238 .get_acl = get_acl_fn,
239 };
240 ],[
241 ],[
242 AC_MSG_RESULT(yes)
243 AC_DEFINE(HAVE_GET_ACL, 1, [iops->get_acl() exists])
244 ],[
245 AC_MSG_RESULT(no)
246 ])
247])
248
249dnl #
250dnl # 2.6.30 API change,
251dnl # current_umask exists only since this version.
252dnl #
253AC_DEFUN([ZFS_AC_KERNEL_CURRENT_UMASK], [
254 AC_MSG_CHECKING([whether current_umask exists])
255 ZFS_LINUX_TRY_COMPILE([
256 #include <linux/fs.h>
257 ],[
258 current_umask();
259 ],[
260 AC_MSG_RESULT(yes)
261 AC_DEFINE(HAVE_CURRENT_UMASK, 1, [current_umask() exists])
262 ],[
263 AC_MSG_RESULT(no)
264 ])
265])