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