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);
43 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);
75 struct reiserfs_xattr_handler trusted_handler = {
76 .prefix = XATTR_TRUSTED_PREFIX,