aboutsummaryrefslogtreecommitdiffstats
path: root/config/kernel-acl.m4
blob: 3dbd97948189c1af6487a3ce1d035b46fc0e993e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
dnl #
dnl # 3.1 API change,
dnl # posix_acl_equiv_mode now wants an umode_t instead of a mode_t
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T], [
	ZFS_LINUX_TEST_SRC([posix_acl_equiv_mode], [
		#include <linux/fs.h>
		#include <linux/posix_acl.h>
	],[
		umode_t tmp;
		posix_acl_equiv_mode(NULL, &tmp);
	])
])

AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T], [
	AC_MSG_CHECKING([whether posix_acl_equiv_mode() wants umode_t])
	ZFS_LINUX_TEST_RESULT([posix_acl_equiv_mode], [
		AC_MSG_RESULT(yes)
	],[
		ZFS_LINUX_TEST_ERROR([posix_acl_equiv_mode()])
	])
])

dnl #
dnl # 3.1 API change,
dnl # Check if inode_operations contains the function get_acl
dnl #
dnl # 5.15 API change,
dnl # Added the bool rcu argument to get_acl for rcu path walk.
dnl #
dnl # 6.2 API change,
dnl # get_acl() was renamed to get_inode_acl()
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_GET_ACL], [
	ZFS_LINUX_TEST_SRC([inode_operations_get_acl], [
		#include <linux/fs.h>

		static struct posix_acl *get_acl_fn(struct inode *inode, int type)
		    { return NULL; }

		static const struct inode_operations
		    iops __attribute__ ((unused)) = {
			.get_acl = get_acl_fn,
		};
	],[])

	ZFS_LINUX_TEST_SRC([inode_operations_get_acl_rcu], [
		#include <linux/fs.h>

		static struct posix_acl *get_acl_fn(struct inode *inode, int type,
		    bool rcu) { return NULL; }

		static const struct inode_operations
		    iops __attribute__ ((unused)) = {
			.get_acl = get_acl_fn,
		};
	],[])

	ZFS_LINUX_TEST_SRC([inode_operations_get_inode_acl], [
		#include <linux/fs.h>

		static struct posix_acl *get_inode_acl_fn(struct inode *inode, int type,
		    bool rcu) { return NULL; }

		static const struct inode_operations
		    iops __attribute__ ((unused)) = {
			.get_inode_acl = get_inode_acl_fn,
		};
	],[])
])

AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL], [
	AC_MSG_CHECKING([whether iops->get_acl() exists])
	ZFS_LINUX_TEST_RESULT([inode_operations_get_acl], [
		AC_MSG_RESULT(yes)
		AC_DEFINE(HAVE_GET_ACL, 1, [iops->get_acl() exists])
	],[
		ZFS_LINUX_TEST_RESULT([inode_operations_get_acl_rcu], [
			AC_MSG_RESULT(yes)
			AC_DEFINE(HAVE_GET_ACL_RCU, 1, [iops->get_acl() takes rcu])
		],[
			ZFS_LINUX_TEST_RESULT([inode_operations_get_inode_acl], [
				AC_MSG_RESULT(yes)
				AC_DEFINE(HAVE_GET_INODE_ACL, 1, [has iops->get_inode_acl()])
			],[
				ZFS_LINUX_TEST_ERROR([iops->get_acl() or iops->get_inode_acl()])
			])
		])
	])
])

dnl #
dnl # 5.12 API change,
dnl # set_acl() added a user_namespace* parameter first
dnl #
dnl # 6.2 API change,
dnl # set_acl() second paramter changed to a struct dentry *
dnl #
dnl # 6.3 API change,
dnl # set_acl() first parameter changed to struct mnt_idmap *
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_SET_ACL], [
	ZFS_LINUX_TEST_SRC([inode_operations_set_acl_mnt_idmap_dentry], [
		#include <linux/fs.h>

		static int set_acl_fn(struct mnt_idmap *idmap,
		    struct dentry *dent, struct posix_acl *acl,
		    int type) { return 0; }

		static const struct inode_operations
		    iops __attribute__ ((unused)) = {
			.set_acl = set_acl_fn,
		};
	],[])
	ZFS_LINUX_TEST_SRC([inode_operations_set_acl_userns_dentry], [
		#include <linux/fs.h>

		static int set_acl_fn(struct user_namespace *userns,
		    struct dentry *dent, struct posix_acl *acl,
		    int type) { return 0; }

		static const struct inode_operations
		    iops __attribute__ ((unused)) = {
			.set_acl = set_acl_fn,
		};
	],[])
	ZFS_LINUX_TEST_SRC([inode_operations_set_acl_userns], [
		#include <linux/fs.h>

		static int set_acl_fn(struct user_namespace *userns,
		    struct inode *inode, struct posix_acl *acl,
		    int type) { return 0; }

		static const struct inode_operations
		    iops __attribute__ ((unused)) = {
			.set_acl = set_acl_fn,
		};
	],[])
	ZFS_LINUX_TEST_SRC([inode_operations_set_acl], [
		#include <linux/fs.h>

		static int set_acl_fn(struct inode *inode, struct posix_acl *acl,
		    int type) { return 0; }

		static const struct inode_operations
		    iops __attribute__ ((unused)) = {
			.set_acl = set_acl_fn,
		};
	],[])
])

AC_DEFUN([ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL], [
	AC_MSG_CHECKING([whether iops->set_acl() with 4 args exists])
	ZFS_LINUX_TEST_RESULT([inode_operations_set_acl_userns], [
		AC_MSG_RESULT(yes)
		AC_DEFINE(HAVE_SET_ACL_USERNS, 1, [iops->set_acl() takes 4 args])
	],[
		ZFS_LINUX_TEST_RESULT([inode_operations_set_acl_mnt_idmap_dentry], [
			AC_MSG_RESULT(yes)
			AC_DEFINE(HAVE_SET_ACL_IDMAP_DENTRY, 1,
			    [iops->set_acl() takes 4 args, arg1 is struct mnt_idmap *])
		],[
			ZFS_LINUX_TEST_RESULT([inode_operations_set_acl_userns_dentry], [
				AC_MSG_RESULT(yes)
				AC_DEFINE(HAVE_SET_ACL_USERNS_DENTRY_ARG2, 1,
				    [iops->set_acl() takes 4 args, arg2 is struct dentry *])
			],[
				AC_MSG_RESULT(no)
			])
		])
	])
])

AC_DEFUN([ZFS_AC_KERNEL_SRC_ACL], [
	ZFS_AC_KERNEL_SRC_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T
	ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_GET_ACL
	ZFS_AC_KERNEL_SRC_INODE_OPERATIONS_SET_ACL
])

AC_DEFUN([ZFS_AC_KERNEL_ACL], [
	ZFS_AC_KERNEL_POSIX_ACL_EQUIV_MODE_WANTS_UMODE_T
	ZFS_AC_KERNEL_INODE_OPERATIONS_GET_ACL
	ZFS_AC_KERNEL_INODE_OPERATIONS_SET_ACL
])