aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/xattr.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext4/xattr.h')
-rw-r--r--fs/ext4/xattr.h158
1 files changed, 103 insertions, 55 deletions
diff --git a/fs/ext4/xattr.h b/fs/ext4/xattr.h
index 91f31ca7d9af..69eda787a96a 100644
--- a/fs/ext4/xattr.h
+++ b/fs/ext4/xattr.h
@@ -21,6 +21,7 @@
21#define EXT4_XATTR_INDEX_TRUSTED 4 21#define EXT4_XATTR_INDEX_TRUSTED 4
22#define EXT4_XATTR_INDEX_LUSTRE 5 22#define EXT4_XATTR_INDEX_LUSTRE 5
23#define EXT4_XATTR_INDEX_SECURITY 6 23#define EXT4_XATTR_INDEX_SECURITY 6
24#define EXT4_XATTR_INDEX_SYSTEM 7
24 25
25struct ext4_xattr_header { 26struct ext4_xattr_header {
26 __le32 h_magic; /* magic number for identification */ 27 __le32 h_magic; /* magic number for identification */
@@ -65,7 +66,32 @@ struct ext4_xattr_entry {
65 EXT4_I(inode)->i_extra_isize)) 66 EXT4_I(inode)->i_extra_isize))
66#define IFIRST(hdr) ((struct ext4_xattr_entry *)((hdr)+1)) 67#define IFIRST(hdr) ((struct ext4_xattr_entry *)((hdr)+1))
67 68
68# ifdef CONFIG_EXT4_FS_XATTR 69#define BHDR(bh) ((struct ext4_xattr_header *)((bh)->b_data))
70#define ENTRY(ptr) ((struct ext4_xattr_entry *)(ptr))
71#define BFIRST(bh) ENTRY(BHDR(bh)+1)
72#define IS_LAST_ENTRY(entry) (*(__u32 *)(entry) == 0)
73
74#define EXT4_ZERO_XATTR_VALUE ((void *)-1)
75
76struct ext4_xattr_info {
77 int name_index;
78 const char *name;
79 const void *value;
80 size_t value_len;
81};
82
83struct ext4_xattr_search {
84 struct ext4_xattr_entry *first;
85 void *base;
86 void *end;
87 struct ext4_xattr_entry *here;
88 int not_found;
89};
90
91struct ext4_xattr_ibody_find {
92 struct ext4_xattr_search s;
93 struct ext4_iloc iloc;
94};
69 95
70extern const struct xattr_handler ext4_xattr_user_handler; 96extern const struct xattr_handler ext4_xattr_user_handler;
71extern const struct xattr_handler ext4_xattr_trusted_handler; 97extern const struct xattr_handler ext4_xattr_trusted_handler;
@@ -90,60 +116,82 @@ extern void ext4_exit_xattr(void);
90 116
91extern const struct xattr_handler *ext4_xattr_handlers[]; 117extern const struct xattr_handler *ext4_xattr_handlers[];
92 118
93# else /* CONFIG_EXT4_FS_XATTR */ 119extern int ext4_xattr_ibody_find(struct inode *inode, struct ext4_xattr_info *i,
94 120 struct ext4_xattr_ibody_find *is);
95static inline int 121extern int ext4_xattr_ibody_get(struct inode *inode, int name_index,
96ext4_xattr_get(struct inode *inode, int name_index, const char *name, 122 const char *name,
97 void *buffer, size_t size, int flags) 123 void *buffer, size_t buffer_size);
98{ 124extern int ext4_xattr_ibody_inline_set(handle_t *handle, struct inode *inode,
99 return -EOPNOTSUPP; 125 struct ext4_xattr_info *i,
100} 126 struct ext4_xattr_ibody_find *is);
101 127
102static inline int 128extern int ext4_has_inline_data(struct inode *inode);
103ext4_xattr_set(struct inode *inode, int name_index, const char *name, 129extern int ext4_get_inline_size(struct inode *inode);
104 const void *value, size_t size, int flags) 130extern int ext4_get_max_inline_size(struct inode *inode);
105{ 131extern int ext4_find_inline_data_nolock(struct inode *inode);
106 return -EOPNOTSUPP; 132extern void ext4_write_inline_data(struct inode *inode,
107} 133 struct ext4_iloc *iloc,
108 134 void *buffer, loff_t pos,
109static inline int 135 unsigned int len);
110ext4_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index, 136extern int ext4_prepare_inline_data(handle_t *handle, struct inode *inode,
111 const char *name, const void *value, size_t size, int flags) 137 unsigned int len);
112{ 138extern int ext4_init_inline_data(handle_t *handle, struct inode *inode,
113 return -EOPNOTSUPP; 139 unsigned int len);
114} 140extern int ext4_destroy_inline_data(handle_t *handle, struct inode *inode);
115 141
116static inline void 142extern int ext4_readpage_inline(struct inode *inode, struct page *page);
117ext4_xattr_delete_inode(handle_t *handle, struct inode *inode) 143extern int ext4_try_to_write_inline_data(struct address_space *mapping,
118{ 144 struct inode *inode,
119} 145 loff_t pos, unsigned len,
120 146 unsigned flags,
121static inline void 147 struct page **pagep);
122ext4_xattr_put_super(struct super_block *sb) 148extern int ext4_write_inline_data_end(struct inode *inode,
123{ 149 loff_t pos, unsigned len,
124} 150 unsigned copied,
125 151 struct page *page);
126static __init inline int 152extern struct buffer_head *
127ext4_init_xattr(void) 153ext4_journalled_write_inline_data(struct inode *inode,
128{ 154 unsigned len,
129 return 0; 155 struct page *page);
130} 156extern int ext4_da_write_inline_data_begin(struct address_space *mapping,
131 157 struct inode *inode,
132static inline void 158 loff_t pos, unsigned len,
133ext4_exit_xattr(void) 159 unsigned flags,
134{ 160 struct page **pagep,
135} 161 void **fsdata);
136 162extern int ext4_da_write_inline_data_end(struct inode *inode, loff_t pos,
137static inline int 163 unsigned len, unsigned copied,
138ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize, 164 struct page *page);
139 struct ext4_inode *raw_inode, handle_t *handle) 165extern int ext4_try_add_inline_entry(handle_t *handle, struct dentry *dentry,
140{ 166 struct inode *inode);
141 return -EOPNOTSUPP; 167extern int ext4_try_create_inline_dir(handle_t *handle,
142} 168 struct inode *parent,
143 169 struct inode *inode);
144#define ext4_xattr_handlers NULL 170extern int ext4_read_inline_dir(struct file *filp,
145 171 void *dirent, filldir_t filldir,
146# endif /* CONFIG_EXT4_FS_XATTR */ 172 int *has_inline_data);
173extern struct buffer_head *ext4_find_inline_entry(struct inode *dir,
174 const struct qstr *d_name,
175 struct ext4_dir_entry_2 **res_dir,
176 int *has_inline_data);
177extern int ext4_delete_inline_entry(handle_t *handle,
178 struct inode *dir,
179 struct ext4_dir_entry_2 *de_del,
180 struct buffer_head *bh,
181 int *has_inline_data);
182extern int empty_inline_dir(struct inode *dir, int *has_inline_data);
183extern struct buffer_head *ext4_get_first_inline_block(struct inode *inode,
184 struct ext4_dir_entry_2 **parent_de,
185 int *retval);
186extern int ext4_inline_data_fiemap(struct inode *inode,
187 struct fiemap_extent_info *fieinfo,
188 int *has_inline);
189extern int ext4_try_to_evict_inline_data(handle_t *handle,
190 struct inode *inode,
191 int needed);
192extern void ext4_inline_data_truncate(struct inode *inode, int *has_inline);
193
194extern int ext4_convert_inline_data(struct inode *inode);
147 195
148#ifdef CONFIG_EXT4_FS_SECURITY 196#ifdef CONFIG_EXT4_FS_SECURITY
149extern int ext4_init_security(handle_t *handle, struct inode *inode, 197extern int ext4_init_security(handle_t *handle, struct inode *inode,