null.h revision 97186
1258945Sroberto/*
2258945Sroberto * Copyright (c) 1992, 1993
3258945Sroberto *	The Regents of the University of California.  All rights reserved.
4258945Sroberto *
5258945Sroberto * This code is derived from software donated to Berkeley by
6258945Sroberto * Jan-Simon Pendry.
7258945Sroberto *
8258945Sroberto * Redistribution and use in source and binary forms, with or without
9258945Sroberto * modification, are permitted provided that the following conditions
10258945Sroberto * are met:
11258945Sroberto * 1. Redistributions of source code must retain the above copyright
12258945Sroberto *    notice, this list of conditions and the following disclaimer.
13258945Sroberto * 2. Redistributions in binary form must reproduce the above copyright
14258945Sroberto *    notice, this list of conditions and the following disclaimer in the
15258945Sroberto *    documentation and/or other materials provided with the distribution.
16258945Sroberto * 3. All advertising materials mentioning features or use of this software
17258945Sroberto *    must display the following acknowledgement:
18258945Sroberto *	This product includes software developed by the University of
19258945Sroberto *	California, Berkeley and its contributors.
20258945Sroberto * 4. Neither the name of the University nor the names of its contributors
21258945Sroberto *    may be used to endorse or promote products derived from this software
22258945Sroberto *    without specific prior written permission.
23258945Sroberto *
24258945Sroberto * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25258945Sroberto * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26258945Sroberto * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27258945Sroberto * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28258945Sroberto * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29258945Sroberto * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30258945Sroberto * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31258945Sroberto * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32258945Sroberto * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33258945Sroberto * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34258945Sroberto * SUCH DAMAGE.
35258945Sroberto *
36258945Sroberto *	@(#)null.h	8.3 (Berkeley) 8/20/94
37258945Sroberto *
38258945Sroberto * $FreeBSD: head/sys/fs/nullfs/null.h 97186 2002-05-23 23:07:27Z mux $
39258945Sroberto */
40258945Sroberto
41258945Srobertostruct null_mount {
42258945Sroberto	struct mount	*nullm_vfs;
43258945Sroberto	struct vnode	*nullm_rootvp;	/* Reference to root null_node */
44258945Sroberto};
45258945Sroberto
46258945Sroberto#ifdef _KERNEL
47258945Sroberto/*
48258945Sroberto * A cache of vnode references
49258945Sroberto */
50258945Srobertostruct null_node {
51258945Sroberto	LIST_ENTRY(null_node)	null_hash;	/* Hash list */
52258945Sroberto	struct vnode	        *null_lowervp;	/* VREFed once */
53258945Sroberto	struct vnode		*null_vnode;	/* Back pointer */
54258945Sroberto};
55258945Sroberto
56258945Sroberto#define	MOUNTTONULLMOUNT(mp) ((struct null_mount *)((mp)->mnt_data))
57258945Sroberto#define	VTONULL(vp) ((struct null_node *)(vp)->v_data)
58258945Sroberto#define	NULLTOV(xp) ((xp)->null_vnode)
59258945Sroberto
60258945Srobertoint nullfs_init(struct vfsconf *vfsp);
61258945Srobertoint nullfs_uninit(struct vfsconf *vfsp);
62258945Srobertoint null_node_create(struct mount *mp, struct vnode *target, struct vnode **vpp);
63258945Srobertoint null_bypass(struct vop_generic_args *ap);
64258945Sroberto
65258945Sroberto#ifdef DIAGNOSTIC
66258945Srobertostruct vnode *null_checkvp(struct vnode *vp, char *fil, int lno);
67258945Sroberto#define	NULLVPTOLOWERVP(vp) null_checkvp((vp), __FILE__, __LINE__)
68258945Sroberto#else
69258945Sroberto#define	NULLVPTOLOWERVP(vp) (VTONULL(vp)->null_lowervp)
70258945Sroberto#endif
71258945Sroberto
72258945Srobertoextern vop_t **null_vnodeop_p;
73258945Srobertoextern struct lock null_hashlock;
74258945Sroberto
75258945Sroberto#ifdef MALLOC_DECLARE
76258945SrobertoMALLOC_DECLARE(M_NULLFSNODE);
77258945Sroberto#endif
78258945Sroberto
79258945Sroberto#ifdef NULLFS_DEBUG
80258945Sroberto#define NULLFSDEBUG(format, args...) printf(format ,## args)
81258945Sroberto#else
82258945Sroberto#define NULLFSDEBUG(format, args...)
83258945Sroberto#endif /* NULLFS_DEBUG */
84258945Sroberto
85258945Sroberto#endif /* _KERNEL */
86258945Sroberto