]> granicus.if.org Git - zfs/blob - config/kernel-xattr-handler.m4
Add back iostat -y or -w descriptions
[zfs] / config / kernel-xattr-handler.m4
1 dnl #
2 dnl # 2.6.35 API change,
3 dnl # The 'struct xattr_handler' was constified in the generic
4 dnl # super_block structure.
5 dnl #
6 AC_DEFUN([ZFS_AC_KERNEL_CONST_XATTR_HANDLER], [
7         AC_MSG_CHECKING([whether super_block uses const struct xattr_handler])
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                 };
21
22                 const struct super_block sb __attribute__ ((unused)) = {
23                         .s_xattr = xattr_handlers,
24                 };
25         ],[
26         ],[
27                 AC_MSG_RESULT([yes])
28                 AC_DEFINE(HAVE_CONST_XATTR_HANDLER, 1,
29                           [super_block uses const struct xattr_handler])
30         ],[
31                 AC_MSG_RESULT([no])
32         ])
33 ])
34
35 dnl #
36 dnl # 4.5 API change,
37 dnl # struct xattr_handler added new member "name".
38 dnl # xattr_handler which matches to whole name rather than prefix should use
39 dnl # "name" instead of "prefix", e.g. "system.posix_acl_access"
40 dnl #
41 AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_NAME], [
42         AC_MSG_CHECKING([whether xattr_handler has name])
43         ZFS_LINUX_TRY_COMPILE([
44                 #include <linux/xattr.h>
45
46                 static const struct xattr_handler
47                     xops __attribute__ ((unused)) = {
48                         .name = XATTR_NAME_POSIX_ACL_ACCESS,
49                 };
50         ],[
51         ],[
52                 AC_MSG_RESULT(yes)
53                 AC_DEFINE(HAVE_XATTR_HANDLER_NAME, 1,
54                     [xattr_handler has name])
55         ],[
56                 AC_MSG_RESULT(no)
57         ])
58 ])
59
60 dnl #
61 dnl # 4.9 API change,
62 dnl # iops->{set,get,remove}xattr and generic_{set,get,remove}xattr are
63 dnl # removed. xattr operations will directly go through sb->s_xattr.
64 dnl #
65 AC_DEFUN([ZFS_AC_KERNEL_HAVE_GENERIC_SETXATTR], [
66         AC_MSG_CHECKING([whether generic_setxattr() exists])
67         ZFS_LINUX_TRY_COMPILE([
68                 #include <linux/fs.h>
69                 #include <linux/xattr.h>
70
71                 static const struct inode_operations
72                     iops __attribute__ ((unused)) = {
73                         .setxattr = generic_setxattr
74                 };
75         ],[
76         ],[
77                 AC_MSG_RESULT(yes)
78                 AC_DEFINE(HAVE_GENERIC_SETXATTR, 1,
79                     [generic_setxattr() exists])
80         ],[
81                 AC_MSG_RESULT(no)
82         ])
83 ])
84
85 dnl #
86 dnl # Supported xattr handler get() interfaces checked newest to oldest.
87 dnl #
88 AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_GET], [
89         dnl #
90         dnl # 4.7 API change,
91         dnl # The xattr_handler->get() callback was changed to take both
92         dnl # dentry and inode.
93         dnl #
94         AC_MSG_CHECKING([whether xattr_handler->get() wants both dentry and inode])
95         ZFS_LINUX_TRY_COMPILE([
96                 #include <linux/xattr.h>
97
98                 int get(const struct xattr_handler *handler,
99                     struct dentry *dentry, struct inode *inode,
100                     const char *name, void *buffer, size_t size) { return 0; }
101                 static const struct xattr_handler
102                     xops __attribute__ ((unused)) = {
103                         .get = get,
104                 };
105         ],[
106         ],[
107                 AC_MSG_RESULT(yes)
108                 AC_DEFINE(HAVE_XATTR_GET_DENTRY_INODE, 1,
109                     [xattr_handler->get() wants both dentry and inode])
110         ],[
111                 dnl #
112                 dnl # 4.4 API change,
113                 dnl # The xattr_handler->get() callback was changed to take a
114                 dnl # attr_handler, and handler_flags argument was removed and
115                 dnl # should be accessed by handler->flags.
116                 dnl #
117                 AC_MSG_RESULT(no)
118                 AC_MSG_CHECKING([whether xattr_handler->get() wants xattr_handler])
119                 ZFS_LINUX_TRY_COMPILE([
120                         #include <linux/xattr.h>
121
122                         int get(const struct xattr_handler *handler,
123                             struct dentry *dentry, const char *name,
124                             void *buffer, size_t size) { return 0; }
125                         static const struct xattr_handler
126                             xops __attribute__ ((unused)) = {
127                                 .get = get,
128                         };
129                 ],[
130                 ],[
131                         AC_MSG_RESULT(yes)
132                         AC_DEFINE(HAVE_XATTR_GET_HANDLER, 1,
133                             [xattr_handler->get() wants xattr_handler])
134                 ],[
135                         dnl #
136                         dnl # 2.6.33 API change,
137                         dnl # The xattr_handler->get() callback was changed to take
138                         dnl # a dentry instead of an inode, and a handler_flags
139                         dnl # argument was added.
140                         dnl #
141                         AC_MSG_RESULT(no)
142                         AC_MSG_CHECKING([whether xattr_handler->get() wants dentry])
143                         ZFS_LINUX_TRY_COMPILE([
144                                 #include <linux/xattr.h>
145
146                                 int get(struct dentry *dentry, const char *name,
147                                     void *buffer, size_t size, int handler_flags)
148                                     { return 0; }
149                                 static const struct xattr_handler
150                                     xops __attribute__ ((unused)) = {
151                                         .get = get,
152                                 };
153                         ],[
154                         ],[
155                                 AC_MSG_RESULT(yes)
156                                 AC_DEFINE(HAVE_XATTR_GET_DENTRY, 1,
157                                     [xattr_handler->get() wants dentry])
158                         ],[
159                                 dnl #
160                                 dnl # 2.6.32 API
161                                 dnl #
162                                 AC_MSG_RESULT(no)
163                                 AC_MSG_CHECKING(
164                                     [whether xattr_handler->get() wants inode])
165                                 ZFS_LINUX_TRY_COMPILE([
166                                         #include <linux/xattr.h>
167
168                                         int get(struct inode *ip, const char *name,
169                                             void *buffer, size_t size) { return 0; }
170                                         static const struct xattr_handler
171                                             xops __attribute__ ((unused)) = {
172                                                 .get = get,
173                                         };
174                                 ],[
175                                 ],[
176                                         AC_MSG_RESULT(yes)
177                                         AC_DEFINE(HAVE_XATTR_GET_INODE, 1,
178                                             [xattr_handler->get() wants inode])
179                                 ],[
180                                         AC_MSG_ERROR([no; please file a bug report])
181                                 ])
182                         ])
183                 ])
184         ])
185 ])
186
187 dnl #
188 dnl # Supported xattr handler set() interfaces checked newest to oldest.
189 dnl #
190 AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_SET], [
191         dnl #
192         dnl # 4.7 API change,
193         dnl # The xattr_handler->set() callback was changed to take both
194         dnl # dentry and inode.
195         dnl #
196         AC_MSG_CHECKING([whether xattr_handler->set() wants both dentry and inode])
197         ZFS_LINUX_TRY_COMPILE([
198                 #include <linux/xattr.h>
199
200                 int set(const struct xattr_handler *handler,
201                     struct dentry *dentry, struct inode *inode,
202                     const char *name, const void *buffer,
203                     size_t size, int flags)
204                     { return 0; }
205                 static const struct xattr_handler
206                     xops __attribute__ ((unused)) = {
207                         .set = set,
208                 };
209         ],[
210         ],[
211                 AC_MSG_RESULT(yes)
212                 AC_DEFINE(HAVE_XATTR_SET_DENTRY_INODE, 1,
213                     [xattr_handler->set() wants both dentry and inode])
214         ],[
215                 dnl #
216                 dnl # 4.4 API change,
217                 dnl # The xattr_handler->set() callback was changed to take a
218                 dnl # xattr_handler, and handler_flags argument was removed and
219                 dnl # should be accessed by handler->flags.
220                 dnl #
221                 AC_MSG_RESULT(no)
222                 AC_MSG_CHECKING([whether xattr_handler->set() wants xattr_handler])
223                 ZFS_LINUX_TRY_COMPILE([
224                         #include <linux/xattr.h>
225
226                         int set(const struct xattr_handler *handler,
227                             struct dentry *dentry, const char *name,
228                             const void *buffer, size_t size, int flags)
229                             { return 0; }
230                         static const struct xattr_handler
231                             xops __attribute__ ((unused)) = {
232                                 .set = set,
233                         };
234                 ],[
235                 ],[
236                         AC_MSG_RESULT(yes)
237                         AC_DEFINE(HAVE_XATTR_SET_HANDLER, 1,
238                             [xattr_handler->set() wants xattr_handler])
239                 ],[
240                         dnl #
241                         dnl # 2.6.33 API change,
242                         dnl # The xattr_handler->set() callback was changed to take a
243                         dnl # dentry instead of an inode, and a handler_flags
244                         dnl # argument was added.
245                         dnl #
246                         AC_MSG_RESULT(no)
247                         AC_MSG_CHECKING([whether xattr_handler->set() wants dentry])
248                         ZFS_LINUX_TRY_COMPILE([
249                                 #include <linux/xattr.h>
250
251                                 int set(struct dentry *dentry, const char *name,
252                                     const void *buffer, size_t size, int flags,
253                                     int handler_flags) { return 0; }
254                                 static const struct xattr_handler
255                                     xops __attribute__ ((unused)) = {
256                                         .set = set,
257                                 };
258                         ],[
259                         ],[
260                                 AC_MSG_RESULT(yes)
261                                 AC_DEFINE(HAVE_XATTR_SET_DENTRY, 1,
262                                     [xattr_handler->set() wants dentry])
263                         ],[
264                                 dnl #
265                                 dnl # 2.6.32 API
266                                 dnl #
267                                 AC_MSG_RESULT(no)
268                                 AC_MSG_CHECKING(
269                                     [whether xattr_handler->set() wants inode])
270                                 ZFS_LINUX_TRY_COMPILE([
271                                         #include <linux/xattr.h>
272
273                                         int set(struct inode *ip, const char *name,
274                                             const void *buffer, size_t size, int flags)
275                                             { return 0; }
276                                         static const struct xattr_handler
277                                             xops __attribute__ ((unused)) = {
278                                                 .set = set,
279                                         };
280                                 ],[
281                                 ],[
282                                         AC_MSG_RESULT(yes)
283                                         AC_DEFINE(HAVE_XATTR_SET_INODE, 1,
284                                             [xattr_handler->set() wants inode])
285                                 ],[
286                                         AC_MSG_ERROR([no; please file a bug report])
287                                 ])
288                         ])
289                 ])
290         ])
291 ])
292
293 dnl #
294 dnl # Supported xattr handler list() interfaces checked newest to oldest.
295 dnl #
296 AC_DEFUN([ZFS_AC_KERNEL_XATTR_HANDLER_LIST], [
297         dnl # 4.5 API change,
298         dnl # The xattr_handler->list() callback was changed to take only a
299         dnl # dentry and it only needs to return if it's accessible.
300         AC_MSG_CHECKING([whether xattr_handler->list() wants simple])
301         ZFS_LINUX_TRY_COMPILE([
302                 #include <linux/xattr.h>
303
304                 bool list(struct dentry *dentry) { return 0; }
305                 static const struct xattr_handler
306                     xops __attribute__ ((unused)) = {
307                         .list = list,
308                 };
309         ],[
310         ],[
311                 AC_MSG_RESULT(yes)
312                 AC_DEFINE(HAVE_XATTR_LIST_SIMPLE, 1,
313                     [xattr_handler->list() wants simple])
314         ],[
315                 dnl #
316                 dnl # 4.4 API change,
317                 dnl # The xattr_handler->list() callback was changed to take a
318                 dnl # xattr_handler, and handler_flags argument was removed
319                 dnl # and should be accessed by handler->flags.
320                 dnl #
321                 AC_MSG_RESULT(no)
322                 AC_MSG_CHECKING(
323                     [whether xattr_handler->list() wants xattr_handler])
324                 ZFS_LINUX_TRY_COMPILE([
325                         #include <linux/xattr.h>
326
327                         size_t list(const struct xattr_handler *handler,
328                             struct dentry *dentry, char *list, size_t list_size,
329                             const char *name, size_t name_len) { return 0; }
330                         static const struct xattr_handler
331                             xops __attribute__ ((unused)) = {
332                                 .list = list,
333                         };
334                 ],[
335                 ],[
336                         AC_MSG_RESULT(yes)
337                         AC_DEFINE(HAVE_XATTR_LIST_HANDLER, 1,
338                             [xattr_handler->list() wants xattr_handler])
339                 ],[
340                         dnl #
341                         dnl # 2.6.33 API change,
342                         dnl # The xattr_handler->list() callback was changed
343                         dnl # to take a dentry instead of an inode, and a
344                         dnl # handler_flags argument was added.
345                         dnl #
346                         AC_MSG_RESULT(no)
347                         AC_MSG_CHECKING(
348                             [whether xattr_handler->list() wants dentry])
349                         ZFS_LINUX_TRY_COMPILE([
350                                 #include <linux/xattr.h>
351
352                                 size_t list(struct dentry *dentry,
353                                     char *list, size_t list_size,
354                                     const char *name, size_t name_len,
355                                     int handler_flags) { return 0; }
356                                 static const struct xattr_handler
357                                     xops __attribute__ ((unused)) = {
358                                         .list = list,
359                                 };
360                         ],[
361                         ],[
362                                 AC_MSG_RESULT(yes)
363                                 AC_DEFINE(HAVE_XATTR_LIST_DENTRY, 1,
364                                     [xattr_handler->list() wants dentry])
365                         ],[
366                                 dnl #
367                                 dnl # 2.6.32 API
368                                 dnl #
369                                 AC_MSG_RESULT(no)
370                                 AC_MSG_CHECKING(
371                                     [whether xattr_handler->list() wants inode])
372                                 ZFS_LINUX_TRY_COMPILE([
373                                         #include <linux/xattr.h>
374
375                                         size_t list(struct inode *ip, char *lst,
376                                             size_t list_size, const char *name,
377                                             size_t name_len) { return 0; }
378                                         static const struct xattr_handler
379                                             xops __attribute__ ((unused)) = {
380                                                 .list = list,
381                                         };
382                                 ],[
383                                 ],[
384                                         AC_MSG_RESULT(yes)
385                                         AC_DEFINE(HAVE_XATTR_LIST_INODE, 1,
386                                             [xattr_handler->list() wants inode])
387                                 ],[
388                                         AC_MSG_ERROR(
389                                             [no; please file a bug report])
390                                 ])
391                         ])
392                 ])
393         ])
394 ])
395
396 dnl #
397 dnl # 3.7 API change,
398 dnl # The posix_acl_{from,to}_xattr functions gained a new
399 dnl # parameter: user_ns
400 dnl #
401 AC_DEFUN([ZFS_AC_KERNEL_POSIX_ACL_FROM_XATTR_USERNS], [
402         AC_MSG_CHECKING([whether posix_acl_from_xattr() needs user_ns])
403         ZFS_LINUX_TRY_COMPILE([
404                 #include <linux/cred.h>
405                 #include <linux/fs.h>
406                 #include <linux/posix_acl_xattr.h>
407         ],[
408                 posix_acl_from_xattr(&init_user_ns, NULL, 0);
409         ],[
410                 AC_MSG_RESULT(yes)
411                 AC_DEFINE(HAVE_POSIX_ACL_FROM_XATTR_USERNS, 1,
412                     [posix_acl_from_xattr() needs user_ns])
413         ],[
414                 AC_MSG_RESULT(no)
415         ])
416 ])
417