-#ifdef KERNEL
-/*
- * Getfs maps a device number into a pointer to the incore super block.
- *
- * The algorithm is a linear search through the mount table. A
- * consistency check of the super block magic number is performed.
- *
- * panic: no fs -- the device is not mounted.
- * this "cannot happen"
- */
-struct fs *
-getfs(dev)
- dev_t dev;
-{
- register struct mount *mp;
- register struct fs *fs;
-
- for (mp = &mount[0]; mp < &mount[NMOUNT]; mp++) {
- if (mp->m_bufp == NULL || mp->m_dev != dev)
- continue;
- fs = mp->m_bufp->b_un.b_fs;
- if (fs->fs_magic != FS_MAGIC) {
- printf("dev = 0x%x, fs = %s\n", dev, fs->fs_fsmnt);
- panic("getfs: bad magic");
- }
- return (fs);
- }
- printf("dev = 0x%x\n", dev);
- panic("getfs: no fs");
- return (NULL);
-}
-
-/*
- * 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);
-}
-
-/*
- * Print out statistics on the current allocation of the buffer pool.
- * Can be enabled to print out on every ``sync'' by setting "syncprt"
- * above.
- */
-bufstats()
-{
- int s, i, j, count;
- register struct buf *bp, *dp;
- int counts[MAXBSIZE/CLBYTES+1];
- static char *bname[BQUEUES] = { "LOCKED", "LRU", "AGE", "EMPTY" };
-
- for (bp = bfreelist, i = 0; bp < &bfreelist[BQUEUES]; bp++, i++) {
- count = 0;
- for (j = 0; j <= MAXBSIZE/CLBYTES; j++)
- counts[j] = 0;
- s = splbio();
- for (dp = bp->av_forw; dp != bp; dp = dp->av_forw) {
- counts[dp->b_bufsize/CLBYTES]++;
- count++;
- }
- splx(s);
- printf("%s: total-%d", bname[i], count);
- for (j = 0; j <= MAXBSIZE/CLBYTES; j++)
- if (counts[j] != 0)
- printf(", %d-%d", j * CLBYTES, counts[j]);
- printf("\n");
- }
-}
-#endif
-
-#if (!defined(vax) && !defined(tahoe)) || defined(VAX630)