1 #include <linux/reiserfs_fs.h>
2 #include <linux/errno.h>
4 #include <linux/pagemap.h>
5 #include <linux/xattr.h>
6 #include <linux/reiserfs_xattr.h>
7 #include <asm/uaccess.h>
9 #define XATTR_TRUSTED_PREFIX "trusted."
12 trusted_get(struct inode *inode, const char *name, void *buffer, size_t size)
14 if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX))
17 if (!reiserfs_xattrs(inode->i_sb))
20 if (!(capable(CAP_SYS_ADMIN) || is_reiserfs_priv_object(inode)))
23 return reiserfs_xattr_get(inode, name, buffer, size);
27 trusted_set(struct inode *inode, const char *name, const void *buffer,
28 size_t size, int flags)
30 if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX))
33 if (!reiserfs_xattrs(inode->i_sb))
36 if (!(capable(CAP_SYS_ADMIN) || is_reiserfs_priv_object(inode)))
39 return reiserfs_xattr_set(inode, name, buffer, size, flags);
42 static int trusted_del(struct inode *inode, const char *name)
44 if (strlen(name) < sizeof(XATTR_TRUSTED_PREFIX))
47 if (!reiserfs_xattrs(inode->i_sb))
50 if (!(capable(CAP_SYS_ADMIN) || is_reiserfs_priv_object(inode)))
57 trusted_list(struct inode *inode, const char *name, int namelen, char *out)
61 if (!reiserfs_xattrs(inode->i_sb))
64 if (!(capable(CAP_SYS_ADMIN) || is_reiserfs_priv_object(inode)))
68 memcpy(out, name, len);
73 struct reiserfs_xattr_handler trusted_handler = {
74 .prefix = XATTR_TRUSTED_PREFIX,