staging: brcm80211: cleanup headers
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / fs / reiserfs / xattr_user.c
blob45ae1a00013aba1f737b2f8a6e1caffe92cb7a7e
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 dentry *dentry, const char *name, void *buffer, size_t size,
11 int handler_flags)
14 if (strlen(name) < sizeof(XATTR_USER_PREFIX))
15 return -EINVAL;
16 if (!reiserfs_xattrs_user(dentry->d_sb))
17 return -EOPNOTSUPP;
18 return reiserfs_xattr_get(dentry->d_inode, name, buffer, size);
21 static int
22 user_set(struct dentry *dentry, const char *name, const void *buffer,
23 size_t size, int flags, int handler_flags)
25 if (strlen(name) < sizeof(XATTR_USER_PREFIX))
26 return -EINVAL;
28 if (!reiserfs_xattrs_user(dentry->d_sb))
29 return -EOPNOTSUPP;
30 return reiserfs_xattr_set(dentry->d_inode, name, buffer, size, flags);
33 static size_t user_list(struct dentry *dentry, char *list, size_t list_size,
34 const char *name, size_t name_len, int handler_flags)
36 const size_t len = name_len + 1;
38 if (!reiserfs_xattrs_user(dentry->d_sb))
39 return 0;
40 if (list && len <= list_size) {
41 memcpy(list, name, name_len);
42 list[name_len] = '\0';
44 return len;
47 const struct xattr_handler reiserfs_xattr_user_handler = {
48 .prefix = XATTR_USER_PREFIX,
49 .get = user_get,
50 .set = user_set,
51 .list = user_list,