]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blame - fs/reiserfs/acl.h
HID: wacom: drop WACOM_PKGLEN_STATUS
[mirror_ubuntu-artful-kernel.git] / fs / 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 50struct posix_acl *reiserfs_get_acl(struct inode *inode, int type);
47f70d08 51int reiserfs_set_acl(struct inode *inode, struct posix_acl *acl, int type);
bd4c625c 52int reiserfs_acl_chmod(struct inode *inode);
0ab2621e
JM
53int reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th,
54 struct inode *dir, struct dentry *dentry,
bd4c625c
LT
55 struct inode *inode);
56int reiserfs_cache_default_acl(struct inode *dir);
cfe14677 57
1da177e4
LT
58#else
59
1da177e4 60#define reiserfs_cache_default_acl(inode) 0
4e34e719 61#define reiserfs_get_acl NULL
47f70d08 62#define reiserfs_set_acl NULL
bc5e483d 63
bd4c625c 64static inline int reiserfs_acl_chmod(struct inode *inode)
1da177e4 65{
bd4c625c 66 return 0;
1da177e4
LT
67}
68
69static inline int
77e46586
AB
70reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th,
71 const struct inode *dir, struct dentry *dentry,
bd4c625c 72 struct inode *inode)
1da177e4 73{
bd4c625c 74 return 0;
1da177e4 75}
1da177e4 76#endif