FreeBSD/sys/fs/nfsserver/nfs_nfsdport.c
/*
 * Remove a non-directory object.
 */
Remove a non-directory object.
Remove a non - directory object .
int
nfsvno_removesub(struct nameidata *ndp, int is_v4, struct ucred *cred,
    struct thread *p, struct nfsexstuff *exp)
{
	struct vnode *vp;
	int error = 0;
	vp = ndp->ni_vp;
	if (vp->v_type == VDIR)
		error = NFSERR_ISDIR;
	else if (is_v4)
		error = nfsrv_checkremove(vp, 1, p);
	if (!error)
		error = VOP_REMOVE(ndp->ni_dvp, vp, &ndp->ni_cnd);
	if (ndp->ni_dvp == vp)
		vrele(ndp->ni_dvp);
	else
		vput(ndp->ni_dvp);
	vput(vp);
	if ((ndp->ni_cnd.cn_flags & SAVENAME) != 0)
		nfsvno_relpathbuf(ndp);
	NFSEXITCODE(error);
	return (error);
}
int nfsvno_removesub ( struct nameidata * ndp , int is_v4 , struct ucred * cred , struct thread * p , struct nfsexstuff * exp ) { struct vnode * vp ; int error = 0 ; vp = ndp -> ni_vp ; if ( vp -> v_type == VDIR ) error = NFSERR_ISDIR ; else if ( is_v4 ) error = nfsrv_checkremove ( vp , 1 , p ) ; if ( ! error ) error = VOP_REMOVE ( ndp -> ni_dvp , vp , & ndp -> ni_cnd ) ; if ( ndp -> ni_dvp == vp ) vrele ( ndp -> ni_dvp ) ; else vput ( ndp -> ni_dvp ) ; vput ( vp ) ; if ( ( ndp -> ni_cnd . cn_flags & SAVENAME ) != 0 ) nfsvno_relpathbuf ( ndp ) ; NFSEXITCODE ( error ) ; return ( error ) ; }
Remove a non-directory object.
Remove a non - directory object .