sys/vfs/union/union_vnops.c
static int
union_create(struct vop_old_create_args *ap)
{
	struct union_node *dun = VTOUNION(ap->a_dvp);
	struct componentname *cnp = ap->a_cnp;
	struct thread *td = cnp->cn_td;
	struct vnode *dvp;
	int error = EROFS;

	if ((dvp = union_lock_upper(dun, td)) != NULL) {
		struct vnode *vp;
		struct mount *mp;

		error = VOP_CREATE(dvp, &vp, cnp, ap->a_vap);
		if (error == 0) {
			mp = ap->a_dvp->v_mount;
			vn_unlock(vp);
			UDEBUG(("ALLOCVP-1 FROM %p REFS %d\n", vp, vp->v_sysref.refcnt));
			error = union_allocvp(ap->a_vpp, mp, NULLVP, NULLVP,
				cnp, vp, NULLVP, 1);
			UDEBUG(("ALLOCVP-2B FROM %p REFS %d\n", *ap->a_vpp, vp->v_sysref.refcnt));
		}
		union_unlock_upper(dvp, td);
	}
	return (error);
}
/*
 * 	union_create:
 *
 * a_dvp is locked on entry and remains locked on return.  a_vpp is returned
 * locked if no error occurs, otherwise it is garbage.
 *
 * union_create(struct vnode *a_dvp, struct vnode **a_vpp,
 *		struct componentname *a_cnp, struct vattr *a_vap)
 */
a_dvp is locked on entry and remains locked on return.  a_vpp is returned
locked if no error occurs, otherwise it is garbage.


a_dvp is locked on entry and remains locked on return . a_vpp is returned locked if no error occurs otherwise it is garbage .
static int
union_create(struct vop_old_create_args *ap)
{
	struct union_node *dun = VTOUNION(ap->a_dvp);
	struct componentname *cnp = ap->a_cnp;
	struct thread *td = cnp->cn_td;
	struct vnode *dvp;
	int error = EROFS;
	if ((dvp = union_lock_upper(dun, td)) != NULL) {
		struct vnode *vp;
		struct mount *mp;
		error = VOP_CREATE(dvp, &vp, cnp, ap->a_vap);
		if (error == 0) {
			mp = ap->a_dvp->v_mount;
			vn_unlock(vp);
			UDEBUG(("ALLOCVP-1 FROM %p REFS %d\n", vp, vp->v_sysref.refcnt));
			error = union_allocvp(ap->a_vpp, mp, NULLVP, NULLVP,
				cnp, vp, NULLVP, 1);
			UDEBUG(("ALLOCVP-2B FROM %p REFS %d\n", *ap->a_vpp, vp->v_sysref.refcnt));
		}
		union_unlock_upper(dvp, td);
	}
	return (error);
}
static int union_create ( struct vop_old_create_args * ap ) { struct union_node * dun = VTOUNION ( ap -> a_dvp ) ; struct componentname * cnp = ap -> a_cnp ; struct thread * td = cnp -> cn_td ; struct vnode * dvp ; int error = EROFS ; if ( ( dvp = union_lock_upper ( dun , td ) ) != NULL ) { struct vnode * vp ; struct mount * mp ; error = VOP_CREATE ( dvp , & vp , cnp , ap -> a_vap ) ; if ( error == 0 ) { mp = ap -> a_dvp -> v_mount ; vn_unlock ( vp ) ; UDEBUG ( ( " \n " , vp , vp -> v_sysref . refcnt ) ) ; error = union_allocvp ( ap -> a_vpp , mp , NULLVP , NULLVP , cnp , vp , NULLVP , 1 ) ; UDEBUG ( ( " \n " , * ap -> a_vpp , vp -> v_sysref . refcnt ) ) ; } union_unlock_upper ( dvp , td ) ; } return ( error ) ; }
union_create:
 a_dvp is locked on entry and remains locked on return.
union_create : a_dvp is locked on entry and remains locked on return .