Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 131034
b: refs/heads/master
c: 0706040
h: refs/heads/master
v: v3
  • Loading branch information
Josef Bacik authored and Chris Mason committed Jan 21, 2009
1 parent aced382 commit 3bc2a8e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: eb1eb04fdfbd9e1c9c40d072ab1b82fe593eeb0f
refs/heads/master: 070604040b86511cc2df0f25f98e26c5529bd928
14 changes: 12 additions & 2 deletions trunk/fs/btrfs/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,12 @@ ssize_t __btrfs_getxattr(struct inode *inode, const char *name,
/* lookup the xattr by name */
di = btrfs_lookup_xattr(NULL, root, path, inode->i_ino, name,
strlen(name), 0);
if (!di || IS_ERR(di)) {
if (!di) {
ret = -ENODATA;
goto out;
} else if (IS_ERR(di)) {
ret = PTR_ERR(di);
goto out;
}

leaf = path->nodes[0];
Expand All @@ -62,6 +65,14 @@ ssize_t __btrfs_getxattr(struct inode *inode, const char *name,
ret = -ERANGE;
goto out;
}

/*
* The way things are packed into the leaf is like this
* |struct btrfs_dir_item|name|data|
* where name is the xattr name, so security.foo, and data is the
* content of the xattr. data_ptr points to the location in memory
* where the data starts in the in memory leaf
*/
data_ptr = (unsigned long)((char *)(di + 1) +
btrfs_dir_name_len(leaf, di));
read_extent_buffer(leaf, buffer, data_ptr,
Expand Down Expand Up @@ -176,7 +187,6 @@ ssize_t btrfs_listxattr(struct dentry *dentry, char *buffer, size_t size)
ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
if (ret < 0)
goto err;
ret = 0;
advance = 0;
while (1) {
leaf = path->nodes[0];
Expand Down

0 comments on commit 3bc2a8e

Please sign in to comment.