null.h revision 60938
1236769Sobrien/*
2236769Sobrien * Copyright (c) 1992, 1993
3236769Sobrien *	The Regents of the University of California.  All rights reserved.
4236769Sobrien *
5236769Sobrien * This code is derived from software donated to Berkeley by
6236769Sobrien * Jan-Simon Pendry.
7236769Sobrien *
8236769Sobrien * Redistribution and use in source and binary forms, with or without
9236769Sobrien * modification, are permitted provided that the following conditions
10236769Sobrien * are met:
11236769Sobrien * 1. Redistributions of source code must retain the above copyright
12236769Sobrien *    notice, this list of conditions and the following disclaimer.
13236769Sobrien * 2. Redistributions in binary form must reproduce the above copyright
14236769Sobrien *    notice, this list of conditions and the following disclaimer in the
15236769Sobrien *    documentation and/or other materials provided with the distribution.
16236769Sobrien * 3. All advertising materials mentioning features or use of this software
17236769Sobrien *    must display the following acknowledgement:
18236769Sobrien *	This product includes software developed by the University of
19236769Sobrien *	California, Berkeley and its contributors.
20236769Sobrien * 4. Neither the name of the University nor the names of its contributors
21236769Sobrien *    may be used to endorse or promote products derived from this software
22236769Sobrien *    without specific prior written permission.
23236769Sobrien *
24236769Sobrien * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25236769Sobrien * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26236769Sobrien * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27236769Sobrien * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28236769Sobrien * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29236769Sobrien * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30236769Sobrien * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31236769Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32236769Sobrien * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33236769Sobrien * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34236769Sobrien * SUCH DAMAGE.
35236769Sobrien *
36236769Sobrien *	@(#)null.h	8.3 (Berkeley) 8/20/94
37236769Sobrien *
38236769Sobrien * $FreeBSD: head/sys/fs/nullfs/null.h 60938 2000-05-26 02:09:24Z jake $
39236769Sobrien */
40236769Sobrien
41236769Sobrienstruct null_args {
42236769Sobrien	char		*target;	/* Target of loopback  */
43236769Sobrien};
44236769Sobrien
45236769Sobrienstruct null_mount {
46236769Sobrien	struct mount	*nullm_vfs;
47236769Sobrien	struct vnode	*nullm_rootvp;	/* Reference to root null_node */
48236769Sobrien};
49236769Sobrien
50236769Sobrien#ifdef _KERNEL
51236769Sobrien/*
52236769Sobrien * A cache of vnode references
53236769Sobrien */
54236769Sobrienstruct null_node {
55236769Sobrien	LIST_ENTRY(null_node)	null_hash;	/* Hash list */
56236769Sobrien	struct vnode	        *null_lowervp;	/* VREFed once */
57236769Sobrien	struct vnode		*null_vnode;	/* Back pointer */
58236769Sobrien};
59236769Sobrien
60236769Sobrienextern int nullfs_init __P((struct vfsconf *vfsp));
61236769Sobrienextern int null_node_create __P((struct mount *mp, struct vnode *target, struct vnode **vpp));
62236769Sobrien
63236769Sobrien#define	MOUNTTONULLMOUNT(mp) ((struct null_mount *)((mp)->mnt_data))
64236769Sobrien#define	VTONULL(vp) ((struct null_node *)(vp)->v_data)
65236769Sobrien#define	NULLTOV(xp) ((xp)->null_vnode)
66236769Sobrien#ifdef DIAGNOSTIC
67236769Sobrienextern struct vnode *null_checkvp __P((struct vnode *vp, char *fil, int lno));
68236769Sobrien#define	NULLVPTOLOWERVP(vp) null_checkvp((vp), __FILE__, __LINE__)
69236769Sobrien#else
70236769Sobrien#define	NULLVPTOLOWERVP(vp) (VTONULL(vp)->null_lowervp)
71236769Sobrien#endif
72236769Sobrien
73236769Sobrienextern int	null_bypass __P((struct vop_generic_args *ap));
74236769Sobrien
75236769Sobrienextern vop_t **null_vnodeop_p;
76236769Sobrien#endif /* _KERNEL */
77236769Sobrien