xref: /linux/fs/reiserfs/xattr_user.c (revision f3539c12d8196ce0a1993364d30b3a18908470d1)
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>
8 
9 static int
10 user_get(const struct xattr_handler *handler, struct dentry *unused,
11 	 struct inode *inode, const char *name, void *buffer, size_t size)
12 {
13 	if (!reiserfs_xattrs_user(inode->i_sb))
14 		return -EOPNOTSUPP;
15 	return reiserfs_xattr_get(inode, xattr_full_name(handler, name),
16 				  buffer, size);
17 }
18 
19 static int
20 user_set(const struct xattr_handler *handler, struct dentry *unused,
21 	 struct inode *inode, const char *name, const void *buffer,
22 	 size_t size, int flags)
23 {
24 	if (!reiserfs_xattrs_user(inode->i_sb))
25 		return -EOPNOTSUPP;
26 	return reiserfs_xattr_set(inode,
27 				  xattr_full_name(handler, name),
28 				  buffer, size, flags);
29 }
30 
31 static bool user_list(struct dentry *dentry)
32 {
33 	return reiserfs_xattrs_user(dentry->d_sb);
34 }
35 
36 const struct xattr_handler reiserfs_xattr_user_handler = {
37 	.prefix = XATTR_USER_PREFIX,
38 	.get = user_get,
39 	.set = user_set,
40 	.list = user_list,
41 };
42