defconfig: exynos9610: Re-add dropped Wi-Fi AP options lost
[GitHub/LineageOS/android_kernel_motorola_exynos9610.git] / fs / reiserfs / xattr_trusted.c
... / ...
CommitLineData
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>
10
11static int
12trusted_get(const struct xattr_handler *handler, struct dentry *unused,
13 struct inode *inode, const char *name, void *buffer, size_t size)
14{
15 if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(inode))
16 return -EPERM;
17
18 return reiserfs_xattr_get(inode, xattr_full_name(handler, name),
19 buffer, size);
20}
21
22static int
23trusted_set(const struct xattr_handler *handler, struct dentry *unused,
24 struct inode *inode, const char *name, const void *buffer,
25 size_t size, int flags)
26{
27 if (!capable(CAP_SYS_ADMIN) || IS_PRIVATE(inode))
28 return -EPERM;
29
30 return reiserfs_xattr_set(inode,
31 xattr_full_name(handler, name),
32 buffer, size, flags);
33}
34
35static bool trusted_list(struct dentry *dentry)
36{
37 return capable(CAP_SYS_ADMIN) && !IS_PRIVATE(d_inode(dentry));
38}
39
40const struct xattr_handler reiserfs_xattr_trusted_handler = {
41 .prefix = XATTR_TRUSTED_PREFIX,
42 .get = trusted_get,
43 .set = trusted_set,
44 .list = trusted_list,
45};