aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs/xattr_user.c
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2009-03-30 14:02:38 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-03-30 15:16:38 -0400
commit48b32a3553a54740d236b79a90f20147a25875e3 (patch)
treefaf6807facb5825608469a9e33c9127f90b974df /fs/reiserfs/xattr_user.c
parent8ecbe550a142fe604874afa477ea68986f89b86c (diff)
reiserfs: use generic xattr handlers
Christoph Hellwig had asked me quite some time ago to port the reiserfs xattrs to the generic xattr interface. This patch replaces the reiserfs-specific xattr handling code with the generic struct xattr_handler. However, since reiserfs doesn't split the prefix and name when accessing xattrs, it can't leverage generic_{set,get,list,remove}xattr without needlessly reconstructing the name on the back end. Update 7/26/07: Added missing dput() to deletion path. Update 8/30/07: Added missing mark_inode_dirty when i_mode is used to represent an ACL and no previous ACL existed. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/reiserfs/xattr_user.c')
-rw-r--r--fs/reiserfs/xattr_user.c31
1 files changed, 8 insertions, 23 deletions
diff --git a/fs/reiserfs/xattr_user.c b/fs/reiserfs/xattr_user.c
index 1384efcb938e..e3238dc4f3db 100644
--- a/fs/reiserfs/xattr_user.c
+++ b/fs/reiserfs/xattr_user.c
@@ -6,10 +6,6 @@
6#include <linux/reiserfs_xattr.h> 6#include <linux/reiserfs_xattr.h>
7#include <asm/uaccess.h> 7#include <asm/uaccess.h>
8 8
9#ifdef CONFIG_REISERFS_FS_POSIX_ACL
10# include <linux/reiserfs_acl.h>
11#endif
12
13static int 9static int
14user_get(struct inode *inode, const char *name, void *buffer, size_t size) 10user_get(struct inode *inode, const char *name, void *buffer, size_t size)
15{ 11{
@@ -25,7 +21,6 @@ static int
25user_set(struct inode *inode, const char *name, const void *buffer, 21user_set(struct inode *inode, const char *name, const void *buffer,
26 size_t size, int flags) 22 size_t size, int flags)
27{ 23{
28
29 if (strlen(name) < sizeof(XATTR_USER_PREFIX)) 24 if (strlen(name) < sizeof(XATTR_USER_PREFIX))
30 return -EINVAL; 25 return -EINVAL;
31 26
@@ -34,33 +29,23 @@ user_set(struct inode *inode, const char *name, const void *buffer,
34 return reiserfs_xattr_set(inode, name, buffer, size, flags); 29 return reiserfs_xattr_set(inode, name, buffer, size, flags);
35} 30}
36 31
37static int user_del(struct inode *inode, const char *name) 32static size_t user_list(struct inode *inode, char *list, size_t list_size,
33 const char *name, size_t name_len)
38{ 34{
39 if (strlen(name) < sizeof(XATTR_USER_PREFIX)) 35 const size_t len = name_len + 1;
40 return -EINVAL;
41
42 if (!reiserfs_xattrs_user(inode->i_sb))
43 return -EOPNOTSUPP;
44 return 0;
45}
46 36
47static int
48user_list(struct inode *inode, const char *name, int namelen, char *out)
49{
50 int len = namelen;
51 if (!reiserfs_xattrs_user(inode->i_sb)) 37 if (!reiserfs_xattrs_user(inode->i_sb))
52 return 0; 38 return 0;
53 39 if (list && len <= list_size) {
54 if (out) 40 memcpy(list, name, name_len);
55 memcpy(out, name, len); 41 list[name_len] = '\0';
56 42 }
57 return len; 43 return len;
58} 44}
59 45
60struct reiserfs_xattr_handler user_handler = { 46struct xattr_handler reiserfs_xattr_user_handler = {
61 .prefix = XATTR_USER_PREFIX, 47 .prefix = XATTR_USER_PREFIX,
62 .get = user_get, 48 .get = user_get,
63 .set = user_set, 49 .set = user_set,
64 .del = user_del,
65 .list = user_list, 50 .list = user_list,
66}; 51};