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