+/*
+ * Unmount system call.
+ *
+ * Note: unmount takes a path to the vnode mounted on as argument,
+ * not special file (as before).
+ */
+unmount()
+{
+ struct a {
+ char *pathp;
+ int flags;
+ } *uap = (struct a *)u.u_ap;
+ register struct vnode *vp;
+ register struct mount *mp;
+ register struct nameidata *ndp = &u.u_nd;
+ struct vnode *coveredvp;
+ int error;
+
+ /*
+ * Must be super user
+ */
+ if (error = suser(u.u_cred, &u.u_acflag))
+ RETURN (error);
+
+ ndp->ni_nameiop = LOOKUP | LOCKLEAF | FOLLOW;
+ ndp->ni_segflg = UIO_USERSPACE;
+ ndp->ni_dirp = uap->pathp;
+ if (error = namei(ndp))
+ RETURN (error);
+ vp = ndp->ni_vp;
+ /*
+ * Must be the root of the filesystem
+ */
+ if ((vp->v_flag & VROOT) == 0) {
+ vput(vp);
+ RETURN (EINVAL);
+ }
+ mp = vp->v_mount;
+ vput(vp);
+ /*
+ * Do the unmount.
+ */
+ coveredvp = mp->m_vnodecovered;
+ if (error = vfs_lock(mp))
+ RETURN (error);
+
+ xumount(mp); /* remove unused sticky files from text table */
+ cache_purgevfs(mp); /* remove cache entries for this file sys */
+ VFS_SYNC(mp, MNT_WAIT);
+
+ error = VFS_UNMOUNT(mp, uap->flags);
+ if (error) {
+ vfs_unlock(mp);
+ } else {
+ vrele(coveredvp);
+ vfs_remove(mp);
+ free((caddr_t)mp, M_MOUNT);
+ }
+ RETURN (error);
+}
+
+/*
+ * Sync system call.
+ * Sync each mounted filesystem.
+ */
+sync()