aboutsummaryrefslogtreecommitdiff
path: root/sys/fs
diff options
context:
space:
mode:
authorAdrian Chadd <adrian@FreeBSD.org>2001-03-01 21:00:17 +0000
committerAdrian Chadd <adrian@FreeBSD.org>2001-03-01 21:00:17 +0000
commitf3a90da99535deaf4e33d660ac83e7126a20a20f (patch)
tree8ea107615a4d686bc40bbe2cead2f674e6cd07f2 /sys/fs
parentc909b97167e227032fe53444366c2c742570373f (diff)
downloadsrc-f3a90da99535deaf4e33d660ac83e7126a20a20f.tar.gz
src-f3a90da99535deaf4e33d660ac83e7126a20a20f.zip
Reviewed by: jlemon
An initial tidyup of the mount() syscall and VFS mount code. This code replaces the earlier work done by jlemon in an attempt to make linux_mount() work. * the guts of the mount work has been moved into vfs_mount(). * move `type', `path' and `flags' from being userland variables into being kernel variables in vfs_mount(). `data' remains a pointer into userspace. * Attempt to verify the `type' and `path' strings passed to vfs_mount() aren't too long. * rework mount() and linux_mount() to take the userland parameters (besides data, as mentioned) and pass kernel variables to vfs_mount(). (linux_mount() already did this, I've just tidied it up a little more.) * remove the copyin*() stuff for `path'. `data' still requires copyin*() since its a pointer into userland. * set `mount->mnt_statf_mntonname' in vfs_mount() rather than in each filesystem. This variable is generally initialised with `path', and each filesystem can override it if they want to. * NOTE: f_mntonname is intiailised with "/" in the case of a root mount.
Notes
Notes: svn path=/head/; revision=73286
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/cd9660/cd9660_vfsops.c2
-rw-r--r--sys/fs/devfs/devfs_vfsops.c8
-rw-r--r--sys/fs/fdescfs/fdesc_vfsops.c3
-rw-r--r--sys/fs/hpfs/hpfs_vfsops.c14
-rw-r--r--sys/fs/msdosfs/msdosfs_vfsops.c3
-rw-r--r--sys/fs/ntfs/ntfs_vfsops.c14
-rw-r--r--sys/fs/nullfs/null_vfsops.c2
-rw-r--r--sys/fs/nwfs/nwfs_vfsops.c3
-rw-r--r--sys/fs/portalfs/portal_vfsops.c2
-rw-r--r--sys/fs/umapfs/umap_vfsops.c2
-rw-r--r--sys/fs/unionfs/union_vfsops.c3
11 files changed, 10 insertions, 46 deletions
diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c
index 3017339f2251..606f9d379413 100644
--- a/sys/fs/cd9660/cd9660_vfsops.c
+++ b/sys/fs/cd9660/cd9660_vfsops.c
@@ -249,8 +249,6 @@ cd9660_mount(mp, path, data, ndp, p)
return error;
}
imp = VFSTOISOFS(mp);
- (void) copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN - 1, &size);
- bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size);
(void) copyinstr(args.fspec, mp->mnt_stat.f_mntfromname, MNAMELEN - 1,
&size);
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
diff --git a/sys/fs/devfs/devfs_vfsops.c b/sys/fs/devfs/devfs_vfsops.c
index eb13d8f719cb..ee369e16ee81 100644
--- a/sys/fs/devfs/devfs_vfsops.c
+++ b/sys/fs/devfs/devfs_vfsops.c
@@ -67,7 +67,6 @@ devfs_mount(mp, path, data, ndp, p)
struct proc *p;
{
int error;
- size_t size;
struct devfs_mount *fmp;
struct vnode *rvp;
@@ -100,13 +99,6 @@ devfs_mount(mp, path, data, ndp, p)
}
VOP_UNLOCK(rvp, 0, p);
- if (path != NULL) {
- (void) copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN - 1, &size);
- } else {
- strcpy(mp->mnt_stat.f_mntonname, "/");
- size = 1;
- }
- bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size);
bzero(mp->mnt_stat.f_mntfromname, MNAMELEN);
bcopy("devfs", mp->mnt_stat.f_mntfromname, sizeof("devfs"));
(void)devfs_statfs(mp, &mp->mnt_stat, p);
diff --git a/sys/fs/fdescfs/fdesc_vfsops.c b/sys/fs/fdescfs/fdesc_vfsops.c
index 84940c70a745..7737e37dd5c7 100644
--- a/sys/fs/fdescfs/fdesc_vfsops.c
+++ b/sys/fs/fdescfs/fdesc_vfsops.c
@@ -74,7 +74,6 @@ fdesc_mount(mp, path, data, ndp, p)
struct proc *p;
{
int error = 0;
- u_int size;
struct fdescmount *fmp;
struct vnode *rvp;
@@ -98,8 +97,6 @@ fdesc_mount(mp, path, data, ndp, p)
mp->mnt_data = (qaddr_t) fmp;
vfs_getnewfsid(mp);
- (void) copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN - 1, &size);
- bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size);
bzero(mp->mnt_stat.f_mntfromname, MNAMELEN);
bcopy("fdesc", mp->mnt_stat.f_mntfromname, sizeof("fdesc"));
(void)fdesc_statfs(mp, &mp->mnt_stat, p);
diff --git a/sys/fs/hpfs/hpfs_vfsops.c b/sys/fs/hpfs/hpfs_vfsops.c
index 1581851da1ca..2d40b2da1253 100644
--- a/sys/fs/hpfs/hpfs_vfsops.c
+++ b/sys/fs/hpfs/hpfs_vfsops.c
@@ -272,16 +272,12 @@ hpfs_mount (
/*
* Since this is a new mount, we want the names for
* the device and the mount point copied in. If an
- * error occurs, the mountpoint is discarded by the
- * upper level code.
+ * error occurs, the mountpoint is discarded by the
+ * upper level code. Note that vfs_mount() handles
+ * copying the mountpoint f_mntonname for us, so we
+ * don't have to do it here unless we want to set it
+ * to something other than "path" for some rason.
*/
- /* Save "last mounted on" info for mount point (NULL pad)*/
- copyinstr( path, /* mount point*/
- mp->mnt_stat.f_mntonname, /* save area*/
- MNAMELEN - 1, /* max size*/
- &size); /* real size*/
- bzero( mp->mnt_stat.f_mntonname + size, MNAMELEN - size);
-
/* Save "mounted from" info for mount point (NULL pad)*/
copyinstr( args.fspec, /* device name*/
mp->mnt_stat.f_mntfromname, /* save area*/
diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c
index 3088d7a2bd6a..672ea5df2e2f 100644
--- a/sys/fs/msdosfs/msdosfs_vfsops.c
+++ b/sys/fs/msdosfs/msdosfs_vfsops.c
@@ -345,9 +345,6 @@ msdosfs_mount(mp, path, data, ndp, p)
msdosfs_unmount(mp, MNT_FORCE, p);
return error;
}
-
- (void) copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN - 1, &size);
- bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size);
(void) copyinstr(args.fspec, mp->mnt_stat.f_mntfromname, MNAMELEN - 1,
&size);
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
diff --git a/sys/fs/ntfs/ntfs_vfsops.c b/sys/fs/ntfs/ntfs_vfsops.c
index 384883e81159..89a7dd7bc0f4 100644
--- a/sys/fs/ntfs/ntfs_vfsops.c
+++ b/sys/fs/ntfs/ntfs_vfsops.c
@@ -376,16 +376,12 @@ ntfs_mount (
/*
* Since this is a new mount, we want the names for
* the device and the mount point copied in. If an
- * error occurs, the mountpoint is discarded by the
- * upper level code.
+ * error occurs, the mountpoint is discarded by the
+ * upper level code. Note that vfs_mount() handles
+ * copying the mountpoint f_mntonname for us, so we
+ * don't have to do it here unless we want to set it
+ * to something other than "path" for some rason.
*/
- /* Save "last mounted on" info for mount point (NULL pad)*/
- copyinstr( path, /* mount point*/
- mp->mnt_stat.f_mntonname, /* save area*/
- MNAMELEN - 1, /* max size*/
- &size); /* real size*/
- bzero( mp->mnt_stat.f_mntonname + size, MNAMELEN - size);
-
/* Save "mounted from" info for mount point (NULL pad)*/
copyinstr( args.fspec, /* device name*/
mp->mnt_stat.f_mntfromname, /* save area*/
diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c
index 333916237b4b..b852cc45ff1e 100644
--- a/sys/fs/nullfs/null_vfsops.c
+++ b/sys/fs/nullfs/null_vfsops.c
@@ -191,8 +191,6 @@ nullfs_mount(mp, path, data, ndp, p)
mp->mnt_data = (qaddr_t) xmp;
vfs_getnewfsid(mp);
- (void) copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN - 1, &size);
- bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size);
(void) copyinstr(args.target, mp->mnt_stat.f_mntfromname, MNAMELEN - 1,
&size);
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
diff --git a/sys/fs/nwfs/nwfs_vfsops.c b/sys/fs/nwfs/nwfs_vfsops.c
index 3e76b30ac1a9..7d17e7d0247d 100644
--- a/sys/fs/nwfs/nwfs_vfsops.c
+++ b/sys/fs/nwfs/nwfs_vfsops.c
@@ -146,7 +146,6 @@ static int nwfs_mount(struct mount *mp, char *path, caddr_t data,
struct nameidata *ndp, struct proc *p)
{
struct nwfs_args args; /* will hold data from mount request */
- size_t size;
int error;
struct nwmount *nmp = NULL;
struct ncp_conn *conn = NULL;
@@ -198,8 +197,6 @@ static int nwfs_mount(struct mount *mp, char *path, caddr_t data,
nmp->m.dir_mode = (nmp->m.dir_mode &
(S_IRWXU|S_IRWXG|S_IRWXO)) | S_IFDIR;
if ((error = nwfs_initnls(nmp)) != 0) goto bad;
- (void) copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN - 1, &size);
- bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size);
pc = mp->mnt_stat.f_mntfromname;
pe = pc+sizeof(mp->mnt_stat.f_mntfromname);
bzero(pc, MNAMELEN);
diff --git a/sys/fs/portalfs/portal_vfsops.c b/sys/fs/portalfs/portal_vfsops.c
index 139746d3d35b..3f7903ca2577 100644
--- a/sys/fs/portalfs/portal_vfsops.c
+++ b/sys/fs/portalfs/portal_vfsops.c
@@ -133,8 +133,6 @@ portal_mount(mp, path, data, ndp, p)
mp->mnt_data = (qaddr_t) fmp;
vfs_getnewfsid(mp);
- (void)copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN - 1, &size);
- bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size);
(void)copyinstr(args.pa_config,
mp->mnt_stat.f_mntfromname, MNAMELEN - 1, &size);
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
diff --git a/sys/fs/umapfs/umap_vfsops.c b/sys/fs/umapfs/umap_vfsops.c
index 6457897c46a7..768ad48334ec 100644
--- a/sys/fs/umapfs/umap_vfsops.c
+++ b/sys/fs/umapfs/umap_vfsops.c
@@ -221,8 +221,6 @@ umapfs_mount(mp, path, data, ndp, p)
mp->mnt_data = (qaddr_t) amp;
vfs_getnewfsid(mp);
- (void) copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN - 1, &size);
- bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size);
(void) copyinstr(args.target, mp->mnt_stat.f_mntfromname, MNAMELEN - 1,
&size);
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
diff --git a/sys/fs/unionfs/union_vfsops.c b/sys/fs/unionfs/union_vfsops.c
index dfa6eae70098..5018f094653f 100644
--- a/sys/fs/unionfs/union_vfsops.c
+++ b/sys/fs/unionfs/union_vfsops.c
@@ -253,9 +253,6 @@ union_mount(mp, path, data, ndp, p)
mp->mnt_data = (qaddr_t) um;
vfs_getnewfsid(mp);
- (void) copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN - 1, &size);
- bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size);
-
switch (um->um_op) {
case UNMNT_ABOVE:
cp = "<above>:";