Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Vyacheslav Dubeyko | 127e5f5 | 2013-02-27 17:03:03 -0800 | [diff] [blame] | 2 | /* |
| 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 Leung | bf29e88 | 2014-06-06 14:36:22 -0700 | [diff] [blame] | 10 | #include <linux/nls.h> |
| 11 | |
Vyacheslav Dubeyko | 127e5f5 | 2013-02-27 17:03:03 -0800 | [diff] [blame] | 12 | #include "hfsplus_fs.h" |
| 13 | #include "xattr.h" |
| 14 | |
Andreas Gruenbacher | d9a82a0 | 2015-10-04 19:18:51 +0200 | [diff] [blame] | 15 | static int hfsplus_trusted_getxattr(const struct xattr_handler *handler, |
Al Viro | b296821 | 2016-04-10 20:48:24 -0400 | [diff] [blame] | 16 | struct dentry *unused, struct inode *inode, |
| 17 | const char *name, void *buffer, size_t size) |
Vyacheslav Dubeyko | 127e5f5 | 2013-02-27 17:03:03 -0800 | [diff] [blame] | 18 | { |
Al Viro | b296821 | 2016-04-10 20:48:24 -0400 | [diff] [blame] | 19 | return hfsplus_getxattr(inode, name, buffer, size, |
Fabian Frederick | a3cef4c | 2015-04-16 12:46:58 -0700 | [diff] [blame] | 20 | XATTR_TRUSTED_PREFIX, |
| 21 | XATTR_TRUSTED_PREFIX_LEN); |
Vyacheslav Dubeyko | 127e5f5 | 2013-02-27 17:03:03 -0800 | [diff] [blame] | 22 | } |
| 23 | |
Andreas Gruenbacher | d9a82a0 | 2015-10-04 19:18:51 +0200 | [diff] [blame] | 24 | static int hfsplus_trusted_setxattr(const struct xattr_handler *handler, |
Christian Brauner | e65ce2a | 2021-01-21 14:19:27 +0100 | [diff] [blame] | 25 | struct user_namespace *mnt_userns, |
Al Viro | 5930122 | 2016-05-27 10:19:30 -0400 | [diff] [blame] | 26 | struct dentry *unused, struct inode *inode, |
| 27 | const char *name, const void *buffer, |
| 28 | size_t size, int flags) |
Vyacheslav Dubeyko | 127e5f5 | 2013-02-27 17:03:03 -0800 | [diff] [blame] | 29 | { |
Al Viro | 5930122 | 2016-05-27 10:19:30 -0400 | [diff] [blame] | 30 | return hfsplus_setxattr(inode, name, buffer, size, flags, |
Fabian Frederick | 5e61473 | 2015-04-16 12:47:01 -0700 | [diff] [blame] | 31 | XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN); |
Vyacheslav Dubeyko | 127e5f5 | 2013-02-27 17:03:03 -0800 | [diff] [blame] | 32 | } |
| 33 | |
Vyacheslav Dubeyko | 127e5f5 | 2013-02-27 17:03:03 -0800 | [diff] [blame] | 34 | const struct xattr_handler hfsplus_xattr_trusted_handler = { |
| 35 | .prefix = XATTR_TRUSTED_PREFIX, |
Vyacheslav Dubeyko | 127e5f5 | 2013-02-27 17:03:03 -0800 | [diff] [blame] | 36 | .get = hfsplus_trusted_getxattr, |
| 37 | .set = hfsplus_trusted_setxattr, |
| 38 | }; |