Vyacheslav Dubeyko | 127e5f5 | 2013-02-27 17:03:03 -0800 | [diff] [blame] | 1 | /* |
| 2 | * linux/fs/hfsplus/xattr_trusted.c |
| 3 | * |
| 4 | * Vyacheslav Dubeyko <slava@dubeyko.com> |
| 5 | * |
| 6 | * Handler for trusted extended attributes. |
| 7 | */ |
| 8 | |
Hin-Tak Leung | bf29e88 | 2014-06-06 14:36:22 -0700 | [diff] [blame] | 9 | #include <linux/nls.h> |
| 10 | |
Vyacheslav Dubeyko | 127e5f5 | 2013-02-27 17:03:03 -0800 | [diff] [blame] | 11 | #include "hfsplus_fs.h" |
| 12 | #include "xattr.h" |
| 13 | |
Andreas Gruenbacher | d9a82a0 | 2015-10-04 19:18:51 +0200 | [diff] [blame] | 14 | static int hfsplus_trusted_getxattr(const struct xattr_handler *handler, |
Al Viro | b296821 | 2016-04-10 20:48:24 -0400 | [diff] [blame^] | 15 | struct dentry *unused, struct inode *inode, |
| 16 | const char *name, void *buffer, size_t size) |
Vyacheslav Dubeyko | 127e5f5 | 2013-02-27 17:03:03 -0800 | [diff] [blame] | 17 | { |
Al Viro | b296821 | 2016-04-10 20:48:24 -0400 | [diff] [blame^] | 18 | return hfsplus_getxattr(inode, name, buffer, size, |
Fabian Frederick | a3cef4c | 2015-04-16 12:46:58 -0700 | [diff] [blame] | 19 | XATTR_TRUSTED_PREFIX, |
| 20 | XATTR_TRUSTED_PREFIX_LEN); |
Vyacheslav Dubeyko | 127e5f5 | 2013-02-27 17:03:03 -0800 | [diff] [blame] | 21 | } |
| 22 | |
Andreas Gruenbacher | d9a82a0 | 2015-10-04 19:18:51 +0200 | [diff] [blame] | 23 | static int hfsplus_trusted_setxattr(const struct xattr_handler *handler, |
| 24 | struct dentry *dentry, const char *name, |
| 25 | const void *buffer, size_t size, int flags) |
Vyacheslav Dubeyko | 127e5f5 | 2013-02-27 17:03:03 -0800 | [diff] [blame] | 26 | { |
Fabian Frederick | 5e61473 | 2015-04-16 12:47:01 -0700 | [diff] [blame] | 27 | return hfsplus_setxattr(dentry, name, buffer, size, flags, |
| 28 | XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN); |
Vyacheslav Dubeyko | 127e5f5 | 2013-02-27 17:03:03 -0800 | [diff] [blame] | 29 | } |
| 30 | |
Vyacheslav Dubeyko | 127e5f5 | 2013-02-27 17:03:03 -0800 | [diff] [blame] | 31 | const struct xattr_handler hfsplus_xattr_trusted_handler = { |
| 32 | .prefix = XATTR_TRUSTED_PREFIX, |
Vyacheslav Dubeyko | 127e5f5 | 2013-02-27 17:03:03 -0800 | [diff] [blame] | 33 | .get = hfsplus_trusted_getxattr, |
| 34 | .set = hfsplus_trusted_setxattr, |
| 35 | }; |