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