]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | File: linux/reiserfs_xattr.h | |
3 | */ | |
4 | ||
521dae19 AB |
5 | #ifndef _LINUX_REISERFS_XATTR_H |
6 | #define _LINUX_REISERFS_XATTR_H | |
7 | ||
8 | #include <linux/types.h> | |
1da177e4 LT |
9 | |
10 | /* Magic value in header */ | |
bd4c625c | 11 | #define REISERFS_XATTR_MAGIC 0x52465841 /* "RFXA" */ |
1da177e4 LT |
12 | |
13 | struct reiserfs_xattr_header { | |
bd4c625c LT |
14 | __le32 h_magic; /* magic number for identification */ |
15 | __le32 h_hash; /* hash of the value */ | |
1da177e4 LT |
16 | }; |
17 | ||
18 | #ifdef __KERNEL__ | |
521dae19 | 19 | |
98ca79d5 | 20 | #include <linux/init.h> |
521dae19 AB |
21 | #include <linux/list.h> |
22 | #include <linux/rwsem.h> | |
23 | #include <linux/reiserfs_fs_i.h> | |
24 | #include <linux/reiserfs_fs.h> | |
25 | ||
26 | struct inode; | |
27 | struct dentry; | |
28 | struct iattr; | |
29 | struct super_block; | |
30 | struct nameidata; | |
1da177e4 LT |
31 | |
32 | struct reiserfs_xattr_handler { | |
33 | char *prefix; | |
bd4c625c LT |
34 | int (*init) (void); |
35 | void (*exit) (void); | |
36 | int (*get) (struct inode * inode, const char *name, void *buffer, | |
37 | size_t size); | |
38 | int (*set) (struct inode * inode, const char *name, const void *buffer, | |
39 | size_t size, int flags); | |
40 | int (*del) (struct inode * inode, const char *name); | |
41 | int (*list) (struct inode * inode, const char *name, int namelen, | |
42 | char *out); | |
43 | struct list_head handlers; | |
1da177e4 LT |
44 | }; |
45 | ||
1da177e4 | 46 | #ifdef CONFIG_REISERFS_FS_XATTR |
1da177e4 | 47 | #define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir) |
bd4c625c LT |
48 | ssize_t reiserfs_getxattr(struct dentry *dentry, const char *name, |
49 | void *buffer, size_t size); | |
50 | int reiserfs_setxattr(struct dentry *dentry, const char *name, | |
51 | const void *value, size_t size, int flags); | |
52 | ssize_t reiserfs_listxattr(struct dentry *dentry, char *buffer, size_t size); | |
53 | int reiserfs_removexattr(struct dentry *dentry, const char *name); | |
54 | int reiserfs_delete_xattrs(struct inode *inode); | |
55 | int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs); | |
56 | int reiserfs_xattr_init(struct super_block *sb, int mount_flags); | |
e6305c43 | 57 | int reiserfs_permission(struct inode *inode, int mask); |
bd4c625c LT |
58 | |
59 | int reiserfs_xattr_del(struct inode *, const char *); | |
60 | int reiserfs_xattr_get(const struct inode *, const char *, void *, size_t); | |
61 | int reiserfs_xattr_set(struct inode *, const char *, const void *, size_t, int); | |
1da177e4 LT |
62 | |
63 | extern struct reiserfs_xattr_handler user_handler; | |
64 | extern struct reiserfs_xattr_handler trusted_handler; | |
1da177e4 | 65 | extern struct reiserfs_xattr_handler security_handler; |
1da177e4 | 66 | |
bd4c625c LT |
67 | int reiserfs_xattr_register_handlers(void) __init; |
68 | void reiserfs_xattr_unregister_handlers(void); | |
1da177e4 | 69 | |
bd4c625c | 70 | static inline void reiserfs_write_lock_xattrs(struct super_block *sb) |
1da177e4 | 71 | { |
bd4c625c | 72 | down_write(&REISERFS_XATTR_DIR_SEM(sb)); |
1da177e4 | 73 | } |
bd4c625c | 74 | static inline void reiserfs_write_unlock_xattrs(struct super_block *sb) |
1da177e4 | 75 | { |
bd4c625c | 76 | up_write(&REISERFS_XATTR_DIR_SEM(sb)); |
1da177e4 | 77 | } |
bd4c625c | 78 | static inline void reiserfs_read_lock_xattrs(struct super_block *sb) |
1da177e4 | 79 | { |
bd4c625c | 80 | down_read(&REISERFS_XATTR_DIR_SEM(sb)); |
1da177e4 LT |
81 | } |
82 | ||
bd4c625c | 83 | static inline void reiserfs_read_unlock_xattrs(struct super_block *sb) |
1da177e4 | 84 | { |
bd4c625c | 85 | up_read(&REISERFS_XATTR_DIR_SEM(sb)); |
1da177e4 LT |
86 | } |
87 | ||
bd4c625c | 88 | static inline void reiserfs_write_lock_xattr_i(struct inode *inode) |
1da177e4 | 89 | { |
bd4c625c | 90 | down_write(&REISERFS_I(inode)->xattr_sem); |
1da177e4 | 91 | } |
bd4c625c | 92 | static inline void reiserfs_write_unlock_xattr_i(struct inode *inode) |
1da177e4 | 93 | { |
bd4c625c | 94 | up_write(&REISERFS_I(inode)->xattr_sem); |
1da177e4 | 95 | } |
bd4c625c | 96 | static inline void reiserfs_read_lock_xattr_i(struct inode *inode) |
1da177e4 | 97 | { |
bd4c625c | 98 | down_read(&REISERFS_I(inode)->xattr_sem); |
1da177e4 LT |
99 | } |
100 | ||
bd4c625c | 101 | static inline void reiserfs_read_unlock_xattr_i(struct inode *inode) |
1da177e4 | 102 | { |
bd4c625c | 103 | up_read(&REISERFS_I(inode)->xattr_sem); |
1da177e4 LT |
104 | } |
105 | ||
068fbb31 AD |
106 | static inline void reiserfs_init_xattr_rwsem(struct inode *inode) |
107 | { | |
108 | init_rwsem(&REISERFS_I(inode)->xattr_sem); | |
109 | } | |
110 | ||
1da177e4 LT |
111 | #else |
112 | ||
1da177e4 LT |
113 | #define reiserfs_getxattr NULL |
114 | #define reiserfs_setxattr NULL | |
115 | #define reiserfs_listxattr NULL | |
116 | #define reiserfs_removexattr NULL | |
cd02b966 VS |
117 | #define reiserfs_write_lock_xattrs(sb) do {;} while(0) |
118 | #define reiserfs_write_unlock_xattrs(sb) do {;} while(0) | |
1da177e4 LT |
119 | #define reiserfs_read_lock_xattrs(sb) |
120 | #define reiserfs_read_unlock_xattrs(sb) | |
121 | ||
122 | #define reiserfs_permission NULL | |
123 | ||
124 | #define reiserfs_xattr_register_handlers() 0 | |
125 | #define reiserfs_xattr_unregister_handlers() | |
126 | ||
bd4c625c LT |
127 | static inline int reiserfs_delete_xattrs(struct inode *inode) |
128 | { | |
129 | return 0; | |
130 | }; | |
131 | static inline int reiserfs_chown_xattrs(struct inode *inode, | |
132 | struct iattr *attrs) | |
133 | { | |
134 | return 0; | |
135 | }; | |
136 | static inline int reiserfs_xattr_init(struct super_block *sb, int mount_flags) | |
1da177e4 | 137 | { |
bd4c625c LT |
138 | sb->s_flags = (sb->s_flags & ~MS_POSIXACL); /* to be sure */ |
139 | return 0; | |
1da177e4 | 140 | }; |
068fbb31 AD |
141 | static inline void reiserfs_init_xattr_rwsem(struct inode *inode) |
142 | { | |
143 | } | |
521dae19 AB |
144 | #endif /* CONFIG_REISERFS_FS_XATTR */ |
145 | ||
146 | #endif /* __KERNEL__ */ | |
1da177e4 | 147 | |
521dae19 | 148 | #endif /* _LINUX_REISERFS_XATTR_H */ |