1*b2441318SGreg Kroah-Hartman // SPDX-License-Identifier: GPL-2.0 21da177e4SLinus Torvalds /* 31da177e4SLinus Torvalds * linux/fs/ext2/xattr_trusted.c 41da177e4SLinus Torvalds * Handler for trusted extended attributes. 51da177e4SLinus Torvalds * 61da177e4SLinus Torvalds * Copyright (C) 2003 by Andreas Gruenbacher, <a.gruenbacher@computer.org> 71da177e4SLinus Torvalds */ 81da177e4SLinus Torvalds 9f7699f2bSAl Viro #include "ext2.h" 101da177e4SLinus Torvalds #include "xattr.h" 111da177e4SLinus Torvalds 12764a5c6bSAndreas Gruenbacher static bool 13764a5c6bSAndreas Gruenbacher ext2_xattr_trusted_list(struct dentry *dentry) 141da177e4SLinus Torvalds { 15764a5c6bSAndreas Gruenbacher return capable(CAP_SYS_ADMIN); 161da177e4SLinus Torvalds } 171da177e4SLinus Torvalds 181da177e4SLinus Torvalds static int 19d9a82a04SAndreas Gruenbacher ext2_xattr_trusted_get(const struct xattr_handler *handler, 20b296821aSAl Viro struct dentry *unused, struct inode *inode, 21b296821aSAl Viro const char *name, void *buffer, size_t size) 221da177e4SLinus Torvalds { 23b296821aSAl Viro return ext2_xattr_get(inode, EXT2_XATTR_INDEX_TRUSTED, name, 241da177e4SLinus Torvalds buffer, size); 251da177e4SLinus Torvalds } 261da177e4SLinus Torvalds 271da177e4SLinus Torvalds static int 28d9a82a04SAndreas Gruenbacher ext2_xattr_trusted_set(const struct xattr_handler *handler, 2959301226SAl Viro struct dentry *unused, struct inode *inode, 3059301226SAl Viro const char *name, const void *value, 3159301226SAl Viro size_t size, int flags) 321da177e4SLinus Torvalds { 3359301226SAl Viro return ext2_xattr_set(inode, EXT2_XATTR_INDEX_TRUSTED, name, 341da177e4SLinus Torvalds value, size, flags); 351da177e4SLinus Torvalds } 361da177e4SLinus Torvalds 37749c72efSStephen Hemminger const struct xattr_handler ext2_xattr_trusted_handler = { 381da177e4SLinus Torvalds .prefix = XATTR_TRUSTED_PREFIX, 391da177e4SLinus Torvalds .list = ext2_xattr_trusted_list, 401da177e4SLinus Torvalds .get = ext2_xattr_trusted_get, 411da177e4SLinus Torvalds .set = ext2_xattr_trusted_set, 421da177e4SLinus Torvalds }; 43