+/*
+ * Return root of a filesystem
+ */
+ufs_root(mp, vpp)
+ struct mount *mp;
+ struct vnode **vpp;
+{
+ struct inode tip, *ip;
+ int error;
+
+ tip.i_dev = VFSTOUFS(mp)->um_dev;
+ tip.i_vnode.v_mount = mp;
+ error = iget(&tip, (ino_t)ROOTINO, &ip);
+ if (error)
+ return (error);
+ *vpp = ITOV(ip);
+ return (0);
+}
+
+/*
+ * Get file system statistics.
+ */
+ufs_statfs(mp, sbp)
+ struct mount *mp;
+ register struct statfs *sbp;
+{
+ register struct ufsmount *ump;
+ register struct fs *fs;
+
+ ump = VFSTOUFS(mp);
+ fs = ump->um_fs;
+ if (fs->fs_magic != FS_MAGIC)
+ panic("ufs_statfs");
+ sbp->f_type = MOUNT_UFS;
+ sbp->f_flags = mp->m_flag &~ (M_MLOCK|M_MWAIT);
+ sbp->f_fsize = fs->fs_fsize;
+ sbp->f_bsize = fs->fs_bsize;
+ sbp->f_blocks = fs->fs_dsize;
+ sbp->f_bfree = fs->fs_cstotal.cs_nbfree * fs->fs_frag +
+ fs->fs_cstotal.cs_nffree;
+ sbp->f_bavail = (fs->fs_dsize * (100 - fs->fs_minfree) / 100) -
+ (fs->fs_dsize - sbp->f_bfree);
+ if (sbp->f_bavail < 0)
+ sbp->f_bavail = 0;
+ sbp->f_files = fs->fs_ncg * fs->fs_ipg;
+ sbp->f_ffree = fs->fs_cstotal.cs_nifree;
+ sbp->f_fsid = mp->m_fsid;
+ bcopy((caddr_t)fs->fs_fsmnt, (caddr_t)&sbp->f_mntonname[0], MNAMELEN);
+ bcopy((caddr_t)ump->um_mntname, (caddr_t)&sbp->f_mntfromname[0],
+ MNAMELEN);
+ return (0);
+}
+
+int syncprt = 0;
+
+/*
+ * Go through the disk queues to initiate sandbagged IO;
+ * go through the inodes to write those that have been modified;
+ * initiate the writing of the super block if it has been modified.
+ */
+ufs_sync(mp, waitfor)