Home | History | Annotate | Line # | Download | only in mfs
mfs_vnops.c revision 1.1
      1  1.1  mycroft /*
      2  1.1  mycroft  * Copyright (c) 1989, 1993
      3  1.1  mycroft  *	The Regents of the University of California.  All rights reserved.
      4  1.1  mycroft  *
      5  1.1  mycroft  * Redistribution and use in source and binary forms, with or without
      6  1.1  mycroft  * modification, are permitted provided that the following conditions
      7  1.1  mycroft  * are met:
      8  1.1  mycroft  * 1. Redistributions of source code must retain the above copyright
      9  1.1  mycroft  *    notice, this list of conditions and the following disclaimer.
     10  1.1  mycroft  * 2. Redistributions in binary form must reproduce the above copyright
     11  1.1  mycroft  *    notice, this list of conditions and the following disclaimer in the
     12  1.1  mycroft  *    documentation and/or other materials provided with the distribution.
     13  1.1  mycroft  * 3. All advertising materials mentioning features or use of this software
     14  1.1  mycroft  *    must display the following acknowledgement:
     15  1.1  mycroft  *	This product includes software developed by the University of
     16  1.1  mycroft  *	California, Berkeley and its contributors.
     17  1.1  mycroft  * 4. Neither the name of the University nor the names of its contributors
     18  1.1  mycroft  *    may be used to endorse or promote products derived from this software
     19  1.1  mycroft  *    without specific prior written permission.
     20  1.1  mycroft  *
     21  1.1  mycroft  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     22  1.1  mycroft  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     23  1.1  mycroft  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     24  1.1  mycroft  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     25  1.1  mycroft  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     26  1.1  mycroft  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     27  1.1  mycroft  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     28  1.1  mycroft  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     29  1.1  mycroft  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     30  1.1  mycroft  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     31  1.1  mycroft  * SUCH DAMAGE.
     32  1.1  mycroft  *
     33  1.1  mycroft  *	from: @(#)mfs_vnops.c	8.3 (Berkeley) 9/21/93
     34  1.1  mycroft  *	$Id: mfs_vnops.c,v 1.1 1994/06/08 11:42:57 mycroft Exp $
     35  1.1  mycroft  */
     36  1.1  mycroft 
     37  1.1  mycroft #include <sys/param.h>
     38  1.1  mycroft #include <sys/systm.h>
     39  1.1  mycroft #include <sys/time.h>
     40  1.1  mycroft #include <sys/kernel.h>
     41  1.1  mycroft #include <sys/proc.h>
     42  1.1  mycroft #include <sys/buf.h>
     43  1.1  mycroft #include <sys/map.h>
     44  1.1  mycroft #include <sys/vnode.h>
     45  1.1  mycroft #include <sys/malloc.h>
     46  1.1  mycroft 
     47  1.1  mycroft #include <miscfs/specfs/specdev.h>
     48  1.1  mycroft 
     49  1.1  mycroft #include <machine/vmparam.h>
     50  1.1  mycroft 
     51  1.1  mycroft #include <ufs/mfs/mfsnode.h>
     52  1.1  mycroft #include <ufs/mfs/mfsiom.h>
     53  1.1  mycroft #include <ufs/mfs/mfs_extern.h>
     54  1.1  mycroft 
     55  1.1  mycroft #if !defined(hp300) && !defined(i386) && !defined(mips) && !defined(sparc) && !defined(luna68k)
     56  1.1  mycroft static int mfsmap_want;		/* 1 => need kernel I/O resources */
     57  1.1  mycroft struct map mfsmap[MFS_MAPSIZE];
     58  1.1  mycroft extern char mfsiobuf[];
     59  1.1  mycroft #endif
     60  1.1  mycroft 
     61  1.1  mycroft /*
     62  1.1  mycroft  * mfs vnode operations.
     63  1.1  mycroft  */
     64  1.1  mycroft int (**mfs_vnodeop_p)();
     65  1.1  mycroft struct vnodeopv_entry_desc mfs_vnodeop_entries[] = {
     66  1.1  mycroft 	{ &vop_default_desc, vn_default_error },
     67  1.1  mycroft 	{ &vop_lookup_desc, mfs_lookup },		/* lookup */
     68  1.1  mycroft 	{ &vop_create_desc, mfs_create },		/* create */
     69  1.1  mycroft 	{ &vop_mknod_desc, mfs_mknod },			/* mknod */
     70  1.1  mycroft 	{ &vop_open_desc, mfs_open },			/* open */
     71  1.1  mycroft 	{ &vop_close_desc, mfs_close },			/* close */
     72  1.1  mycroft 	{ &vop_access_desc, mfs_access },		/* access */
     73  1.1  mycroft 	{ &vop_getattr_desc, mfs_getattr },		/* getattr */
     74  1.1  mycroft 	{ &vop_setattr_desc, mfs_setattr },		/* setattr */
     75  1.1  mycroft 	{ &vop_read_desc, mfs_read },			/* read */
     76  1.1  mycroft 	{ &vop_write_desc, mfs_write },			/* write */
     77  1.1  mycroft 	{ &vop_ioctl_desc, mfs_ioctl },			/* ioctl */
     78  1.1  mycroft 	{ &vop_select_desc, mfs_select },		/* select */
     79  1.1  mycroft 	{ &vop_mmap_desc, mfs_mmap },			/* mmap */
     80  1.1  mycroft 	{ &vop_fsync_desc, spec_fsync },		/* fsync */
     81  1.1  mycroft 	{ &vop_seek_desc, mfs_seek },			/* seek */
     82  1.1  mycroft 	{ &vop_remove_desc, mfs_remove },		/* remove */
     83  1.1  mycroft 	{ &vop_link_desc, mfs_link },			/* link */
     84  1.1  mycroft 	{ &vop_rename_desc, mfs_rename },		/* rename */
     85  1.1  mycroft 	{ &vop_mkdir_desc, mfs_mkdir },			/* mkdir */
     86  1.1  mycroft 	{ &vop_rmdir_desc, mfs_rmdir },			/* rmdir */
     87  1.1  mycroft 	{ &vop_symlink_desc, mfs_symlink },		/* symlink */
     88  1.1  mycroft 	{ &vop_readdir_desc, mfs_readdir },		/* readdir */
     89  1.1  mycroft 	{ &vop_readlink_desc, mfs_readlink },		/* readlink */
     90  1.1  mycroft 	{ &vop_abortop_desc, mfs_abortop },		/* abortop */
     91  1.1  mycroft 	{ &vop_inactive_desc, mfs_inactive },		/* inactive */
     92  1.1  mycroft 	{ &vop_reclaim_desc, mfs_reclaim },		/* reclaim */
     93  1.1  mycroft 	{ &vop_lock_desc, mfs_lock },			/* lock */
     94  1.1  mycroft 	{ &vop_unlock_desc, mfs_unlock },		/* unlock */
     95  1.1  mycroft 	{ &vop_bmap_desc, mfs_bmap },			/* bmap */
     96  1.1  mycroft 	{ &vop_strategy_desc, mfs_strategy },		/* strategy */
     97  1.1  mycroft 	{ &vop_print_desc, mfs_print },			/* print */
     98  1.1  mycroft 	{ &vop_islocked_desc, mfs_islocked },		/* islocked */
     99  1.1  mycroft 	{ &vop_pathconf_desc, mfs_pathconf },		/* pathconf */
    100  1.1  mycroft 	{ &vop_advlock_desc, mfs_advlock },		/* advlock */
    101  1.1  mycroft 	{ &vop_blkatoff_desc, mfs_blkatoff },		/* blkatoff */
    102  1.1  mycroft 	{ &vop_valloc_desc, mfs_valloc },		/* valloc */
    103  1.1  mycroft 	{ &vop_vfree_desc, mfs_vfree },			/* vfree */
    104  1.1  mycroft 	{ &vop_truncate_desc, mfs_truncate },		/* truncate */
    105  1.1  mycroft 	{ &vop_update_desc, mfs_update },		/* update */
    106  1.1  mycroft 	{ &vop_bwrite_desc, mfs_bwrite },		/* bwrite */
    107  1.1  mycroft 	{ (struct vnodeop_desc*)NULL, (int(*)())NULL }
    108  1.1  mycroft };
    109  1.1  mycroft struct vnodeopv_desc mfs_vnodeop_opv_desc =
    110  1.1  mycroft 	{ &mfs_vnodeop_p, mfs_vnodeop_entries };
    111  1.1  mycroft 
    112  1.1  mycroft /*
    113  1.1  mycroft  * Vnode Operations.
    114  1.1  mycroft  *
    115  1.1  mycroft  * Open called to allow memory filesystem to initialize and
    116  1.1  mycroft  * validate before actual IO. Record our process identifier
    117  1.1  mycroft  * so we can tell when we are doing I/O to ourself.
    118  1.1  mycroft  */
    119  1.1  mycroft /* ARGSUSED */
    120  1.1  mycroft int
    121  1.1  mycroft mfs_open(ap)
    122  1.1  mycroft 	struct vop_open_args /* {
    123  1.1  mycroft 		struct vnode *a_vp;
    124  1.1  mycroft 		int  a_mode;
    125  1.1  mycroft 		struct ucred *a_cred;
    126  1.1  mycroft 		struct proc *a_p;
    127  1.1  mycroft 	} */ *ap;
    128  1.1  mycroft {
    129  1.1  mycroft 
    130  1.1  mycroft 	if (ap->a_vp->v_type != VBLK) {
    131  1.1  mycroft 		panic("mfs_ioctl not VBLK");
    132  1.1  mycroft 		/* NOTREACHED */
    133  1.1  mycroft 	}
    134  1.1  mycroft 	return (0);
    135  1.1  mycroft }
    136  1.1  mycroft 
    137  1.1  mycroft /*
    138  1.1  mycroft  * Ioctl operation.
    139  1.1  mycroft  */
    140  1.1  mycroft /* ARGSUSED */
    141  1.1  mycroft int
    142  1.1  mycroft mfs_ioctl(ap)
    143  1.1  mycroft 	struct vop_ioctl_args /* {
    144  1.1  mycroft 		struct vnode *a_vp;
    145  1.1  mycroft 		int  a_command;
    146  1.1  mycroft 		caddr_t  a_data;
    147  1.1  mycroft 		int  a_fflag;
    148  1.1  mycroft 		struct ucred *a_cred;
    149  1.1  mycroft 		struct proc *a_p;
    150  1.1  mycroft 	} */ *ap;
    151  1.1  mycroft {
    152  1.1  mycroft 
    153  1.1  mycroft 	return (ENOTTY);
    154  1.1  mycroft }
    155  1.1  mycroft 
    156  1.1  mycroft /*
    157  1.1  mycroft  * Pass I/O requests to the memory filesystem process.
    158  1.1  mycroft  */
    159  1.1  mycroft int
    160  1.1  mycroft mfs_strategy(ap)
    161  1.1  mycroft 	struct vop_strategy_args /* {
    162  1.1  mycroft 		struct buf *a_bp;
    163  1.1  mycroft 	} */ *ap;
    164  1.1  mycroft {
    165  1.1  mycroft 	register struct buf *bp = ap->a_bp;
    166  1.1  mycroft 	register struct mfsnode *mfsp;
    167  1.1  mycroft 	struct vnode *vp;
    168  1.1  mycroft 	struct proc *p = curproc;		/* XXX */
    169  1.1  mycroft 
    170  1.1  mycroft 	if (!vfinddev(bp->b_dev, VBLK, &vp) || vp->v_usecount == 0)
    171  1.1  mycroft 		panic("mfs_strategy: bad dev");
    172  1.1  mycroft 	mfsp = VTOMFS(vp);
    173  1.1  mycroft 	/* check for mini-root access */
    174  1.1  mycroft 	if (mfsp->mfs_pid == 0) {
    175  1.1  mycroft 		caddr_t base;
    176  1.1  mycroft 
    177  1.1  mycroft 		base = mfsp->mfs_baseoff + (bp->b_blkno << DEV_BSHIFT);
    178  1.1  mycroft 		if (bp->b_flags & B_READ)
    179  1.1  mycroft 			bcopy(base, bp->b_data, bp->b_bcount);
    180  1.1  mycroft 		else
    181  1.1  mycroft 			bcopy(bp->b_data, base, bp->b_bcount);
    182  1.1  mycroft 		biodone(bp);
    183  1.1  mycroft 	} else if (mfsp->mfs_pid == p->p_pid) {
    184  1.1  mycroft 		mfs_doio(bp, mfsp->mfs_baseoff);
    185  1.1  mycroft 	} else {
    186  1.1  mycroft 		bp->b_actf = mfsp->mfs_buflist;
    187  1.1  mycroft 		mfsp->mfs_buflist = bp;
    188  1.1  mycroft 		wakeup((caddr_t)vp);
    189  1.1  mycroft 	}
    190  1.1  mycroft 	return (0);
    191  1.1  mycroft }
    192  1.1  mycroft 
    193  1.1  mycroft #if defined(vax) || defined(tahoe)
    194  1.1  mycroft /*
    195  1.1  mycroft  * Memory file system I/O.
    196  1.1  mycroft  *
    197  1.1  mycroft  * Essentially play ubasetup() and disk interrupt service routine by
    198  1.1  mycroft  * doing the copies to or from the memfs process. If doing physio
    199  1.1  mycroft  * (i.e. pagein), we must map the I/O through the kernel virtual
    200  1.1  mycroft  * address space.
    201  1.1  mycroft  */
    202  1.1  mycroft void
    203  1.1  mycroft mfs_doio(bp, base)
    204  1.1  mycroft 	register struct buf *bp;
    205  1.1  mycroft 	caddr_t base;
    206  1.1  mycroft {
    207  1.1  mycroft 	register struct pte *pte, *ppte;
    208  1.1  mycroft 	register caddr_t vaddr;
    209  1.1  mycroft 	int off, npf, npf2, reg;
    210  1.1  mycroft 	caddr_t kernaddr, offset;
    211  1.1  mycroft 
    212  1.1  mycroft 	/*
    213  1.1  mycroft 	 * For phys I/O, map the b_data into kernel virtual space using
    214  1.1  mycroft 	 * the Mfsiomap pte's.
    215  1.1  mycroft 	 */
    216  1.1  mycroft 	if ((bp->b_flags & B_PHYS) == 0) {
    217  1.1  mycroft 		kernaddr = bp->b_data;
    218  1.1  mycroft 	} else {
    219  1.1  mycroft 		if (bp->b_flags & (B_PAGET | B_UAREA | B_DIRTY))
    220  1.1  mycroft 			panic("swap on memfs?");
    221  1.1  mycroft 		off = (int)bp->b_data & PGOFSET;
    222  1.1  mycroft 		npf = btoc(bp->b_bcount + off);
    223  1.1  mycroft 		/*
    224  1.1  mycroft 		 * Get some mapping page table entries
    225  1.1  mycroft 		 */
    226  1.1  mycroft 		while ((reg = rmalloc(mfsmap, (long)npf)) == 0) {
    227  1.1  mycroft 			mfsmap_want++;
    228  1.1  mycroft 			sleep((caddr_t)&mfsmap_want, PZERO-1);
    229  1.1  mycroft 		}
    230  1.1  mycroft 		reg--;
    231  1.1  mycroft 		pte = vtopte(bp->b_proc, btop(bp->b_data));
    232  1.1  mycroft 		/*
    233  1.1  mycroft 		 * Do vmaccess() but with the Mfsiomap page table.
    234  1.1  mycroft 		 */
    235  1.1  mycroft 		ppte = &Mfsiomap[reg];
    236  1.1  mycroft 		vaddr = &mfsiobuf[reg * NBPG];
    237  1.1  mycroft 		kernaddr = vaddr + off;
    238  1.1  mycroft 		for (npf2 = npf; npf2; npf2--) {
    239  1.1  mycroft 			mapin(ppte, (u_int)vaddr, pte->pg_pfnum,
    240  1.1  mycroft 				(int)(PG_V|PG_KW));
    241  1.1  mycroft #if defined(tahoe)
    242  1.1  mycroft 			if ((bp->b_flags & B_READ) == 0)
    243  1.1  mycroft 				mtpr(P1DC, vaddr);
    244  1.1  mycroft #endif
    245  1.1  mycroft 			ppte++;
    246  1.1  mycroft 			pte++;
    247  1.1  mycroft 			vaddr += NBPG;
    248  1.1  mycroft 		}
    249  1.1  mycroft 	}
    250  1.1  mycroft 	offset = base + (bp->b_blkno << DEV_BSHIFT);
    251  1.1  mycroft 	if (bp->b_flags & B_READ)
    252  1.1  mycroft 		bp->b_error = copyin(offset, kernaddr, bp->b_bcount);
    253  1.1  mycroft 	else
    254  1.1  mycroft 		bp->b_error = copyout(kernaddr, offset, bp->b_bcount);
    255  1.1  mycroft 	if (bp->b_error)
    256  1.1  mycroft 		bp->b_flags |= B_ERROR;
    257  1.1  mycroft 	/*
    258  1.1  mycroft 	 * Release pte's used by physical I/O.
    259  1.1  mycroft 	 */
    260  1.1  mycroft 	if (bp->b_flags & B_PHYS) {
    261  1.1  mycroft 		rmfree(mfsmap, (long)npf, (long)++reg);
    262  1.1  mycroft 		if (mfsmap_want) {
    263  1.1  mycroft 			mfsmap_want = 0;
    264  1.1  mycroft 			wakeup((caddr_t)&mfsmap_want);
    265  1.1  mycroft 		}
    266  1.1  mycroft 	}
    267  1.1  mycroft 	biodone(bp);
    268  1.1  mycroft }
    269  1.1  mycroft #endif	/* vax || tahoe */
    270  1.1  mycroft 
    271  1.1  mycroft #if defined(hp300) || defined(i386) || defined(mips) || defined(sparc) || defined(luna68k)
    272  1.1  mycroft /*
    273  1.1  mycroft  * Memory file system I/O.
    274  1.1  mycroft  *
    275  1.1  mycroft  * Trivial on the HP since buffer has already been mapping into KVA space.
    276  1.1  mycroft  */
    277  1.1  mycroft void
    278  1.1  mycroft mfs_doio(bp, base)
    279  1.1  mycroft 	register struct buf *bp;
    280  1.1  mycroft 	caddr_t base;
    281  1.1  mycroft {
    282  1.1  mycroft 
    283  1.1  mycroft 	base += (bp->b_blkno << DEV_BSHIFT);
    284  1.1  mycroft 	if (bp->b_flags & B_READ)
    285  1.1  mycroft 		bp->b_error = copyin(base, bp->b_data, bp->b_bcount);
    286  1.1  mycroft 	else
    287  1.1  mycroft 		bp->b_error = copyout(bp->b_data, base, bp->b_bcount);
    288  1.1  mycroft 	if (bp->b_error)
    289  1.1  mycroft 		bp->b_flags |= B_ERROR;
    290  1.1  mycroft 	biodone(bp);
    291  1.1  mycroft }
    292  1.1  mycroft #endif
    293  1.1  mycroft 
    294  1.1  mycroft /*
    295  1.1  mycroft  * This is a noop, simply returning what one has been given.
    296  1.1  mycroft  */
    297  1.1  mycroft int
    298  1.1  mycroft mfs_bmap(ap)
    299  1.1  mycroft 	struct vop_bmap_args /* {
    300  1.1  mycroft 		struct vnode *a_vp;
    301  1.1  mycroft 		daddr_t  a_bn;
    302  1.1  mycroft 		struct vnode **a_vpp;
    303  1.1  mycroft 		daddr_t *a_bnp;
    304  1.1  mycroft 		int *a_runp;
    305  1.1  mycroft 	} */ *ap;
    306  1.1  mycroft {
    307  1.1  mycroft 
    308  1.1  mycroft 	if (ap->a_vpp != NULL)
    309  1.1  mycroft 		*ap->a_vpp = ap->a_vp;
    310  1.1  mycroft 	if (ap->a_bnp != NULL)
    311  1.1  mycroft 		*ap->a_bnp = ap->a_bn;
    312  1.1  mycroft 	return (0);
    313  1.1  mycroft }
    314  1.1  mycroft 
    315  1.1  mycroft /*
    316  1.1  mycroft  * Memory filesystem close routine
    317  1.1  mycroft  */
    318  1.1  mycroft /* ARGSUSED */
    319  1.1  mycroft int
    320  1.1  mycroft mfs_close(ap)
    321  1.1  mycroft 	struct vop_close_args /* {
    322  1.1  mycroft 		struct vnode *a_vp;
    323  1.1  mycroft 		int  a_fflag;
    324  1.1  mycroft 		struct ucred *a_cred;
    325  1.1  mycroft 		struct proc *a_p;
    326  1.1  mycroft 	} */ *ap;
    327  1.1  mycroft {
    328  1.1  mycroft 	register struct vnode *vp = ap->a_vp;
    329  1.1  mycroft 	register struct mfsnode *mfsp = VTOMFS(vp);
    330  1.1  mycroft 	register struct buf *bp;
    331  1.1  mycroft 	int error;
    332  1.1  mycroft 
    333  1.1  mycroft 	/*
    334  1.1  mycroft 	 * Finish any pending I/O requests.
    335  1.1  mycroft 	 */
    336  1.1  mycroft 	while (bp = mfsp->mfs_buflist) {
    337  1.1  mycroft 		mfsp->mfs_buflist = bp->b_actf;
    338  1.1  mycroft 		mfs_doio(bp, mfsp->mfs_baseoff);
    339  1.1  mycroft 		wakeup((caddr_t)bp);
    340  1.1  mycroft 	}
    341  1.1  mycroft 	/*
    342  1.1  mycroft 	 * On last close of a memory filesystem
    343  1.1  mycroft 	 * we must invalidate any in core blocks, so that
    344  1.1  mycroft 	 * we can, free up its vnode.
    345  1.1  mycroft 	 */
    346  1.1  mycroft 	if (error = vinvalbuf(vp, 1, ap->a_cred, ap->a_p, 0, 0))
    347  1.1  mycroft 		return (error);
    348  1.1  mycroft 	/*
    349  1.1  mycroft 	 * There should be no way to have any more uses of this
    350  1.1  mycroft 	 * vnode, so if we find any other uses, it is a panic.
    351  1.1  mycroft 	 */
    352  1.1  mycroft 	if (vp->v_usecount > 1)
    353  1.1  mycroft 		printf("mfs_close: ref count %d > 1\n", vp->v_usecount);
    354  1.1  mycroft 	if (vp->v_usecount > 1 || mfsp->mfs_buflist)
    355  1.1  mycroft 		panic("mfs_close");
    356  1.1  mycroft 	/*
    357  1.1  mycroft 	 * Send a request to the filesystem server to exit.
    358  1.1  mycroft 	 */
    359  1.1  mycroft 	mfsp->mfs_buflist = (struct buf *)(-1);
    360  1.1  mycroft 	wakeup((caddr_t)vp);
    361  1.1  mycroft 	return (0);
    362  1.1  mycroft }
    363  1.1  mycroft 
    364  1.1  mycroft /*
    365  1.1  mycroft  * Memory filesystem inactive routine
    366  1.1  mycroft  */
    367  1.1  mycroft /* ARGSUSED */
    368  1.1  mycroft int
    369  1.1  mycroft mfs_inactive(ap)
    370  1.1  mycroft 	struct vop_inactive_args /* {
    371  1.1  mycroft 		struct vnode *a_vp;
    372  1.1  mycroft 	} */ *ap;
    373  1.1  mycroft {
    374  1.1  mycroft 	register struct mfsnode *mfsp = VTOMFS(ap->a_vp);
    375  1.1  mycroft 
    376  1.1  mycroft 	if (mfsp->mfs_buflist && mfsp->mfs_buflist != (struct buf *)(-1))
    377  1.1  mycroft 		panic("mfs_inactive: not inactive (mfs_buflist %x)",
    378  1.1  mycroft 			mfsp->mfs_buflist);
    379  1.1  mycroft 	return (0);
    380  1.1  mycroft }
    381  1.1  mycroft 
    382  1.1  mycroft /*
    383  1.1  mycroft  * Reclaim a memory filesystem devvp so that it can be reused.
    384  1.1  mycroft  */
    385  1.1  mycroft int
    386  1.1  mycroft mfs_reclaim(ap)
    387  1.1  mycroft 	struct vop_reclaim_args /* {
    388  1.1  mycroft 		struct vnode *a_vp;
    389  1.1  mycroft 	} */ *ap;
    390  1.1  mycroft {
    391  1.1  mycroft 	register struct vnode *vp = ap->a_vp;
    392  1.1  mycroft #if 0 /* XXX */
    393  1.1  mycroft 	int error;
    394  1.1  mycroft 
    395  1.1  mycroft 	error = ufs_reclaim(vp);
    396  1.1  mycroft 	if (error)
    397  1.1  mycroft 		return (error);
    398  1.1  mycroft #endif
    399  1.1  mycroft 	FREE(vp->v_data, M_MFSNODE);
    400  1.1  mycroft 	vp->v_data = NULL;
    401  1.1  mycroft 	return (0);
    402  1.1  mycroft }
    403  1.1  mycroft 
    404  1.1  mycroft /*
    405  1.1  mycroft  * Print out the contents of an mfsnode.
    406  1.1  mycroft  */
    407  1.1  mycroft int
    408  1.1  mycroft mfs_print(ap)
    409  1.1  mycroft 	struct vop_print_args /* {
    410  1.1  mycroft 		struct vnode *a_vp;
    411  1.1  mycroft 	} */ *ap;
    412  1.1  mycroft {
    413  1.1  mycroft 	register struct mfsnode *mfsp = VTOMFS(ap->a_vp);
    414  1.1  mycroft 
    415  1.1  mycroft 	printf("tag VT_MFS, pid %d, base %d, size %d\n", mfsp->mfs_pid,
    416  1.1  mycroft 		mfsp->mfs_baseoff, mfsp->mfs_size);
    417  1.1  mycroft 	return (0);
    418  1.1  mycroft }
    419  1.1  mycroft 
    420  1.1  mycroft /*
    421  1.1  mycroft  * Block device bad operation
    422  1.1  mycroft  */
    423  1.1  mycroft int
    424  1.1  mycroft mfs_badop()
    425  1.1  mycroft {
    426  1.1  mycroft 
    427  1.1  mycroft 	panic("mfs_badop called\n");
    428  1.1  mycroft 	/* NOTREACHED */
    429  1.1  mycroft }
    430  1.1  mycroft 
    431  1.1  mycroft /*
    432  1.1  mycroft  * Memory based filesystem initialization.
    433  1.1  mycroft  */
    434  1.1  mycroft mfs_init()
    435  1.1  mycroft {
    436  1.1  mycroft 
    437  1.1  mycroft #if !defined(hp300) && !defined(i386) && !defined(mips) && !defined(sparc) && !defined(luna68k)
    438  1.1  mycroft 	rminit(mfsmap, (long)MFS_MAPREG, (long)1, "mfs mapreg", MFS_MAPSIZE);
    439  1.1  mycroft #endif
    440  1.1  mycroft }
    441