null_vfsops.c (28270) | null_vfsops.c (30354) |
---|---|
1/* 2 * Copyright (c) 1992, 1993, 1995 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software donated to Berkeley by 6 * Jan-Simon Pendry. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 22 unchanged lines hidden (view full) --- 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * @(#)null_vfsops.c 8.2 (Berkeley) 1/21/94 37 * 38 * @(#)lofs_vfsops.c 1.2 (Berkeley) 6/18/92 | 1/* 2 * Copyright (c) 1992, 1993, 1995 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software donated to Berkeley by 6 * Jan-Simon Pendry. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 22 unchanged lines hidden (view full) --- 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * @(#)null_vfsops.c 8.2 (Berkeley) 1/21/94 37 * 38 * @(#)lofs_vfsops.c 1.2 (Berkeley) 6/18/92 |
39 * $Id: null_vfsops.c,v 1.18 1997/08/02 14:32:05 bde Exp $ | 39 * $Id: null_vfsops.c,v 1.19 1997/08/16 19:15:16 wollman Exp $ |
40 */ 41 42/* 43 * Null Layer 44 * (See null_vnops.c for a description of what this does.) 45 */ 46 47#include <sys/param.h> 48#include <sys/systm.h> 49#include <sys/kernel.h> 50#include <sys/proc.h> | 40 */ 41 42/* 43 * Null Layer 44 * (See null_vnops.c for a description of what this does.) 45 */ 46 47#include <sys/param.h> 48#include <sys/systm.h> 49#include <sys/kernel.h> 50#include <sys/proc.h> |
51#include <sys/malloc.h> |
|
51#include <sys/vnode.h> 52#include <sys/mount.h> 53#include <sys/namei.h> | 52#include <sys/vnode.h> 53#include <sys/mount.h> 54#include <sys/namei.h> |
54#include <sys/malloc.h> | |
55#include <miscfs/nullfs/null.h> 56 | 55#include <miscfs/nullfs/null.h> 56 |
57static MALLOC_DEFINE(M_NULLFSMNT, "NULLFS mount", "NULLFS mount structure"); 58 |
|
57static int nullfs_fhtovp __P((struct mount *mp, struct fid *fidp, 58 struct sockaddr *nam, struct vnode **vpp, 59 int *exflagsp, struct ucred **credanonp)); 60static int nullfs_mount __P((struct mount *mp, char *path, caddr_t data, 61 struct nameidata *ndp, struct proc *p)); 62static int nullfs_quotactl __P((struct mount *mp, int cmd, uid_t uid, 63 caddr_t arg, struct proc *p)); 64static int nullfs_root __P((struct mount *mp, struct vnode **vpp)); --- 84 unchanged lines hidden (view full) --- 149 if (lowerrootvp == VTONULL(mp->mnt_vnodecovered)->null_lowervp) { 150#ifdef DIAGNOSTIC 151 printf("nullfs_mount: multi null mount?\n"); 152#endif 153 return (EDEADLK); 154 } 155 156 xmp = (struct null_mount *) malloc(sizeof(struct null_mount), | 59static int nullfs_fhtovp __P((struct mount *mp, struct fid *fidp, 60 struct sockaddr *nam, struct vnode **vpp, 61 int *exflagsp, struct ucred **credanonp)); 62static int nullfs_mount __P((struct mount *mp, char *path, caddr_t data, 63 struct nameidata *ndp, struct proc *p)); 64static int nullfs_quotactl __P((struct mount *mp, int cmd, uid_t uid, 65 caddr_t arg, struct proc *p)); 66static int nullfs_root __P((struct mount *mp, struct vnode **vpp)); --- 84 unchanged lines hidden (view full) --- 151 if (lowerrootvp == VTONULL(mp->mnt_vnodecovered)->null_lowervp) { 152#ifdef DIAGNOSTIC 153 printf("nullfs_mount: multi null mount?\n"); 154#endif 155 return (EDEADLK); 156 } 157 158 xmp = (struct null_mount *) malloc(sizeof(struct null_mount), |
157 M_UFSMNT, M_WAITOK); /* XXX */ | 159 M_NULLFSMNT, M_WAITOK); /* XXX */ |
158 159 /* 160 * Save reference to underlying FS 161 */ 162 xmp->nullm_vfs = lowerrootvp->v_mount; 163 164 /* 165 * Save reference. Each mount also holds --- 4 unchanged lines hidden (view full) --- 170 * Unlock the node (either the lower or the alias) 171 */ 172 VOP_UNLOCK(vp, 0, p); 173 /* 174 * Make sure the node alias worked 175 */ 176 if (error) { 177 vrele(lowerrootvp); | 160 161 /* 162 * Save reference to underlying FS 163 */ 164 xmp->nullm_vfs = lowerrootvp->v_mount; 165 166 /* 167 * Save reference. Each mount also holds --- 4 unchanged lines hidden (view full) --- 172 * Unlock the node (either the lower or the alias) 173 */ 174 VOP_UNLOCK(vp, 0, p); 175 /* 176 * Make sure the node alias worked 177 */ 178 if (error) { 179 vrele(lowerrootvp); |
178 free(xmp, M_UFSMNT); /* XXX */ | 180 free(xmp, M_NULLFSMNT); /* XXX */ |
179 return (error); 180 } 181 182 /* 183 * Keep a held reference to the root vnode. 184 * It is vrele'd in nullfs_unmount. 185 */ 186 nullm_rootvp = vp; --- 76 unchanged lines hidden (view full) --- 263 vrele(nullm_rootvp); 264 /* 265 * And blow it away for future re-use 266 */ 267 vgone(nullm_rootvp); 268 /* 269 * Finally, throw away the null_mount structure 270 */ | 181 return (error); 182 } 183 184 /* 185 * Keep a held reference to the root vnode. 186 * It is vrele'd in nullfs_unmount. 187 */ 188 nullm_rootvp = vp; --- 76 unchanged lines hidden (view full) --- 265 vrele(nullm_rootvp); 266 /* 267 * And blow it away for future re-use 268 */ 269 vgone(nullm_rootvp); 270 /* 271 * Finally, throw away the null_mount structure 272 */ |
271 free(mp->mnt_data, M_UFSMNT); /* XXX */ | 273 free(mp->mnt_data, M_NULLFSMNT); /* XXX */ |
272 mp->mnt_data = 0; 273 return 0; 274} 275 276static int 277nullfs_root(mp, vpp) 278 struct mount *mp; 279 struct vnode **vpp; --- 143 unchanged lines hidden --- | 274 mp->mnt_data = 0; 275 return 0; 276} 277 278static int 279nullfs_root(mp, vpp) 280 struct mount *mp; 281 struct vnode **vpp; --- 143 unchanged lines hidden --- |