File: xattr_acl.h

package info (click to toggle)
ns3 3.7.1-7
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 186,596 kB
  • ctags: 507,963
  • sloc: ansic: 1,455,115; cpp: 151,502; python: 72,564; asm: 5,317; perl: 4,801; makefile: 1,107; sh: 1,023; tcl: 295; lex: 230
file content (50 lines) | stat: -rw-r--r-- 1,098 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
  File: linux/xattr_acl.h

  (extended attribute representation of access control lists)

  (C) 2000 Andreas Gruenbacher, <a.gruenbacher@computer.org>
*/

#ifndef _LINUX_XATTR_ACL_H
#define _LINUX_XATTR_ACL_H

#include <linux/posix_acl.h>

#define XATTR_NAME_ACL_ACCESS	"system.posix_acl_access"
#define XATTR_NAME_ACL_DEFAULT	"system.posix_acl_default"

#define XATTR_ACL_VERSION	0x0002

typedef struct {
	__u16		e_tag;
	__u16		e_perm;
	__u32		e_id;
} xattr_acl_entry;

typedef struct {
	__u32		a_version;
	xattr_acl_entry	a_entries[0];
} xattr_acl_header;

static inline size_t xattr_acl_size(int count)
{
	return sizeof(xattr_acl_header) + count * sizeof(xattr_acl_entry);
}

static inline int xattr_acl_count(size_t size)
{
	if (size < sizeof(xattr_acl_header))
		return -1;
	size -= sizeof(xattr_acl_header);
	if (size % sizeof(xattr_acl_entry))
		return -1;
	return size / sizeof(xattr_acl_entry);
}

struct posix_acl * posix_acl_from_xattr(const void *value, size_t size);
int posix_acl_to_xattr(const struct posix_acl *acl, void *buffer, size_t size);



#endif /* _LINUX_XATTR_ACL_H */