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])
45 dnl # posix_acl_chmod_masq() is not exported anymore and posix_acl_chmod()
46 dnl # was introduced to replace it.
48 dnl # 3.14 API change,
49 dnl # posix_acl_chmod() is changed to __posix_acl_chmod()
51 AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_CHMOD], [
52 AC_MSG_CHECKING([whether posix_acl_chmod exists])
53 ZFS_LINUX_TRY_COMPILE([
55 #include <linux/posix_acl.h>
57 posix_acl_chmod(NULL, 0, 0)
60 AC_DEFINE(HAVE_POSIX_ACL_CHMOD, 1, [posix_acl_chmod() exists])
65 AC_MSG_CHECKING([whether __posix_acl_chmod exists])
66 ZFS_LINUX_TRY_COMPILE([
68 #include <linux/posix_acl.h>
70 __posix_acl_chmod(NULL, 0, 0)
73 AC_DEFINE(HAVE___POSIX_ACL_CHMOD, 1, [__posix_acl_chmod() exists])
81 dnl # posix_acl_equiv_mode now wants an umode_t* instead of a mode_t*
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([
87 #include <linux/posix_acl.h>
90 posix_acl_equiv_mode(NULL,&tmp);
93 AC_DEFINE(HAVE_POSIX_ACL_EQUIV_MODE_UMODE_T, 1,
94 [ posix_acl_equiv_mode wants umode_t*])
101 dnl # 4.8 API change,
102 dnl # The function posix_acl_valid now must be passed a namespace.
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>
110 struct user_namespace *user_ns = NULL;
111 const struct posix_acl *acl = NULL;
114 error = posix_acl_valid(user_ns, acl);
117 AC_DEFINE(HAVE_POSIX_ACL_VALID_WITH_NS, 1,
118 [posix_acl_valid() wants user namespace])
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.
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>
134 int permission_fn(struct inode *inode, int mask) { return 0; }
136 static const struct inode_operations
137 iops __attribute__ ((unused)) = {
138 .permission = permission_fn,
143 AC_DEFINE(HAVE_PERMISSION, 1, [iops->permission() exists])
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.
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>
159 int permission_fn(struct inode *inode, int mask,
160 struct nameidata *nd) { return 0; }
162 static const struct inode_operations
163 iops __attribute__ ((unused)) = {
164 .permission = permission_fn,
169 AC_DEFINE(HAVE_PERMISSION, 1, [iops->permission() exists])
170 AC_DEFINE(HAVE_PERMISSION_WITH_NAMEIDATA, 1,
171 [iops->permission() with nameidata exists])
178 dnl # 2.6.32 API change,
179 dnl # Check if inode_operations contains the function check_acl
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>
186 int check_acl_fn(struct inode *inode, int mask) { return 0; }
188 static const struct inode_operations
189 iops __attribute__ ((unused)) = {
190 .check_acl = check_acl_fn,
195 AC_DEFINE(HAVE_CHECK_ACL, 1, [iops->check_acl() exists])
202 dnl # 2.6.38 API change,
203 dnl # The function check_acl gained a new parameter: flags
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>
210 int check_acl_fn(struct inode *inode, int mask,
211 unsigned int flags) { return 0; }
213 static const struct inode_operations
214 iops __attribute__ ((unused)) = {
215 .check_acl = check_acl_fn,
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])
229 dnl # 3.1 API change,
230 dnl # Check if inode_operations contains the function get_acl
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>
237 struct posix_acl *get_acl_fn(struct inode *inode, int type)
240 static const struct inode_operations
241 iops __attribute__ ((unused)) = {
242 .get_acl = get_acl_fn,
247 AC_DEFINE(HAVE_GET_ACL, 1, [iops->get_acl() exists])
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
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>
264 void *sentinel __attribute__ ((unused)) = uncached_acl_sentinel(NULL);
267 AC_DEFINE(HAVE_KERNEL_GET_ACL_HANDLE_CACHE, 1, [uncached_acl_sentinel() exists])