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])
23 AC_MSG_CHECKING([whether posix_acl_release() is GPL-only])
24 ZFS_LINUX_TRY_COMPILE([
25 #include <linux/cred.h>
27 #include <linux/posix_acl.h>
29 MODULE_LICENSE("$ZFS_META_LICENSE");
31 struct posix_acl* tmp = posix_acl_alloc(1, 0);
32 posix_acl_release(tmp);
37 AC_DEFINE(HAVE_POSIX_ACL_RELEASE_GPL_ONLY, 1,
38 [posix_acl_release() is GPL-only])
44 dnl # posix_acl_chmod_masq() is not exported anymore and posix_acl_chmod()
45 dnl # was introduced to replace it.
47 dnl # 3.14 API change,
48 dnl # posix_acl_chmod() is changed to __posix_acl_chmod()
50 AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_CHMOD], [
51 AC_MSG_CHECKING([whether posix_acl_chmod exists])
52 ZFS_LINUX_TRY_COMPILE([
54 #include <linux/posix_acl.h>
56 posix_acl_chmod(NULL, 0, 0)
59 AC_DEFINE(HAVE_POSIX_ACL_CHMOD, 1, [posix_acl_chmod() exists])
64 AC_MSG_CHECKING([whether __posix_acl_chmod exists])
65 ZFS_LINUX_TRY_COMPILE([
67 #include <linux/posix_acl.h>
69 __posix_acl_chmod(NULL, 0, 0)
72 AC_DEFINE(HAVE___POSIX_ACL_CHMOD, 1, [__posix_acl_chmod() exists])
80 dnl # posix_acl_equiv_mode now wants an umode_t* instead of a mode_t*
82 AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T], [
83 AC_MSG_CHECKING([whether posix_acl_equiv_mode() wants umode_t])
84 ZFS_LINUX_TRY_COMPILE([
86 #include <linux/posix_acl.h>
89 posix_acl_equiv_mode(NULL,&tmp);
92 AC_DEFINE(HAVE_POSIX_ACL_EQUIV_MODE_UMODE_T, 1,
93 [ posix_acl_equiv_mode wants umode_t*])
100 dnl # 4.8 API change,
101 dnl # The function posix_acl_valid now must be passed a namespace.
103 AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_VALID_WITH_NS], [
104 AC_MSG_CHECKING([whether posix_acl_valid() wants user namespace])
105 ZFS_LINUX_TRY_COMPILE([
106 #include <linux/fs.h>
107 #include <linux/posix_acl.h>
109 struct user_namespace *user_ns = NULL;
110 const struct posix_acl *acl = NULL;
113 error = posix_acl_valid(user_ns, acl);
116 AC_DEFINE(HAVE_POSIX_ACL_VALID_WITH_NS, 1,
117 [posix_acl_valid() wants user namespace])
124 dnl # 2.6.27 API change,
125 dnl # Check if inode_operations contains the function permission
126 dnl # and expects the nameidata structure to have been removed.
128 AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION], [
129 AC_MSG_CHECKING([whether iops->permission() exists])
130 ZFS_LINUX_TRY_COMPILE([
131 #include <linux/fs.h>
133 int permission_fn(struct inode *inode, int mask) { return 0; }
135 static const struct inode_operations
136 iops __attribute__ ((unused)) = {
137 .permission = permission_fn,
142 AC_DEFINE(HAVE_PERMISSION, 1, [iops->permission() exists])
149 dnl # 2.6.26 API change,
150 dnl # Check if inode_operations contains the function permission
151 dnl # and expects the nameidata structure to be passed.
153 AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_PERMISSION_WITH_NAMEIDATA], [
154 AC_MSG_CHECKING([whether iops->permission() wants nameidata])
155 ZFS_LINUX_TRY_COMPILE([
156 #include <linux/fs.h>
158 int permission_fn(struct inode *inode, int mask,
159 struct nameidata *nd) { return 0; }
161 static const struct inode_operations
162 iops __attribute__ ((unused)) = {
163 .permission = permission_fn,
168 AC_DEFINE(HAVE_PERMISSION, 1, [iops->permission() exists])
169 AC_DEFINE(HAVE_PERMISSION_WITH_NAMEIDATA, 1,
170 [iops->permission() with nameidata exists])
177 dnl # 2.6.32 API change,
178 dnl # Check if inode_operations contains the function check_acl
180 AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_CHECK_ACL], [
181 AC_MSG_CHECKING([whether iops->check_acl() exists])
182 ZFS_LINUX_TRY_COMPILE([
183 #include <linux/fs.h>
185 int check_acl_fn(struct inode *inode, int mask) { return 0; }
187 static const struct inode_operations
188 iops __attribute__ ((unused)) = {
189 .check_acl = check_acl_fn,
194 AC_DEFINE(HAVE_CHECK_ACL, 1, [iops->check_acl() exists])
201 dnl # 2.6.38 API change,
202 dnl # The function check_acl gained a new parameter: flags
204 AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_CHECK_ACL_WITH_FLAGS], [
205 AC_MSG_CHECKING([whether iops->check_acl() wants flags])
206 ZFS_LINUX_TRY_COMPILE([
207 #include <linux/fs.h>
209 int check_acl_fn(struct inode *inode, int mask,
210 unsigned int flags) { return 0; }
212 static const struct inode_operations
213 iops __attribute__ ((unused)) = {
214 .check_acl = check_acl_fn,
219 AC_DEFINE(HAVE_CHECK_ACL, 1, [iops->check_acl() exists])
220 AC_DEFINE(HAVE_CHECK_ACL_WITH_FLAGS, 1,
221 [iops->check_acl() wants flags])
228 dnl # 3.1 API change,
229 dnl # Check if inode_operations contains the function get_acl
231 AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL], [
232 AC_MSG_CHECKING([whether iops->get_acl() exists])
233 ZFS_LINUX_TRY_COMPILE([
234 #include <linux/fs.h>
236 struct posix_acl *get_acl_fn(struct inode *inode, int type)
239 static const struct inode_operations
240 iops __attribute__ ((unused)) = {
241 .get_acl = get_acl_fn,
246 AC_DEFINE(HAVE_GET_ACL, 1, [iops->get_acl() exists])
253 dnl # 4.7 API change,
254 dnl # The kernel get_acl will now check cache before calling i_op->get_acl and
255 dnl # do set_cached_acl after that, so i_op->get_acl don't need to do that
258 AC_DEFUN([ZFS_AC_KERNE_GET_ACL_HANDLE_CACHE], [
259 AC_MSG_CHECKING([whether uncached_acl_sentinel() exists])
260 ZFS_LINUX_TRY_COMPILE([
261 #include <linux/fs.h>
263 void *sentinel __attribute__ ((unused)) = uncached_acl_sentinel(NULL);
266 AC_DEFINE(HAVE_KERNEL_GET_ACL_HANDLE_CACHE, 1, [uncached_acl_sentinel() exists])