vfs_mount.c (141206) | vfs_mount.c (141634) |
---|---|
1/*- 2 * Copyright (c) 1999-2004 Poul-Henning Kamp 3 * Copyright (c) 1999 Michael Smith 4 * Copyright (c) 1989, 1993 5 * The Regents of the University of California. All rights reserved. 6 * (c) UNIX System Laboratories, Inc. 7 * All or some portions of this file are derived from material licensed 8 * to the University of California by American Telephone and Telegraph --- 21 unchanged lines hidden (view full) --- 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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 37#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1999-2004 Poul-Henning Kamp 3 * Copyright (c) 1999 Michael Smith 4 * Copyright (c) 1989, 1993 5 * The Regents of the University of California. All rights reserved. 6 * (c) UNIX System Laboratories, Inc. 7 * All or some portions of this file are derived from material licensed 8 * to the University of California by American Telephone and Telegraph --- 21 unchanged lines hidden (view full) --- 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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 37#include <sys/cdefs.h> |
38__FBSDID("$FreeBSD: head/sys/kern/vfs_mount.c 141206 2005-02-03 15:10:58Z pjd $"); | 38__FBSDID("$FreeBSD: head/sys/kern/vfs_mount.c 141634 2005-02-10 12:25:38Z phk $"); |
39 40#include <sys/param.h> 41#include <sys/conf.h> 42#include <sys/jail.h> 43#include <sys/kernel.h> 44#include <sys/libkern.h> 45#include <sys/mac.h> 46#include <sys/malloc.h> --- 29 unchanged lines hidden (view full) --- 76static int vfs_domount(struct thread *td, const char *fstype, 77 char *fspath, int fsflags, void *fsdata); 78static int vfs_mount_alloc(struct vnode *dvp, struct vfsconf *vfsp, 79 const char *fspath, struct thread *td, struct mount **mpp); 80static int vfs_mountroot_ask(void); 81static int vfs_mountroot_try(const char *mountfrom); 82static int vfs_donmount(struct thread *td, int fsflags, 83 struct uio *fsoptions); | 39 40#include <sys/param.h> 41#include <sys/conf.h> 42#include <sys/jail.h> 43#include <sys/kernel.h> 44#include <sys/libkern.h> 45#include <sys/mac.h> 46#include <sys/malloc.h> --- 29 unchanged lines hidden (view full) --- 76static int vfs_domount(struct thread *td, const char *fstype, 77 char *fspath, int fsflags, void *fsdata); 78static int vfs_mount_alloc(struct vnode *dvp, struct vfsconf *vfsp, 79 const char *fspath, struct thread *td, struct mount **mpp); 80static int vfs_mountroot_ask(void); 81static int vfs_mountroot_try(const char *mountfrom); 82static int vfs_donmount(struct thread *td, int fsflags, 83 struct uio *fsoptions); |
84static void free_mntarg(struct mntarg *ma); 85static void vfs_mount_destroy(struct mount *, struct thread *); |
|
84 85static int usermount = 0; 86SYSCTL_INT(_vfs, OID_AUTO, usermount, CTLFLAG_RW, &usermount, 0, 87 "Unprivileged users may mount and unmount file systems"); 88 89MALLOC_DEFINE(M_MOUNT, "mount", "vfs mount structure"); 90 91/* List of mounted filesystems. */ --- 48 unchanged lines hidden (view full) --- 140 NULL 141}; 142 143/* legacy find-root code */ 144char *rootdevnames[2] = {NULL, NULL}; 145#ifndef ROOTDEVNAME 146# define ROOTDEVNAME NULL 147#endif | 86 87static int usermount = 0; 88SYSCTL_INT(_vfs, OID_AUTO, usermount, CTLFLAG_RW, &usermount, 0, 89 "Unprivileged users may mount and unmount file systems"); 90 91MALLOC_DEFINE(M_MOUNT, "mount", "vfs mount structure"); 92 93/* List of mounted filesystems. */ --- 48 unchanged lines hidden (view full) --- 142 NULL 143}; 144 145/* legacy find-root code */ 146char *rootdevnames[2] = {NULL, NULL}; 147#ifndef ROOTDEVNAME 148# define ROOTDEVNAME NULL 149#endif |
148const char *ctrootdevname = ROOTDEVNAME; | 150static const char *ctrootdevname = ROOTDEVNAME; |
149 150/* 151 * --------------------------------------------------------------------- 152 * Functions for building and sanitizing the mount options 153 */ 154 155/* Remove one mount option. */ 156static void --- 271 unchanged lines hidden (view full) --- 428#endif 429 *mpp = mp; 430 return (0); 431} 432 433/* 434 * Destroy the mount struct previously allocated by vfs_mount_alloc(). 435 */ | 151 152/* 153 * --------------------------------------------------------------------- 154 * Functions for building and sanitizing the mount options 155 */ 156 157/* Remove one mount option. */ 158static void --- 271 unchanged lines hidden (view full) --- 430#endif 431 *mpp = mp; 432 return (0); 433} 434 435/* 436 * Destroy the mount struct previously allocated by vfs_mount_alloc(). 437 */ |
436void | 438static void |
437vfs_mount_destroy(struct mount *mp, struct thread *td) 438{ 439 440 mp->mnt_vfc->vfc_refcount--; 441 if (!TAILQ_EMPTY(&mp->mnt_nvnodelist)) 442 panic("unmount: dangling vnode"); 443 vfs_unbusy(mp,td); 444 lockdestroy(&mp->mnt_lock); --- 1192 unchanged lines hidden (view full) --- 1637 ma->v[ma->len].iov_len = len; 1638 ma->len++; 1639 return (ma); 1640} 1641 1642/* 1643 * Free a mntarg structure 1644 */ | 439vfs_mount_destroy(struct mount *mp, struct thread *td) 440{ 441 442 mp->mnt_vfc->vfc_refcount--; 443 if (!TAILQ_EMPTY(&mp->mnt_nvnodelist)) 444 panic("unmount: dangling vnode"); 445 vfs_unbusy(mp,td); 446 lockdestroy(&mp->mnt_lock); --- 1192 unchanged lines hidden (view full) --- 1639 ma->v[ma->len].iov_len = len; 1640 ma->len++; 1641 return (ma); 1642} 1643 1644/* 1645 * Free a mntarg structure 1646 */ |
1645void | 1647static void |
1646free_mntarg(struct mntarg *ma) 1647{ 1648 struct mntaarg *maa; 1649 1650 while (!SLIST_EMPTY(&ma->list)) { 1651 maa = SLIST_FIRST(&ma->list); 1652 SLIST_REMOVE_HEAD(&ma->list, next); 1653 free(maa, M_MOUNT); --- 54 unchanged lines hidden --- | 1648free_mntarg(struct mntarg *ma) 1649{ 1650 struct mntaarg *maa; 1651 1652 while (!SLIST_EMPTY(&ma->list)) { 1653 maa = SLIST_FIRST(&ma->list); 1654 SLIST_REMOVE_HEAD(&ma->list, next); 1655 free(maa, M_MOUNT); --- 54 unchanged lines hidden --- |