OMAP3 SRF: Generic shared resource f/w
[linux-ginger.git] / fs / reiserfs / xattr_user.c
blobe3238dc4f3db941ebf3108d347402fbc9a8281df
1 #include <linux/reiserfs_fs.h>
2 #include <linux/errno.h>
3 #include <linux/fs.h>
4 #include <linux/pagemap.h>
5 #include <linux/xattr.h>
6 #include <linux/reiserfs_xattr.h>
7 #include <asm/uaccess.h>
9 static int
10 user_get(struct inode *inode, const char *name, void *buffer, size_t size)
13 if (strlen(name) < sizeof(XATTR_USER_PREFIX))
14 return -EINVAL;
15 if (!reiserfs_xattrs_user(inode->i_sb))
16 return -EOPNOTSUPP;
17 return reiserfs_xattr_get(inode, name, buffer, size);
20 static int
21 user_set(struct inode *inode, const char *name, const void *buffer,
22 size_t size, int flags)
24 if (strlen(name) < sizeof(XATTR_USER_PREFIX))
25 return -EINVAL;
27 if (!reiserfs_xattrs_user(inode->i_sb))
28 return -EOPNOTSUPP;
29 return reiserfs_xattr_set(inode, name, buffer, size, flags);
32 static size_t user_list(struct inode *inode, char *list, size_t list_size,
33 const char *name, size_t name_len)
35 const size_t len = name_len + 1;
37 if (!reiserfs_xattrs_user(inode->i_sb))
38 return 0;
39 if (list && len <= list_size) {
40 memcpy(list, name, name_len);
41 list[name_len] = '\0';
43 return len;
46 struct xattr_handler reiserfs_xattr_user_handler = {
47 .prefix = XATTR_USER_PREFIX,
48 .get = user_get,
49 .set = user_set,
50 .list = user_list,