mmc: tmio: Remove redundant runtime PM calls
[linux/fpc-iii.git] / fs / reiserfs / xattr_trusted.c
blob64b67aa643a96909b2759824fcbfdd0fda43c562
1 #include "reiserfs.h"
2 #include <linux/capability.h>
3 #include <linux/errno.h>
4 #include <linux/fs.h>
5 #include <linux/pagemap.h>
6 #include <linux/xattr.h>
7 #include "xattr.h"
8 #include <linux/uaccess.h>
10 static int
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))
15 return -EINVAL;
17 if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(d_inode(dentry)))
18 return -EPERM;
20 return reiserfs_xattr_get(d_inode(dentry), name, buffer, size);
23 static int
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))
28 return -EINVAL;
30 if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(d_inode(dentry)))
31 return -EPERM;
33 return reiserfs_xattr_set(d_inode(dentry), name, buffer, size, flags);
36 static bool trusted_list(struct dentry *dentry)
38 return capable(CAP_SYS_ADMIN) && !IS_PRIVATE(d_inode(dentry));
41 const struct xattr_handler reiserfs_xattr_trusted_handler = {
42 .prefix = XATTR_TRUSTED_PREFIX,
43 .get = trusted_get,
44 .set = trusted_set,
45 .list = trusted_list,