Whamcloud - gitweb
b=15625
[fs/lustre-release.git] / lustre / include / lustre_eacl.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  *   This file is part of Lustre, http://www.lustre.org
5  *
6  * MDS data structures.
7  * See also lustre_idl.h for wire formats of requests.
8  */
9
10 #ifndef _LUSTRE_EACL_H
11 #define _LUSTRE_EACL_H
12
13 #ifdef CONFIG_FS_POSIX_ACL
14
15 # ifdef HAVE_XATTR_ACL
16 #  include <linux/xattr_acl.h>
17 # endif /* HAVE_XATTR_ACL */
18 # ifdef HAVE_LINUX_POSIX_ACL_XATTR_H
19 #  include <linux/posix_acl_xattr.h>
20 # endif /* HAVE_LINUX_POSIX_ACL_XATTR_H */
21
22 #include <lustre_idmap.h>
23 #include <md_object.h>
24 #include <lu_object.h>
25
26 typedef struct {
27         __u16                   e_tag;
28         __u16                   e_perm;
29         __u32                   e_id;
30         __u32                   e_stat;
31 } ext_acl_xattr_entry;
32
33 typedef struct {
34         __u32                   a_count;
35         ext_acl_xattr_entry     a_entries[0];
36 } ext_acl_xattr_header;
37
38 #define CFS_ACL_XATTR_SIZE(count, prefix) \
39         (sizeof(prefix ## _header) + (count) * sizeof(prefix ## _entry))
40
41 #define CFS_ACL_XATTR_COUNT(size, prefix) \
42         (((size) - sizeof(prefix ## _header)) / sizeof(prefix ## _entry))
43
44 extern int lustre_posix_acl_permission(struct md_ucred *mu, struct lu_attr *la,
45                                        int want, posix_acl_xattr_entry *entry,
46                                        int count);
47 extern int lustre_posix_acl_chmod_masq(posix_acl_xattr_entry *entry,
48                                        __u32 mode, int count);
49 extern int lustre_posix_acl_create_masq(posix_acl_xattr_entry *entry,
50                                         __u32 *pmode, int count);
51
52 extern ext_acl_xattr_header *
53 lustre_posix_acl_xattr_2ext(posix_acl_xattr_header *header, int size);
54 extern int
55 lustre_posix_acl_xattr_filter(posix_acl_xattr_header *header, int size,
56                               posix_acl_xattr_header **out);
57 extern int
58 lustre_posix_acl_xattr_id2client(struct md_ucred *mu,
59                                  struct lustre_idmap_table *t,
60                                  posix_acl_xattr_header *header,
61                                  int size, int flags);
62 extern void
63 lustre_posix_acl_xattr_free(posix_acl_xattr_header *header, int size);
64 extern int
65 lustre_ext_acl_xattr_id2server(struct md_ucred *mu,
66                                struct lustre_idmap_table *t,
67                                ext_acl_xattr_header *header);
68 extern void
69 lustre_ext_acl_xattr_free(ext_acl_xattr_header *header);
70 extern int
71 lustre_acl_xattr_merge2posix(posix_acl_xattr_header *posix_header, int size,
72                              ext_acl_xattr_header *ext_header,
73                              posix_acl_xattr_header **out);
74 extern ext_acl_xattr_header *
75 lustre_acl_xattr_merge2ext(posix_acl_xattr_header *posix_header, int size,
76                            ext_acl_xattr_header *ext_header);
77
78 #endif /* CONFIG_FS_POSIX_ACL */
79
80 #endif