Home | History | Annotate | Line # | Download | only in nullfs
null_vnops.c revision 1.5
      1  1.5  christos /*	$NetBSD: null_vnops.c,v 1.5 1996/02/09 22:40:34 christos Exp $	*/
      2  1.2       cgd 
      3  1.1   mycroft /*
      4  1.1   mycroft  * Copyright (c) 1992, 1993
      5  1.1   mycroft  *	The Regents of the University of California.  All rights reserved.
      6  1.1   mycroft  *
      7  1.1   mycroft  * This code is derived from software contributed to Berkeley by
      8  1.1   mycroft  * John Heidemann of the UCLA Ficus project.
      9  1.1   mycroft  *
     10  1.1   mycroft  * Redistribution and use in source and binary forms, with or without
     11  1.1   mycroft  * modification, are permitted provided that the following conditions
     12  1.1   mycroft  * are met:
     13  1.1   mycroft  * 1. Redistributions of source code must retain the above copyright
     14  1.1   mycroft  *    notice, this list of conditions and the following disclaimer.
     15  1.1   mycroft  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.1   mycroft  *    notice, this list of conditions and the following disclaimer in the
     17  1.1   mycroft  *    documentation and/or other materials provided with the distribution.
     18  1.1   mycroft  * 3. All advertising materials mentioning features or use of this software
     19  1.1   mycroft  *    must display the following acknowledgement:
     20  1.1   mycroft  *	This product includes software developed by the University of
     21  1.1   mycroft  *	California, Berkeley and its contributors.
     22  1.1   mycroft  * 4. Neither the name of the University nor the names of its contributors
     23  1.1   mycroft  *    may be used to endorse or promote products derived from this software
     24  1.1   mycroft  *    without specific prior written permission.
     25  1.1   mycroft  *
     26  1.1   mycroft  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     27  1.1   mycroft  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     28  1.1   mycroft  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     29  1.1   mycroft  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     30  1.1   mycroft  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     31  1.1   mycroft  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     32  1.1   mycroft  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     33  1.1   mycroft  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     34  1.1   mycroft  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     35  1.1   mycroft  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     36  1.1   mycroft  * SUCH DAMAGE.
     37  1.1   mycroft  *
     38  1.2       cgd  *	@(#)null_vnops.c	8.1 (Berkeley) 6/10/93
     39  1.1   mycroft  *
     40  1.1   mycroft  * Ancestors:
     41  1.1   mycroft  *	@(#)lofs_vnops.c	1.2 (Berkeley) 6/18/92
     42  1.1   mycroft  *	Id: lofs_vnops.c,v 1.11 1992/05/30 10:05:43 jsp Exp
     43  1.1   mycroft  *	...and...
     44  1.1   mycroft  *	@(#)null_vnodeops.c 1.20 92/07/07 UCLA Ficus project
     45  1.1   mycroft  */
     46  1.1   mycroft 
     47  1.1   mycroft /*
     48  1.1   mycroft  * Null Layer
     49  1.1   mycroft  *
     50  1.1   mycroft  * (See mount_null(8) for more information.)
     51  1.1   mycroft  *
     52  1.1   mycroft  * The null layer duplicates a portion of the file system
     53  1.1   mycroft  * name space under a new name.  In this respect, it is
     54  1.1   mycroft  * similar to the loopback file system.  It differs from
     55  1.1   mycroft  * the loopback fs in two respects:  it is implemented using
     56  1.1   mycroft  * a stackable layers techniques, and it's "null-node"s stack above
     57  1.1   mycroft  * all lower-layer vnodes, not just over directory vnodes.
     58  1.1   mycroft  *
     59  1.1   mycroft  * The null layer has two purposes.  First, it serves as a demonstration
     60  1.1   mycroft  * of layering by proving a layer which does nothing.  (It actually
     61  1.1   mycroft  * does everything the loopback file system does, which is slightly
     62  1.1   mycroft  * more than nothing.)  Second, the null layer can serve as a prototype
     63  1.1   mycroft  * layer.  Since it provides all necessary layer framework,
     64  1.1   mycroft  * new file system layers can be created very easily be starting
     65  1.1   mycroft  * with a null layer.
     66  1.1   mycroft  *
     67  1.1   mycroft  * The remainder of this man page examines the null layer as a basis
     68  1.1   mycroft  * for constructing new layers.
     69  1.1   mycroft  *
     70  1.1   mycroft  *
     71  1.1   mycroft  * INSTANTIATING NEW NULL LAYERS
     72  1.1   mycroft  *
     73  1.1   mycroft  * New null layers are created with mount_null(8).
     74  1.1   mycroft  * Mount_null(8) takes two arguments, the pathname
     75  1.1   mycroft  * of the lower vfs (target-pn) and the pathname where the null
     76  1.1   mycroft  * layer will appear in the namespace (alias-pn).  After
     77  1.1   mycroft  * the null layer is put into place, the contents
     78  1.1   mycroft  * of target-pn subtree will be aliased under alias-pn.
     79  1.1   mycroft  *
     80  1.1   mycroft  *
     81  1.1   mycroft  * OPERATION OF A NULL LAYER
     82  1.1   mycroft  *
     83  1.1   mycroft  * The null layer is the minimum file system layer,
     84  1.1   mycroft  * simply bypassing all possible operations to the lower layer
     85  1.1   mycroft  * for processing there.  The majority of its activity centers
     86  1.1   mycroft  * on the bypass routine, though which nearly all vnode operations
     87  1.1   mycroft  * pass.
     88  1.1   mycroft  *
     89  1.1   mycroft  * The bypass routine accepts arbitrary vnode operations for
     90  1.1   mycroft  * handling by the lower layer.  It begins by examing vnode
     91  1.1   mycroft  * operation arguments and replacing any null-nodes by their
     92  1.1   mycroft  * lower-layer equivlants.  It then invokes the operation
     93  1.1   mycroft  * on the lower layer.  Finally, it replaces the null-nodes
     94  1.1   mycroft  * in the arguments and, if a vnode is return by the operation,
     95  1.1   mycroft  * stacks a null-node on top of the returned vnode.
     96  1.1   mycroft  *
     97  1.1   mycroft  * Although bypass handles most operations,
     98  1.1   mycroft  * vop_getattr, _inactive, _reclaim, and _print are not bypassed.
     99  1.1   mycroft  * Vop_getattr must change the fsid being returned.
    100  1.1   mycroft  * Vop_inactive and vop_reclaim are not bypassed so that
    101  1.1   mycroft  * they can handle freeing null-layer specific data.
    102  1.1   mycroft  * Vop_print is not bypassed to avoid excessive debugging
    103  1.1   mycroft  * information.
    104  1.1   mycroft  *
    105  1.1   mycroft  *
    106  1.1   mycroft  * INSTANTIATING VNODE STACKS
    107  1.1   mycroft  *
    108  1.1   mycroft  * Mounting associates the null layer with a lower layer,
    109  1.1   mycroft  * effect stacking two VFSes.  Vnode stacks are instead
    110  1.1   mycroft  * created on demand as files are accessed.
    111  1.1   mycroft  *
    112  1.1   mycroft  * The initial mount creates a single vnode stack for the
    113  1.1   mycroft  * root of the new null layer.  All other vnode stacks
    114  1.1   mycroft  * are created as a result of vnode operations on
    115  1.1   mycroft  * this or other null vnode stacks.
    116  1.1   mycroft  *
    117  1.1   mycroft  * New vnode stacks come into existance as a result of
    118  1.1   mycroft  * an operation which returns a vnode.
    119  1.1   mycroft  * The bypass routine stacks a null-node above the new
    120  1.1   mycroft  * vnode before returning it to the caller.
    121  1.1   mycroft  *
    122  1.1   mycroft  * For example, imagine mounting a null layer with
    123  1.1   mycroft  * "mount_null /usr/include /dev/layer/null".
    124  1.1   mycroft  * Changing directory to /dev/layer/null will assign
    125  1.1   mycroft  * the root null-node (which was created when the null layer was mounted).
    126  1.1   mycroft  * Now consider opening "sys".  A vop_lookup would be
    127  1.1   mycroft  * done on the root null-node.  This operation would bypass through
    128  1.1   mycroft  * to the lower layer which would return a vnode representing
    129  1.1   mycroft  * the UFS "sys".  Null_bypass then builds a null-node
    130  1.1   mycroft  * aliasing the UFS "sys" and returns this to the caller.
    131  1.1   mycroft  * Later operations on the null-node "sys" will repeat this
    132  1.1   mycroft  * process when constructing other vnode stacks.
    133  1.1   mycroft  *
    134  1.1   mycroft  *
    135  1.1   mycroft  * CREATING OTHER FILE SYSTEM LAYERS
    136  1.1   mycroft  *
    137  1.1   mycroft  * One of the easiest ways to construct new file system layers is to make
    138  1.1   mycroft  * a copy of the null layer, rename all files and variables, and
    139  1.1   mycroft  * then begin modifing the copy.  Sed can be used to easily rename
    140  1.1   mycroft  * all variables.
    141  1.1   mycroft  *
    142  1.1   mycroft  * The umap layer is an example of a layer descended from the
    143  1.1   mycroft  * null layer.
    144  1.1   mycroft  *
    145  1.1   mycroft  *
    146  1.1   mycroft  * INVOKING OPERATIONS ON LOWER LAYERS
    147  1.1   mycroft  *
    148  1.1   mycroft  * There are two techniques to invoke operations on a lower layer
    149  1.1   mycroft  * when the operation cannot be completely bypassed.  Each method
    150  1.1   mycroft  * is appropriate in different situations.  In both cases,
    151  1.1   mycroft  * it is the responsibility of the aliasing layer to make
    152  1.1   mycroft  * the operation arguments "correct" for the lower layer
    153  1.1   mycroft  * by mapping an vnode arguments to the lower layer.
    154  1.1   mycroft  *
    155  1.1   mycroft  * The first approach is to call the aliasing layer's bypass routine.
    156  1.1   mycroft  * This method is most suitable when you wish to invoke the operation
    157  1.1   mycroft  * currently being hanldled on the lower layer.  It has the advantage
    158  1.1   mycroft  * that the bypass routine already must do argument mapping.
    159  1.1   mycroft  * An example of this is null_getattrs in the null layer.
    160  1.1   mycroft  *
    161  1.1   mycroft  * A second approach is to directly invoked vnode operations on
    162  1.1   mycroft  * the lower layer with the VOP_OPERATIONNAME interface.
    163  1.1   mycroft  * The advantage of this method is that it is easy to invoke
    164  1.1   mycroft  * arbitrary operations on the lower layer.  The disadvantage
    165  1.1   mycroft  * is that vnodes arguments must be manualy mapped.
    166  1.1   mycroft  *
    167  1.1   mycroft  */
    168  1.1   mycroft 
    169  1.1   mycroft #include <sys/param.h>
    170  1.1   mycroft #include <sys/systm.h>
    171  1.1   mycroft #include <sys/proc.h>
    172  1.1   mycroft #include <sys/time.h>
    173  1.1   mycroft #include <sys/types.h>
    174  1.1   mycroft #include <sys/vnode.h>
    175  1.1   mycroft #include <sys/mount.h>
    176  1.1   mycroft #include <sys/namei.h>
    177  1.1   mycroft #include <sys/malloc.h>
    178  1.1   mycroft #include <sys/buf.h>
    179  1.1   mycroft #include <miscfs/nullfs/null.h>
    180  1.1   mycroft 
    181  1.1   mycroft 
    182  1.1   mycroft int null_bug_bypass = 0;   /* for debugging: enables bypass printf'ing */
    183  1.1   mycroft 
    184  1.5  christos int	null_bypass __P((void *));
    185  1.5  christos int	null_getattr __P((void *));
    186  1.5  christos int	null_inactive __P((void *));
    187  1.5  christos int	null_reclaim __P((void *));
    188  1.5  christos int	null_print __P((void *));
    189  1.5  christos int	null_strategy __P((void *));
    190  1.5  christos int	null_bwrite __P((void *));
    191  1.1   mycroft /*
    192  1.1   mycroft  * This is the 10-Apr-92 bypass routine.
    193  1.1   mycroft  *    This version has been optimized for speed, throwing away some
    194  1.1   mycroft  * safety checks.  It should still always work, but it's not as
    195  1.1   mycroft  * robust to programmer errors.
    196  1.1   mycroft  *    Define SAFETY to include some error checking code.
    197  1.1   mycroft  *
    198  1.1   mycroft  * In general, we map all vnodes going down and unmap them on the way back.
    199  1.1   mycroft  * As an exception to this, vnodes can be marked "unmapped" by setting
    200  1.1   mycroft  * the Nth bit in operation's vdesc_flags.
    201  1.1   mycroft  *
    202  1.1   mycroft  * Also, some BSD vnode operations have the side effect of vrele'ing
    203  1.1   mycroft  * their arguments.  With stacking, the reference counts are held
    204  1.1   mycroft  * by the upper node, not the lower one, so we must handle these
    205  1.1   mycroft  * side-effects here.  This is not of concern in Sun-derived systems
    206  1.1   mycroft  * since there are no such side-effects.
    207  1.1   mycroft  *
    208  1.1   mycroft  * This makes the following assumptions:
    209  1.1   mycroft  * - only one returned vpp
    210  1.1   mycroft  * - no INOUT vpp's (Sun's vop_open has one of these)
    211  1.1   mycroft  * - the vnode operation vector of the first vnode should be used
    212  1.1   mycroft  *   to determine what implementation of the op should be invoked
    213  1.1   mycroft  * - all mapped vnodes are of our vnode-type (NEEDSWORK:
    214  1.1   mycroft  *   problems on rmdir'ing mount points and renaming?)
    215  1.1   mycroft  */
    216  1.1   mycroft int
    217  1.5  christos null_bypass(v)
    218  1.5  christos 	void *v;
    219  1.5  christos {
    220  1.1   mycroft 	struct vop_generic_args /* {
    221  1.1   mycroft 		struct vnodeop_desc *a_desc;
    222  1.1   mycroft 		<other random data follows, presumably>
    223  1.5  christos 	} */ *ap = v;
    224  1.1   mycroft 	register struct vnode **this_vp_p;
    225  1.1   mycroft 	int error;
    226  1.1   mycroft 	struct vnode *old_vps[VDESC_MAX_VPS];
    227  1.1   mycroft 	struct vnode **vps_p[VDESC_MAX_VPS];
    228  1.1   mycroft 	struct vnode ***vppp;
    229  1.1   mycroft 	struct vnodeop_desc *descp = ap->a_desc;
    230  1.1   mycroft 	int reles, i;
    231  1.1   mycroft 
    232  1.1   mycroft 	if (null_bug_bypass)
    233  1.1   mycroft 		printf ("null_bypass: %s\n", descp->vdesc_name);
    234  1.1   mycroft 
    235  1.1   mycroft #ifdef SAFETY
    236  1.1   mycroft 	/*
    237  1.1   mycroft 	 * We require at least one vp.
    238  1.1   mycroft 	 */
    239  1.1   mycroft 	if (descp->vdesc_vp_offsets == NULL ||
    240  1.1   mycroft 	    descp->vdesc_vp_offsets[0] == VDESC_NO_OFFSET)
    241  1.1   mycroft 		panic ("null_bypass: no vp's in map.\n");
    242  1.1   mycroft #endif
    243  1.1   mycroft 
    244  1.1   mycroft 	/*
    245  1.1   mycroft 	 * Map the vnodes going in.
    246  1.1   mycroft 	 * Later, we'll invoke the operation based on
    247  1.1   mycroft 	 * the first mapped vnode's operation vector.
    248  1.1   mycroft 	 */
    249  1.1   mycroft 	reles = descp->vdesc_flags;
    250  1.1   mycroft 	for (i = 0; i < VDESC_MAX_VPS; reles >>= 1, i++) {
    251  1.1   mycroft 		if (descp->vdesc_vp_offsets[i] == VDESC_NO_OFFSET)
    252  1.1   mycroft 			break;   /* bail out at end of list */
    253  1.1   mycroft 		vps_p[i] = this_vp_p =
    254  1.1   mycroft 			VOPARG_OFFSETTO(struct vnode**,descp->vdesc_vp_offsets[i],ap);
    255  1.1   mycroft 		/*
    256  1.1   mycroft 		 * We're not guaranteed that any but the first vnode
    257  1.1   mycroft 		 * are of our type.  Check for and don't map any
    258  1.1   mycroft 		 * that aren't.  (We must always map first vp or vclean fails.)
    259  1.1   mycroft 		 */
    260  1.3   mycroft 		if (i && (*this_vp_p == NULLVP ||
    261  1.3   mycroft 		    (*this_vp_p)->v_op != null_vnodeop_p)) {
    262  1.3   mycroft 			old_vps[i] = NULLVP;
    263  1.1   mycroft 		} else {
    264  1.1   mycroft 			old_vps[i] = *this_vp_p;
    265  1.1   mycroft 			*(vps_p[i]) = NULLVPTOLOWERVP(*this_vp_p);
    266  1.1   mycroft 			/*
    267  1.1   mycroft 			 * XXX - Several operations have the side effect
    268  1.1   mycroft 			 * of vrele'ing their vp's.  We must account for
    269  1.1   mycroft 			 * that.  (This should go away in the future.)
    270  1.1   mycroft 			 */
    271  1.1   mycroft 			if (reles & 1)
    272  1.1   mycroft 				VREF(*this_vp_p);
    273  1.1   mycroft 		}
    274  1.1   mycroft 
    275  1.1   mycroft 	}
    276  1.1   mycroft 
    277  1.1   mycroft 	/*
    278  1.1   mycroft 	 * Call the operation on the lower layer
    279  1.1   mycroft 	 * with the modified argument structure.
    280  1.1   mycroft 	 */
    281  1.1   mycroft 	error = VCALL(*(vps_p[0]), descp->vdesc_offset, ap);
    282  1.1   mycroft 
    283  1.1   mycroft 	/*
    284  1.1   mycroft 	 * Maintain the illusion of call-by-value
    285  1.1   mycroft 	 * by restoring vnodes in the argument structure
    286  1.1   mycroft 	 * to their original value.
    287  1.1   mycroft 	 */
    288  1.1   mycroft 	reles = descp->vdesc_flags;
    289  1.1   mycroft 	for (i = 0; i < VDESC_MAX_VPS; reles >>= 1, i++) {
    290  1.1   mycroft 		if (descp->vdesc_vp_offsets[i] == VDESC_NO_OFFSET)
    291  1.1   mycroft 			break;   /* bail out at end of list */
    292  1.3   mycroft 		if (old_vps[i] != NULLVP) {
    293  1.1   mycroft 			*(vps_p[i]) = old_vps[i];
    294  1.1   mycroft 			if (reles & 1)
    295  1.1   mycroft 				vrele(*(vps_p[i]));
    296  1.1   mycroft 		}
    297  1.1   mycroft 	}
    298  1.1   mycroft 
    299  1.1   mycroft 	/*
    300  1.1   mycroft 	 * Map the possible out-going vpp
    301  1.1   mycroft 	 * (Assumes that the lower layer always returns
    302  1.1   mycroft 	 * a VREF'ed vpp unless it gets an error.)
    303  1.1   mycroft 	 */
    304  1.1   mycroft 	if (descp->vdesc_vpp_offset != VDESC_NO_OFFSET &&
    305  1.1   mycroft 	    !(descp->vdesc_flags & VDESC_NOMAP_VPP) &&
    306  1.1   mycroft 	    !error) {
    307  1.1   mycroft 		/*
    308  1.1   mycroft 		 * XXX - even though some ops have vpp returned vp's,
    309  1.1   mycroft 		 * several ops actually vrele this before returning.
    310  1.1   mycroft 		 * We must avoid these ops.
    311  1.1   mycroft 		 * (This should go away when these ops are regularized.)
    312  1.1   mycroft 		 */
    313  1.1   mycroft 		if (descp->vdesc_flags & VDESC_VPP_WILLRELE)
    314  1.1   mycroft 			goto out;
    315  1.1   mycroft 		vppp = VOPARG_OFFSETTO(struct vnode***,
    316  1.1   mycroft 				 descp->vdesc_vpp_offset,ap);
    317  1.1   mycroft 		error = null_node_create(old_vps[0]->v_mount, **vppp, *vppp);
    318  1.1   mycroft 	}
    319  1.1   mycroft 
    320  1.1   mycroft  out:
    321  1.1   mycroft 	return (error);
    322  1.1   mycroft }
    323  1.1   mycroft 
    324  1.1   mycroft 
    325  1.1   mycroft /*
    326  1.1   mycroft  *  We handle getattr only to change the fsid.
    327  1.1   mycroft  */
    328  1.1   mycroft int
    329  1.5  christos null_getattr(v)
    330  1.5  christos 	void *v;
    331  1.5  christos {
    332  1.1   mycroft 	struct vop_getattr_args /* {
    333  1.1   mycroft 		struct vnode *a_vp;
    334  1.1   mycroft 		struct vattr *a_vap;
    335  1.1   mycroft 		struct ucred *a_cred;
    336  1.1   mycroft 		struct proc *a_p;
    337  1.5  christos 	} */ *ap = v;
    338  1.1   mycroft 	int error;
    339  1.5  christos 	if ((error = null_bypass(ap)) != NULL)
    340  1.1   mycroft 		return (error);
    341  1.1   mycroft 	/* Requires that arguments be restored. */
    342  1.1   mycroft 	ap->a_vap->va_fsid = ap->a_vp->v_mount->mnt_stat.f_fsid.val[0];
    343  1.1   mycroft 	return (0);
    344  1.1   mycroft }
    345  1.1   mycroft 
    346  1.1   mycroft 
    347  1.1   mycroft int
    348  1.5  christos null_inactive(v)
    349  1.5  christos 	void *v;
    350  1.1   mycroft {
    351  1.1   mycroft 	/*
    352  1.1   mycroft 	 * Do nothing (and _don't_ bypass).
    353  1.1   mycroft 	 * Wait to vrele lowervp until reclaim,
    354  1.1   mycroft 	 * so that until then our null_node is in the
    355  1.1   mycroft 	 * cache and reusable.
    356  1.1   mycroft 	 *
    357  1.1   mycroft 	 * NEEDSWORK: Someday, consider inactive'ing
    358  1.1   mycroft 	 * the lowervp and then trying to reactivate it
    359  1.1   mycroft 	 * with capabilities (v_id)
    360  1.1   mycroft 	 * like they do in the name lookup cache code.
    361  1.1   mycroft 	 * That's too much work for now.
    362  1.1   mycroft 	 */
    363  1.1   mycroft 	return (0);
    364  1.1   mycroft }
    365  1.1   mycroft 
    366  1.1   mycroft int
    367  1.5  christos null_reclaim(v)
    368  1.5  christos 	void *v;
    369  1.5  christos {
    370  1.1   mycroft 	struct vop_reclaim_args /* {
    371  1.1   mycroft 		struct vnode *a_vp;
    372  1.5  christos 	} */ *ap = v;
    373  1.1   mycroft 	struct vnode *vp = ap->a_vp;
    374  1.1   mycroft 	struct null_node *xp = VTONULL(vp);
    375  1.1   mycroft 	struct vnode *lowervp = xp->null_lowervp;
    376  1.1   mycroft 
    377  1.1   mycroft 	/*
    378  1.1   mycroft 	 * Note: in vop_reclaim, vp->v_op == dead_vnodeop_p,
    379  1.1   mycroft 	 * so we can't call VOPs on ourself.
    380  1.1   mycroft 	 */
    381  1.1   mycroft 	/* After this assignment, this node will not be re-used. */
    382  1.1   mycroft 	xp->null_lowervp = NULL;
    383  1.4   mycroft 	LIST_REMOVE(xp, null_hash);
    384  1.1   mycroft 	FREE(vp->v_data, M_TEMP);
    385  1.1   mycroft 	vp->v_data = NULL;
    386  1.1   mycroft 	vrele (lowervp);
    387  1.1   mycroft 	return (0);
    388  1.1   mycroft }
    389  1.1   mycroft 
    390  1.1   mycroft 
    391  1.1   mycroft int
    392  1.5  christos null_print(v)
    393  1.5  christos 	void *v;
    394  1.5  christos {
    395  1.1   mycroft 	struct vop_print_args /* {
    396  1.1   mycroft 		struct vnode *a_vp;
    397  1.5  christos 	} */ *ap = v;
    398  1.1   mycroft 	register struct vnode *vp = ap->a_vp;
    399  1.5  christos 	printf ("\ttag VT_NULLFS, vp=%x, lowervp=%x\n", (unsigned int) vp,
    400  1.5  christos 		(unsigned int) NULLVPTOLOWERVP(vp));
    401  1.1   mycroft 	return (0);
    402  1.1   mycroft }
    403  1.1   mycroft 
    404  1.1   mycroft 
    405  1.1   mycroft /*
    406  1.1   mycroft  * XXX - vop_strategy must be hand coded because it has no
    407  1.1   mycroft  * vnode in its arguments.
    408  1.1   mycroft  * This goes away with a merged VM/buffer cache.
    409  1.1   mycroft  */
    410  1.1   mycroft int
    411  1.5  christos null_strategy(v)
    412  1.5  christos 	void *v;
    413  1.5  christos {
    414  1.1   mycroft 	struct vop_strategy_args /* {
    415  1.1   mycroft 		struct buf *a_bp;
    416  1.5  christos 	} */ *ap = v;
    417  1.1   mycroft 	struct buf *bp = ap->a_bp;
    418  1.1   mycroft 	int error;
    419  1.1   mycroft 	struct vnode *savedvp;
    420  1.1   mycroft 
    421  1.1   mycroft 	savedvp = bp->b_vp;
    422  1.1   mycroft 	bp->b_vp = NULLVPTOLOWERVP(bp->b_vp);
    423  1.1   mycroft 
    424  1.1   mycroft 	error = VOP_STRATEGY(bp);
    425  1.1   mycroft 
    426  1.1   mycroft 	bp->b_vp = savedvp;
    427  1.1   mycroft 
    428  1.1   mycroft 	return (error);
    429  1.1   mycroft }
    430  1.1   mycroft 
    431  1.1   mycroft 
    432  1.1   mycroft /*
    433  1.1   mycroft  * XXX - like vop_strategy, vop_bwrite must be hand coded because it has no
    434  1.1   mycroft  * vnode in its arguments.
    435  1.1   mycroft  * This goes away with a merged VM/buffer cache.
    436  1.1   mycroft  */
    437  1.1   mycroft int
    438  1.5  christos null_bwrite(v)
    439  1.5  christos 	void *v;
    440  1.5  christos {
    441  1.1   mycroft 	struct vop_bwrite_args /* {
    442  1.1   mycroft 		struct buf *a_bp;
    443  1.5  christos 	} */ *ap = v;
    444  1.1   mycroft 	struct buf *bp = ap->a_bp;
    445  1.1   mycroft 	int error;
    446  1.1   mycroft 	struct vnode *savedvp;
    447  1.1   mycroft 
    448  1.1   mycroft 	savedvp = bp->b_vp;
    449  1.1   mycroft 	bp->b_vp = NULLVPTOLOWERVP(bp->b_vp);
    450  1.1   mycroft 
    451  1.1   mycroft 	error = VOP_BWRITE(bp);
    452  1.1   mycroft 
    453  1.1   mycroft 	bp->b_vp = savedvp;
    454  1.1   mycroft 
    455  1.1   mycroft 	return (error);
    456  1.1   mycroft }
    457  1.1   mycroft 
    458  1.1   mycroft /*
    459  1.1   mycroft  * Global vfs data structures
    460  1.1   mycroft  */
    461  1.5  christos int (**null_vnodeop_p) __P((void *));
    462  1.1   mycroft struct vnodeopv_entry_desc null_vnodeop_entries[] = {
    463  1.5  christos 	{ &vop_default_desc,	null_bypass },
    464  1.1   mycroft 
    465  1.5  christos 	{ &vop_getattr_desc,	null_getattr },
    466  1.5  christos 	{ &vop_inactive_desc,	null_inactive },
    467  1.5  christos 	{ &vop_reclaim_desc,	null_reclaim },
    468  1.5  christos 	{ &vop_print_desc,	null_print },
    469  1.1   mycroft 
    470  1.5  christos 	{ &vop_strategy_desc,	null_strategy },
    471  1.5  christos 	{ &vop_bwrite_desc,	null_bwrite },
    472  1.1   mycroft 
    473  1.5  christos 	{ (struct vnodeop_desc*)NULL,	(int(*) __P((void *)))NULL }
    474  1.1   mycroft };
    475  1.1   mycroft struct vnodeopv_desc null_vnodeop_opv_desc =
    476  1.1   mycroft 	{ &null_vnodeop_p, null_vnodeop_entries };
    477