summaryrefslogtreecommitdiffstats
path: root/sys/fs
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2001-03-01 21:00:17 +0000
committeradrian <adrian@FreeBSD.org>2001-03-01 21:00:17 +0000
commit401895533496c6f7943c0cadf487c2cfa8f852ac (patch)
tree19b63a29b1f18d2efdee5765c5bffd371838dd1e /sys/fs
parent845eeac4fc47466824d871b49fc54af4c3812e09 (diff)
downloadFreeBSD-src-401895533496c6f7943c0cadf487c2cfa8f852ac.zip
FreeBSD-src-401895533496c6f7943c0cadf487c2cfa8f852ac.tar.gz
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.
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 3017339..606f9d3 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 eb13d8f..ee369e1 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 84940c7..7737e37 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 1581851..2d40b2d 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 3088d7a..672ea5d 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 384883e..89a7dd7 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 3339162..b852cc4 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 3e76b30..7d17e7d 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 139746d..3f7903c 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 6457897..768ad48 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 dfa6eae..5018f09 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>:";
OpenPOWER on IntegriCloud