Exemple #1
0
int
fdesc_unmount(struct mount *mp, int mntflags)
{
	int error;
	int flags = 0;
	struct vnode *rtvp = VFSTOFDESC(mp)->f_root;

	if (mntflags & MNT_FORCE)
		flags |= FORCECLOSE;

	if (rtvp->v_usecount > 1 && (mntflags & MNT_FORCE) == 0)
		return (EBUSY);
	if ((error = vflush(mp, rtvp, flags)) != 0)
		return (error);

	/*
	 * Blow it away for future re-use
	 */
	vgone(rtvp);
	/*
	 * Finally, throw away the fdescmount structure
	 */
	free(mp->mnt_data, M_UFSMNT);	/* XXX */
	mp->mnt_data = NULL;

	return (0);
}
Exemple #2
0
int
fdesc_root(struct mount *mp, struct vnode **vpp)
{
	struct vnode *vp;
	int error;

	/*
	 * Return locked reference to root.
	 */
	vp = VFSTOFDESC(mp)->f_root;
	error = vget(vp, LK_EXCLUSIVE | LK_RETRY);
	if (error == 0)
		*vpp = vp;
	return (error);
}