summaryrefslogtreecommitdiff
path: root/release/src/linux/linux/include/linux/reiserfs_xattr.h
blob: 14bdd166016375a1e6c8474174e832431635630a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/*
  File: linux/reiserfs_xattr.h
*/

#include <linux/config.h>
#include <linux/init.h>
#include <linux/xattr.h>

/* Magic value in header */
#define REISERFS_XATTR_MAGIC 0x52465841 /* "RFXA" */

struct reiserfs_xattr_header {
    __u32 h_magic;              /* magic number for identification */
    __u32 h_hash;               /* hash of the value */
};

#ifdef __KERNEL__

struct reiserfs_xattr_handler {
	char *prefix;
	int (*get)(struct inode *inode, const char *name, void *buffer,
		   size_t size);
	int (*set)(struct inode *inode, const char *name, const void *buffer,
		   size_t size, int flags);
	int (*del)(struct inode *inode, const char *name);
        int (*list)(struct inode *inode, const char *name, int namelen, char *out);
        struct reiserfs_xattr_handler *next;
};


#ifdef CONFIG_REISERFS_FS_XATTR
#define is_reiserfs_priv_object(inode) (((inode)->u.reiserfs_i.i_flags & i_priv_object) == i_priv_object)
ssize_t reiserfs_getxattr (struct dentry *dentry, const char *name,
			   void *buffer, size_t size);
int reiserfs_setxattr (struct dentry *dentry, const char *name,
                       const void *value, size_t size, int flags);
ssize_t reiserfs_listxattr (struct dentry *dentry, char *buffer, size_t size);
int reiserfs_removexattr (struct dentry *dentry, const char *name);
int reiserfs_delete_xattrs (struct inode *inode);
int reiserfs_chown_xattrs (struct inode *inode, struct iattr *attrs);
int reiserfs_xattr_init (struct super_block *sb, int mount_flags);

static inline void
reiserfs_write_lock_xattrs(struct super_block *sb)
{
    down_write (&REISERFS_XATTR_DIR_SEM(sb));
}
static inline void
reiserfs_write_unlock_xattrs(struct super_block *sb)
{
    up_write (&REISERFS_XATTR_DIR_SEM(sb));
}
static inline void
reiserfs_read_lock_xattrs(struct super_block *sb)
{
    down_read (&REISERFS_XATTR_DIR_SEM(sb));
}
static inline void
reiserfs_read_unlock_xattrs(struct super_block *sb)
{
    up_read (&REISERFS_XATTR_DIR_SEM(sb));
}
#else
#define is_reiserfs_priv_object(inode) 0
#define reiserfs_getxattr NULL
#define reiserfs_setxattr NULL
#define reiserfs_listxattr NULL
#define reiserfs_removexattr NULL
#define reiserfs_write_lock_xattrs(sb)
#define reiserfs_write_unlock_xattrs(sb)
#define reiserfs_read_lock_xattrs(sb)
#define reiserfs_read_unlock_xattrs(sb)
static inline int
reiserfs_xattr_init (struct super_block *s, int mount_flags)
{
    s->s_flags = (s->s_flags & ~MS_POSIXACL); /* to be sure */
    return 0;
}

static inline int
reiserfs_delete_xattrs (struct inode *inode)
{
    return 0;
}

static inline int
reiserfs_chown_xattrs (struct inode *inode, struct iattr *attrs)
{
    return 0;
}
#endif

extern int reiserfs_xattr_register_handler(struct reiserfs_xattr_handler *);
extern int reiserfs_xattr_unregister_handler(struct reiserfs_xattr_handler *);
extern int reiserfs_xattr_del (struct inode *, const char *);
extern int reiserfs_xattr_get (const struct inode *, const char *, void *, size_t);
extern int reiserfs_xattr_set (struct inode *, const char *, const void *,
                               size_t, int);
#ifdef CONFIG_REISERFS_FS_XATTR_USER
extern int reiserfs_xattr_user_init (void) __init;
extern int reiserfs_xattr_user_exit (void);
#else
static inline int
reiserfs_xattr_user_init (void)
{
    return 0;
}

static inline int
reiserfs_xattr_user_exit (void)
{
    return 0;
}
#endif
#ifdef CONFIG_REISERFS_FS_XATTR_TRUSTED
extern int reiserfs_xattr_trusted_init (void) __init;
extern int reiserfs_xattr_trusted_exit (void);
#else
static inline int
reiserfs_xattr_trusted_init (void)
{
    return 0;
}

static inline int
reiserfs_xattr_trusted_exit (void)
{
    return 0;
}
#endif

#endif  /* __KERNEL__ */