1 #include <linux/reiserfs_fs.h>
2 #include <linux/capability.h>
3 #include <linux/errno.h>
5 #include <linux/pagemap.h>
6 #include <linux/xattr.h>
7 #include <linux/reiserfs_xattr.h>
8 #include <asm/uaccess.h>
10 #define XATTR_TRUSTED_PREFIX "trusted."
13 trusted_get(struct inode *inode, const char *name, void *buffer, size_t size)
15 if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX))
18 if (!reiserfs_xattrs(inode->i_sb))
21 if (!(capable(CAP_SYS_ADMIN) || is_reiserfs_priv_object(inode)))
24 return reiserfs_xattr_get(inode, name, buffer, size);
28 trusted_set(struct inode *inode, const char *name, const void *buffer,
29 size_t size, int flags)
31 if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX))
34 if (!reiserfs_xattrs(inode->i_sb))
37 if (!(capable(CAP_SYS_ADMIN) || is_reiserfs_priv_object(inode)))
40 return reiserfs_xattr_set(inode, name, buffer, size, flags);
43 static int trusted_del(struct inode *inode, const char *name)
45 if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX))
48 if (!reiserfs_xattrs(inode->i_sb))
51 if (!(capable(CAP_SYS_ADMIN) || is_reiserfs_priv_object(inode)))
58 trusted_list(struct inode *inode, const char *name, int namelen, char *out)
62 if (!reiserfs_xattrs(inode->i_sb))
65 if (!(capable(CAP_SYS_ADMIN) || is_reiserfs_priv_object(inode)))
69 memcpy(out, name, len);
74 struct reiserfs_xattr_handler trusted_handler = {
75 .prefix = XATTR_TRUSTED_PREFIX,