Merge branches 'topic/fix/hda' and 'topic/fix/sound-core' into for-linus
[linux-2.6-block.git] / include / linux / reiserfs_acl.h
CommitLineData
1da177e4
LT
1#include <linux/init.h>
2#include <linux/posix_acl.h>
1da177e4
LT
3
4#define REISERFS_ACL_VERSION 0x0001
5
6typedef struct {
bd4c625c
LT
7 __le16 e_tag;
8 __le16 e_perm;
9 __le32 e_id;
1da177e4
LT
10} reiserfs_acl_entry;
11
12typedef struct {
bd4c625c
LT
13 __le16 e_tag;
14 __le16 e_perm;
1da177e4
LT
15} reiserfs_acl_entry_short;
16
17typedef struct {
bd4c625c 18 __le32 a_version;
1da177e4
LT
19} reiserfs_acl_header;
20
21static inline size_t reiserfs_acl_size(int count)
22{
23 if (count <= 4) {
24 return sizeof(reiserfs_acl_header) +
bd4c625c 25 count * sizeof(reiserfs_acl_entry_short);
1da177e4
LT
26 } else {
27 return sizeof(reiserfs_acl_header) +
bd4c625c
LT
28 4 * sizeof(reiserfs_acl_entry_short) +
29 (count - 4) * sizeof(reiserfs_acl_entry);
1da177e4
LT
30 }
31}
32
33static inline int reiserfs_acl_count(size_t size)
34{
35 ssize_t s;
36 size -= sizeof(reiserfs_acl_header);
37 s = size - 4 * sizeof(reiserfs_acl_entry_short);
38 if (s < 0) {
39 if (size % sizeof(reiserfs_acl_entry_short))
40 return -1;
41 return size / sizeof(reiserfs_acl_entry_short);
42 } else {
43 if (s % sizeof(reiserfs_acl_entry))
44 return -1;
45 return s / sizeof(reiserfs_acl_entry) + 4;
46 }
47}
48
1da177e4 49#ifdef CONFIG_REISERFS_FS_POSIX_ACL
bd4c625c
LT
50struct posix_acl *reiserfs_get_acl(struct inode *inode, int type);
51int reiserfs_acl_chmod(struct inode *inode);
52int reiserfs_inherit_default_acl(struct inode *dir, struct dentry *dentry,
53 struct inode *inode);
54int reiserfs_cache_default_acl(struct inode *dir);
55extern int reiserfs_xattr_posix_acl_init(void) __init;
56extern int reiserfs_xattr_posix_acl_exit(void);
1da177e4
LT
57extern struct reiserfs_xattr_handler posix_acl_default_handler;
58extern struct reiserfs_xattr_handler posix_acl_access_handler;
cfe14677
AD
59
60static inline void reiserfs_init_acl_access(struct inode *inode)
61{
62 REISERFS_I(inode)->i_acl_access = NULL;
63}
64
65static inline void reiserfs_init_acl_default(struct inode *inode)
66{
67 REISERFS_I(inode)->i_acl_default = NULL;
68}
1da177e4
LT
69#else
70
1da177e4
LT
71#define reiserfs_cache_default_acl(inode) 0
72
bc5e483d
AM
73static inline struct posix_acl *reiserfs_get_acl(struct inode *inode, int type)
74{
75 return NULL;
76}
77
bd4c625c 78static inline int reiserfs_xattr_posix_acl_init(void)
1da177e4 79{
bd4c625c 80 return 0;
1da177e4
LT
81}
82
bd4c625c 83static inline int reiserfs_xattr_posix_acl_exit(void)
1da177e4 84{
bd4c625c 85 return 0;
1da177e4
LT
86}
87
bd4c625c 88static inline int reiserfs_acl_chmod(struct inode *inode)
1da177e4 89{
bd4c625c 90 return 0;
1da177e4
LT
91}
92
93static inline int
bd4c625c
LT
94reiserfs_inherit_default_acl(const struct inode *dir, struct dentry *dentry,
95 struct inode *inode)
1da177e4 96{
bd4c625c 97 return 0;
1da177e4
LT
98}
99
cfe14677
AD
100static inline void reiserfs_init_acl_access(struct inode *inode)
101{
102}
103
104static inline void reiserfs_init_acl_default(struct inode *inode)
105{
106}
1da177e4 107#endif