drm/panthor: Don't declare a queue blocked if deferred operations are pending
[drm/drm-misc.git] / fs / reiserfs / xattr_trusted.c
blob0c0c74d8db0eda0788336ff02f4ceca91183fe22
1 // SPDX-License-Identifier: GPL-2.0
2 #include "reiserfs.h"
3 #include <linux/capability.h>
4 #include <linux/errno.h>
5 #include <linux/fs.h>
6 #include <linux/pagemap.h>
7 #include <linux/xattr.h>
8 #include "xattr.h"
9 #include <linux/uaccess.h>
11 static int
12 trusted_get(const struct xattr_handler *handler, struct dentry *unused,
13 struct inode *inode, const char *name, void *buffer, size_t size)
15 if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(inode))
16 return -EPERM;
18 return reiserfs_xattr_get(inode, xattr_full_name(handler, name),
19 buffer, size);
22 static int
23 trusted_set(const struct xattr_handler *handler,
24 struct mnt_idmap *idmap, struct dentry *unused,
25 struct inode *inode, const char *name, const void *buffer,
26 size_t size, int flags)
28 if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(inode))
29 return -EPERM;
31 return reiserfs_xattr_set(inode,
32 xattr_full_name(handler, name),
33 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,