]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - include/linux/reiserfs_acl.h
[PATCH] ARM SMP: TLB implementations only affect local CPU
[linux-2.6-omap-h63xx.git] / include / linux / reiserfs_acl.h
1 #include <linux/init.h>
2 #include <linux/posix_acl.h>
3
4 #define REISERFS_ACL_VERSION    0x0001
5
6 typedef struct {
7         __le16          e_tag;
8         __le16          e_perm;
9         __le32          e_id;
10 } reiserfs_acl_entry;
11
12 typedef struct {
13         __le16          e_tag;
14         __le16          e_perm;
15 } reiserfs_acl_entry_short;
16
17 typedef struct {
18         __le32          a_version;
19 } reiserfs_acl_header;
20
21 static inline size_t reiserfs_acl_size(int count)
22 {
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);
30         }
31 }
32
33 static 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
49
50 #ifdef CONFIG_REISERFS_FS_POSIX_ACL
51 struct posix_acl * reiserfs_get_acl(struct inode *inode, int type);
52 int reiserfs_acl_chmod (struct inode *inode);
53 int reiserfs_inherit_default_acl (struct inode *dir, struct dentry *dentry, struct inode *inode);
54 int reiserfs_cache_default_acl (struct inode *dir);
55 extern int reiserfs_xattr_posix_acl_init (void) __init;
56 extern int reiserfs_xattr_posix_acl_exit (void);
57 extern struct reiserfs_xattr_handler posix_acl_default_handler;
58 extern struct reiserfs_xattr_handler posix_acl_access_handler;
59 #else
60
61 #define reiserfs_get_acl NULL
62 #define reiserfs_cache_default_acl(inode) 0
63
64 static inline int
65 reiserfs_xattr_posix_acl_init (void)
66 {
67     return 0;
68 }
69
70 static inline int
71 reiserfs_xattr_posix_acl_exit (void)
72 {
73     return 0;
74 }
75
76 static inline int
77 reiserfs_acl_chmod (struct inode *inode)
78 {
79     return 0;
80 }
81
82 static inline int
83 reiserfs_inherit_default_acl (const struct inode *dir, struct dentry *dentry, struct inode *inode)
84 {
85     return 0;
86 }
87
88 #endif