]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - config/kernel-acl.m4
Use file_dentry and file_inode wrappers
[FreeBSD/FreeBSD.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_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>
26
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                 ])
38         ],[
39                 AC_MSG_RESULT(no)
40         ])
41 ])
42
43 dnl #
44 dnl # 3.1 API change,
45 dnl # posix_acl_chmod_masq() is not exported anymore and posix_acl_chmod()
46 dnl # was introduced to replace it.
47 dnl #
48 dnl # 3.14 API change,
49 dnl # posix_acl_chmod() is changed to __posix_acl_chmod()
50 dnl #
51 AC_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
79 dnl #
80 dnl # 3.1 API change,
81 dnl # posix_acl_equiv_mode now wants an umode_t* instead of a mode_t*
82 dnl #
83 AC_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
100 dnl #
101 dnl # 4.8 API change,
102 dnl # The function posix_acl_valid now must be passed a namespace.
103 dnl #
104 AC_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
124 dnl #
125 dnl # 2.6.27 API change,
126 dnl # Check if inode_operations contains the function permission
127 dnl # and expects the nameidata structure to have been removed.
128 dnl #
129 AC_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
149 dnl #
150 dnl # 2.6.26 API change,
151 dnl # Check if inode_operations contains the function permission
152 dnl # and expects the nameidata structure to be passed.
153 dnl #
154 AC_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
177 dnl #
178 dnl # 2.6.32 API change,
179 dnl # Check if inode_operations contains the function check_acl
180 dnl #
181 AC_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
201 dnl #
202 dnl # 2.6.38 API change,
203 dnl # The function check_acl gained a new parameter: flags
204 dnl #
205 AC_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
228 dnl #
229 dnl # 3.1 API change,
230 dnl # Check if inode_operations contains the function get_acl
231 dnl #
232 AC_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
253 dnl #
254 dnl # 4.7 API change,
255 dnl # The kernel get_acl will now check cache before calling i_op->get_acl and
256 dnl # do set_cached_acl after that, so i_op->get_acl don't need to do that
257 dnl # anymore.
258 dnl #
259 AC_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 ])