Whamcloud - gitweb
b=24188 rehash patch makes oops in quota_search_lqs
[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  * GPL HEADER START
5  *
6  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 only,
10  * as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License version 2 for more details (a copy is included
16  * in the LICENSE file that accompanied this code).
17  *
18  * You should have received a copy of the GNU General Public License
19  * version 2 along with this program; If not, see
20  * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
21  *
22  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23  * CA 95054 USA or visit www.sun.com if you need additional information or
24  * have any questions.
25  *
26  * GPL HEADER END
27  */
28 /*
29  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
30  * Use is subject to license terms.
31  */
32 /*
33  * This file is part of Lustre, http://www.lustre.org/
34  * Lustre is a trademark of Sun Microsystems, Inc.
35  *
36  * lustre/lustre/include/lustre_idmap.h
37  *
38  * MDS data structures.
39  * See also lustre_idl.h for wire formats of requests.
40  */
41
42 #ifndef _LUSTRE_EACL_H
43 #define _LUSTRE_EACL_H
44
45 /** \defgroup eacl eacl
46  *
47  * @{
48  */
49
50 #ifdef CONFIG_FS_POSIX_ACL
51
52 # ifdef HAVE_XATTR_ACL
53 #  include <linux/xattr_acl.h>
54 # endif /* HAVE_XATTR_ACL */
55 # ifdef HAVE_LINUX_POSIX_ACL_XATTR_H
56 #  include <linux/posix_acl_xattr.h>
57 # endif /* HAVE_LINUX_POSIX_ACL_XATTR_H */
58
59 #include <lustre_idmap.h>
60 #include <md_object.h>
61 #include <lu_object.h>
62
63 typedef struct {
64         __u16                   e_tag;
65         __u16                   e_perm;
66         __u32                   e_id;
67         __u32                   e_stat;
68 } ext_acl_xattr_entry;
69
70 typedef struct {
71         __u32                   a_count;
72         ext_acl_xattr_entry     a_entries[0];
73 } ext_acl_xattr_header;
74
75 #define CFS_ACL_XATTR_SIZE(count, prefix) \
76         (sizeof(prefix ## _header) + (count) * sizeof(prefix ## _entry))
77
78 #define CFS_ACL_XATTR_COUNT(size, prefix) \
79         (((size) - sizeof(prefix ## _header)) / sizeof(prefix ## _entry))
80
81 extern int lustre_posix_acl_permission(struct md_ucred *mu, struct lu_attr *la,
82                                        int want, posix_acl_xattr_entry *entry,
83                                        int count);
84 extern int lustre_posix_acl_chmod_masq(posix_acl_xattr_entry *entry,
85                                        __u32 mode, int count);
86 extern int lustre_posix_acl_create_masq(posix_acl_xattr_entry *entry,
87                                         __u32 *pmode, int count);
88
89 extern ext_acl_xattr_header *
90 lustre_posix_acl_xattr_2ext(posix_acl_xattr_header *header, int size);
91 extern int
92 lustre_posix_acl_xattr_filter(posix_acl_xattr_header *header, int size,
93                               posix_acl_xattr_header **out);
94 extern int
95 lustre_posix_acl_xattr_id2client(struct md_ucred *mu,
96                                  struct lustre_idmap_table *t,
97                                  posix_acl_xattr_header *header,
98                                  int size, int flags);
99 extern void
100 lustre_posix_acl_xattr_free(posix_acl_xattr_header *header, int size);
101 extern int
102 lustre_ext_acl_xattr_id2server(struct md_ucred *mu,
103                                struct lustre_idmap_table *t,
104                                ext_acl_xattr_header *header);
105 extern void
106 lustre_ext_acl_xattr_free(ext_acl_xattr_header *header);
107 extern int
108 lustre_acl_xattr_merge2posix(posix_acl_xattr_header *posix_header, int size,
109                              ext_acl_xattr_header *ext_header,
110                              posix_acl_xattr_header **out);
111 extern ext_acl_xattr_header *
112 lustre_acl_xattr_merge2ext(posix_acl_xattr_header *posix_header, int size,
113                            ext_acl_xattr_header *ext_header);
114
115 #endif /* CONFIG_FS_POSIX_ACL */
116
117 /** @} eacl */
118
119 #endif