Linux 4.6-rc6
[cris-mirror.git] / fs / reiserfs / xattr_user.c
blob12e6306f562a3f9ff1cddbf3b2818d5ae134127e
1 #include "reiserfs.h"
2 #include <linux/errno.h>
3 #include <linux/fs.h>
4 #include <linux/pagemap.h>
5 #include <linux/xattr.h>
6 #include "xattr.h"
7 #include <linux/uaccess.h>
9 static int
10 user_get(const struct xattr_handler *handler, struct dentry *dentry,
11 const char *name, void *buffer, size_t size)
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(d_inode(dentry), name, buffer, size);
21 static int
22 user_set(const struct xattr_handler *handler, struct dentry *dentry,
23 const char *name, const void *buffer, size_t size, int 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(d_inode(dentry), name, buffer, size, flags);
33 static bool user_list(struct dentry *dentry)
35 return reiserfs_xattrs_user(dentry->d_sb);
38 const struct xattr_handler reiserfs_xattr_user_handler = {
39 .prefix = XATTR_USER_PREFIX,
40 .get = user_get,
41 .set = user_set,
42 .list = user_list,