- return (allerror);
-}
-
-/*
- * Write a superblock and associated information back to disk.
- */
-sbupdate(mp, waitfor)
- struct ufsmount *mp;
- int waitfor;
-{
- register struct fs *fs = mp->um_fs;
- register struct buf *bp;
- int blks;
- caddr_t space;
- int i, size, error = 0;
-
-#ifdef SECSIZE
- bp = getblk(mp->m_dev, (daddr_t)fsbtodb(fs, SBOFF / fs->fs_fsize),
- (int)fs->fs_sbsize, fs->fs_dbsize);
-#else SECSIZE
- bp = getblk(mp->um_devvp, SBLOCK, (int)fs->fs_sbsize);
-#endif SECSIZE
- bcopy((caddr_t)fs, bp->b_un.b_addr, (u_int)fs->fs_sbsize);
- /* Restore compatibility to old file systems. XXX */
- if (fs->fs_postblformat == FS_42POSTBLFMT) /* XXX */
- bp->b_un.b_fs->fs_nrpos = -1; /* XXX */
-#ifdef SECSIZE
-#ifdef tahoe
- /* restore standard fsbtodb shift */
- bp->b_un.b_fs->fs_fsbtodb = fs->fs_sparecon[0];
- bp->b_un.b_fs->fs_sparecon[0] = 0;
-#endif
-#endif SECSIZE
- if (waitfor == MNT_WAIT)
- error = bwrite(bp);
- else
- bawrite(bp);
- blks = howmany(fs->fs_cssize, fs->fs_fsize);
- space = (caddr_t)fs->fs_csp[0];
- for (i = 0; i < blks; i += fs->fs_frag) {
- size = fs->fs_bsize;
- if (i + fs->fs_frag > blks)
- size = (blks - i) * fs->fs_fsize;
-#ifdef SECSIZE
- bp = getblk(mp->m_dev, fsbtodb(fs, fs->fs_csaddr + i), size,
- fs->fs_dbsize);
-#else SECSIZE
- bp = getblk(mp->um_devvp, fsbtodb(fs, fs->fs_csaddr + i), size);
-#endif SECSIZE
- bcopy(space, bp->b_un.b_addr, (u_int)size);
- space += size;
- if (waitfor == MNT_WAIT)
- error = bwrite(bp);
- else
- bawrite(bp);