Linux-2.6.12-rc2
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / include / linux / xattr_acl.h
1 /*
2 File: linux/xattr_acl.h
3
4 (extended attribute representation of access control lists)
5
6 (C) 2000 Andreas Gruenbacher, <a.gruenbacher@computer.org>
7 */
8
9 #ifndef _LINUX_XATTR_ACL_H
10 #define _LINUX_XATTR_ACL_H
11
12 #include <linux/posix_acl.h>
13
14 #define XATTR_NAME_ACL_ACCESS "system.posix_acl_access"
15 #define XATTR_NAME_ACL_DEFAULT "system.posix_acl_default"
16
17 #define XATTR_ACL_VERSION 0x0002
18
19 typedef struct {
20 __u16 e_tag;
21 __u16 e_perm;
22 __u32 e_id;
23 } xattr_acl_entry;
24
25 typedef struct {
26 __u32 a_version;
27 xattr_acl_entry a_entries[0];
28 } xattr_acl_header;
29
30 static inline size_t xattr_acl_size(int count)
31 {
32 return sizeof(xattr_acl_header) + count * sizeof(xattr_acl_entry);
33 }
34
35 static inline int xattr_acl_count(size_t size)
36 {
37 if (size < sizeof(xattr_acl_header))
38 return -1;
39 size -= sizeof(xattr_acl_header);
40 if (size % sizeof(xattr_acl_entry))
41 return -1;
42 return size / sizeof(xattr_acl_entry);
43 }
44
45 struct posix_acl * posix_acl_from_xattr(const void *value, size_t size);
46 int posix_acl_to_xattr(const struct posix_acl *acl, void *buffer, size_t size);
47
48
49
50 #endif /* _LINUX_XATTR_ACL_H */