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
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>
11 #include <linux/posix_acl.h>
13 struct posix_acl* tmp = posix_acl_alloc(1, 0);
14 posix_acl_release(tmp);
17 AC_DEFINE(HAVE_POSIX_ACL_RELEASE, 1,
18 [posix_acl_release() is available])
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>
25 #include <linux/posix_acl.h>
27 MODULE_LICENSE("$ZFS_META_LICENSE");
29 struct posix_acl* tmp = posix_acl_alloc(1, 0);
30 posix_acl_release(tmp);
35 AC_DEFINE(HAVE_POSIX_ACL_RELEASE_GPL_ONLY, 1,
36 [posix_acl_release() is GPL-only])
44 dnl # 3.14 API change,
45 dnl # set_cached_acl() and forget_cached_acl() changed from inline to
46 dnl # EXPORT_SYMBOL. In the former case, they may not be usable because of
47 dnl # posix_acl_release. In the latter case, we can always use them.
49 AC_DEFUN([ZFS_AC_KERNEL_SET_CACHED_ACL_USABLE], [
50 AC_MSG_CHECKING([whether set_cached_acl() is usable])
51 ZFS_LINUX_TRY_COMPILE([
52 #include <linux/module.h>
53 #include <linux/cred.h>
55 #include <linux/posix_acl.h>
57 MODULE_LICENSE("$ZFS_META_LICENSE");
59 struct inode *ip = NULL;
60 struct posix_acl *acl = posix_acl_alloc(1, 0);
61 set_cached_acl(ip, ACL_TYPE_ACCESS, acl);
62 forget_cached_acl(ip, ACL_TYPE_ACCESS);
65 AC_DEFINE(HAVE_SET_CACHED_ACL_USABLE, 1,
66 [posix_acl_release() is usable])
74 dnl # posix_acl_chmod_masq() is not exported anymore and posix_acl_chmod()
75 dnl # was introduced to replace it.
77 dnl # 3.14 API change,
78 dnl # posix_acl_chmod() is changed to __posix_acl_chmod()
80 AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_CHMOD], [
81 AC_MSG_CHECKING([whether posix_acl_chmod exists])
82 ZFS_LINUX_TRY_COMPILE([
84 #include <linux/posix_acl.h>
86 posix_acl_chmod(NULL, 0, 0)
89 AC_DEFINE(HAVE_POSIX_ACL_CHMOD, 1, [posix_acl_chmod() exists])
94 AC_MSG_CHECKING([whether __posix_acl_chmod exists])
95 ZFS_LINUX_TRY_COMPILE([
97 #include <linux/posix_acl.h>
99 __posix_acl_chmod(NULL, 0, 0)
102 AC_DEFINE(HAVE___POSIX_ACL_CHMOD, 1, [__posix_acl_chmod() exists])
109 dnl # 3.1 API change,
110 dnl # posix_acl_equiv_mode now wants an umode_t* instead of a mode_t*
112 AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T], [
113 AC_MSG_CHECKING([whether posix_acl_equiv_mode() wants umode_t])
114 ZFS_LINUX_TRY_COMPILE([
115 #include <linux/fs.h>
116 #include <linux/posix_acl.h>
119 posix_acl_equiv_mode(NULL,&tmp);
122 AC_DEFINE(HAVE_POSIX_ACL_EQUIV_MODE_UMODE_T, 1,
123 [ posix_acl_equiv_mode wants umode_t*])
130 dnl # 4.8 API change,
131 dnl # The function posix_acl_valid now must be passed a namespace.
133 AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_VALID_WITH_NS], [
134 AC_MSG_CHECKING([whether posix_acl_valid() wants user namespace])
135 ZFS_LINUX_TRY_COMPILE([
136 #include <linux/fs.h>
137 #include <linux/posix_acl.h>
139 struct user_namespace *user_ns = NULL;
140 const struct posix_acl *acl = NULL;
143 error = posix_acl_valid(user_ns, acl);
146 AC_DEFINE(HAVE_POSIX_ACL_VALID_WITH_NS, 1,
147 [posix_acl_valid() wants user namespace])
154 dnl # 2.6.27 API change,
155 dnl # Check if inode_operations contains the function permission
156 dnl # and expects the nameidata structure to have been removed.
158 AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION], [
159 AC_MSG_CHECKING([whether iops->permission() exists])
160 ZFS_LINUX_TRY_COMPILE([
161 #include <linux/fs.h>
163 int permission_fn(struct inode *inode, int mask) { return 0; }
165 static const struct inode_operations
166 iops __attribute__ ((unused)) = {
167 .permission = permission_fn,
172 AC_DEFINE(HAVE_PERMISSION, 1, [iops->permission() exists])
179 dnl # 2.6.26 API change,
180 dnl # Check if inode_operations contains the function permission
181 dnl # and expects the nameidata structure to be passed.
183 AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION_WITH_NAMEIDATA], [
184 AC_MSG_CHECKING([whether iops->permission() wants nameidata])
185 ZFS_LINUX_TRY_COMPILE([
186 #include <linux/fs.h>
187 #include <linux/sched.h>
189 int permission_fn(struct inode *inode, int mask,
190 struct nameidata *nd) { return 0; }
192 static const struct inode_operations
193 iops __attribute__ ((unused)) = {
194 .permission = permission_fn,
199 AC_DEFINE(HAVE_PERMISSION, 1, [iops->permission() exists])
200 AC_DEFINE(HAVE_PERMISSION_WITH_NAMEIDATA, 1,
201 [iops->permission() with nameidata exists])
208 dnl # 2.6.32 API change,
209 dnl # Check if inode_operations contains the function check_acl
211 AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_CHECK_ACL], [
212 AC_MSG_CHECKING([whether iops->check_acl() exists])
213 ZFS_LINUX_TRY_COMPILE([
214 #include <linux/fs.h>
216 int check_acl_fn(struct inode *inode, int mask) { return 0; }
218 static const struct inode_operations
219 iops __attribute__ ((unused)) = {
220 .check_acl = check_acl_fn,
225 AC_DEFINE(HAVE_CHECK_ACL, 1, [iops->check_acl() exists])
232 dnl # 2.6.38 API change,
233 dnl # The function check_acl gained a new parameter: flags
235 AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_CHECK_ACL_WITH_FLAGS], [
236 AC_MSG_CHECKING([whether iops->check_acl() wants flags])
237 ZFS_LINUX_TRY_COMPILE([
238 #include <linux/fs.h>
240 int check_acl_fn(struct inode *inode, int mask,
241 unsigned int flags) { return 0; }
243 static const struct inode_operations
244 iops __attribute__ ((unused)) = {
245 .check_acl = check_acl_fn,
250 AC_DEFINE(HAVE_CHECK_ACL, 1, [iops->check_acl() exists])
251 AC_DEFINE(HAVE_CHECK_ACL_WITH_FLAGS, 1,
252 [iops->check_acl() wants flags])
259 dnl # 3.1 API change,
260 dnl # Check if inode_operations contains the function get_acl
262 AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL], [
263 AC_MSG_CHECKING([whether iops->get_acl() exists])
264 ZFS_LINUX_TRY_COMPILE([
265 #include <linux/fs.h>
267 struct posix_acl *get_acl_fn(struct inode *inode, int type)
270 static const struct inode_operations
271 iops __attribute__ ((unused)) = {
272 .get_acl = get_acl_fn,
277 AC_DEFINE(HAVE_GET_ACL, 1, [iops->get_acl() exists])
284 dnl # 3.14 API change,
285 dnl # Check if inode_operations contains the function set_acl
287 AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL], [
288 AC_MSG_CHECKING([whether iops->set_acl() exists])
289 ZFS_LINUX_TRY_COMPILE([
290 #include <linux/fs.h>
292 int set_acl_fn(struct inode *inode, struct posix_acl *acl, int type)
295 static const struct inode_operations
296 iops __attribute__ ((unused)) = {
297 .set_acl = set_acl_fn,
302 AC_DEFINE(HAVE_SET_ACL, 1, [iops->set_acl() exists])
309 dnl # 4.7 API change,
310 dnl # The kernel get_acl will now check cache before calling i_op->get_acl and
311 dnl # do set_cached_acl after that, so i_op->get_acl don't need to do that
314 AC_DEFUN([ZFS_AC_KERNEL_GET_ACL_HANDLE_CACHE], [
315 AC_MSG_CHECKING([whether uncached_acl_sentinel() exists])
316 ZFS_LINUX_TRY_COMPILE([
317 #include <linux/fs.h>
319 void *sentinel __attribute__ ((unused)) = uncached_acl_sentinel(NULL);
322 AC_DEFINE(HAVE_KERNEL_GET_ACL_HANDLE_CACHE, 1, [uncached_acl_sentinel() exists])