* lustre/llite/xattr_security.c
* Handler for storing security labels as extended attributes.
*/
+
+#include <linux/types.h>
#include <linux/security.h>
+#include <linux/selinux.h>
#include <linux/xattr.h>
#include "llite_internal.h"
ll_initxattrs(struct inode *inode, const struct xattr *xattr_array,
void *fs_info)
{
- const struct xattr_handler *handler;
struct dentry *dentry = fs_info;
const struct xattr *xattr;
int err = 0;
- handler = get_xattr_type(XATTR_SECURITY_PREFIX);
- if (!handler)
- return -ENXIO;
-
for (xattr = xattr_array; xattr->name; xattr++) {
- err = handler->set(handler, dentry, inode, xattr->name,
- xattr->value, xattr->value_len,
- XATTR_CREATE);
+ char *full_name;
+
+ full_name = kasprintf(GFP_KERNEL, "%s%s",
+ XATTR_SECURITY_PREFIX, xattr->name);
+ if (!full_name) {
+ err = -ENOMEM;
+ break;
+ }
+
+ err = __vfs_setxattr(dentry, inode, full_name, xattr->value,
+ xattr->value_len, XATTR_CREATE);
+ kfree(full_name);
if (err < 0)
break;
}