USB: correct error handling in cdc-wdm
[wandboard.git] / include / linux / reiserfs_acl.h
blob8cc65757e47adfc476ed4b2ca2c1d020c06ab6bf
1 #include <linux/init.h>
2 #include <linux/posix_acl.h>
4 #define REISERFS_ACL_VERSION 0x0001
6 typedef struct {
7 __le16 e_tag;
8 __le16 e_perm;
9 __le32 e_id;
10 } reiserfs_acl_entry;
12 typedef struct {
13 __le16 e_tag;
14 __le16 e_perm;
15 } reiserfs_acl_entry_short;
17 typedef struct {
18 __le32 a_version;
19 } reiserfs_acl_header;
21 static inline size_t reiserfs_acl_size(int count)
23 if (count <= 4) {
24 return sizeof(reiserfs_acl_header) +
25 count * sizeof(reiserfs_acl_entry_short);
26 } else {
27 return sizeof(reiserfs_acl_header) +
28 4 * sizeof(reiserfs_acl_entry_short) +
29 (count - 4) * sizeof(reiserfs_acl_entry);
33 static inline int reiserfs_acl_count(size_t size)
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;
49 #ifdef CONFIG_REISERFS_FS_POSIX_ACL
50 struct posix_acl *reiserfs_get_acl(struct inode *inode, int type);
51 int reiserfs_acl_chmod(struct inode *inode);
52 int reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th,
53 struct inode *dir, struct dentry *dentry,
54 struct inode *inode);
55 int reiserfs_cache_default_acl(struct inode *dir);
56 extern struct xattr_handler reiserfs_posix_acl_default_handler;
57 extern struct xattr_handler reiserfs_posix_acl_access_handler;
59 static inline void reiserfs_init_acl_access(struct inode *inode)
61 REISERFS_I(inode)->i_acl_access = NULL;
64 static inline void reiserfs_init_acl_default(struct inode *inode)
66 REISERFS_I(inode)->i_acl_default = NULL;
68 #else
70 #define reiserfs_cache_default_acl(inode) 0
72 static inline struct posix_acl *reiserfs_get_acl(struct inode *inode, int type)
74 return NULL;
77 static inline int reiserfs_acl_chmod(struct inode *inode)
79 return 0;
82 static inline int
83 reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th,
84 const struct inode *dir, struct dentry *dentry,
85 struct inode *inode)
87 return 0;
90 static inline void reiserfs_init_acl_access(struct inode *inode)
94 static inline void reiserfs_init_acl_default(struct inode *inode)
97 #endif