Deleted Added
full compact
union_vfsops.c (29888) union_vfsops.c (30354)
1/*
2 * Copyright (c) 1994, 1995 The Regents of the University of California.
3 * Copyright (c) 1994, 1995 Jan-Simon Pendry.
4 * All rights reserved.
5 *
6 * This code is derived from software donated to Berkeley by
7 * Jan-Simon Pendry.
8 *

--- 21 unchanged lines hidden (view full) ---

30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 *
37 * @(#)union_vfsops.c 8.20 (Berkeley) 5/20/95
1/*
2 * Copyright (c) 1994, 1995 The Regents of the University of California.
3 * Copyright (c) 1994, 1995 Jan-Simon Pendry.
4 * All rights reserved.
5 *
6 * This code is derived from software donated to Berkeley by
7 * Jan-Simon Pendry.
8 *

--- 21 unchanged lines hidden (view full) ---

30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 *
37 * @(#)union_vfsops.c 8.20 (Berkeley) 5/20/95
38 * $Id: union_vfsops.c,v 1.19 1997/08/16 19:15:22 wollman Exp $
38 * $Id: union_vfsops.c,v 1.20 1997/09/27 13:39:29 kato Exp $
39 */
40
41/*
42 * Union Layer
43 */
44
45#include <sys/param.h>
46#include <sys/systm.h>
47#include <sys/kernel.h>
48#include <sys/proc.h>
49#include <sys/vnode.h>
50#include <sys/mount.h>
51#include <sys/namei.h>
52#include <sys/malloc.h>
53#include <sys/filedesc.h>
54#include <miscfs/union/union.h>
55
39 */
40
41/*
42 * Union Layer
43 */
44
45#include <sys/param.h>
46#include <sys/systm.h>
47#include <sys/kernel.h>
48#include <sys/proc.h>
49#include <sys/vnode.h>
50#include <sys/mount.h>
51#include <sys/namei.h>
52#include <sys/malloc.h>
53#include <sys/filedesc.h>
54#include <miscfs/union/union.h>
55
56static MALLOC_DEFINE(M_UNIONFSMNT, "UNION mount", "UNION mount structure");
57
56extern int union_init __P((struct vfsconf *));
57
58extern int union_fhtovp __P((struct mount *mp, struct fid *fidp,
59 struct mbuf *nam, struct vnode **vpp,
60 int *exflagsp, struct ucred **credanonp));
61extern int union_mount __P((struct mount *mp, char *path, caddr_t data,
62 struct nameidata *ndp, struct proc *p));
63extern int union_quotactl __P((struct mount *mp, int cmd, uid_t uid,

--- 107 unchanged lines hidden (view full) ---

171 }
172
173 if (upperrootvp->v_type != VDIR) {
174 error = EINVAL;
175 goto bad;
176 }
177
178 um = (struct union_mount *) malloc(sizeof(struct union_mount),
58extern int union_init __P((struct vfsconf *));
59
60extern int union_fhtovp __P((struct mount *mp, struct fid *fidp,
61 struct mbuf *nam, struct vnode **vpp,
62 int *exflagsp, struct ucred **credanonp));
63extern int union_mount __P((struct mount *mp, char *path, caddr_t data,
64 struct nameidata *ndp, struct proc *p));
65extern int union_quotactl __P((struct mount *mp, int cmd, uid_t uid,

--- 107 unchanged lines hidden (view full) ---

173 }
174
175 if (upperrootvp->v_type != VDIR) {
176 error = EINVAL;
177 goto bad;
178 }
179
180 um = (struct union_mount *) malloc(sizeof(struct union_mount),
179 M_UFSMNT, M_WAITOK); /* XXX */
181 M_UNIONFSMNT, M_WAITOK); /* XXX */
180
181 /*
182 * Keep a held reference to the target vnodes.
183 * They are vrele'd in union_unmount.
184 *
185 * Depending on the _BELOW flag, the filesystems are
186 * viewed in a different order. In effect, this is the
187 * same as providing a mount under option to the mount syscall.

--- 93 unchanged lines hidden (view full) ---

281#ifdef UNION_DIAGNOSTIC
282 printf("union_mount: from %s, on %s\n",
283 mp->mnt_stat.f_mntfromname, mp->mnt_stat.f_mntonname);
284#endif
285 return (0);
286
287bad:
288 if (um)
182
183 /*
184 * Keep a held reference to the target vnodes.
185 * They are vrele'd in union_unmount.
186 *
187 * Depending on the _BELOW flag, the filesystems are
188 * viewed in a different order. In effect, this is the
189 * same as providing a mount under option to the mount syscall.

--- 93 unchanged lines hidden (view full) ---

283#ifdef UNION_DIAGNOSTIC
284 printf("union_mount: from %s, on %s\n",
285 mp->mnt_stat.f_mntfromname, mp->mnt_stat.f_mntonname);
286#endif
287 return (0);
288
289bad:
290 if (um)
289 free(um, M_UFSMNT);
291 free(um, M_UNIONFSMNT);
290 if (cred)
291 crfree(cred);
292 if (upperrootvp)
293 vrele(upperrootvp);
294 if (lowerrootvp)
295 vrele(lowerrootvp);
296 return (error);
297}

--- 87 unchanged lines hidden (view full) ---

385 vput(um_rootvp);
386 /*
387 * And blow it away for future re-use
388 */
389 vgone(um_rootvp);
390 /*
391 * Finally, throw away the union_mount structure
392 */
292 if (cred)
293 crfree(cred);
294 if (upperrootvp)
295 vrele(upperrootvp);
296 if (lowerrootvp)
297 vrele(lowerrootvp);
298 return (error);
299}

--- 87 unchanged lines hidden (view full) ---

387 vput(um_rootvp);
388 /*
389 * And blow it away for future re-use
390 */
391 vgone(um_rootvp);
392 /*
393 * Finally, throw away the union_mount structure
394 */
393 free(mp->mnt_data, M_UFSMNT); /* XXX */
395 free(mp->mnt_data, M_UNIONFSMNT); /* XXX */
394 mp->mnt_data = 0;
395 return (0);
396}
397
398int
399union_root(mp, vpp)
400 struct mount *mp;
401 struct vnode **vpp;

--- 161 unchanged lines hidden ---
396 mp->mnt_data = 0;
397 return (0);
398}
399
400int
401union_root(mp, vpp)
402 struct mount *mp;
403 struct vnode **vpp;

--- 161 unchanged lines hidden ---