]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - config/kernel-acl.m4
fix booting via dracut generated initramfs
[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_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 # 2.6.30 API change,
80 dnl # caching of ACL into the inode was added in this version.
81 dnl #
82 AC_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
99 dnl #
100 dnl # 3.1 API change,
101 dnl # posix_acl_equiv_mode now wants an umode_t* instead of a mode_t*
102 dnl #
103 AC_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
120 dnl #
121 dnl # 2.6.27 API change,
122 dnl # Check if inode_operations contains the function permission
123 dnl # and expects the nameidata structure to have been removed.
124 dnl #
125 AC_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
145 dnl #
146 dnl # 2.6.26 API change,
147 dnl # Check if inode_operations contains the function permission
148 dnl # and expects the nameidata structure to be passed.
149 dnl #
150 AC_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
173 dnl #
174 dnl # 2.6.32 API change,
175 dnl # Check if inode_operations contains the function check_acl
176 dnl #
177 AC_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
197 dnl #
198 dnl # 2.6.38 API change,
199 dnl # The function check_acl gained a new parameter: flags
200 dnl #
201 AC_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
224 dnl #
225 dnl # 3.1 API change,
226 dnl # Check if inode_operations contains the function get_acl
227 dnl #
228 AC_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
249 dnl #
250 dnl # 2.6.30 API change,
251 dnl # current_umask exists only since this version.
252 dnl #
253 AC_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 ])