1139776Simp/*- 21541Srgrimes * Copyright (c) 1992, 1993 31541Srgrimes * The Regents of the University of California. All rights reserved. 41541Srgrimes * 51541Srgrimes * This code is derived from software donated to Berkeley by 61541Srgrimes * Jan-Simon Pendry. 71541Srgrimes * 81541Srgrimes * Redistribution and use in source and binary forms, with or without 91541Srgrimes * modification, are permitted provided that the following conditions 101541Srgrimes * are met: 111541Srgrimes * 1. Redistributions of source code must retain the above copyright 121541Srgrimes * notice, this list of conditions and the following disclaimer. 131541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 141541Srgrimes * notice, this list of conditions and the following disclaimer in the 151541Srgrimes * documentation and/or other materials provided with the distribution. 161541Srgrimes * 4. Neither the name of the University nor the names of its contributors 171541Srgrimes * may be used to endorse or promote products derived from this software 181541Srgrimes * without specific prior written permission. 191541Srgrimes * 201541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 211541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 221541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 231541Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 241541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 251541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 261541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 271541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 281541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 291541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 301541Srgrimes * SUCH DAMAGE. 311541Srgrimes * 3222521Sdyson * @(#)null.h 8.3 (Berkeley) 8/20/94 331541Srgrimes * 3450477Speter * $FreeBSD$ 351541Srgrimes */ 361541Srgrimes 37245353Skib#ifndef FS_NULL_H 38245353Skib#define FS_NULL_H 39245353Skib 40245353Skib#define NULLM_CACHE 0x0001 41245353Skib 421541Srgrimesstruct null_mount { 431541Srgrimes struct mount *nullm_vfs; 441541Srgrimes struct vnode *nullm_rootvp; /* Reference to root null_node */ 45245353Skib uint64_t nullm_flags; 461541Srgrimes}; 471541Srgrimes 4855206Speter#ifdef _KERNEL 491541Srgrimes/* 501541Srgrimes * A cache of vnode references 511541Srgrimes */ 521541Srgrimesstruct null_node { 5360938Sjake LIST_ENTRY(null_node) null_hash; /* Hash list */ 541541Srgrimes struct vnode *null_lowervp; /* VREFed once */ 551541Srgrimes struct vnode *null_vnode; /* Back pointer */ 56250978Skib u_int null_flags; 571541Srgrimes}; 581541Srgrimes 59250978Skib#define NULLV_NOUNLOCK 0x0001 60250978Skib#define NULLV_DROP 0x0002 61250978Skib 621541Srgrimes#define MOUNTTONULLMOUNT(mp) ((struct null_mount *)((mp)->mnt_data)) 631541Srgrimes#define VTONULL(vp) ((struct null_node *)(vp)->v_data) 641541Srgrimes#define NULLTOV(xp) ((xp)->null_vnode) 6565464Sbp 6665464Sbpint nullfs_init(struct vfsconf *vfsp); 6765467Sbpint nullfs_uninit(struct vfsconf *vfsp); 6898183Ssemenuint null_nodeget(struct mount *mp, struct vnode *target, struct vnode **vpp); 69244654Skibstruct vnode *null_hashget(struct mount *mp, struct vnode *lowervp); 7098176Ssemenuvoid null_hashrem(struct null_node *xp); 7165464Sbpint null_bypass(struct vop_generic_args *ap); 7265464Sbp 7350890Sbde#ifdef DIAGNOSTIC 7465464Sbpstruct vnode *null_checkvp(struct vnode *vp, char *fil, int lno); 751541Srgrimes#define NULLVPTOLOWERVP(vp) null_checkvp((vp), __FILE__, __LINE__) 761541Srgrimes#else 771541Srgrimes#define NULLVPTOLOWERVP(vp) (VTONULL(vp)->null_lowervp) 781541Srgrimes#endif 791541Srgrimes 80138290Sphkextern struct vop_vector null_vnodeops; 8126111Speter 8265467Sbp#ifdef MALLOC_DECLARE 8365467SbpMALLOC_DECLARE(M_NULLFSNODE); 8465467Sbp#endif 8565467Sbp 8665467Sbp#ifdef NULLFS_DEBUG 8765467Sbp#define NULLFSDEBUG(format, args...) printf(format ,## args) 8865467Sbp#else 8965467Sbp#define NULLFSDEBUG(format, args...) 9065467Sbp#endif /* NULLFS_DEBUG */ 9165467Sbp 9255206Speter#endif /* _KERNEL */ 93245353Skib 94245353Skib#endif 95