Home | History | Annotate | Line # | Download | only in mfs
mfs_vnops.c revision 1.22
      1  1.22   thorpej /*	$NetBSD: mfs_vnops.c,v 1.22 2000/05/16 17:20:23 thorpej Exp $	*/
      2  1.22   thorpej 
      3  1.22   thorpej /*-
      4  1.22   thorpej  * Copyright (c) 2000 The NetBSD Foundation, Inc.
      5  1.22   thorpej  * All rights reserved.
      6  1.22   thorpej  *
      7  1.22   thorpej  * This code is derived from software contributed to The NetBSD Foundation
      8  1.22   thorpej  * by Jason R. Thorpe of Zembu Labs, Inc.
      9  1.22   thorpej  *
     10  1.22   thorpej  * Redistribution and use in source and binary forms, with or without
     11  1.22   thorpej  * modification, are permitted provided that the following conditions
     12  1.22   thorpej  * are met:
     13  1.22   thorpej  * 1. Redistributions of source code must retain the above copyright
     14  1.22   thorpej  *    notice, this list of conditions and the following disclaimer.
     15  1.22   thorpej  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.22   thorpej  *    notice, this list of conditions and the following disclaimer in the
     17  1.22   thorpej  *    documentation and/or other materials provided with the distribution.
     18  1.22   thorpej  * 3. All advertising materials mentioning features or use of this software
     19  1.22   thorpej  *    must display the following acknowledgement:
     20  1.22   thorpej  *	This product includes software developed by the NetBSD
     21  1.22   thorpej  *	Foundation, Inc. and its contributors.
     22  1.22   thorpej  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  1.22   thorpej  *    contributors may be used to endorse or promote products derived
     24  1.22   thorpej  *    from this software without specific prior written permission.
     25  1.22   thorpej  *
     26  1.22   thorpej  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  1.22   thorpej  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  1.22   thorpej  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  1.22   thorpej  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  1.22   thorpej  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  1.22   thorpej  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  1.22   thorpej  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  1.22   thorpej  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  1.22   thorpej  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  1.22   thorpej  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  1.22   thorpej  * POSSIBILITY OF SUCH DAMAGE.
     37  1.22   thorpej  */
     38   1.3       cgd 
     39   1.1   mycroft /*
     40   1.1   mycroft  * Copyright (c) 1989, 1993
     41   1.1   mycroft  *	The Regents of the University of California.  All rights reserved.
     42   1.1   mycroft  *
     43   1.1   mycroft  * Redistribution and use in source and binary forms, with or without
     44   1.1   mycroft  * modification, are permitted provided that the following conditions
     45   1.1   mycroft  * are met:
     46   1.1   mycroft  * 1. Redistributions of source code must retain the above copyright
     47   1.1   mycroft  *    notice, this list of conditions and the following disclaimer.
     48   1.1   mycroft  * 2. Redistributions in binary form must reproduce the above copyright
     49   1.1   mycroft  *    notice, this list of conditions and the following disclaimer in the
     50   1.1   mycroft  *    documentation and/or other materials provided with the distribution.
     51   1.1   mycroft  * 3. All advertising materials mentioning features or use of this software
     52   1.1   mycroft  *    must display the following acknowledgement:
     53   1.1   mycroft  *	This product includes software developed by the University of
     54   1.1   mycroft  *	California, Berkeley and its contributors.
     55   1.1   mycroft  * 4. Neither the name of the University nor the names of its contributors
     56   1.1   mycroft  *    may be used to endorse or promote products derived from this software
     57   1.1   mycroft  *    without specific prior written permission.
     58   1.1   mycroft  *
     59   1.1   mycroft  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     60   1.1   mycroft  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     61   1.1   mycroft  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     62   1.1   mycroft  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     63   1.1   mycroft  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     64   1.1   mycroft  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     65   1.1   mycroft  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     66   1.1   mycroft  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     67   1.1   mycroft  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     68   1.1   mycroft  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     69   1.1   mycroft  * SUCH DAMAGE.
     70   1.1   mycroft  *
     71  1.13      fvdl  *	@(#)mfs_vnops.c	8.11 (Berkeley) 5/22/95
     72   1.1   mycroft  */
     73   1.1   mycroft 
     74   1.1   mycroft #include <sys/param.h>
     75   1.1   mycroft #include <sys/systm.h>
     76   1.1   mycroft #include <sys/time.h>
     77   1.1   mycroft #include <sys/kernel.h>
     78   1.1   mycroft #include <sys/proc.h>
     79   1.1   mycroft #include <sys/buf.h>
     80   1.1   mycroft #include <sys/map.h>
     81   1.1   mycroft #include <sys/vnode.h>
     82   1.1   mycroft #include <sys/malloc.h>
     83  1.22   thorpej #include <sys/uio.h>
     84  1.22   thorpej 
     85  1.22   thorpej #include <vm/vm.h>
     86  1.22   thorpej #include <uvm/uvm_extern.h>
     87   1.1   mycroft 
     88   1.9   mycroft #include <miscfs/genfs/genfs.h>
     89   1.1   mycroft #include <miscfs/specfs/specdev.h>
     90   1.1   mycroft 
     91   1.1   mycroft #include <ufs/mfs/mfsnode.h>
     92   1.1   mycroft #include <ufs/mfs/mfs_extern.h>
     93   1.1   mycroft 
     94   1.1   mycroft /*
     95   1.1   mycroft  * mfs vnode operations.
     96   1.1   mycroft  */
     97   1.6  christos int (**mfs_vnodeop_p) __P((void *));
     98   1.1   mycroft struct vnodeopv_entry_desc mfs_vnodeop_entries[] = {
     99   1.1   mycroft 	{ &vop_default_desc, vn_default_error },
    100   1.1   mycroft 	{ &vop_lookup_desc, mfs_lookup },		/* lookup */
    101   1.1   mycroft 	{ &vop_create_desc, mfs_create },		/* create */
    102   1.1   mycroft 	{ &vop_mknod_desc, mfs_mknod },			/* mknod */
    103   1.1   mycroft 	{ &vop_open_desc, mfs_open },			/* open */
    104   1.1   mycroft 	{ &vop_close_desc, mfs_close },			/* close */
    105   1.1   mycroft 	{ &vop_access_desc, mfs_access },		/* access */
    106   1.1   mycroft 	{ &vop_getattr_desc, mfs_getattr },		/* getattr */
    107   1.1   mycroft 	{ &vop_setattr_desc, mfs_setattr },		/* setattr */
    108   1.1   mycroft 	{ &vop_read_desc, mfs_read },			/* read */
    109   1.1   mycroft 	{ &vop_write_desc, mfs_write },			/* write */
    110   1.1   mycroft 	{ &vop_ioctl_desc, mfs_ioctl },			/* ioctl */
    111  1.10   mycroft 	{ &vop_poll_desc, mfs_poll },			/* poll */
    112  1.13      fvdl 	{ &vop_revoke_desc, mfs_revoke },		/* revoke */
    113   1.1   mycroft 	{ &vop_mmap_desc, mfs_mmap },			/* mmap */
    114   1.1   mycroft 	{ &vop_fsync_desc, spec_fsync },		/* fsync */
    115   1.1   mycroft 	{ &vop_seek_desc, mfs_seek },			/* seek */
    116   1.1   mycroft 	{ &vop_remove_desc, mfs_remove },		/* remove */
    117   1.1   mycroft 	{ &vop_link_desc, mfs_link },			/* link */
    118   1.1   mycroft 	{ &vop_rename_desc, mfs_rename },		/* rename */
    119   1.1   mycroft 	{ &vop_mkdir_desc, mfs_mkdir },			/* mkdir */
    120   1.1   mycroft 	{ &vop_rmdir_desc, mfs_rmdir },			/* rmdir */
    121   1.1   mycroft 	{ &vop_symlink_desc, mfs_symlink },		/* symlink */
    122   1.1   mycroft 	{ &vop_readdir_desc, mfs_readdir },		/* readdir */
    123   1.1   mycroft 	{ &vop_readlink_desc, mfs_readlink },		/* readlink */
    124   1.1   mycroft 	{ &vop_abortop_desc, mfs_abortop },		/* abortop */
    125   1.1   mycroft 	{ &vop_inactive_desc, mfs_inactive },		/* inactive */
    126   1.1   mycroft 	{ &vop_reclaim_desc, mfs_reclaim },		/* reclaim */
    127   1.1   mycroft 	{ &vop_lock_desc, mfs_lock },			/* lock */
    128   1.1   mycroft 	{ &vop_unlock_desc, mfs_unlock },		/* unlock */
    129   1.1   mycroft 	{ &vop_bmap_desc, mfs_bmap },			/* bmap */
    130   1.1   mycroft 	{ &vop_strategy_desc, mfs_strategy },		/* strategy */
    131   1.1   mycroft 	{ &vop_print_desc, mfs_print },			/* print */
    132   1.1   mycroft 	{ &vop_islocked_desc, mfs_islocked },		/* islocked */
    133   1.1   mycroft 	{ &vop_pathconf_desc, mfs_pathconf },		/* pathconf */
    134   1.1   mycroft 	{ &vop_advlock_desc, mfs_advlock },		/* advlock */
    135   1.1   mycroft 	{ &vop_blkatoff_desc, mfs_blkatoff },		/* blkatoff */
    136   1.1   mycroft 	{ &vop_valloc_desc, mfs_valloc },		/* valloc */
    137   1.1   mycroft 	{ &vop_vfree_desc, mfs_vfree },			/* vfree */
    138   1.1   mycroft 	{ &vop_truncate_desc, mfs_truncate },		/* truncate */
    139   1.1   mycroft 	{ &vop_update_desc, mfs_update },		/* update */
    140   1.1   mycroft 	{ &vop_bwrite_desc, mfs_bwrite },		/* bwrite */
    141   1.6  christos 	{ (struct vnodeop_desc*)NULL, (int(*) __P((void *)))NULL }
    142   1.1   mycroft };
    143   1.1   mycroft struct vnodeopv_desc mfs_vnodeop_opv_desc =
    144   1.1   mycroft 	{ &mfs_vnodeop_p, mfs_vnodeop_entries };
    145   1.1   mycroft 
    146   1.1   mycroft /*
    147   1.1   mycroft  * Vnode Operations.
    148   1.1   mycroft  *
    149   1.1   mycroft  * Open called to allow memory filesystem to initialize and
    150   1.1   mycroft  * validate before actual IO. Record our process identifier
    151   1.1   mycroft  * so we can tell when we are doing I/O to ourself.
    152   1.1   mycroft  */
    153   1.1   mycroft /* ARGSUSED */
    154   1.1   mycroft int
    155   1.6  christos mfs_open(v)
    156   1.6  christos 	void *v;
    157   1.6  christos {
    158   1.1   mycroft 	struct vop_open_args /* {
    159   1.1   mycroft 		struct vnode *a_vp;
    160   1.1   mycroft 		int  a_mode;
    161   1.1   mycroft 		struct ucred *a_cred;
    162   1.1   mycroft 		struct proc *a_p;
    163   1.6  christos 	} */ *ap = v;
    164   1.1   mycroft 
    165   1.1   mycroft 	if (ap->a_vp->v_type != VBLK) {
    166   1.1   mycroft 		panic("mfs_ioctl not VBLK");
    167   1.1   mycroft 		/* NOTREACHED */
    168   1.1   mycroft 	}
    169   1.1   mycroft 	return (0);
    170   1.1   mycroft }
    171   1.1   mycroft 
    172   1.1   mycroft /*
    173   1.1   mycroft  * Pass I/O requests to the memory filesystem process.
    174   1.1   mycroft  */
    175   1.1   mycroft int
    176   1.6  christos mfs_strategy(v)
    177   1.6  christos 	void *v;
    178   1.6  christos {
    179   1.1   mycroft 	struct vop_strategy_args /* {
    180   1.1   mycroft 		struct buf *a_bp;
    181   1.6  christos 	} */ *ap = v;
    182  1.20  augustss 	struct buf *bp = ap->a_bp;
    183  1.20  augustss 	struct mfsnode *mfsp;
    184   1.1   mycroft 	struct vnode *vp;
    185  1.22   thorpej 	struct proc *p;
    186  1.22   thorpej 	struct uio auio;
    187  1.22   thorpej 	struct iovec aiov;
    188  1.22   thorpej 	caddr_t base;
    189   1.1   mycroft 
    190   1.1   mycroft 	if (!vfinddev(bp->b_dev, VBLK, &vp) || vp->v_usecount == 0)
    191   1.1   mycroft 		panic("mfs_strategy: bad dev");
    192  1.22   thorpej 
    193   1.1   mycroft 	mfsp = VTOMFS(vp);
    194  1.22   thorpej 	p = mfsp->mfs_proc;
    195  1.22   thorpej 
    196  1.22   thorpej 	bp->b_error = 0;
    197  1.22   thorpej 
    198  1.22   thorpej 	base = mfsp->mfs_baseoff + (bp->b_blkno << DEV_BSHIFT);
    199  1.22   thorpej 
    200  1.22   thorpej 	/*
    201  1.22   thorpej 	 * We have to preserve order, so what we do here is put
    202  1.22   thorpej 	 * ourselves on the end of the queue and then wait for
    203  1.22   thorpej 	 * our buffer to bubble to the front.  This is necessary
    204  1.22   thorpej 	 * in case we sleep faulting in the pages for the I/O
    205  1.22   thorpej 	 * and another process comes in to do I/O while we're
    206  1.22   thorpej 	 * sleeping.
    207  1.22   thorpej 	 *
    208  1.22   thorpej 	 * The fact that our buffer is still at the front of
    209  1.22   thorpej 	 * the queue while we process the I/O serves as a
    210  1.22   thorpej 	 * mutex.
    211  1.22   thorpej 	 */
    212  1.22   thorpej 	BUFQ_INSERT_TAIL(&mfsp->mfs_buflist, bp);
    213  1.22   thorpej 	while (BUFQ_FIRST(&mfsp->mfs_buflist) != bp)
    214  1.22   thorpej 		(void) tsleep(&mfsp->mfs_buflist, PRIBIO,
    215  1.22   thorpej 		    "mfsio", 0);
    216  1.22   thorpej 
    217  1.21   thorpej 	if (mfsp->mfs_proc == NULL) {
    218  1.22   thorpej 		/*
    219  1.22   thorpej 		 * Access to kernel-space miniroot.
    220  1.22   thorpej 		 */
    221   1.1   mycroft 		if (bp->b_flags & B_READ)
    222  1.14     perry 			memcpy(bp->b_data, base, bp->b_bcount);
    223   1.1   mycroft 		else
    224  1.14     perry 			memcpy(base, bp->b_data, bp->b_bcount);
    225  1.22   thorpej 	} else if (mfsp->mfs_proc == curproc) {
    226  1.22   thorpej 		/*
    227  1.22   thorpej 		 * The MFS server process is doing the I/O itself
    228  1.22   thorpej 		 * (possibly unmounting the file system).  Do the
    229  1.22   thorpej 		 * I/O to the address space directly.
    230  1.22   thorpej 		 */
    231  1.22   thorpej 		if (bp->b_flags & B_READ)
    232  1.22   thorpej 			bp->b_error = copyin(base, bp->b_data, bp->b_bcount);
    233  1.22   thorpej 		else
    234  1.22   thorpej 			bp->b_error = copyout(bp->b_data, base, bp->b_bcount);
    235   1.1   mycroft 	} else {
    236  1.22   thorpej 		aiov.iov_base = bp->b_data;
    237  1.22   thorpej 		aiov.iov_len = bp->b_bcount;
    238  1.22   thorpej 
    239  1.22   thorpej 		auio.uio_iov = &aiov;
    240  1.22   thorpej 		auio.uio_iovcnt = 1;
    241  1.22   thorpej 		auio.uio_offset = (vaddr_t)base;
    242  1.22   thorpej 		auio.uio_resid = bp->b_bcount;
    243  1.22   thorpej 		auio.uio_segflg = UIO_SYSSPACE;
    244  1.22   thorpej 		auio.uio_rw = (bp->b_flags & B_READ) ? UIO_READ : UIO_WRITE;
    245  1.22   thorpej 		auio.uio_procp = p;
    246  1.22   thorpej 
    247  1.22   thorpej 		/* XXXCDC: how should locking work here? */
    248  1.22   thorpej 		if ((p->p_flag & P_WEXIT) || (p->p_vmspace->vm_refcnt < 1)) {
    249  1.22   thorpej 			bp->b_error = EFAULT;
    250  1.22   thorpej 			goto out;
    251  1.22   thorpej 		}
    252  1.22   thorpej 
    253  1.22   thorpej 		/*
    254  1.22   thorpej 		 * XXX I don't think PHOLD()/PRELE() is really necessary,
    255  1.22   thorpej 		 * XXX here.  --thorpej
    256  1.22   thorpej 		 */
    257  1.22   thorpej 
    258  1.22   thorpej 		PHOLD(p);			/* XXX */
    259  1.22   thorpej 		p->p_vmspace->vm_refcnt++;	/* XXX */
    260  1.22   thorpej 		bp->b_error = uvm_io(&p->p_vmspace->vm_map, &auio);
    261  1.22   thorpej 		PRELE(p);			/* XXX */
    262  1.22   thorpej 		p->p_vmspace->vm_refcnt--;	/* XXX */
    263   1.1   mycroft 	}
    264  1.22   thorpej  out:
    265  1.22   thorpej 	if (bp->b_error != 0)
    266   1.1   mycroft 		bp->b_flags |= B_ERROR;
    267  1.16       chs 	else
    268  1.16       chs 		bp->b_resid = 0;
    269  1.22   thorpej 
    270  1.22   thorpej 	/*
    271  1.22   thorpej 	 * Pull our buffer off the front of the queue, thereby releasing
    272  1.22   thorpej 	 * the mutex, and awaken any threads waiting to do I/O.
    273  1.22   thorpej 	 */
    274  1.22   thorpej 	BUFQ_REMOVE(&mfsp->mfs_buflist, bp);
    275  1.22   thorpej 	if (BUFQ_FIRST(&mfsp->mfs_buflist) != NULL)
    276  1.22   thorpej 		wakeup(&mfsp->mfs_buflist);
    277  1.22   thorpej 
    278   1.1   mycroft 	biodone(bp);
    279  1.22   thorpej 	return (0);
    280   1.1   mycroft }
    281   1.1   mycroft 
    282   1.1   mycroft /*
    283   1.1   mycroft  * This is a noop, simply returning what one has been given.
    284   1.1   mycroft  */
    285   1.1   mycroft int
    286   1.6  christos mfs_bmap(v)
    287   1.6  christos 	void *v;
    288   1.6  christos {
    289   1.1   mycroft 	struct vop_bmap_args /* {
    290   1.1   mycroft 		struct vnode *a_vp;
    291   1.1   mycroft 		daddr_t  a_bn;
    292   1.1   mycroft 		struct vnode **a_vpp;
    293   1.1   mycroft 		daddr_t *a_bnp;
    294   1.1   mycroft 		int *a_runp;
    295   1.6  christos 	} */ *ap = v;
    296   1.1   mycroft 
    297   1.1   mycroft 	if (ap->a_vpp != NULL)
    298   1.1   mycroft 		*ap->a_vpp = ap->a_vp;
    299   1.1   mycroft 	if (ap->a_bnp != NULL)
    300   1.1   mycroft 		*ap->a_bnp = ap->a_bn;
    301  1.13      fvdl 	if (ap->a_runp != NULL)
    302  1.13      fvdl 		 *ap->a_runp = 0;
    303   1.1   mycroft 	return (0);
    304   1.1   mycroft }
    305   1.1   mycroft 
    306   1.1   mycroft /*
    307   1.1   mycroft  * Memory filesystem close routine
    308   1.1   mycroft  */
    309   1.1   mycroft /* ARGSUSED */
    310   1.1   mycroft int
    311   1.6  christos mfs_close(v)
    312   1.6  christos 	void *v;
    313   1.6  christos {
    314   1.1   mycroft 	struct vop_close_args /* {
    315   1.1   mycroft 		struct vnode *a_vp;
    316   1.1   mycroft 		int  a_fflag;
    317   1.1   mycroft 		struct ucred *a_cred;
    318   1.1   mycroft 		struct proc *a_p;
    319   1.6  christos 	} */ *ap = v;
    320  1.20  augustss 	struct vnode *vp = ap->a_vp;
    321  1.20  augustss 	struct mfsnode *mfsp = VTOMFS(vp);
    322   1.1   mycroft 	int error;
    323   1.1   mycroft 
    324   1.1   mycroft 	/*
    325   1.1   mycroft 	 * On last close of a memory filesystem
    326   1.1   mycroft 	 * we must invalidate any in core blocks, so that
    327   1.1   mycroft 	 * we can, free up its vnode.
    328   1.1   mycroft 	 */
    329   1.6  christos 	if ((error = vinvalbuf(vp, 1, ap->a_cred, ap->a_p, 0, 0)) != 0)
    330   1.1   mycroft 		return (error);
    331   1.1   mycroft 	/*
    332   1.1   mycroft 	 * There should be no way to have any more uses of this
    333   1.1   mycroft 	 * vnode, so if we find any other uses, it is a panic.
    334   1.1   mycroft 	 */
    335   1.1   mycroft 	if (vp->v_usecount > 1)
    336  1.18   mycroft 		printf("mfs_close: ref count %ld > 1\n", vp->v_usecount);
    337  1.19   thorpej 	if (vp->v_usecount > 1 || BUFQ_FIRST(&mfsp->mfs_buflist) != NULL)
    338   1.1   mycroft 		panic("mfs_close");
    339   1.1   mycroft 	/*
    340   1.1   mycroft 	 * Send a request to the filesystem server to exit.
    341   1.1   mycroft 	 */
    342  1.22   thorpej 	mfsp->mfs_alive = 0;
    343  1.22   thorpej 	wakeup((void *)&mfsp->mfs_alive);
    344   1.1   mycroft 	return (0);
    345   1.1   mycroft }
    346   1.1   mycroft 
    347   1.1   mycroft /*
    348   1.1   mycroft  * Memory filesystem inactive routine
    349   1.1   mycroft  */
    350   1.1   mycroft /* ARGSUSED */
    351   1.1   mycroft int
    352   1.6  christos mfs_inactive(v)
    353   1.6  christos 	void *v;
    354   1.6  christos {
    355   1.1   mycroft 	struct vop_inactive_args /* {
    356   1.1   mycroft 		struct vnode *a_vp;
    357  1.13      fvdl 		struct proc *a_p;
    358   1.6  christos 	} */ *ap = v;
    359  1.13      fvdl 	struct vnode *vp = ap->a_vp;
    360  1.13      fvdl 	struct mfsnode *mfsp = VTOMFS(vp);
    361   1.1   mycroft 
    362  1.22   thorpej 	if (BUFQ_FIRST(&mfsp->mfs_buflist) != NULL)
    363   1.8  christos 		panic("mfs_inactive: not inactive (mfs_buflist %p)",
    364  1.19   thorpej 			BUFQ_FIRST(&mfsp->mfs_buflist));
    365  1.13      fvdl 	VOP_UNLOCK(vp, 0);
    366   1.1   mycroft 	return (0);
    367   1.1   mycroft }
    368   1.1   mycroft 
    369   1.1   mycroft /*
    370   1.1   mycroft  * Reclaim a memory filesystem devvp so that it can be reused.
    371   1.1   mycroft  */
    372   1.1   mycroft int
    373   1.6  christos mfs_reclaim(v)
    374   1.6  christos 	void *v;
    375   1.6  christos {
    376   1.1   mycroft 	struct vop_reclaim_args /* {
    377   1.1   mycroft 		struct vnode *a_vp;
    378   1.6  christos 	} */ *ap = v;
    379  1.20  augustss 	struct vnode *vp = ap->a_vp;
    380   1.1   mycroft 
    381   1.1   mycroft 	FREE(vp->v_data, M_MFSNODE);
    382   1.1   mycroft 	vp->v_data = NULL;
    383   1.1   mycroft 	return (0);
    384   1.1   mycroft }
    385   1.1   mycroft 
    386   1.1   mycroft /*
    387   1.1   mycroft  * Print out the contents of an mfsnode.
    388   1.1   mycroft  */
    389   1.1   mycroft int
    390   1.6  christos mfs_print(v)
    391   1.6  christos 	void *v;
    392   1.6  christos {
    393   1.1   mycroft 	struct vop_print_args /* {
    394   1.1   mycroft 		struct vnode *a_vp;
    395   1.6  christos 	} */ *ap = v;
    396  1.20  augustss 	struct mfsnode *mfsp = VTOMFS(ap->a_vp);
    397   1.1   mycroft 
    398  1.21   thorpej 	printf("tag VT_MFS, pid %d, base %p, size %ld\n",
    399  1.21   thorpej 	    (mfsp->mfs_proc != NULL) ? mfsp->mfs_proc->p_pid : 0,
    400   1.8  christos 	    mfsp->mfs_baseoff, mfsp->mfs_size);
    401   1.1   mycroft 	return (0);
    402   1.1   mycroft }
    403