FreeBSD/sys/ufs/ufs/ufs_acl.c
/*
 * Retrieve the ACL on a file.
 *
 * As part of the ACL is stored in the inode, and the rest in an EA,
 * assemble both into a final ACL product.  Right now this is not done
 * very efficiently.
 */
Retrieve the ACL on a file.
As part of the ACL is stored in the inode, and the rest in an EA,
assemble both into a final ACL product.  Right now this is not done
very efficiently.
Retrieve the ACL on a file . As part of the ACL is stored in the inode and the rest in an EA assemble both into a final ACL product . Right now this is not done very efficiently .
static int
ufs_getacl_posix1e(struct vop_getacl_args *ap)
{
	struct inode *ip = VTOI(ap->a_vp);
	int error;
	struct oldacl *old;
	if ((ap->a_vp->v_mount->mnt_flag & MNT_ACLS) == 0)
		return (EINVAL);
	old = malloc(sizeof(*old), M_ACL, M_WAITOK | M_ZERO);
	error = ufs_get_oldacl(ap->a_type, old, ap->a_vp, ap->a_td);
	switch (error) {
	case ENOATTR:
		switch (ap->a_type) {
		case ACL_TYPE_ACCESS:
			old->acl_cnt = 3;
			old->acl_entry[0].ae_tag = ACL_USER_OBJ;
			old->acl_entry[0].ae_id = ACL_UNDEFINED_ID;
			old->acl_entry[0].ae_perm = ACL_PERM_NONE;
			old->acl_entry[1].ae_tag = ACL_GROUP_OBJ;
			old->acl_entry[1].ae_id = ACL_UNDEFINED_ID;
			old->acl_entry[1].ae_perm = ACL_PERM_NONE;
			old->acl_entry[2].ae_tag = ACL_OTHER;
			old->acl_entry[2].ae_id = ACL_UNDEFINED_ID;
			old->acl_entry[2].ae_perm = ACL_PERM_NONE;
			break;
		case ACL_TYPE_DEFAULT:
			old->acl_cnt = 0;
			break;
		}
	case 0:
		error = acl_copy_oldacl_into_acl(old, ap->a_aclp);
		if (error != 0)
			break;
		if (ap->a_type == ACL_TYPE_ACCESS)
			ufs_sync_acl_from_inode(ip, ap->a_aclp);
	default:
		break;
	}
	free(old, M_ACL);
	return (error);
}
static int ufs_getacl_posix1e ( struct vop_getacl_args * ap ) { struct inode * ip = VTOI ( ap -> a_vp ) ; int error ; struct oldacl * old ; if ( ( ap -> a_vp -> v_mount -> mnt_flag & MNT_ACLS ) == 0 ) return ( EINVAL ) ; old = malloc ( sizeof ( * old ) , M_ACL , M_WAITOK | M_ZERO ) ; error = ufs_get_oldacl ( ap -> a_type , old , ap -> a_vp , ap -> a_td ) ; switch ( error ) { case ENOATTR : switch ( ap -> a_type ) { case ACL_TYPE_ACCESS : old -> acl_cnt = 3 ; old -> acl_entry [ 0 ] . ae_tag = ACL_USER_OBJ ; old -> acl_entry [ 0 ] . ae_id = ACL_UNDEFINED_ID ; old -> acl_entry [ 0 ] . ae_perm = ACL_PERM_NONE ; old -> acl_entry [ 1 ] . ae_tag = ACL_GROUP_OBJ ; old -> acl_entry [ 1 ] . ae_id = ACL_UNDEFINED_ID ; old -> acl_entry [ 1 ] . ae_perm = ACL_PERM_NONE ; old -> acl_entry [ 2 ] . ae_tag = ACL_OTHER ; old -> acl_entry [ 2 ] . ae_id = ACL_UNDEFINED_ID ; old -> acl_entry [ 2 ] . ae_perm = ACL_PERM_NONE ; break ; case ACL_TYPE_DEFAULT : old -> acl_cnt = 0 ; break ; } case 0 : error = acl_copy_oldacl_into_acl ( old , ap -> a_aclp ) ; if ( error != 0 ) break ; if ( ap -> a_type == ACL_TYPE_ACCESS ) ufs_sync_acl_from_inode ( ip , ap -> a_aclp ) ; default : break ; } free ( old , M_ACL ) ; return ( error ) ; }
Retrieve the ACL on a file.
Retrieve the ACL on a file .
/*
	 * XXX: If ufs_getacl() should work on file systems not supporting
	 * ACLs, remove this check.
	 */ /*
	 * Attempt to retrieve the ACL from the extended attributes.
	 */ /*
	 * XXX: If ufs_getacl() should work on filesystems
	 * without the EA configured, add case EOPNOTSUPP here.
	 */ /*
			 * Legitimately no ACL set on object, purely
			 * emulate it through the inode.  These fields will
			 * be updated when the ACL is synchronized with
			 * the inode later.
			 */ /*
			 * Unlike ACL_TYPE_ACCESS, there is no relationship
			 * between the inode contents and the ACL, and it is
			 * therefore possible for the request for the ACL
			 * to fail since the ACL is undefined.  In this
			 * situation, return success and an empty ACL,
			 * as required by POSIX.1e.
			 */ /* FALLTHROUGH */