]> bbs.cooldavid.org Git - net-next-2.6.git/blame - include/linux/reiserfs_xattr.h
reiserfs: eliminate per-super xattr lock
[net-next-2.6.git] / include / linux / reiserfs_xattr.h
CommitLineData
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
13struct 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
26struct inode;
27struct dentry;
28struct iattr;
29struct super_block;
30struct nameidata;
1da177e4
LT
31
32struct 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
a72bdb1c
JM
46int reiserfs_xattr_register_handlers(void) __init;
47void reiserfs_xattr_unregister_handlers(void);
48int reiserfs_xattr_init(struct super_block *sb, int mount_flags);
49int reiserfs_delete_xattrs(struct inode *inode);
50int reiserfs_chown_xattrs(struct inode *inode, struct iattr *attrs);
51
1da177e4 52#ifdef CONFIG_REISERFS_FS_XATTR
1da177e4 53#define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir)
bd4c625c
LT
54ssize_t reiserfs_getxattr(struct dentry *dentry, const char *name,
55 void *buffer, size_t size);
56int reiserfs_setxattr(struct dentry *dentry, const char *name,
57 const void *value, size_t size, int flags);
58ssize_t reiserfs_listxattr(struct dentry *dentry, char *buffer, size_t size);
59int reiserfs_removexattr(struct dentry *dentry, const char *name);
e6305c43 60int reiserfs_permission(struct inode *inode, int mask);
bd4c625c
LT
61
62int reiserfs_xattr_del(struct inode *, const char *);
63int reiserfs_xattr_get(const struct inode *, const char *, void *, size_t);
64int reiserfs_xattr_set(struct inode *, const char *, const void *, size_t, int);
1da177e4
LT
65
66extern struct reiserfs_xattr_handler user_handler;
67extern struct reiserfs_xattr_handler trusted_handler;
1da177e4 68extern struct reiserfs_xattr_handler security_handler;
1da177e4 69
bd4c625c 70static inline void reiserfs_write_lock_xattr_i(struct inode *inode)
1da177e4 71{
d984561b 72 down_write(&REISERFS_I(inode)->i_xattr_sem);
1da177e4 73}
bd4c625c 74static inline void reiserfs_write_unlock_xattr_i(struct inode *inode)
1da177e4 75{
d984561b 76 up_write(&REISERFS_I(inode)->i_xattr_sem);
1da177e4 77}
bd4c625c 78static inline void reiserfs_read_lock_xattr_i(struct inode *inode)
1da177e4 79{
d984561b 80 down_read(&REISERFS_I(inode)->i_xattr_sem);
1da177e4
LT
81}
82
bd4c625c 83static inline void reiserfs_read_unlock_xattr_i(struct inode *inode)
1da177e4 84{
d984561b 85 up_read(&REISERFS_I(inode)->i_xattr_sem);
1da177e4
LT
86}
87
068fbb31
AD
88static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
89{
d984561b 90 init_rwsem(&REISERFS_I(inode)->i_xattr_sem);
068fbb31
AD
91}
92
1da177e4
LT
93#else
94
1da177e4
LT
95#define reiserfs_getxattr NULL
96#define reiserfs_setxattr NULL
97#define reiserfs_listxattr NULL
98#define reiserfs_removexattr NULL
cd02b966
VS
99#define reiserfs_write_lock_xattrs(sb) do {;} while(0)
100#define reiserfs_write_unlock_xattrs(sb) do {;} while(0)
1da177e4
LT
101#define reiserfs_read_lock_xattrs(sb)
102#define reiserfs_read_unlock_xattrs(sb)
103
104#define reiserfs_permission NULL
105
068fbb31
AD
106static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
107{
108}
521dae19
AB
109#endif /* CONFIG_REISERFS_FS_XATTR */
110
111#endif /* __KERNEL__ */
1da177e4 112
521dae19 113#endif /* _LINUX_REISERFS_XATTR_H */