blob: e150372ec56490db17a1a7f3c7dfcfe200704add [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001// SPDX-License-Identifier: GPL-2.0
Vyacheslav Dubeyko127e5f52013-02-27 17:03:03 -08002/*
3 * linux/fs/hfsplus/xattr_trusted.c
4 *
5 * Vyacheslav Dubeyko <slava@dubeyko.com>
6 *
7 * Handler for trusted extended attributes.
8 */
9
Hin-Tak Leungbf29e882014-06-06 14:36:22 -070010#include <linux/nls.h>
11
Vyacheslav Dubeyko127e5f52013-02-27 17:03:03 -080012#include "hfsplus_fs.h"
13#include "xattr.h"
14
Andreas Gruenbacherd9a82a02015-10-04 19:18:51 +020015static int hfsplus_trusted_getxattr(const struct xattr_handler *handler,
Al Virob2968212016-04-10 20:48:24 -040016 struct dentry *unused, struct inode *inode,
17 const char *name, void *buffer, size_t size)
Vyacheslav Dubeyko127e5f52013-02-27 17:03:03 -080018{
Al Virob2968212016-04-10 20:48:24 -040019 return hfsplus_getxattr(inode, name, buffer, size,
Fabian Fredericka3cef4c2015-04-16 12:46:58 -070020 XATTR_TRUSTED_PREFIX,
21 XATTR_TRUSTED_PREFIX_LEN);
Vyacheslav Dubeyko127e5f52013-02-27 17:03:03 -080022}
23
Andreas Gruenbacherd9a82a02015-10-04 19:18:51 +020024static int hfsplus_trusted_setxattr(const struct xattr_handler *handler,
Christian Braunere65ce2a2021-01-21 14:19:27 +010025 struct user_namespace *mnt_userns,
Al Viro59301222016-05-27 10:19:30 -040026 struct dentry *unused, struct inode *inode,
27 const char *name, const void *buffer,
28 size_t size, int flags)
Vyacheslav Dubeyko127e5f52013-02-27 17:03:03 -080029{
Al Viro59301222016-05-27 10:19:30 -040030 return hfsplus_setxattr(inode, name, buffer, size, flags,
Fabian Frederick5e614732015-04-16 12:47:01 -070031 XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN);
Vyacheslav Dubeyko127e5f52013-02-27 17:03:03 -080032}
33
Vyacheslav Dubeyko127e5f52013-02-27 17:03:03 -080034const struct xattr_handler hfsplus_xattr_trusted_handler = {
35 .prefix = XATTR_TRUSTED_PREFIX,
Vyacheslav Dubeyko127e5f52013-02-27 17:03:03 -080036 .get = hfsplus_trusted_getxattr,
37 .set = hfsplus_trusted_setxattr,
38};