- printf("%s: %s\n", fs->fs_fsmnt, cp);
-}
-
-/*
- * Getfsx returns the index in the file system
- * table of the specified device. The swap device
- * is also assigned a pseudo-index. The index may
- * be used as a compressed indication of the location
- * of a block, recording
- * <getfsx(dev),blkno>
- * rather than
- * <dev, blkno>
- * provided the information need remain valid only
- * as long as the file system is mounted.
- */
-getfsx(dev)
- dev_t dev;
-{
- register struct mount *mp;
-
- if (dev == swapdev)
- return (MSWAPX);
- for(mp = &mount[0]; mp < &mount[NMOUNT]; mp++)
- if (mp->m_dev == dev)
- return (mp - &mount[0]);
- return (-1);
-}
-
-/*
- * Update is the internal name of 'sync'. It goes through the disk
- * queues to initiate sandbagged IO; goes through the inodes to write
- * modified nodes; and it goes through the mount table to initiate modified
- * super blocks.
- */
-update()
-{
- register struct inode *ip;
- register struct mount *mp;
- register struct buf *bp;
- struct fs *fs;
- time_t tim;
- int i, blks;
-
- if (updlock)
- return;
- updlock++;
- /*
- * Write back modified superblocks.
- * Consistency check that the superblock
- * of each file system is still in the buffer cache.
- */
- for (mp = &mount[0]; mp < &mount[NMOUNT]; mp++)
- if (mp->m_bufp != NULL) {
- fs = mp->m_bufp->b_un.b_fs;
- if (fs->fs_fmod == 0)
- continue;
- if (fs->fs_ronly != 0)
- panic("update: rofs mod");
- bp = getblk(mp->m_dev, SBLOCK, BSIZE);
- fs->fs_fmod = 0;
- fs->fs_time = TIME;
- if (bp->b_un.b_fs != fs)
- panic("update: bad b_fs");
- bwrite(bp);
- blks = howmany(cssize(fs), BSIZE);
- for (i = 0; i < blks; i++) {
- bp = getblk(mp->m_dev, csaddr(fs) + (i * FRAG),
- BSIZE);
- bwrite(bp);
- }
- }
- /*
- * Write back each (modified) inode.
- */
- for (ip = inode; ip < inodeNINODE; ip++)
- if((ip->i_flag&ILOCK)==0 && ip->i_count) {
- ip->i_flag |= ILOCK;
- ip->i_count++;
- tim = TIME;
- iupdat(ip, &tim, &tim, 0);
- iput(ip);
- }
- updlock = 0;
- /*
- * Force stale buffer cache information to be flushed,
- * for all devices.
- */
- bflush(NODEV);