1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * linux/fs/hfsplus/xattr_trusted.c
4  *
5  * Vyacheslav Dubeyko <slava@dubeyko.com>
6  *
7  * Handler for trusted extended attributes.
8  */
9 
10 #include <linux/nls.h>
11 
12 #include "hfsplus_fs.h"
13 #include "xattr.h"
14 
hfsplus_trusted_getxattr(const struct xattr_handler * handler,struct dentry * unused,struct inode * inode,const char * name,void * buffer,size_t size)15 static int hfsplus_trusted_getxattr(const struct xattr_handler *handler,
16 				    struct dentry *unused, struct inode *inode,
17 				    const char *name, void *buffer, size_t size)
18 {
19 	return hfsplus_getxattr(inode, name, buffer, size,
20 				XATTR_TRUSTED_PREFIX,
21 				XATTR_TRUSTED_PREFIX_LEN);
22 }
23 
hfsplus_trusted_setxattr(const struct xattr_handler * handler,struct dentry * unused,struct inode * inode,const char * name,const void * buffer,size_t size,int flags)24 static int hfsplus_trusted_setxattr(const struct xattr_handler *handler,
25 				    struct dentry *unused, struct inode *inode,
26 				    const char *name, const void *buffer,
27 				    size_t size, int flags)
28 {
29 	return hfsplus_setxattr(inode, name, buffer, size, flags,
30 				XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN);
31 }
32 
33 const struct xattr_handler hfsplus_xattr_trusted_handler = {
34 	.prefix	= XATTR_TRUSTED_PREFIX,
35 	.get	= hfsplus_trusted_getxattr,
36 	.set	= hfsplus_trusted_setxattr,
37 };
38