Blame view
fs/ext4/acl.h
1.68 KB
ac27a0ec1
|
1 |
/* |
617ba13b3
|
2 |
File: fs/ext4/acl.h |
ac27a0ec1
|
3 4 5 6 7 |
(C) 2001 Andreas Gruenbacher, <a.gruenbacher@computer.org> */ #include <linux/posix_acl_xattr.h> |
617ba13b3
|
8 |
#define EXT4_ACL_VERSION 0x0001 |
ac27a0ec1
|
9 10 11 12 13 |
typedef struct { __le16 e_tag; __le16 e_perm; __le32 e_id; |
617ba13b3
|
14 |
} ext4_acl_entry; |
ac27a0ec1
|
15 16 17 18 |
typedef struct { __le16 e_tag; __le16 e_perm; |
617ba13b3
|
19 |
} ext4_acl_entry_short; |
ac27a0ec1
|
20 21 22 |
typedef struct { __le32 a_version; |
617ba13b3
|
23 |
} ext4_acl_header; |
ac27a0ec1
|
24 |
|
617ba13b3
|
25 |
static inline size_t ext4_acl_size(int count) |
ac27a0ec1
|
26 27 |
{ if (count <= 4) { |
617ba13b3
|
28 29 |
return sizeof(ext4_acl_header) + count * sizeof(ext4_acl_entry_short); |
ac27a0ec1
|
30 |
} else { |
617ba13b3
|
31 32 33 |
return sizeof(ext4_acl_header) + 4 * sizeof(ext4_acl_entry_short) + (count - 4) * sizeof(ext4_acl_entry); |
ac27a0ec1
|
34 35 |
} } |
617ba13b3
|
36 |
static inline int ext4_acl_count(size_t size) |
ac27a0ec1
|
37 38 |
{ ssize_t s; |
617ba13b3
|
39 40 |
size -= sizeof(ext4_acl_header); s = size - 4 * sizeof(ext4_acl_entry_short); |
ac27a0ec1
|
41 |
if (s < 0) { |
617ba13b3
|
42 |
if (size % sizeof(ext4_acl_entry_short)) |
ac27a0ec1
|
43 |
return -1; |
617ba13b3
|
44 |
return size / sizeof(ext4_acl_entry_short); |
ac27a0ec1
|
45 |
} else { |
617ba13b3
|
46 |
if (s % sizeof(ext4_acl_entry)) |
ac27a0ec1
|
47 |
return -1; |
617ba13b3
|
48 |
return s / sizeof(ext4_acl_entry) + 4; |
ac27a0ec1
|
49 50 |
} } |
617ba13b3
|
51 |
#ifdef CONFIG_EXT4DEV_FS_POSIX_ACL |
ac27a0ec1
|
52 |
|
617ba13b3
|
53 |
/* Value for inode->u.ext4_i.i_acl and inode->u.ext4_i.i_default_acl |
ac27a0ec1
|
54 |
if the ACL has not been cached */ |
617ba13b3
|
55 |
#define EXT4_ACL_NOT_CACHED ((void *)-1) |
ac27a0ec1
|
56 57 |
/* acl.c */ |
617ba13b3
|
58 59 60 |
extern int ext4_permission (struct inode *, int, struct nameidata *); extern int ext4_acl_chmod (struct inode *); extern int ext4_init_acl (handle_t *, struct inode *, struct inode *); |
ac27a0ec1
|
61 |
|
617ba13b3
|
62 |
#else /* CONFIG_EXT4DEV_FS_POSIX_ACL */ |
ac27a0ec1
|
63 |
#include <linux/sched.h> |
617ba13b3
|
64 |
#define ext4_permission NULL |
ac27a0ec1
|
65 66 |
static inline int |
617ba13b3
|
67 |
ext4_acl_chmod(struct inode *inode) |
ac27a0ec1
|
68 69 70 71 72 |
{ return 0; } static inline int |
617ba13b3
|
73 |
ext4_init_acl(handle_t *handle, struct inode *inode, struct inode *dir) |
ac27a0ec1
|
74 75 76 |
{ return 0; } |
617ba13b3
|
77 |
#endif /* CONFIG_EXT4DEV_FS_POSIX_ACL */ |
ac27a0ec1
|
78 |