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.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]; |
138 mp->mnt_vfc = vfsconf[uap->type]; |
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 |
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--; |
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--; |
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 --- |