Esempio n. 1
0
int
xfs_check_acl(struct inode *inode, int mask, unsigned int flags)
{
	struct xfs_inode *ip;
	struct posix_acl *acl;
	int error = -EAGAIN;

	ip = XFS_I(inode);
	trace_xfs_check_acl(ip);

	/*
	 * If there is no attribute fork no ACL exists on this inode and
	 * we can skip the whole exercise.
	 */
	if (!XFS_IFORK_Q(ip))
		return -EAGAIN;

	if (flags & IPERM_FLAG_RCU) {
		if (!negative_cached_acl(inode, ACL_TYPE_ACCESS))
			return -ECHILD;
		return -EAGAIN;
	}

	acl = xfs_get_acl(inode, ACL_TYPE_ACCESS);
	if (IS_ERR(acl))
		return PTR_ERR(acl);
	if (acl) {
		error = posix_acl_permission(inode, acl, mask);
		posix_acl_release(acl);
	}

	return error;
}
Esempio n. 2
0
int
generic_check_acl(struct inode *inode, int mask, unsigned int flags)
{
    if (flags & IPERM_FLAG_RCU) {
        if (!negative_cached_acl(inode, ACL_TYPE_ACCESS))
            return -ECHILD;
    } else {
        struct posix_acl *acl;

        acl = get_cached_acl(inode, ACL_TYPE_ACCESS);
        if (acl) {
            int error = posix_acl_permission(inode, acl, mask);
            posix_acl_release(acl);
            return error;
        }
    }
    return -EAGAIN;
}
Esempio n. 3
0
int
ext3_check_acl(struct inode *inode, int mask, unsigned int flags)
{
	struct posix_acl *acl;

	if (flags & IPERM_FLAG_RCU) {
		if (!negative_cached_acl(inode, ACL_TYPE_ACCESS))
			return -ECHILD;
		return -EAGAIN;
	}

	acl = ext3_get_acl(inode, ACL_TYPE_ACCESS);
	if (IS_ERR(acl))
		return PTR_ERR(acl);
	if (acl) {
		int error = posix_acl_permission(inode, acl, mask);
		posix_acl_release(acl);
		return error;
	}

	return -EAGAIN;
}