Deleted Added
full compact
vfs_syscalls.c (2459) vfs_syscalls.c (2946)
1/*
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

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

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94
1/*
2 * Copyright (c) 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

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

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94
39 * $Id: vfs_syscalls.c,v 1.5 1994/09/02 04:14:44 davidg Exp $
39 * $Id: vfs_syscalls.c,v 1.6 1994/09/02 10:23:43 davidg Exp $
40 */
41
42#include <sys/param.h>
43#include <sys/systm.h>
44#include <sys/namei.h>
45#include <sys/filedesc.h>
46#include <sys/kernel.h>
47#include <sys/file.h>

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

130
131 /*
132 * Allocate and initialize the file system.
133 */
134 mp = (struct mount *)malloc((u_long)sizeof(struct mount),
135 M_MOUNT, M_WAITOK);
136 bzero((char *)mp, (u_long)sizeof(struct mount));
137 mp->mnt_op = vfssw[uap->type];
40 */
41
42#include <sys/param.h>
43#include <sys/systm.h>
44#include <sys/namei.h>
45#include <sys/filedesc.h>
46#include <sys/kernel.h>
47#include <sys/file.h>

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

130
131 /*
132 * Allocate and initialize the file system.
133 */
134 mp = (struct mount *)malloc((u_long)sizeof(struct mount),
135 M_MOUNT, M_WAITOK);
136 bzero((char *)mp, (u_long)sizeof(struct mount));
137 mp->mnt_op = vfssw[uap->type];
138 mp->mnt_vfc = vfsconf[uap->type];
138 if (error = vfs_lock(mp)) {
139 free((caddr_t)mp, M_MOUNT);
140 vput(vp);
141 return (error);
142 }
143 if (vp->v_mountedhere != NULL) {
144 vfs_unlock(mp);
145 free((caddr_t)mp, M_MOUNT);
146 vput(vp);
147 return (EBUSY);
148 }
149 vp->v_mountedhere = mp;
150 mp->mnt_vnodecovered = vp;
139 if (error = vfs_lock(mp)) {
140 free((caddr_t)mp, M_MOUNT);
141 vput(vp);
142 return (error);
143 }
144 if (vp->v_mountedhere != NULL) {
145 vfs_unlock(mp);
146 free((caddr_t)mp, M_MOUNT);
147 vput(vp);
148 return (EBUSY);
149 }
150 vp->v_mountedhere = mp;
151 mp->mnt_vnodecovered = vp;
152 vfsconf[uap->type]->vfc_refcount++;
153
151update:
152 /*
153 * Set the mount level flags.
154 */
155 if (uap->flags & MNT_RDONLY)
156 mp->mnt_flag |= MNT_RDONLY;
157 else if (mp->mnt_flag & MNT_RDONLY)
158 mp->mnt_flag |= MNT_WANTRDWR;

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

183 VOP_UNLOCK(vp);
184 vfs_unlock(mp);
185 error = VFS_START(mp, 0, p);
186 } else {
187 mp->mnt_vnodecovered->v_mountedhere = (struct mount *)0;
188 vfs_unlock(mp);
189 free((caddr_t)mp, M_MOUNT);
190 vput(vp);
154update:
155 /*
156 * Set the mount level flags.
157 */
158 if (uap->flags & MNT_RDONLY)
159 mp->mnt_flag |= MNT_RDONLY;
160 else if (mp->mnt_flag & MNT_RDONLY)
161 mp->mnt_flag |= MNT_WANTRDWR;

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

186 VOP_UNLOCK(vp);
187 vfs_unlock(mp);
188 error = VFS_START(mp, 0, p);
189 } else {
190 mp->mnt_vnodecovered->v_mountedhere = (struct mount *)0;
191 vfs_unlock(mp);
192 free((caddr_t)mp, M_MOUNT);
193 vput(vp);
194 vfsconf[uap->type]->vfc_refcount--;
191 }
192 return (error);
193}
194
195/*
196 * Unmount a file system.
197 *
198 * Note: unmount takes a path to the vnode mounted on as argument,

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

277 vfs_unbusy(mp);
278 if (error) {
279 vfs_unlock(mp);
280 } else {
281 vrele(coveredvp);
282 TAILQ_REMOVE(&mountlist, mp, mnt_list);
283 mp->mnt_vnodecovered->v_mountedhere = (struct mount *)0;
284 vfs_unlock(mp);
195 }
196 return (error);
197}
198
199/*
200 * Unmount a file system.
201 *
202 * Note: unmount takes a path to the vnode mounted on as argument,

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

281 vfs_unbusy(mp);
282 if (error) {
283 vfs_unlock(mp);
284 } else {
285 vrele(coveredvp);
286 TAILQ_REMOVE(&mountlist, mp, mnt_list);
287 mp->mnt_vnodecovered->v_mountedhere = (struct mount *)0;
288 vfs_unlock(mp);
289 mp->mnt_vfc->vfc_refcount--;
285 if (mp->mnt_vnodelist.lh_first != NULL)
286 panic("unmount: dangling vnode");
287 free((caddr_t)mp, M_MOUNT);
288 }
289 return (error);
290}
291
292/*

--- 1905 unchanged lines hidden ---
290 if (mp->mnt_vnodelist.lh_first != NULL)
291 panic("unmount: dangling vnode");
292 free((caddr_t)mp, M_MOUNT);
293 }
294 return (error);
295}
296
297/*

--- 1905 unchanged lines hidden ---