FreeBSD/sys/ufs/ufs/ufs_acl.c
/*
 * Synchronize an ACL and an inode by copying over appropriate inode fields
 * to the passed ACL.  Assumes an ACL that would satisfy acl_posix1e_check(),
 * and may panic if not.
 */
Synchronize an ACL and an inode by copying over appropriate inode fields
to the passed ACL.  Assumes an ACL that would satisfy acl_posix1e_check(),
and may panic if not.
Synchronize an ACL and an inode by copying over appropriate inode fields to the passed ACL . Assumes an ACL that would satisfy acl_posix1e_check () and may panic if not .
void
ufs_sync_acl_from_inode(struct inode *ip, struct acl *acl)
{
	struct acl_entry	*acl_mask, *acl_group_obj;
	int	i;
	acl_mask = NULL;
	acl_group_obj = NULL;
	for (i = 0; i < acl->acl_cnt; i++) {
		switch (acl->acl_entry[i].ae_tag) {
		case ACL_USER_OBJ:
			acl->acl_entry[i].ae_perm = acl_posix1e_mode_to_perm(
			    ACL_USER_OBJ, ip->i_mode);
			acl->acl_entry[i].ae_id = ACL_UNDEFINED_ID;
			break;
		case ACL_GROUP_OBJ:
			acl_group_obj = &acl->acl_entry[i];
			acl->acl_entry[i].ae_id = ACL_UNDEFINED_ID;
			break;
		case ACL_OTHER:
			acl->acl_entry[i].ae_perm = acl_posix1e_mode_to_perm(
			    ACL_OTHER, ip->i_mode);
			acl->acl_entry[i].ae_id = ACL_UNDEFINED_ID;
			break;
		case ACL_MASK:
			acl_mask = &acl->acl_entry[i];
			acl->acl_entry[i].ae_id = ACL_UNDEFINED_ID;
			break;
		case ACL_USER:
		case ACL_GROUP:
			break;
		default:
			panic("ufs_sync_acl_from_inode(): bad ae_tag");
		}
	}
	if (acl_group_obj == NULL)
		panic("ufs_sync_acl_from_inode(): no ACL_GROUP_OBJ");
	if (acl_mask == NULL) {
		acl_group_obj->ae_perm = acl_posix1e_mode_to_perm(
		    ACL_GROUP_OBJ, ip->i_mode);
	} else {
		acl_mask->ae_perm = acl_posix1e_mode_to_perm(ACL_GROUP_OBJ,
		    ip->i_mode);
	}
}
void ufs_sync_acl_from_inode ( struct inode * ip , struct acl * acl ) { struct acl_entry * acl_mask , * acl_group_obj ; int i ; acl_mask = NULL ; acl_group_obj = NULL ; for ( i = 0 ; i < acl -> acl_cnt ; i ++ ) { switch ( acl -> acl_entry [ i ] . ae_tag ) { case ACL_USER_OBJ : acl -> acl_entry [ i ] . ae_perm = acl_posix1e_mode_to_perm ( ACL_USER_OBJ , ip -> i_mode ) ; acl -> acl_entry [ i ] . ae_id = ACL_UNDEFINED_ID ; break ; case ACL_GROUP_OBJ : acl_group_obj = & acl -> acl_entry [ i ] ; acl -> acl_entry [ i ] . ae_id = ACL_UNDEFINED_ID ; break ; case ACL_OTHER : acl -> acl_entry [ i ] . ae_perm = acl_posix1e_mode_to_perm ( ACL_OTHER , ip -> i_mode ) ; acl -> acl_entry [ i ] . ae_id = ACL_UNDEFINED_ID ; break ; case ACL_MASK : acl_mask = & acl -> acl_entry [ i ] ; acl -> acl_entry [ i ] . ae_id = ACL_UNDEFINED_ID ; break ; case ACL_USER : case ACL_GROUP : break ; default : panic ( " " ) ; } } if ( acl_group_obj == NULL ) panic ( " " ) ; if ( acl_mask == NULL ) { acl_group_obj -> ae_perm = acl_posix1e_mode_to_perm ( ACL_GROUP_OBJ , ip -> i_mode ) ; } else { acl_mask -> ae_perm = acl_posix1e_mode_to_perm ( ACL_GROUP_OBJ , ip -> i_mode ) ; } }
Synchronize an ACL and an inode by copying over appropriate inode fields
 to the passed ACL.
Synchronize an ACL and an inode by copying over appropriate inode fields to the passed ACL .
/*
	 * Update ACL_USER_OBJ, ACL_OTHER, but simply identify ACL_MASK
	 * and ACL_GROUP_OBJ for use after we know whether ACL_MASK is
	 * present.
	 */ /*
		 * There is no ACL_MASK, so update ACL_GROUP_OBJ.
		 */ /*
		 * Update the ACL_MASK entry instead of ACL_GROUP_OBJ.
		 */