21 #include <linux/slab.h>
23 #include <linux/xattr.h>
40 unsigned long data_ptr;
52 }
else if (IS_ERR(di)) {
57 leaf = path->
nodes[0];
60 ret = btrfs_dir_data_len(leaf, di);
65 if (btrfs_dir_data_len(leaf, di) > size) {
77 data_ptr = (
unsigned long)((
char *)(di + 1) +
78 btrfs_dir_name_len(leaf, di));
80 btrfs_dir_data_len(leaf, di));
81 ret = btrfs_dir_data_len(leaf, di);
129 name, name_len, value, size);
182 struct inode *inode,
const char *name,
183 const void *value,
size_t size,
int flags)
185 struct btrfs_root *root = BTRFS_I(inode)->root;
189 return do_setxattr(trans, inode, name, value, size, flags);
193 return PTR_ERR(trans);
195 ret = do_setxattr(trans, inode, name, value, size, flags);
199 inode_inc_iversion(inode);
211 struct inode *inode = dentry->
d_inode;
212 struct btrfs_root *root = BTRFS_I(inode)->root;
218 unsigned long name_ptr;
241 leaf = path->
nodes[0];
245 if (
slot >= btrfs_header_nritems(leaf)) {
258 btrfs_item_key_to_cpu(leaf, &found_key,
slot);
270 name_len = btrfs_dir_name_len(leaf, di);
271 total_size += name_len + 1;
277 if (!buffer || (name_len + 1) > size_left) {
282 name_ptr = (
unsigned long)(di + 1);
286 size_left -= name_len + 1;
287 buffer += name_len + 1;
304 #ifdef CONFIG_BTRFS_FS_POSIX_ACL
317 static bool btrfs_is_valid_xattr(
const char *name)
327 void *
buffer,
size_t size)
337 if (!btrfs_is_valid_xattr(name))
343 size_t size,
int flags)
351 if (btrfs_root_readonly(root))
362 if (!btrfs_is_valid_xattr(name))
380 if (btrfs_root_readonly(root))
391 if (!btrfs_is_valid_xattr(name))
406 for (xattr = xattr_array; xattr->
name !=
NULL; xattr++) {
425 struct inode *inode,
struct inode *dir,