/* Hook in SELinux. This is not quite correct yet, what we really need here (as we do for default ACLs) is a mechanism by which creation of these attrs can be journalled at inode creation time (along with the inode, of course, such that log replay can't cause these to be lost).  */
STATIC int xfs_init_security(struct inode *inode, struct inode *dir)
/* Hook in SELinux. This is not quite correct yet, what we really need here (as we do for default ACLs) is a mechanism by which creation of these attrs can be journalled at inode creation time (along with the inode, of course, such that log replay can't cause these to be lost).  */
STATIC int xfs_init_security(struct inode *inode, struct inode *dir)
{
	struct xfs_inode *ip = XFS_I(inode);
	size_t		length;
	void		*value;
	char		*name;
	int		error;
	error = security_inode_init_security(inode, dir, &name,
					     &value, &length);
	if (error) {
		if (error == -EOPNOTSUPP)
			return 0;
		return -error;
	}
	error = xfs_attr_set(ip, name, value, length, ATTR_SECURE);
	kfree(name);
	kfree(value);
	return error;
}