xattr_security.c (498495dba268b20e8eadd7fe93c140c68b6cc9d2) xattr_security.c (f168d9fd634a4612d308d7dbe0a4d2a9b366c045)
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 storing security labels as extended attributes.
8 */
9
10#include <linux/security.h>
11#include <linux/nls.h>
12
13#include "hfsplus_fs.h"
14#include "xattr.h"
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 storing security labels as extended attributes.
8 */
9
10#include <linux/security.h>
11#include <linux/nls.h>
12
13#include "hfsplus_fs.h"
14#include "xattr.h"
15#include "acl.h"
16
17static int hfsplus_security_getxattr(const struct xattr_handler *handler,
18 struct dentry *unused, struct inode *inode,
19 const char *name, void *buffer, size_t size)
20{
21 return hfsplus_getxattr(inode, name, buffer, size,
22 XATTR_SECURITY_PREFIX,
23 XATTR_SECURITY_PREFIX_LEN);

--- 43 unchanged lines hidden (view full) ---

67
68int hfsplus_init_security(struct inode *inode, struct inode *dir,
69 const struct qstr *qstr)
70{
71 return security_inode_init_security(inode, dir, qstr,
72 &hfsplus_initxattrs, NULL);
73}
74
15
16static int hfsplus_security_getxattr(const struct xattr_handler *handler,
17 struct dentry *unused, struct inode *inode,
18 const char *name, void *buffer, size_t size)
19{
20 return hfsplus_getxattr(inode, name, buffer, size,
21 XATTR_SECURITY_PREFIX,
22 XATTR_SECURITY_PREFIX_LEN);

--- 43 unchanged lines hidden (view full) ---

66
67int hfsplus_init_security(struct inode *inode, struct inode *dir,
68 const struct qstr *qstr)
69{
70 return security_inode_init_security(inode, dir, qstr,
71 &hfsplus_initxattrs, NULL);
72}
73
75int hfsplus_init_inode_security(struct inode *inode,
76 struct inode *dir,
77 const struct qstr *qstr)
78{
79 int err;
80
81 err = hfsplus_init_posix_acl(inode, dir);
82 if (!err)
83 err = hfsplus_init_security(inode, dir, qstr);
84 return err;
85}
86
87const struct xattr_handler hfsplus_xattr_security_handler = {
88 .prefix = XATTR_SECURITY_PREFIX,
89 .get = hfsplus_security_getxattr,
90 .set = hfsplus_security_setxattr,
91};
74const struct xattr_handler hfsplus_xattr_security_handler = {
75 .prefix = XATTR_SECURITY_PREFIX,
76 .get = hfsplus_security_getxattr,
77 .set = hfsplus_security_setxattr,
78};