diff options
Diffstat (limited to 'fs/ext4/xattr.h')
-rw-r--r-- | fs/ext4/xattr.h | 158 |
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 | ||
25 | struct ext4_xattr_header { | 26 | struct 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 | |||
76 | struct ext4_xattr_info { | ||
77 | int name_index; | ||
78 | const char *name; | ||
79 | const void *value; | ||
80 | size_t value_len; | ||
81 | }; | ||
82 | |||
83 | struct 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 | |||
91 | struct ext4_xattr_ibody_find { | ||
92 | struct ext4_xattr_search s; | ||
93 | struct ext4_iloc iloc; | ||
94 | }; | ||
69 | 95 | ||
70 | extern const struct xattr_handler ext4_xattr_user_handler; | 96 | extern const struct xattr_handler ext4_xattr_user_handler; |
71 | extern const struct xattr_handler ext4_xattr_trusted_handler; | 97 | extern const struct xattr_handler ext4_xattr_trusted_handler; |
@@ -90,60 +116,82 @@ extern void ext4_exit_xattr(void); | |||
90 | 116 | ||
91 | extern const struct xattr_handler *ext4_xattr_handlers[]; | 117 | extern const struct xattr_handler *ext4_xattr_handlers[]; |
92 | 118 | ||
93 | # else /* CONFIG_EXT4_FS_XATTR */ | 119 | extern int ext4_xattr_ibody_find(struct inode *inode, struct ext4_xattr_info *i, |
94 | 120 | struct ext4_xattr_ibody_find *is); | |
95 | static inline int | 121 | extern int ext4_xattr_ibody_get(struct inode *inode, int name_index, |
96 | ext4_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 | { | 124 | extern 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 | ||
102 | static inline int | 128 | extern int ext4_has_inline_data(struct inode *inode); |
103 | ext4_xattr_set(struct inode *inode, int name_index, const char *name, | 129 | extern int ext4_get_inline_size(struct inode *inode); |
104 | const void *value, size_t size, int flags) | 130 | extern int ext4_get_max_inline_size(struct inode *inode); |
105 | { | 131 | extern int ext4_find_inline_data_nolock(struct inode *inode); |
106 | return -EOPNOTSUPP; | 132 | extern void ext4_write_inline_data(struct inode *inode, |
107 | } | 133 | struct ext4_iloc *iloc, |
108 | 134 | void *buffer, loff_t pos, | |
109 | static inline int | 135 | unsigned int len); |
110 | ext4_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index, | 136 | extern 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 | { | 138 | extern int ext4_init_inline_data(handle_t *handle, struct inode *inode, |
113 | return -EOPNOTSUPP; | 139 | unsigned int len); |
114 | } | 140 | extern int ext4_destroy_inline_data(handle_t *handle, struct inode *inode); |
115 | 141 | ||
116 | static inline void | 142 | extern int ext4_readpage_inline(struct inode *inode, struct page *page); |
117 | ext4_xattr_delete_inode(handle_t *handle, struct inode *inode) | 143 | extern 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, | |
121 | static inline void | 147 | struct page **pagep); |
122 | ext4_xattr_put_super(struct super_block *sb) | 148 | extern 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); | |
126 | static __init inline int | 152 | extern struct buffer_head * |
127 | ext4_init_xattr(void) | 153 | ext4_journalled_write_inline_data(struct inode *inode, |
128 | { | 154 | unsigned len, |
129 | return 0; | 155 | struct page *page); |
130 | } | 156 | extern int ext4_da_write_inline_data_begin(struct address_space *mapping, |
131 | 157 | struct inode *inode, | |
132 | static inline void | 158 | loff_t pos, unsigned len, |
133 | ext4_exit_xattr(void) | 159 | unsigned flags, |
134 | { | 160 | struct page **pagep, |
135 | } | 161 | void **fsdata); |
136 | 162 | extern int ext4_da_write_inline_data_end(struct inode *inode, loff_t pos, | |
137 | static inline int | 163 | unsigned len, unsigned copied, |
138 | ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize, | 164 | struct page *page); |
139 | struct ext4_inode *raw_inode, handle_t *handle) | 165 | extern int ext4_try_add_inline_entry(handle_t *handle, struct dentry *dentry, |
140 | { | 166 | struct inode *inode); |
141 | return -EOPNOTSUPP; | 167 | extern 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 | 170 | extern 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); |
173 | extern 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); | ||
177 | extern 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); | ||
182 | extern int empty_inline_dir(struct inode *dir, int *has_inline_data); | ||
183 | extern struct buffer_head *ext4_get_first_inline_block(struct inode *inode, | ||
184 | struct ext4_dir_entry_2 **parent_de, | ||
185 | int *retval); | ||
186 | extern int ext4_inline_data_fiemap(struct inode *inode, | ||
187 | struct fiemap_extent_info *fieinfo, | ||
188 | int *has_inline); | ||
189 | extern int ext4_try_to_evict_inline_data(handle_t *handle, | ||
190 | struct inode *inode, | ||
191 | int needed); | ||
192 | extern void ext4_inline_data_truncate(struct inode *inode, int *has_inline); | ||
193 | |||
194 | extern int ext4_convert_inline_data(struct inode *inode); | ||
147 | 195 | ||
148 | #ifdef CONFIG_EXT4_FS_SECURITY | 196 | #ifdef CONFIG_EXT4_FS_SECURITY |
149 | extern int ext4_init_security(handle_t *handle, struct inode *inode, | 197 | extern int ext4_init_security(handle_t *handle, struct inode *inode, |