1/*
2  File: acl_ea.h
3
4  (extended attribute representation of access control lists)
5
6  (C) 2002 Andreas Gruenbacher, <a.gruenbacher@computer.org>
7*/
8
9#define ACL_EA_ACCESS		"system.posix_acl_access"
10#define ACL_EA_DEFAULT		"system.posix_acl_default"
11
12#define ACL_EA_VERSION		0x0002
13
14typedef struct {
15	u_int16_t	e_tag;
16	u_int16_t	e_perm;
17	u_int32_t	e_id;
18} acl_ea_entry;
19
20typedef struct {
21	u_int32_t	a_version;
22	acl_ea_entry	a_entries[0];
23} acl_ea_header;
24
25static inline size_t acl_ea_size(int count)
26{
27	return sizeof(acl_ea_header) + count * sizeof(acl_ea_entry);
28}
29
30static inline int acl_ea_count(size_t size)
31{
32	if (size < sizeof(acl_ea_header))
33		return -1;
34	size -= sizeof(acl_ea_header);
35	if (size % sizeof(acl_ea_entry))
36		return -1;
37	return size / sizeof(acl_ea_entry);
38}
39
40