FreeBSD/sys/ufs/ufs/ufs_acl.c
/*
 * Set NFSv4 ACL without doing any access checking.  This is required
 * e.g. by the UFS code that implements ACL inheritance, or from
 * ufs_vnops.c:ufs_chmod(), as some of the checks have to be skipped
 * in that case, and others are redundant.
 */
Set NFSv4 ACL without doing any access checking.
Set NFSv4 ACL without doing any access checking .
int
ufs_setacl_nfs4_internal(struct vnode *vp, struct acl *aclp, struct thread *td)
{
	int error;
	mode_t mode;
	struct inode *ip = VTOI(vp);
	KASSERT(acl_nfs4_check(aclp, vp->v_type == VDIR) == 0,
	    ("invalid ACL passed to ufs_setacl_nfs4_internal"));
	if (acl_nfs4_is_trivial(aclp, ip->i_uid)) {
		error = vn_extattr_rm(vp, IO_NODELOCKED,
		    NFS4_ACL_EXTATTR_NAMESPACE, NFS4_ACL_EXTATTR_NAME, td);
		if (error == ENOATTR)
			error = 0;
	} else {
		error = vn_extattr_set(vp, IO_NODELOCKED,
		    NFS4_ACL_EXTATTR_NAMESPACE, NFS4_ACL_EXTATTR_NAME,
		    sizeof(*aclp), (char *) aclp, td);
	}
	if (error == ENOATTR)
		return (EOPNOTSUPP);
	if (error)
		return (error);
	mode = ip->i_mode;
	acl_nfs4_sync_mode_from_acl(&mode, aclp);
	ip->i_mode &= ACL_PRESERVE_MASK;
	ip->i_mode |= mode;
	DIP_SET(ip, i_mode, ip->i_mode);
	ip->i_flag |= IN_CHANGE;
	VN_KNOTE_UNLOCKED(vp, NOTE_ATTRIB);
	error = UFS_UPDATE(vp, 0);
	return (error);
}
int ufs_setacl_nfs4_internal ( struct vnode * vp , struct acl * aclp , struct thread * td ) { int error ; mode_t mode ; struct inode * ip = VTOI ( vp ) ; KASSERT ( acl_nfs4_check ( aclp , vp -> v_type == VDIR ) == 0 , ( " " ) ) ; if ( acl_nfs4_is_trivial ( aclp , ip -> i_uid ) ) { error = vn_extattr_rm ( vp , IO_NODELOCKED , NFS4_ACL_EXTATTR_NAMESPACE , NFS4_ACL_EXTATTR_NAME , td ) ; if ( error == ENOATTR ) error = 0 ; } else { error = vn_extattr_set ( vp , IO_NODELOCKED , NFS4_ACL_EXTATTR_NAMESPACE , NFS4_ACL_EXTATTR_NAME , sizeof ( * aclp ) , ( char * ) aclp , td ) ; } if ( error == ENOATTR ) return ( EOPNOTSUPP ) ; if ( error ) return ( error ) ; mode = ip -> i_mode ; acl_nfs4_sync_mode_from_acl ( & mode , aclp ) ; ip -> i_mode &= ACL_PRESERVE_MASK ; ip -> i_mode |= mode ; DIP_SET ( ip , i_mode , ip -> i_mode ) ; ip -> i_flag |= IN_CHANGE ; VN_KNOTE_UNLOCKED ( vp , NOTE_ATTRIB ) ; error = UFS_UPDATE ( vp , 0 ) ; return ( error ) ; }
Set NFSv4 ACL without doing any access checking.
Set NFSv4 ACL without doing any access checking .
/*
		 * An attempt to remove ACL from a file that didn't have
		 * any extended entries is not an error.
		 */ /*
	 * Map lack of attribute definition in UFS_EXTATTR into lack of
	 * support for ACLs on the filesystem.
	 */