Home | History | Annotate | Line # | Download | only in nullfs
null.h revision 1.15.12.1
      1  1.15.12.1      yamt /*	$NetBSD: null.h,v 1.15.12.1 2006/06/21 15:10:26 yamt Exp $	*/
      2       1.10  wrstuden 
      3       1.10  wrstuden /*
      4       1.10  wrstuden  * Copyright (c) 1999 National Aeronautics & Space Administration
      5       1.10  wrstuden  * All rights reserved.
      6       1.10  wrstuden  *
      7       1.12       wiz  * This software was written by William Studenmund of the
      8       1.12       wiz  * Numerical Aerospace Simulation Facility, NASA Ames Research Center.
      9       1.10  wrstuden  *
     10       1.10  wrstuden  * Redistribution and use in source and binary forms, with or without
     11       1.10  wrstuden  * modification, are permitted provided that the following conditions
     12       1.10  wrstuden  * are met:
     13       1.10  wrstuden  * 1. Redistributions of source code must retain the above copyright
     14       1.10  wrstuden  *    notice, this list of conditions and the following disclaimer.
     15       1.10  wrstuden  * 2. Redistributions in binary form must reproduce the above copyright
     16       1.10  wrstuden  *    notice, this list of conditions and the following disclaimer in the
     17       1.10  wrstuden  *    documentation and/or other materials provided with the distribution.
     18       1.11     soren  * 3. Neither the name of the National Aeronautics & Space Administration
     19       1.10  wrstuden  *    nor the names of its contributors may be used to endorse or promote
     20       1.10  wrstuden  *    products derived from this software without specific prior written
     21       1.10  wrstuden  *    permission.
     22       1.10  wrstuden  *
     23       1.10  wrstuden  * THIS SOFTWARE IS PROVIDED BY THE NATIONAL AERONAUTICS & SPACE ADMINISTRATION
     24       1.10  wrstuden  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     25       1.10  wrstuden  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     26       1.10  wrstuden  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE ADMINISTRATION OR CONTRIB-
     27       1.10  wrstuden  * UTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
     28       1.10  wrstuden  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     29       1.10  wrstuden  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     30       1.10  wrstuden  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     31       1.10  wrstuden  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     32       1.10  wrstuden  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     33       1.10  wrstuden  * POSSIBILITY OF SUCH DAMAGE.
     34       1.10  wrstuden  */
     35        1.2       cgd 
     36        1.1   mycroft /*
     37        1.1   mycroft  * Copyright (c) 1992, 1993
     38        1.1   mycroft  *	The Regents of the University of California.  All rights reserved.
     39        1.1   mycroft  *
     40        1.1   mycroft  * This code is derived from software donated to Berkeley by
     41        1.1   mycroft  * Jan-Simon Pendry.
     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.14       agc  * 3. Neither the name of the University nor the names of its contributors
     52        1.1   mycroft  *    may be used to endorse or promote products derived from this software
     53        1.1   mycroft  *    without specific prior written permission.
     54        1.1   mycroft  *
     55        1.1   mycroft  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     56        1.1   mycroft  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     57        1.1   mycroft  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     58        1.1   mycroft  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     59        1.1   mycroft  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     60        1.1   mycroft  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     61        1.1   mycroft  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     62        1.1   mycroft  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     63        1.1   mycroft  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     64        1.1   mycroft  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     65        1.1   mycroft  * SUCH DAMAGE.
     66        1.1   mycroft  *
     67        1.1   mycroft  *	from: Id: lofs.h,v 1.8 1992/05/30 10:05:43 jsp Exp
     68        1.2       cgd  *	@(#)null.h	8.2 (Berkeley) 1/21/94
     69        1.1   mycroft  */
     70        1.1   mycroft 
     71       1.10  wrstuden #include <miscfs/genfs/layer.h>
     72       1.10  wrstuden 
     73        1.1   mycroft struct null_args {
     74       1.10  wrstuden 	struct	layer_args	la;	/* generic layerfs args */
     75        1.1   mycroft };
     76       1.10  wrstuden #define	nulla_target	la.target
     77       1.10  wrstuden #define	nulla_export	la.export
     78        1.1   mycroft 
     79       1.10  wrstuden #ifdef _KERNEL
     80        1.1   mycroft struct null_mount {
     81       1.10  wrstuden 	struct	layer_mount	lm;	/* generic layerfs mount stuff */
     82        1.1   mycroft };
     83       1.10  wrstuden #define	nullm_vfs		lm.layerm_vfs
     84       1.10  wrstuden #define	nullm_rootvp		lm.layerm_rootvp
     85       1.10  wrstuden #define	nullm_export		lm.layerm_export
     86       1.10  wrstuden #define	nullm_flags		lm.layerm_flags
     87       1.10  wrstuden #define	nullm_size		lm.layerm_size
     88       1.10  wrstuden #define	nullm_tag		lm.layerm_tag
     89       1.10  wrstuden #define	nullm_bypass		lm.layerm_bypass
     90       1.10  wrstuden #define	nullm_alloc		lm.layerm_alloc
     91       1.10  wrstuden #define	nullm_vnodeop_p		lm.layerm_vnodeop_p
     92       1.10  wrstuden #define	nullm_node_hashtbl	lm.layerm_node_hashtbl
     93       1.10  wrstuden #define	nullm_node_hash		lm.layerm_node_hash
     94       1.10  wrstuden #define	nullm_hashlock		lm.layerm_hashlock
     95        1.1   mycroft 
     96        1.1   mycroft /*
     97        1.1   mycroft  * A cache of vnode references
     98        1.1   mycroft  */
     99        1.1   mycroft struct null_node {
    100       1.10  wrstuden 	struct	layer_node	ln;
    101        1.1   mycroft };
    102       1.10  wrstuden #define	null_hash	ln.layer_hash
    103       1.10  wrstuden #define	null_lowervp	ln.layer_lowervp
    104       1.10  wrstuden #define	null_vnode	ln.layer_vnode
    105       1.10  wrstuden #define	null_flags	ln.layer_flags
    106        1.1   mycroft 
    107  1.15.12.1      yamt int	null_node_create(struct mount *, struct vnode *,
    108  1.15.12.1      yamt 	    struct vnode **);
    109        1.1   mycroft 
    110        1.1   mycroft #define	MOUNTTONULLMOUNT(mp) ((struct null_mount *)((mp)->mnt_data))
    111        1.1   mycroft #define	VTONULL(vp) ((struct null_node *)(vp)->v_data)
    112        1.1   mycroft #define	NULLTOV(xp) ((xp)->null_vnode)
    113        1.1   mycroft #ifdef NULLFS_DIAGNOSTIC
    114  1.15.12.1      yamt struct vnode *layer_checkvp(struct vnode *, char *, int);
    115       1.10  wrstuden #define	NULLVPTOLOWERVP(vp) layer_checkvp((vp), __FILE__, __LINE__)
    116        1.1   mycroft #else
    117        1.1   mycroft #define	NULLVPTOLOWERVP(vp) (VTONULL(vp)->null_lowervp)
    118        1.1   mycroft #endif
    119        1.1   mycroft 
    120  1.15.12.1      yamt extern int (**null_vnodeop_p)(void *);
    121        1.9   thorpej extern struct vfsops nullfs_vfsops;
    122        1.5  christos 
    123  1.15.12.1      yamt void nullfs_init(void);
    124        1.5  christos 
    125       1.15    atatat #ifdef SYSCTL_SETUP_PROTO
    126       1.15    atatat SYSCTL_SETUP_PROTO(sysctl_vfs_null_setup);
    127       1.15    atatat #endif /* SYSCTL_SETUP_PROTO */
    128        1.4    briggs #endif /* _KERNEL */
    129