• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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>
8 
9 #ifdef CONFIG_REISERFS_FS_POSIX_ACL
10 # include <linux/reiserfs_acl.h>
11 #endif
12 
13 static int
user_get(struct inode * inode,const char * name,void * buffer,size_t size)14 user_get(struct inode *inode, const char *name, void *buffer, size_t size)
15 {
16 
17 	if (strlen(name) < sizeof(XATTR_USER_PREFIX))
18 		return -EINVAL;
19 	if (!reiserfs_xattrs_user(inode->i_sb))
20 		return -EOPNOTSUPP;
21 	return reiserfs_xattr_get(inode, name, buffer, size);
22 }
23 
24 static int
user_set(struct inode * inode,const char * name,const void * buffer,size_t size,int flags)25 user_set(struct inode *inode, const char *name, const void *buffer,
26 	 size_t size, int flags)
27 {
28 
29 	if (strlen(name) < sizeof(XATTR_USER_PREFIX))
30 		return -EINVAL;
31 
32 	if (!reiserfs_xattrs_user(inode->i_sb))
33 		return -EOPNOTSUPP;
34 	return reiserfs_xattr_set(inode, name, buffer, size, flags);
35 }
36 
user_del(struct inode * inode,const char * name)37 static int user_del(struct inode *inode, const char *name)
38 {
39 	if (strlen(name) < sizeof(XATTR_USER_PREFIX))
40 		return -EINVAL;
41 
42 	if (!reiserfs_xattrs_user(inode->i_sb))
43 		return -EOPNOTSUPP;
44 	return 0;
45 }
46 
47 static int
user_list(struct inode * inode,const char * name,int namelen,char * out)48 user_list(struct inode *inode, const char *name, int namelen, char *out)
49 {
50 	int len = namelen;
51 	if (!reiserfs_xattrs_user(inode->i_sb))
52 		return 0;
53 
54 	if (out)
55 		memcpy(out, name, len);
56 
57 	return len;
58 }
59 
60 struct reiserfs_xattr_handler user_handler = {
61 	.prefix = XATTR_USER_PREFIX,
62 	.get = user_get,
63 	.set = user_set,
64 	.del = user_del,
65 	.list = user_list,
66 };
67