2 #include <linux/capability.h>
3 #include <linux/errno.h>
5 #include <linux/pagemap.h>
6 #include <linux/xattr.h>
8 #include <asm/uaccess.h>
11 trusted_get(struct dentry
*dentry
, const char *name
, void *buffer
, size_t size
,
14 if (strlen(name
) < sizeof(XATTR_TRUSTED_PREFIX
))
17 if (!capable(CAP_SYS_ADMIN
) || IS_PRIVATE(dentry
->d_inode
))
20 return reiserfs_xattr_get(dentry
->d_inode
, name
, buffer
, size
);
24 trusted_set(struct dentry
*dentry
, const char *name
, const void *buffer
,
25 size_t size
, int flags
, int handler_flags
)
27 if (strlen(name
) < sizeof(XATTR_TRUSTED_PREFIX
))
30 if (!capable(CAP_SYS_ADMIN
) || IS_PRIVATE(dentry
->d_inode
))
33 return reiserfs_xattr_set(dentry
->d_inode
, name
, buffer
, size
, flags
);
36 static size_t trusted_list(struct dentry
*dentry
, char *list
, size_t list_size
,
37 const char *name
, size_t name_len
, int handler_flags
)
39 const size_t len
= name_len
+ 1;
41 if (!capable(CAP_SYS_ADMIN
) || IS_PRIVATE(dentry
->d_inode
))
44 if (list
&& len
<= list_size
) {
45 memcpy(list
, name
, name_len
);
46 list
[name_len
] = '\0';
51 const struct xattr_handler reiserfs_xattr_trusted_handler
= {
52 .prefix
= XATTR_TRUSTED_PREFIX
,