/*-1* SPDX-License-Identifier: BSD-3-Clause2*3* Copyright (c) 1992, 19934* The Regents of the University of California. All rights reserved.5*6* This code is derived from software donated to Berkeley by7* Jan-Simon Pendry.8*9* Redistribution and use in source and binary forms, with or without10* modification, are permitted provided that the following conditions11* are met:12* 1. Redistributions of source code must retain the above copyright13* notice, this list of conditions and the following disclaimer.14* 2. Redistributions in binary form must reproduce the above copyright15* notice, this list of conditions and the following disclaimer in the16* documentation and/or other materials provided with the distribution.17* 3. Neither the name of the University nor the names of its contributors18* may be used to endorse or promote products derived from this software19* without specific prior written permission.20*21* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND22* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE23* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE24* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE25* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL26* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS27* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)28* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT29* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY30* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF31* SUCH DAMAGE.32*/3334#ifndef FS_NULL_H35#define FS_NULL_H3637#define NULLM_CACHE 0x00013839#include <sys/ck.h>40#include <vm/uma.h>4142struct null_mount {43struct mount *nullm_vfs;44struct vnode *nullm_lowerrootvp; /* Ref to lower root vnode */45uint64_t nullm_flags;46struct mount_upper_node upper_node;47struct mount_upper_node notify_node;48};4950#ifdef _KERNEL51/*52* A cache of vnode references53*/54struct null_node {55CK_LIST_ENTRY(null_node) null_hash; /* Hash list */56struct vnode *null_lowervp; /* VREFed once */57struct vnode *null_vnode; /* Back pointer */58u_int null_flags;59};6061#define NULLV_NOUNLOCK 0x000162#define NULLV_DROP 0x00026364#define MOUNTTONULLMOUNT(mp) ((struct null_mount *)((mp)->mnt_data))65#define VTONULL(vp) ((struct null_node *)(vp)->v_data)66#define VTONULL_SMR(vp) ((struct null_node *)vn_load_v_data_smr(vp))67#define NULLTOV(xp) ((xp)->null_vnode)6869int nullfs_init(struct vfsconf *vfsp);70int nullfs_uninit(struct vfsconf *vfsp);71int null_nodeget(struct mount *mp, struct vnode *target, struct vnode **vpp);72struct vnode *null_hashget(struct mount *mp, struct vnode *lowervp);73void null_hashrem(struct null_node *xp);74int null_bypass(struct vop_generic_args *ap);7576#ifdef DIAGNOSTIC77struct vnode *null_checkvp(struct vnode *vp, char *fil, int lno);78#define NULLVPTOLOWERVP(vp) null_checkvp((vp), __FILE__, __LINE__)79#else80#define NULLVPTOLOWERVP(vp) (VTONULL(vp)->null_lowervp)81#endif8283extern struct vop_vector null_vnodeops;8485extern uma_zone_t null_node_zone;8687#ifdef NULLFS_DEBUG88#define NULLFSDEBUG(format, args...) printf(format ,## args)89#else90#define NULLFSDEBUG(format, args...)91#endif /* NULLFS_DEBUG */9293#endif /* _KERNEL */9495#endif969798