]> git.proxmox.com Git - mirror_zfs.git/blame - config/kernel-xattr-handler.m4
Linux 4.5 compat: get_link() / put_link()
[mirror_zfs.git] / config / kernel-xattr-handler.m4
CommitLineData
777d4af8
BB
1dnl #
2dnl # 2.6.35 API change,
3dnl # The 'struct xattr_handler' was constified in the generic
4dnl # super_block structure.
5dnl #
6AC_DEFUN([ZFS_AC_KERNEL_CONST_XATTR_HANDLER],
7 [AC_MSG_CHECKING([whether super_block uses const struct xattr_hander])
8 ZFS_LINUX_TRY_COMPILE([
9 #include <linux/fs.h>
10 #include <linux/xattr.h>
11
12 const struct xattr_handler xattr_test_handler = {
13 .prefix = "test",
14 .get = NULL,
15 .set = NULL,
16 };
17
18 const struct xattr_handler *xattr_handlers[] = {
19 &xattr_test_handler,
20 };
777d4af8 21
b83e3e48
RY
22 const struct super_block sb __attribute__ ((unused)) = {
23 .s_xattr = xattr_handlers,
24 };
25 ],[
777d4af8
BB
26 ],[
27 AC_MSG_RESULT([yes])
28 AC_DEFINE(HAVE_CONST_XATTR_HANDLER, 1,
29 [super_block uses const struct xattr_hander])
30 ],[
31 AC_MSG_RESULT([no])
32 ])
33])
f9637c6c
BB
34
35dnl #
36dnl # 2.6.33 API change,
37dnl # The xattr_hander->get() callback was changed to take a dentry
38dnl # instead of an inode, and a handler_flags argument was added.
39dnl #
61d482f7
CC
40dnl # 4.4 API change,
41dnl # The xattr_hander->get() callback was changed to take a xattr_handler,
42dnl # and handler_flags argument was removed and should be accessed by
43dnl # handler->flags.
44dnl #
f9637c6c
BB
45AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET], [
46 AC_MSG_CHECKING([whether xattr_handler->get() wants dentry])
47 ZFS_LINUX_TRY_COMPILE([
48 #include <linux/xattr.h>
f9637c6c 49
b83e3e48
RY
50 int get(struct dentry *dentry, const char *name,
51 void *buffer, size_t size, int handler_flags) { return 0; }
52 static const struct xattr_handler
53 xops __attribute__ ((unused)) = {
54 .get = get,
55 };
56 ],[
f9637c6c
BB
57 ],[
58 AC_MSG_RESULT(yes)
59 AC_DEFINE(HAVE_DENTRY_XATTR_GET, 1,
60 [xattr_handler->get() wants dentry])
61 ],[
62 AC_MSG_RESULT(no)
61d482f7
CC
63 AC_MSG_CHECKING([whether xattr_handler->get() wants xattr_handler])
64 ZFS_LINUX_TRY_COMPILE([
65 #include <linux/xattr.h>
66
67 int get(const struct xattr_handler *handler, struct dentry *dentry,
68 const char *name, void *buffer, size_t size) { return 0; }
69 static const struct xattr_handler
70 xops __attribute__ ((unused)) = {
71 .get = get,
72 };
73 ],[
74 ],[
75 AC_MSG_RESULT(yes)
76 AC_DEFINE(HAVE_HANDLER_XATTR_GET, 1,
77 [xattr_handler->get() wants xattr_handler])
78 ],[
79 AC_MSG_RESULT(no)
80 ])
f9637c6c
BB
81 ])
82])
83
84dnl #
85dnl # 2.6.33 API change,
86dnl # The xattr_hander->set() callback was changed to take a dentry
87dnl # instead of an inode, and a handler_flags argument was added.
88dnl #
61d482f7
CC
89dnl # 4.4 API change,
90dnl # The xattr_hander->set() callback was changed to take a xattr_handler,
91dnl # and handler_flags argument was removed and should be accessed by
92dnl # handler->flags.
93dnl #
f9637c6c
BB
94AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [
95 AC_MSG_CHECKING([whether xattr_handler->set() wants dentry])
96 ZFS_LINUX_TRY_COMPILE([
97 #include <linux/xattr.h>
f9637c6c 98
b83e3e48
RY
99 int set(struct dentry *dentry, const char *name,
100 const void *buffer, size_t size, int flags,
101 int handler_flags) { return 0; }
102 static const struct xattr_handler
103 xops __attribute__ ((unused)) = {
104 .set = set,
105 };
106 ],[
f9637c6c
BB
107 ],[
108 AC_MSG_RESULT(yes)
109 AC_DEFINE(HAVE_DENTRY_XATTR_SET, 1,
110 [xattr_handler->set() wants dentry])
111 ],[
112 AC_MSG_RESULT(no)
61d482f7
CC
113 AC_MSG_CHECKING([whether xattr_handler->set() wants xattr_handler])
114 ZFS_LINUX_TRY_COMPILE([
115 #include <linux/xattr.h>
116
117 int set(const struct xattr_handler *handler, struct dentry *dentry,
118 const char *name, const void *buffer, size_t size, int flags) { return 0; }
119 static const struct xattr_handler
120 xops __attribute__ ((unused)) = {
121 .set = set,
122 };
123 ],[
124 ],[
125 AC_MSG_RESULT(yes)
126 AC_DEFINE(HAVE_HANDLER_XATTR_SET, 1,
127 [xattr_handler->set() wants xattr_handler])
128 ],[
129 AC_MSG_RESULT(no)
130 ])
f9637c6c
BB
131 ])
132])
023699cd
MM
133
134dnl #
135dnl # 2.6.33 API change,
136dnl # The xattr_hander->list() callback was changed to take a dentry
137dnl # instead of an inode, and a handler_flags argument was added.
138dnl #
61d482f7
CC
139dnl # 4.4 API change,
140dnl # The xattr_hander->list() callback was changed to take a xattr_handler,
141dnl # and handler_flags argument was removed and should be accessed by
142dnl # handler->flags.
143dnl #
023699cd
MM
144AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [
145 AC_MSG_CHECKING([whether xattr_handler->list() wants dentry])
146 ZFS_LINUX_TRY_COMPILE([
147 #include <linux/xattr.h>
148
149 size_t list(struct dentry *dentry, char *list, size_t list_size,
150 const char *name, size_t name_len, int handler_flags)
151 { return 0; }
152 static const struct xattr_handler
153 xops __attribute__ ((unused)) = {
154 .list = list,
155 };
156 ],[
157 ],[
158 AC_MSG_RESULT(yes)
159 AC_DEFINE(HAVE_DENTRY_XATTR_LIST, 1,
160 [xattr_handler->list() wants dentry])
161 ],[
162 AC_MSG_RESULT(no)
61d482f7
CC
163 AC_MSG_CHECKING([whether xattr_handler->list() wants xattr_handler])
164 ZFS_LINUX_TRY_COMPILE([
165 #include <linux/xattr.h>
166
167 size_t list(const struct xattr_handler *handler, struct dentry *dentry,
168 char *list, size_t list_size, const char *name, size_t name_len) { return 0; }
169 static const struct xattr_handler
170 xops __attribute__ ((unused)) = {
171 .list = list,
172 };
173 ],[
174 ],[
175 AC_MSG_RESULT(yes)
176 AC_DEFINE(HAVE_HANDLER_XATTR_LIST, 1,
177 [xattr_handler->list() wants xattr_handler])
178 ],[
179 AC_MSG_RESULT(no)
180 ])
023699cd
MM
181 ])
182])
183
184dnl #
185dnl # 3.7 API change,
186dnl # The posix_acl_{from,to}_xattr functions gained a new
187dnl # parameter: user_ns
188dnl #
189AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_FROM_XATTR_USERNS], [
190 AC_MSG_CHECKING([whether posix_acl_from_xattr() needs user_ns])
191 ZFS_LINUX_TRY_COMPILE([
192 #include <linux/cred.h>
193 #include <linux/fs.h>
194 #include <linux/posix_acl_xattr.h>
195 ],[
196 posix_acl_from_xattr(&init_user_ns, NULL, 0);
197 ],[
198 AC_MSG_RESULT(yes)
199 AC_DEFINE(HAVE_POSIX_ACL_FROM_XATTR_USERNS, 1,
200 [posix_acl_from_xattr() needs user_ns])
201 ],[
202 AC_MSG_RESULT(no)
203 ])
204])
205