1*228d72edShannken /* $NetBSD: overlay.h,v 1.9 2017/04/11 07:51:37 hannken Exp $ */ 2fab192f2Swrstuden 3fab192f2Swrstuden /* 4fab192f2Swrstuden * Copyright (c) 1999 National Aeronautics & Space Administration 5fab192f2Swrstuden * All rights reserved. 6fab192f2Swrstuden * 7e265f988Swiz * This software was written by William Studenmund of the 8e265f988Swiz * Numerical Aerospace Simulation Facility, NASA Ames Research Center. 9fab192f2Swrstuden * 10fab192f2Swrstuden * Redistribution and use in source and binary forms, with or without 11fab192f2Swrstuden * modification, are permitted provided that the following conditions 12fab192f2Swrstuden * are met: 13fab192f2Swrstuden * 1. Redistributions of source code must retain the above copyright 14fab192f2Swrstuden * notice, this list of conditions and the following disclaimer. 15fab192f2Swrstuden * 2. Redistributions in binary form must reproduce the above copyright 16fab192f2Swrstuden * notice, this list of conditions and the following disclaimer in the 17fab192f2Swrstuden * documentation and/or other materials provided with the distribution. 1895054da1Ssoren * 3. Neither the name of the National Aeronautics & Space Administration 19fab192f2Swrstuden * nor the names of its contributors may be used to endorse or promote 20fab192f2Swrstuden * products derived from this software without specific prior written 21fab192f2Swrstuden * permission. 22fab192f2Swrstuden * 23fab192f2Swrstuden * THIS SOFTWARE IS PROVIDED BY THE NATIONAL AERONAUTICS & SPACE ADMINISTRATION 24fab192f2Swrstuden * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 25fab192f2Swrstuden * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 26fab192f2Swrstuden * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ADMINISTRATION OR CONTRIB- 27fab192f2Swrstuden * UTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, 28fab192f2Swrstuden * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 29fab192f2Swrstuden * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30fab192f2Swrstuden * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31fab192f2Swrstuden * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32fab192f2Swrstuden * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33fab192f2Swrstuden * POSSIBILITY OF SUCH DAMAGE. 34fab192f2Swrstuden */ 35fab192f2Swrstuden 36fab192f2Swrstuden /* 37fab192f2Swrstuden * Copyright (c) 1992, 1993 38fab192f2Swrstuden * The Regents of the University of California. All rights reserved. 39fab192f2Swrstuden * 40fab192f2Swrstuden * This code is derived from software donated to Berkeley by 41fab192f2Swrstuden * Jan-Simon Pendry. 42fab192f2Swrstuden * 43fab192f2Swrstuden * Redistribution and use in source and binary forms, with or without 44fab192f2Swrstuden * modification, are permitted provided that the following conditions 45fab192f2Swrstuden * are met: 46fab192f2Swrstuden * 1. Redistributions of source code must retain the above copyright 47fab192f2Swrstuden * notice, this list of conditions and the following disclaimer. 48fab192f2Swrstuden * 2. Redistributions in binary form must reproduce the above copyright 49fab192f2Swrstuden * notice, this list of conditions and the following disclaimer in the 50fab192f2Swrstuden * documentation and/or other materials provided with the distribution. 51aad01611Sagc * 3. Neither the name of the University nor the names of its contributors 52fab192f2Swrstuden * may be used to endorse or promote products derived from this software 53fab192f2Swrstuden * without specific prior written permission. 54fab192f2Swrstuden * 55fab192f2Swrstuden * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 56fab192f2Swrstuden * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 57fab192f2Swrstuden * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 58fab192f2Swrstuden * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 59fab192f2Swrstuden * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 60fab192f2Swrstuden * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 61fab192f2Swrstuden * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 62fab192f2Swrstuden * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 63fab192f2Swrstuden * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 64fab192f2Swrstuden * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 65fab192f2Swrstuden * SUCH DAMAGE. 66fab192f2Swrstuden * 67fab192f2Swrstuden * from: Id: lofs.h,v 1.8 1992/05/30 10:05:43 jsp Exp 68fab192f2Swrstuden * @(#)null.h 8.2 (Berkeley) 1/21/94 69fab192f2Swrstuden */ 70fab192f2Swrstuden 71fab192f2Swrstuden #include <miscfs/genfs/layer.h> 72fab192f2Swrstuden 73fab192f2Swrstuden struct overlay_args { 74fab192f2Swrstuden struct layer_args la; /* generic layerfs args */ 75fab192f2Swrstuden }; 76fab192f2Swrstuden /* 77e265f988Swiz * We leave ova_target for two reasons. One, we can tell the difference 78fab192f2Swrstuden * between a mount_overlay -u and a call from mountd as the former will 79fab192f2Swrstuden * pass a pointer to a string while the latter will pass NULL. Two, 80fab192f2Swrstuden * filesystems based on the overlay layer might have use for it. 81fab192f2Swrstuden */ 82fab192f2Swrstuden #define ova_target la.target 83fab192f2Swrstuden #define ova_export la.export 84fab192f2Swrstuden 85fab192f2Swrstuden #ifdef _KERNEL 86fab192f2Swrstuden struct overlay_mount { 87fab192f2Swrstuden struct layer_mount lm; /* generic layerfs mount stuff */ 88fab192f2Swrstuden }; 89fab192f2Swrstuden #define ovm_rootvp lm.layerm_rootvp 90fab192f2Swrstuden #define ovm_export lm.layerm_export 91fab192f2Swrstuden #define ovm_flags lm.layerm_flags 92fab192f2Swrstuden #define ovm_size lm.layerm_size 93fab192f2Swrstuden #define ovm_tag lm.layerm_tag 94fab192f2Swrstuden #define ovm_bypass lm.layerm_bypass 95fab192f2Swrstuden #define ovm_alloc lm.layerm_alloc 96fab192f2Swrstuden #define ovm_vnodeop_p lm.layerm_vnodeop_p 97fab192f2Swrstuden #define ovm_node_hashtbl lm.layerm_node_hashtbl 98fab192f2Swrstuden #define ovm_node_hash lm.layerm_node_hash 99fab192f2Swrstuden #define ovm_hashlock lm.layerm_hashlock 100fab192f2Swrstuden 101fab192f2Swrstuden /* 102fab192f2Swrstuden * A cache of vnode references 103fab192f2Swrstuden */ 104fab192f2Swrstuden struct overlay_node { 105fab192f2Swrstuden struct layer_node ln; 106fab192f2Swrstuden }; 107fab192f2Swrstuden #define ov_hash ln.layer_hash 108fab192f2Swrstuden #define ov_lowervp ln.layer_lowervp 109fab192f2Swrstuden #define ov_vnode ln.layer_vnode 110fab192f2Swrstuden #define ov_flags ln.layer_flags 111fab192f2Swrstuden 112fab192f2Swrstuden #define MOUNTTOOVERLAYMOUNT(mp) ((struct overlay_mount *)((mp)->mnt_data)) 113fab192f2Swrstuden #define VTOOVERLAY(vp) ((struct overlay_node *)(vp)->v_data) 114fab192f2Swrstuden #define OVERLAYTOV(xp) ((xp)->ov_vnode) 115fab192f2Swrstuden #ifdef OVERLAYFS_DIAGNOSTIC 116af97f2e8Sxtraeme extern struct vnode *layer_checkvp(struct vnode *vp, char *fil, int lno); 117fab192f2Swrstuden #define OVERLAYVPTOLOWERVP(vp) layer_checkvp((vp), __FILE__, __LINE__) 118fab192f2Swrstuden #else 119fab192f2Swrstuden #define OVERLAYVPTOLOWERVP(vp) (VTOOVERLAY(vp)->ov_lowervp) 120fab192f2Swrstuden #endif 121fab192f2Swrstuden 122af97f2e8Sxtraeme extern int (**overlay_vnodeop_p)(void *); 123fab192f2Swrstuden extern struct vfsops overlay_vfsops; 124fab192f2Swrstuden 125fab192f2Swrstuden #endif /* _KERNEL */ 126