Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 125797
b: refs/heads/master
c: 4e3e9d0
h: refs/heads/master
i:
  125795: 6ac8db1
v: v3
  • Loading branch information
Tiger Yang authored and Mark Fasheh committed Jan 5, 2009
1 parent baf4603 commit e6a14c1
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 13 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: 534eadddc1de8754a227202c0e747af4973f82ce
refs/heads/master: 4e3e9d027f63488e676bf7700ec515a192e54f69
40 changes: 28 additions & 12 deletions trunk/fs/ocfs2/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -925,20 +925,15 @@ static int ocfs2_xattr_block_get(struct inode *inode,
return ret;
}

/* ocfs2_xattr_get()
*
* Copy an extended attribute into the buffer provided.
* Buffer is NULL to compute the size of buffer required.
*/
static int ocfs2_xattr_get(struct inode *inode,
int ocfs2_xattr_get_nolock(struct inode *inode,
struct buffer_head *di_bh,
int name_index,
const char *name,
void *buffer,
size_t buffer_size)
{
int ret;
struct ocfs2_dinode *di = NULL;
struct buffer_head *di_bh = NULL;
struct ocfs2_inode_info *oi = OCFS2_I(inode);
struct ocfs2_xattr_search xis = {
.not_found = -ENODATA,
Expand All @@ -953,11 +948,6 @@ static int ocfs2_xattr_get(struct inode *inode,
if (!(oi->ip_dyn_features & OCFS2_HAS_XATTR_FL))
ret = -ENODATA;

ret = ocfs2_inode_lock(inode, &di_bh, 0);
if (ret < 0) {
mlog_errno(ret);
return ret;
}
xis.inode_bh = xbs.inode_bh = di_bh;
di = (struct ocfs2_dinode *)di_bh->b_data;

Expand All @@ -968,6 +958,32 @@ static int ocfs2_xattr_get(struct inode *inode,
ret = ocfs2_xattr_block_get(inode, name_index, name, buffer,
buffer_size, &xbs);
up_read(&oi->ip_xattr_sem);

return ret;
}

/* ocfs2_xattr_get()
*
* Copy an extended attribute into the buffer provided.
* Buffer is NULL to compute the size of buffer required.
*/
static int ocfs2_xattr_get(struct inode *inode,
int name_index,
const char *name,
void *buffer,
size_t buffer_size)
{
int ret;
struct buffer_head *di_bh = NULL;

ret = ocfs2_inode_lock(inode, &di_bh, 0);
if (ret < 0) {
mlog_errno(ret);
return ret;
}
ret = ocfs2_xattr_get_nolock(inode, di_bh, name_index,
name, buffer, buffer_size);

ocfs2_inode_unlock(inode, 0);

brelse(di_bh);
Expand Down
2 changes: 2 additions & 0 deletions trunk/fs/ocfs2/xattr.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ extern struct xattr_handler ocfs2_xattr_security_handler;
extern struct xattr_handler *ocfs2_xattr_handlers[];

ssize_t ocfs2_listxattr(struct dentry *, char *, size_t);
int ocfs2_xattr_get_nolock(struct inode *, struct buffer_head *, int,
const char *, void *, size_t);
int ocfs2_xattr_set(struct inode *, int, const char *, const void *,
size_t, int);
int ocfs2_xattr_set_handle(handle_t *, struct inode *, struct buffer_head *,
Expand Down

0 comments on commit e6a14c1

Please sign in to comment.