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