reiserfs: remove IS_PRIVATE helpers
[linux-2.6/mini2440.git] / include / linux / reiserfs_xattr.h
blob58f32ba7f5a0f04a13863b38079f387c32c660d1
1 /*
2 File: linux/reiserfs_xattr.h
3 */
5 #ifndef _LINUX_REISERFS_XATTR_H
6 #define _LINUX_REISERFS_XATTR_H
8 #include <linux/types.h>
10 /* Magic value in header */
11 #define REISERFS_XATTR_MAGIC 0x52465841 /* "RFXA" */
13 struct reiserfs_xattr_header {
14 __le32 h_magic; /* magic number for identification */
15 __le32 h_hash; /* hash of the value */
18 #ifdef __KERNEL__
20 #include <linux/init.h>
21 #include <linux/list.h>
22 #include <linux/rwsem.h>
23 #include <linux/reiserfs_fs_i.h>
24 #include <linux/reiserfs_fs.h>
26 struct inode;
27 struct dentry;
28 struct iattr;
29 struct super_block;
30 struct nameidata;
32 struct reiserfs_xattr_handler {
33 char *prefix;
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;
46 #ifdef CONFIG_REISERFS_FS_XATTR
47 #define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir)
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);
57 int reiserfs_permission(struct inode *inode, int mask);
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);
63 extern struct reiserfs_xattr_handler user_handler;
64 extern struct reiserfs_xattr_handler trusted_handler;
65 extern struct reiserfs_xattr_handler security_handler;
67 int reiserfs_xattr_register_handlers(void) __init;
68 void reiserfs_xattr_unregister_handlers(void);
70 static inline void reiserfs_write_lock_xattrs(struct super_block *sb)
72 down_write(&REISERFS_XATTR_DIR_SEM(sb));
74 static inline void reiserfs_write_unlock_xattrs(struct super_block *sb)
76 up_write(&REISERFS_XATTR_DIR_SEM(sb));
78 static inline void reiserfs_read_lock_xattrs(struct super_block *sb)
80 down_read(&REISERFS_XATTR_DIR_SEM(sb));
83 static inline void reiserfs_read_unlock_xattrs(struct super_block *sb)
85 up_read(&REISERFS_XATTR_DIR_SEM(sb));
88 static inline void reiserfs_write_lock_xattr_i(struct inode *inode)
90 down_write(&REISERFS_I(inode)->xattr_sem);
92 static inline void reiserfs_write_unlock_xattr_i(struct inode *inode)
94 up_write(&REISERFS_I(inode)->xattr_sem);
96 static inline void reiserfs_read_lock_xattr_i(struct inode *inode)
98 down_read(&REISERFS_I(inode)->xattr_sem);
101 static inline void reiserfs_read_unlock_xattr_i(struct inode *inode)
103 up_read(&REISERFS_I(inode)->xattr_sem);
106 static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
108 init_rwsem(&REISERFS_I(inode)->xattr_sem);
111 #else
113 #define reiserfs_getxattr NULL
114 #define reiserfs_setxattr NULL
115 #define reiserfs_listxattr NULL
116 #define reiserfs_removexattr NULL
117 #define reiserfs_write_lock_xattrs(sb) do {;} while(0)
118 #define reiserfs_write_unlock_xattrs(sb) do {;} while(0)
119 #define reiserfs_read_lock_xattrs(sb)
120 #define reiserfs_read_unlock_xattrs(sb)
122 #define reiserfs_permission NULL
124 #define reiserfs_xattr_register_handlers() 0
125 #define reiserfs_xattr_unregister_handlers()
127 static inline int reiserfs_delete_xattrs(struct inode *inode)
129 return 0;
131 static inline int reiserfs_chown_xattrs(struct inode *inode,
132 struct iattr *attrs)
134 return 0;
136 static inline int reiserfs_xattr_init(struct super_block *sb, int mount_flags)
138 sb->s_flags = (sb->s_flags & ~MS_POSIXACL); /* to be sure */
139 return 0;
141 static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
144 #endif /* CONFIG_REISERFS_FS_XATTR */
146 #endif /* __KERNEL__ */
148 #endif /* _LINUX_REISERFS_XATTR_H */