Automatic merge of rsync://rsync.kernel.org/pub/scm/linux/kernel/git/gregkh/driver...
[linux-2.6/verdex.git] / include / linux / xattr_acl.h
blob7a1f9b93a45fdca4259784dd5875f2f20abff43e
1 /*
2 File: linux/xattr_acl.h
4 (extended attribute representation of access control lists)
6 (C) 2000 Andreas Gruenbacher, <a.gruenbacher@computer.org>
7 */
9 #ifndef _LINUX_XATTR_ACL_H
10 #define _LINUX_XATTR_ACL_H
12 #include <linux/posix_acl.h>
14 #define XATTR_NAME_ACL_ACCESS "system.posix_acl_access"
15 #define XATTR_NAME_ACL_DEFAULT "system.posix_acl_default"
17 #define XATTR_ACL_VERSION 0x0002
19 typedef struct {
20 __u16 e_tag;
21 __u16 e_perm;
22 __u32 e_id;
23 } xattr_acl_entry;
25 typedef struct {
26 __u32 a_version;
27 xattr_acl_entry a_entries[0];
28 } xattr_acl_header;
30 static inline size_t xattr_acl_size(int count)
32 return sizeof(xattr_acl_header) + count * sizeof(xattr_acl_entry);
35 static inline int xattr_acl_count(size_t size)
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);
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);
50 #endif /* _LINUX_XATTR_ACL_H */