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.
This commit is contained in:
parent
c909b97167
commit
f3a90da995
@ -90,9 +90,6 @@ linprocfs_mount(mp, path, data, ndp, p)
|
|||||||
mp->mnt_data = 0;
|
mp->mnt_data = 0;
|
||||||
vfs_getnewfsid(mp);
|
vfs_getnewfsid(mp);
|
||||||
|
|
||||||
(void) copyinstr(path, (caddr_t)mp->mnt_stat.f_mntonname, MNAMELEN, &size);
|
|
||||||
bzero(mp->mnt_stat.f_mntonname + size, MNAMELEN - size);
|
|
||||||
|
|
||||||
size = sizeof("linprocfs") - 1;
|
size = sizeof("linprocfs") - 1;
|
||||||
bcopy("linprocfs", mp->mnt_stat.f_mntfromname, size);
|
bcopy("linprocfs", mp->mnt_stat.f_mntfromname, size);
|
||||||
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
|
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
|
||||||
|
@ -901,14 +901,16 @@ linux_pwrite(p, uap)
|
|||||||
int
|
int
|
||||||
linux_mount(struct proc *p, struct linux_mount_args *args)
|
linux_mount(struct proc *p, struct linux_mount_args *args)
|
||||||
{
|
{
|
||||||
struct mount_args bsd_args;
|
|
||||||
struct ufs_args ufs;
|
struct ufs_args ufs;
|
||||||
char fstypename[MFSNAMELEN];
|
char fstypename[MFSNAMELEN];
|
||||||
char mntonname[MNAMELEN], mntfromname[MNAMELEN];
|
char mntonname[MNAMELEN], mntfromname[MNAMELEN];
|
||||||
int error = 0;
|
int error;
|
||||||
|
int fsflags;
|
||||||
|
const char *fstype;
|
||||||
|
void *fsdata;
|
||||||
|
|
||||||
error = copyinstr(args->filesystemtype, fstypename,
|
error = copyinstr(args->filesystemtype, fstypename, MFSNAMELEN - 1,
|
||||||
MFSNAMELEN - 1, NULL);
|
NULL);
|
||||||
if (error)
|
if (error)
|
||||||
return (error);
|
return (error);
|
||||||
error = copyinstr(args->specialfile, mntfromname, MFSNAMELEN - 1, NULL);
|
error = copyinstr(args->specialfile, mntfromname, MFSNAMELEN - 1, NULL);
|
||||||
@ -925,22 +927,21 @@ linux_mount(struct proc *p, struct linux_mount_args *args)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (strcmp(fstypename, "ext2") == 0) {
|
if (strcmp(fstypename, "ext2") == 0) {
|
||||||
bsd_args.type = "ext2fs";
|
fstype = "ext2fs";
|
||||||
bsd_args.data = (void *)&ufs;
|
fsdata = &ufs;
|
||||||
ufs.fspec = mntfromname;
|
ufs.fspec = mntfromname;
|
||||||
#define DEFAULT_ROOTID -2
|
#define DEFAULT_ROOTID -2
|
||||||
ufs.export.ex_root = DEFAULT_ROOTID;
|
ufs.export.ex_root = DEFAULT_ROOTID;
|
||||||
ufs.export.ex_flags =
|
ufs.export.ex_flags =
|
||||||
args->rwflag & LINUX_MS_RDONLY ? MNT_EXRDONLY : 0;
|
args->rwflag & LINUX_MS_RDONLY ? MNT_EXRDONLY : 0;
|
||||||
} else if (strcmp(fstypename, "proc") == 0) {
|
} else if (strcmp(fstypename, "proc") == 0) {
|
||||||
bsd_args.type = "linprocfs";
|
fstype = "linprocfs";
|
||||||
bsd_args.data = NULL;
|
fsdata = NULL;
|
||||||
} else {
|
} else {
|
||||||
return (ENODEV);
|
return (ENODEV);
|
||||||
}
|
}
|
||||||
|
|
||||||
bsd_args.path = mntonname;
|
fsflags = 0;
|
||||||
bsd_args.flags = 0;
|
|
||||||
|
|
||||||
if ((args->rwflag & 0xffff0000) == 0xc0ed0000) {
|
if ((args->rwflag & 0xffff0000) == 0xc0ed0000) {
|
||||||
/*
|
/*
|
||||||
@ -948,18 +949,18 @@ linux_mount(struct proc *p, struct linux_mount_args *args)
|
|||||||
* FreeBSD has is !ASYNC, which is our default.
|
* FreeBSD has is !ASYNC, which is our default.
|
||||||
*/
|
*/
|
||||||
if (args->rwflag & LINUX_MS_RDONLY)
|
if (args->rwflag & LINUX_MS_RDONLY)
|
||||||
bsd_args.flags |= MNT_RDONLY;
|
fsflags |= MNT_RDONLY;
|
||||||
if (args->rwflag & LINUX_MS_NOSUID)
|
if (args->rwflag & LINUX_MS_NOSUID)
|
||||||
bsd_args.flags |= MNT_NOSUID;
|
fsflags |= MNT_NOSUID;
|
||||||
if (args->rwflag & LINUX_MS_NODEV)
|
if (args->rwflag & LINUX_MS_NODEV)
|
||||||
bsd_args.flags |= MNT_NODEV;
|
fsflags |= MNT_NODEV;
|
||||||
if (args->rwflag & LINUX_MS_NOEXEC)
|
if (args->rwflag & LINUX_MS_NOEXEC)
|
||||||
bsd_args.flags |= MNT_NOEXEC;
|
fsflags |= MNT_NOEXEC;
|
||||||
if (args->rwflag & LINUX_MS_REMOUNT)
|
if (args->rwflag & LINUX_MS_REMOUNT)
|
||||||
bsd_args.flags |= MNT_UPDATE;
|
fsflags |= MNT_UPDATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (mount1(p, &bsd_args, UIO_SYSSPACE));
|
return (vfs_mount(p, fstype, mntonname, fsflags, fsdata));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -249,8 +249,6 @@ cd9660_mount(mp, path, data, ndp, p)
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
imp = VFSTOISOFS(mp);
|
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,
|
(void) copyinstr(args.fspec, mp->mnt_stat.f_mntfromname, MNAMELEN - 1,
|
||||||
&size);
|
&size);
|
||||||
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
|
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
|
||||||
|
@ -67,7 +67,6 @@ devfs_mount(mp, path, data, ndp, p)
|
|||||||
struct proc *p;
|
struct proc *p;
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
size_t size;
|
|
||||||
struct devfs_mount *fmp;
|
struct devfs_mount *fmp;
|
||||||
struct vnode *rvp;
|
struct vnode *rvp;
|
||||||
|
|
||||||
@ -100,13 +99,6 @@ devfs_mount(mp, path, data, ndp, p)
|
|||||||
}
|
}
|
||||||
VOP_UNLOCK(rvp, 0, 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);
|
bzero(mp->mnt_stat.f_mntfromname, MNAMELEN);
|
||||||
bcopy("devfs", mp->mnt_stat.f_mntfromname, sizeof("devfs"));
|
bcopy("devfs", mp->mnt_stat.f_mntfromname, sizeof("devfs"));
|
||||||
(void)devfs_statfs(mp, &mp->mnt_stat, p);
|
(void)devfs_statfs(mp, &mp->mnt_stat, p);
|
||||||
|
@ -74,7 +74,6 @@ fdesc_mount(mp, path, data, ndp, p)
|
|||||||
struct proc *p;
|
struct proc *p;
|
||||||
{
|
{
|
||||||
int error = 0;
|
int error = 0;
|
||||||
u_int size;
|
|
||||||
struct fdescmount *fmp;
|
struct fdescmount *fmp;
|
||||||
struct vnode *rvp;
|
struct vnode *rvp;
|
||||||
|
|
||||||
@ -98,8 +97,6 @@ fdesc_mount(mp, path, data, ndp, p)
|
|||||||
mp->mnt_data = (qaddr_t) fmp;
|
mp->mnt_data = (qaddr_t) fmp;
|
||||||
vfs_getnewfsid(mp);
|
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);
|
bzero(mp->mnt_stat.f_mntfromname, MNAMELEN);
|
||||||
bcopy("fdesc", mp->mnt_stat.f_mntfromname, sizeof("fdesc"));
|
bcopy("fdesc", mp->mnt_stat.f_mntfromname, sizeof("fdesc"));
|
||||||
(void)fdesc_statfs(mp, &mp->mnt_stat, p);
|
(void)fdesc_statfs(mp, &mp->mnt_stat, p);
|
||||||
|
@ -272,16 +272,12 @@ hpfs_mount (
|
|||||||
/*
|
/*
|
||||||
* Since this is a new mount, we want the names for
|
* Since this is a new mount, we want the names for
|
||||||
* the device and the mount point copied in. If an
|
* the device and the mount point copied in. If an
|
||||||
* error occurs, the mountpoint is discarded by the
|
* error occurs, the mountpoint is discarded by the
|
||||||
* upper level code.
|
* 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)*/
|
/* Save "mounted from" info for mount point (NULL pad)*/
|
||||||
copyinstr( args.fspec, /* device name*/
|
copyinstr( args.fspec, /* device name*/
|
||||||
mp->mnt_stat.f_mntfromname, /* save area*/
|
mp->mnt_stat.f_mntfromname, /* save area*/
|
||||||
|
@ -345,9 +345,6 @@ msdosfs_mount(mp, path, data, ndp, p)
|
|||||||
msdosfs_unmount(mp, MNT_FORCE, p);
|
msdosfs_unmount(mp, MNT_FORCE, p);
|
||||||
return error;
|
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,
|
(void) copyinstr(args.fspec, mp->mnt_stat.f_mntfromname, MNAMELEN - 1,
|
||||||
&size);
|
&size);
|
||||||
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
|
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
|
||||||
|
@ -376,16 +376,12 @@ ntfs_mount (
|
|||||||
/*
|
/*
|
||||||
* Since this is a new mount, we want the names for
|
* Since this is a new mount, we want the names for
|
||||||
* the device and the mount point copied in. If an
|
* the device and the mount point copied in. If an
|
||||||
* error occurs, the mountpoint is discarded by the
|
* error occurs, the mountpoint is discarded by the
|
||||||
* upper level code.
|
* 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)*/
|
/* Save "mounted from" info for mount point (NULL pad)*/
|
||||||
copyinstr( args.fspec, /* device name*/
|
copyinstr( args.fspec, /* device name*/
|
||||||
mp->mnt_stat.f_mntfromname, /* save area*/
|
mp->mnt_stat.f_mntfromname, /* save area*/
|
||||||
|
@ -191,8 +191,6 @@ nullfs_mount(mp, path, data, ndp, p)
|
|||||||
mp->mnt_data = (qaddr_t) xmp;
|
mp->mnt_data = (qaddr_t) xmp;
|
||||||
vfs_getnewfsid(mp);
|
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,
|
(void) copyinstr(args.target, mp->mnt_stat.f_mntfromname, MNAMELEN - 1,
|
||||||
&size);
|
&size);
|
||||||
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
|
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
|
||||||
|
@ -146,7 +146,6 @@ static int nwfs_mount(struct mount *mp, char *path, caddr_t data,
|
|||||||
struct nameidata *ndp, struct proc *p)
|
struct nameidata *ndp, struct proc *p)
|
||||||
{
|
{
|
||||||
struct nwfs_args args; /* will hold data from mount request */
|
struct nwfs_args args; /* will hold data from mount request */
|
||||||
size_t size;
|
|
||||||
int error;
|
int error;
|
||||||
struct nwmount *nmp = NULL;
|
struct nwmount *nmp = NULL;
|
||||||
struct ncp_conn *conn = 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 &
|
nmp->m.dir_mode = (nmp->m.dir_mode &
|
||||||
(S_IRWXU|S_IRWXG|S_IRWXO)) | S_IFDIR;
|
(S_IRWXU|S_IRWXG|S_IRWXO)) | S_IFDIR;
|
||||||
if ((error = nwfs_initnls(nmp)) != 0) goto bad;
|
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;
|
pc = mp->mnt_stat.f_mntfromname;
|
||||||
pe = pc+sizeof(mp->mnt_stat.f_mntfromname);
|
pe = pc+sizeof(mp->mnt_stat.f_mntfromname);
|
||||||
bzero(pc, MNAMELEN);
|
bzero(pc, MNAMELEN);
|
||||||
|
@ -133,8 +133,6 @@ portal_mount(mp, path, data, ndp, p)
|
|||||||
mp->mnt_data = (qaddr_t) fmp;
|
mp->mnt_data = (qaddr_t) fmp;
|
||||||
vfs_getnewfsid(mp);
|
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,
|
(void)copyinstr(args.pa_config,
|
||||||
mp->mnt_stat.f_mntfromname, MNAMELEN - 1, &size);
|
mp->mnt_stat.f_mntfromname, MNAMELEN - 1, &size);
|
||||||
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
|
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
|
||||||
|
@ -221,8 +221,6 @@ umapfs_mount(mp, path, data, ndp, p)
|
|||||||
mp->mnt_data = (qaddr_t) amp;
|
mp->mnt_data = (qaddr_t) amp;
|
||||||
vfs_getnewfsid(mp);
|
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,
|
(void) copyinstr(args.target, mp->mnt_stat.f_mntfromname, MNAMELEN - 1,
|
||||||
&size);
|
&size);
|
||||||
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
|
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
|
||||||
|
@ -253,9 +253,6 @@ union_mount(mp, path, data, ndp, p)
|
|||||||
mp->mnt_data = (qaddr_t) um;
|
mp->mnt_data = (qaddr_t) um;
|
||||||
vfs_getnewfsid(mp);
|
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) {
|
switch (um->um_op) {
|
||||||
case UNMNT_ABOVE:
|
case UNMNT_ABOVE:
|
||||||
cp = "<above>:";
|
cp = "<above>:";
|
||||||
|
@ -192,7 +192,11 @@ ext2_mount(mp, path, data, ndp, p)
|
|||||||
int error, flags;
|
int error, flags;
|
||||||
mode_t accessmode;
|
mode_t accessmode;
|
||||||
|
|
||||||
if ((error = copyin(data, (caddr_t)&args, sizeof (struct ufs_args))) != 0)
|
/* Double-check the length of path.. */
|
||||||
|
if (strlen(path) >= MAXMNTLEN - 1)
|
||||||
|
return (ENAMETOOLONG);
|
||||||
|
error = copyin(data, (caddr_t)&args, sizeof (struct ufs_args));
|
||||||
|
if (error != 0)
|
||||||
return (error);
|
return (error);
|
||||||
/*
|
/*
|
||||||
* If updating, check whether changing from read-only to
|
* If updating, check whether changing from read-only to
|
||||||
@ -308,10 +312,12 @@ ext2_mount(mp, path, data, ndp, p)
|
|||||||
}
|
}
|
||||||
ump = VFSTOUFS(mp);
|
ump = VFSTOUFS(mp);
|
||||||
fs = ump->um_e2fs;
|
fs = ump->um_e2fs;
|
||||||
(void) copyinstr(path, fs->fs_fsmnt, sizeof(fs->fs_fsmnt) - 1, &size);
|
/*
|
||||||
bzero(fs->fs_fsmnt + size, sizeof(fs->fs_fsmnt) - size);
|
* Note that this strncpy() is ok because of a check at the start
|
||||||
bcopy((caddr_t)fs->fs_fsmnt, (caddr_t)mp->mnt_stat.f_mntonname,
|
* of ext2_mount().
|
||||||
MNAMELEN);
|
*/
|
||||||
|
strncpy(fs->fs_fsmnt, path, MAXMNTLEN);
|
||||||
|
fs->fs_fsmnt[MAXMNTLEN - 1] = '\0';
|
||||||
(void) copyinstr(args.fspec, mp->mnt_stat.f_mntfromname, MNAMELEN - 1,
|
(void) copyinstr(args.fspec, mp->mnt_stat.f_mntfromname, MNAMELEN - 1,
|
||||||
&size);
|
&size);
|
||||||
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
|
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
|
||||||
|
@ -192,7 +192,11 @@ ext2_mount(mp, path, data, ndp, p)
|
|||||||
int error, flags;
|
int error, flags;
|
||||||
mode_t accessmode;
|
mode_t accessmode;
|
||||||
|
|
||||||
if ((error = copyin(data, (caddr_t)&args, sizeof (struct ufs_args))) != 0)
|
/* Double-check the length of path.. */
|
||||||
|
if (strlen(path) >= MAXMNTLEN - 1)
|
||||||
|
return (ENAMETOOLONG);
|
||||||
|
error = copyin(data, (caddr_t)&args, sizeof (struct ufs_args));
|
||||||
|
if (error != 0)
|
||||||
return (error);
|
return (error);
|
||||||
/*
|
/*
|
||||||
* If updating, check whether changing from read-only to
|
* If updating, check whether changing from read-only to
|
||||||
@ -308,10 +312,12 @@ ext2_mount(mp, path, data, ndp, p)
|
|||||||
}
|
}
|
||||||
ump = VFSTOUFS(mp);
|
ump = VFSTOUFS(mp);
|
||||||
fs = ump->um_e2fs;
|
fs = ump->um_e2fs;
|
||||||
(void) copyinstr(path, fs->fs_fsmnt, sizeof(fs->fs_fsmnt) - 1, &size);
|
/*
|
||||||
bzero(fs->fs_fsmnt + size, sizeof(fs->fs_fsmnt) - size);
|
* Note that this strncpy() is ok because of a check at the start
|
||||||
bcopy((caddr_t)fs->fs_fsmnt, (caddr_t)mp->mnt_stat.f_mntonname,
|
* of ext2_mount().
|
||||||
MNAMELEN);
|
*/
|
||||||
|
strncpy(fs->fs_fsmnt, path, MAXMNTLEN);
|
||||||
|
fs->fs_fsmnt[MAXMNTLEN - 1] = '\0';
|
||||||
(void) copyinstr(args.fspec, mp->mnt_stat.f_mntfromname, MNAMELEN - 1,
|
(void) copyinstr(args.fspec, mp->mnt_stat.f_mntfromname, MNAMELEN - 1,
|
||||||
&size);
|
&size);
|
||||||
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
|
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
|
||||||
|
@ -249,8 +249,6 @@ cd9660_mount(mp, path, data, ndp, p)
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
imp = VFSTOISOFS(mp);
|
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,
|
(void) copyinstr(args.fspec, mp->mnt_stat.f_mntfromname, MNAMELEN - 1,
|
||||||
&size);
|
&size);
|
||||||
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
|
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
|
||||||
|
@ -214,6 +214,14 @@ vfs_mountroot_try(char *mountfrom)
|
|||||||
(devsw(rootdev)->d_flags & D_MEMDISK))
|
(devsw(rootdev)->d_flags & D_MEMDISK))
|
||||||
mp->mnt_flag &= ~MNT_RDONLY;
|
mp->mnt_flag &= ~MNT_RDONLY;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the mount path to be something useful, because the
|
||||||
|
* filesystem code isn't responsible now for initialising
|
||||||
|
* f_mntonname unless they want to override the default
|
||||||
|
* (which is `path'.)
|
||||||
|
*/
|
||||||
|
strncpy(mp->mnt_stat.f_mntonname, "/", MNAMELEN);
|
||||||
|
|
||||||
error = VFS_MOUNT(mp, NULL, NULL, NULL, curproc);
|
error = VFS_MOUNT(mp, NULL, NULL, NULL, curproc);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
@ -107,14 +107,6 @@ struct mount_args {
|
|||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
int
|
int
|
||||||
mount(p, uap)
|
mount(p, uap)
|
||||||
struct proc *p;
|
|
||||||
struct mount_args *uap;
|
|
||||||
{
|
|
||||||
return (mount1(p, uap, UIO_USERSPACE));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
mount1(p, uap, segflag)
|
|
||||||
struct proc *p;
|
struct proc *p;
|
||||||
struct mount_args /* {
|
struct mount_args /* {
|
||||||
syscallarg(char *) type;
|
syscallarg(char *) type;
|
||||||
@ -122,7 +114,47 @@ mount1(p, uap, segflag)
|
|||||||
syscallarg(int) flags;
|
syscallarg(int) flags;
|
||||||
syscallarg(caddr_t) data;
|
syscallarg(caddr_t) data;
|
||||||
} */ *uap;
|
} */ *uap;
|
||||||
int segflag;
|
{
|
||||||
|
char *fstype;
|
||||||
|
char *fspath;
|
||||||
|
int error;
|
||||||
|
|
||||||
|
fstype = malloc(MFSNAMELEN, M_TEMP, M_WAITOK | M_ZERO);
|
||||||
|
fspath = malloc(MNAMELEN, M_TEMP, M_WAITOK | M_ZERO);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* vfs_mount() actually takes a kernel string for `type' and
|
||||||
|
* `path' now, so extract them.
|
||||||
|
*/
|
||||||
|
error = copyinstr(SCARG(uap, type), fstype, MFSNAMELEN, NULL);
|
||||||
|
if (error)
|
||||||
|
goto finish;
|
||||||
|
error = copyinstr(SCARG(uap, path), fspath, MNAMELEN, NULL);
|
||||||
|
if (error)
|
||||||
|
goto finish;
|
||||||
|
error = vfs_mount(p, fstype, fspath, SCARG(uap, flags),
|
||||||
|
SCARG(uap, data));
|
||||||
|
finish:
|
||||||
|
free(fstype, M_TEMP);
|
||||||
|
free(fspath, M_TEMP);
|
||||||
|
return (error);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* vfs_mount(): actually attempt a filesystem mount.
|
||||||
|
*
|
||||||
|
* This routine is designed to be a "generic" entry point for routines
|
||||||
|
* that wish to mount a filesystem. All parameters except `fsdata' are
|
||||||
|
* pointers into kernel space. `fsdata' is currently still a pointer
|
||||||
|
* into userspace.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
vfs_mount(p, fstype, fspath, fsflags, fsdata)
|
||||||
|
struct proc *p;
|
||||||
|
char *fstype;
|
||||||
|
char *fspath;
|
||||||
|
int fsflags;
|
||||||
|
void *fsdata;
|
||||||
{
|
{
|
||||||
struct vnode *vp;
|
struct vnode *vp;
|
||||||
struct mount *mp;
|
struct mount *mp;
|
||||||
@ -130,14 +162,22 @@ mount1(p, uap, segflag)
|
|||||||
int error, flag = 0, flag2 = 0;
|
int error, flag = 0, flag2 = 0;
|
||||||
struct vattr va;
|
struct vattr va;
|
||||||
struct nameidata nd;
|
struct nameidata nd;
|
||||||
char fstypename[MFSNAMELEN];
|
|
||||||
|
/*
|
||||||
|
* Be ultra-paranoid about making sure the type and fspath
|
||||||
|
* variables will fit in our mp buffers, including the
|
||||||
|
* terminating NUL.
|
||||||
|
*/
|
||||||
|
if ((strlen(fstype) >= MNAMELEN - 1) ||
|
||||||
|
(strlen(fspath) >= MFSNAMELEN - 1))
|
||||||
|
return (ENAMETOOLONG);
|
||||||
|
|
||||||
if (usermount == 0 && (error = suser(p)))
|
if (usermount == 0 && (error = suser(p)))
|
||||||
return (error);
|
return (error);
|
||||||
/*
|
/*
|
||||||
* Do not allow NFS export by non-root users.
|
* Do not allow NFS export by non-root users.
|
||||||
*/
|
*/
|
||||||
if (SCARG(uap, flags) & MNT_EXPORTED) {
|
if (fsflags & MNT_EXPORTED) {
|
||||||
error = suser(p);
|
error = suser(p);
|
||||||
if (error)
|
if (error)
|
||||||
return (error);
|
return (error);
|
||||||
@ -146,16 +186,16 @@ mount1(p, uap, segflag)
|
|||||||
* Silently enforce MNT_NOSUID and MNT_NODEV for non-root users
|
* Silently enforce MNT_NOSUID and MNT_NODEV for non-root users
|
||||||
*/
|
*/
|
||||||
if (suser_xxx(p->p_ucred, 0, 0))
|
if (suser_xxx(p->p_ucred, 0, 0))
|
||||||
SCARG(uap, flags) |= MNT_NOSUID | MNT_NODEV;
|
fsflags |= MNT_NOSUID | MNT_NODEV;
|
||||||
/*
|
/*
|
||||||
* Get vnode to be covered
|
* Get vnode to be covered
|
||||||
*/
|
*/
|
||||||
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, segflag, SCARG(uap, path), p);
|
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, fspath, p);
|
||||||
if ((error = namei(&nd)) != 0)
|
if ((error = namei(&nd)) != 0)
|
||||||
return (error);
|
return (error);
|
||||||
NDFREE(&nd, NDF_ONLY_PNBUF);
|
NDFREE(&nd, NDF_ONLY_PNBUF);
|
||||||
vp = nd.ni_vp;
|
vp = nd.ni_vp;
|
||||||
if (SCARG(uap, flags) & MNT_UPDATE) {
|
if (fsflags & MNT_UPDATE) {
|
||||||
if ((vp->v_flag & VROOT) == 0) {
|
if ((vp->v_flag & VROOT) == 0) {
|
||||||
vput(vp);
|
vput(vp);
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
@ -167,7 +207,7 @@ mount1(p, uap, segflag)
|
|||||||
* We only allow the filesystem to be reloaded if it
|
* We only allow the filesystem to be reloaded if it
|
||||||
* is currently mounted read-only.
|
* is currently mounted read-only.
|
||||||
*/
|
*/
|
||||||
if ((SCARG(uap, flags) & MNT_RELOAD) &&
|
if ((fsflags & MNT_RELOAD) &&
|
||||||
((mp->mnt_flag & MNT_RDONLY) == 0)) {
|
((mp->mnt_flag & MNT_RDONLY) == 0)) {
|
||||||
vput(vp);
|
vput(vp);
|
||||||
return (EOPNOTSUPP); /* Needs translation */
|
return (EOPNOTSUPP); /* Needs translation */
|
||||||
@ -195,7 +235,7 @@ mount1(p, uap, segflag)
|
|||||||
}
|
}
|
||||||
vp->v_flag |= VMOUNT;
|
vp->v_flag |= VMOUNT;
|
||||||
mtx_unlock(&vp->v_interlock);
|
mtx_unlock(&vp->v_interlock);
|
||||||
mp->mnt_flag |= SCARG(uap, flags) &
|
mp->mnt_flag |= fsflags &
|
||||||
(MNT_RELOAD | MNT_FORCE | MNT_UPDATE | MNT_SNAPSHOT);
|
(MNT_RELOAD | MNT_FORCE | MNT_UPDATE | MNT_SNAPSHOT);
|
||||||
VOP_UNLOCK(vp, 0, p);
|
VOP_UNLOCK(vp, 0, p);
|
||||||
goto update;
|
goto update;
|
||||||
@ -218,13 +258,8 @@ mount1(p, uap, segflag)
|
|||||||
vput(vp);
|
vput(vp);
|
||||||
return (ENOTDIR);
|
return (ENOTDIR);
|
||||||
}
|
}
|
||||||
if ((error = copyinstrfrom(SCARG(uap, type),
|
|
||||||
fstypename, MFSNAMELEN, NULL, segflag)) != 0) {
|
|
||||||
vput(vp);
|
|
||||||
return (error);
|
|
||||||
}
|
|
||||||
for (vfsp = vfsconf; vfsp; vfsp = vfsp->vfc_next)
|
for (vfsp = vfsconf; vfsp; vfsp = vfsp->vfc_next)
|
||||||
if (!strcmp(vfsp->vfc_name, fstypename))
|
if (!strcmp(vfsp->vfc_name, fstype))
|
||||||
break;
|
break;
|
||||||
if (vfsp == NULL) {
|
if (vfsp == NULL) {
|
||||||
linker_file_t lf;
|
linker_file_t lf;
|
||||||
@ -234,7 +269,7 @@ mount1(p, uap, segflag)
|
|||||||
vput(vp);
|
vput(vp);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
error = linker_load_file(fstypename, &lf);
|
error = linker_load_file(fstype, &lf);
|
||||||
if (error || lf == NULL) {
|
if (error || lf == NULL) {
|
||||||
vput(vp);
|
vput(vp);
|
||||||
if (lf == NULL)
|
if (lf == NULL)
|
||||||
@ -244,7 +279,7 @@ mount1(p, uap, segflag)
|
|||||||
lf->userrefs++;
|
lf->userrefs++;
|
||||||
/* lookup again, see if the VFS was loaded */
|
/* lookup again, see if the VFS was loaded */
|
||||||
for (vfsp = vfsconf; vfsp; vfsp = vfsp->vfc_next)
|
for (vfsp = vfsconf; vfsp; vfsp = vfsp->vfc_next)
|
||||||
if (!strcmp(vfsp->vfc_name, fstypename))
|
if (!strcmp(vfsp->vfc_name, fstype))
|
||||||
break;
|
break;
|
||||||
if (vfsp == NULL) {
|
if (vfsp == NULL) {
|
||||||
lf->userrefs--;
|
lf->userrefs--;
|
||||||
@ -274,16 +309,19 @@ mount1(p, uap, segflag)
|
|||||||
vfsp->vfc_refcount++;
|
vfsp->vfc_refcount++;
|
||||||
mp->mnt_stat.f_type = vfsp->vfc_typenum;
|
mp->mnt_stat.f_type = vfsp->vfc_typenum;
|
||||||
mp->mnt_flag |= vfsp->vfc_flags & MNT_VISFLAGMASK;
|
mp->mnt_flag |= vfsp->vfc_flags & MNT_VISFLAGMASK;
|
||||||
strncpy(mp->mnt_stat.f_fstypename, vfsp->vfc_name, MFSNAMELEN);
|
strncpy(mp->mnt_stat.f_fstypename, fstype, MFSNAMELEN);
|
||||||
|
mp->mnt_stat.f_fstypename[MFSNAMELEN - 1] = '\0';
|
||||||
mp->mnt_vnodecovered = vp;
|
mp->mnt_vnodecovered = vp;
|
||||||
mp->mnt_stat.f_owner = p->p_ucred->cr_uid;
|
mp->mnt_stat.f_owner = p->p_ucred->cr_uid;
|
||||||
|
strncpy(mp->mnt_stat.f_mntonname, fspath, MNAMELEN);
|
||||||
|
mp->mnt_stat.f_mntonname[MNAMELEN - 1] = '\0';
|
||||||
mp->mnt_iosize_max = DFLTPHYS;
|
mp->mnt_iosize_max = DFLTPHYS;
|
||||||
VOP_UNLOCK(vp, 0, p);
|
VOP_UNLOCK(vp, 0, p);
|
||||||
update:
|
update:
|
||||||
/*
|
/*
|
||||||
* Set the mount level flags.
|
* Set the mount level flags.
|
||||||
*/
|
*/
|
||||||
if (SCARG(uap, flags) & MNT_RDONLY)
|
if (fsflags & MNT_RDONLY)
|
||||||
mp->mnt_flag |= MNT_RDONLY;
|
mp->mnt_flag |= MNT_RDONLY;
|
||||||
else if (mp->mnt_flag & MNT_RDONLY)
|
else if (mp->mnt_flag & MNT_RDONLY)
|
||||||
mp->mnt_kern_flag |= MNTK_WANTRDWR;
|
mp->mnt_kern_flag |= MNTK_WANTRDWR;
|
||||||
@ -291,7 +329,7 @@ update:
|
|||||||
MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_NOATIME |
|
MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_NOATIME |
|
||||||
MNT_NOSYMFOLLOW | MNT_IGNORE |
|
MNT_NOSYMFOLLOW | MNT_IGNORE |
|
||||||
MNT_NOCLUSTERR | MNT_NOCLUSTERW | MNT_SUIDDIR);
|
MNT_NOCLUSTERR | MNT_NOCLUSTERW | MNT_SUIDDIR);
|
||||||
mp->mnt_flag |= SCARG(uap, flags) & (MNT_NOSUID | MNT_NOEXEC |
|
mp->mnt_flag |= fsflags & (MNT_NOSUID | MNT_NOEXEC |
|
||||||
MNT_NODEV | MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_FORCE |
|
MNT_NODEV | MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_FORCE |
|
||||||
MNT_NOSYMFOLLOW | MNT_IGNORE |
|
MNT_NOSYMFOLLOW | MNT_IGNORE |
|
||||||
MNT_NOATIME | MNT_NOCLUSTERR | MNT_NOCLUSTERW | MNT_SUIDDIR);
|
MNT_NOATIME | MNT_NOCLUSTERR | MNT_NOCLUSTERW | MNT_SUIDDIR);
|
||||||
@ -300,7 +338,7 @@ update:
|
|||||||
* XXX The final recipients of VFS_MOUNT just overwrite the ndp they
|
* XXX The final recipients of VFS_MOUNT just overwrite the ndp they
|
||||||
* get. No freeing of cn_pnbuf.
|
* get. No freeing of cn_pnbuf.
|
||||||
*/
|
*/
|
||||||
error = VFS_MOUNT(mp, SCARG(uap, path), SCARG(uap, data), &nd, p);
|
error = VFS_MOUNT(mp, fspath, fsdata, &nd, p);
|
||||||
if (mp->mnt_flag & MNT_UPDATE) {
|
if (mp->mnt_flag & MNT_UPDATE) {
|
||||||
if (mp->mnt_kern_flag & MNTK_WANTRDWR)
|
if (mp->mnt_kern_flag & MNTK_WANTRDWR)
|
||||||
mp->mnt_flag &= ~MNT_RDONLY;
|
mp->mnt_flag &= ~MNT_RDONLY;
|
||||||
|
@ -214,6 +214,14 @@ vfs_mountroot_try(char *mountfrom)
|
|||||||
(devsw(rootdev)->d_flags & D_MEMDISK))
|
(devsw(rootdev)->d_flags & D_MEMDISK))
|
||||||
mp->mnt_flag &= ~MNT_RDONLY;
|
mp->mnt_flag &= ~MNT_RDONLY;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the mount path to be something useful, because the
|
||||||
|
* filesystem code isn't responsible now for initialising
|
||||||
|
* f_mntonname unless they want to override the default
|
||||||
|
* (which is `path'.)
|
||||||
|
*/
|
||||||
|
strncpy(mp->mnt_stat.f_mntonname, "/", MNAMELEN);
|
||||||
|
|
||||||
error = VFS_MOUNT(mp, NULL, NULL, NULL, curproc);
|
error = VFS_MOUNT(mp, NULL, NULL, NULL, curproc);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
@ -107,14 +107,6 @@ struct mount_args {
|
|||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
int
|
int
|
||||||
mount(p, uap)
|
mount(p, uap)
|
||||||
struct proc *p;
|
|
||||||
struct mount_args *uap;
|
|
||||||
{
|
|
||||||
return (mount1(p, uap, UIO_USERSPACE));
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
mount1(p, uap, segflag)
|
|
||||||
struct proc *p;
|
struct proc *p;
|
||||||
struct mount_args /* {
|
struct mount_args /* {
|
||||||
syscallarg(char *) type;
|
syscallarg(char *) type;
|
||||||
@ -122,7 +114,47 @@ mount1(p, uap, segflag)
|
|||||||
syscallarg(int) flags;
|
syscallarg(int) flags;
|
||||||
syscallarg(caddr_t) data;
|
syscallarg(caddr_t) data;
|
||||||
} */ *uap;
|
} */ *uap;
|
||||||
int segflag;
|
{
|
||||||
|
char *fstype;
|
||||||
|
char *fspath;
|
||||||
|
int error;
|
||||||
|
|
||||||
|
fstype = malloc(MFSNAMELEN, M_TEMP, M_WAITOK | M_ZERO);
|
||||||
|
fspath = malloc(MNAMELEN, M_TEMP, M_WAITOK | M_ZERO);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* vfs_mount() actually takes a kernel string for `type' and
|
||||||
|
* `path' now, so extract them.
|
||||||
|
*/
|
||||||
|
error = copyinstr(SCARG(uap, type), fstype, MFSNAMELEN, NULL);
|
||||||
|
if (error)
|
||||||
|
goto finish;
|
||||||
|
error = copyinstr(SCARG(uap, path), fspath, MNAMELEN, NULL);
|
||||||
|
if (error)
|
||||||
|
goto finish;
|
||||||
|
error = vfs_mount(p, fstype, fspath, SCARG(uap, flags),
|
||||||
|
SCARG(uap, data));
|
||||||
|
finish:
|
||||||
|
free(fstype, M_TEMP);
|
||||||
|
free(fspath, M_TEMP);
|
||||||
|
return (error);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* vfs_mount(): actually attempt a filesystem mount.
|
||||||
|
*
|
||||||
|
* This routine is designed to be a "generic" entry point for routines
|
||||||
|
* that wish to mount a filesystem. All parameters except `fsdata' are
|
||||||
|
* pointers into kernel space. `fsdata' is currently still a pointer
|
||||||
|
* into userspace.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
vfs_mount(p, fstype, fspath, fsflags, fsdata)
|
||||||
|
struct proc *p;
|
||||||
|
char *fstype;
|
||||||
|
char *fspath;
|
||||||
|
int fsflags;
|
||||||
|
void *fsdata;
|
||||||
{
|
{
|
||||||
struct vnode *vp;
|
struct vnode *vp;
|
||||||
struct mount *mp;
|
struct mount *mp;
|
||||||
@ -130,14 +162,22 @@ mount1(p, uap, segflag)
|
|||||||
int error, flag = 0, flag2 = 0;
|
int error, flag = 0, flag2 = 0;
|
||||||
struct vattr va;
|
struct vattr va;
|
||||||
struct nameidata nd;
|
struct nameidata nd;
|
||||||
char fstypename[MFSNAMELEN];
|
|
||||||
|
/*
|
||||||
|
* Be ultra-paranoid about making sure the type and fspath
|
||||||
|
* variables will fit in our mp buffers, including the
|
||||||
|
* terminating NUL.
|
||||||
|
*/
|
||||||
|
if ((strlen(fstype) >= MNAMELEN - 1) ||
|
||||||
|
(strlen(fspath) >= MFSNAMELEN - 1))
|
||||||
|
return (ENAMETOOLONG);
|
||||||
|
|
||||||
if (usermount == 0 && (error = suser(p)))
|
if (usermount == 0 && (error = suser(p)))
|
||||||
return (error);
|
return (error);
|
||||||
/*
|
/*
|
||||||
* Do not allow NFS export by non-root users.
|
* Do not allow NFS export by non-root users.
|
||||||
*/
|
*/
|
||||||
if (SCARG(uap, flags) & MNT_EXPORTED) {
|
if (fsflags & MNT_EXPORTED) {
|
||||||
error = suser(p);
|
error = suser(p);
|
||||||
if (error)
|
if (error)
|
||||||
return (error);
|
return (error);
|
||||||
@ -146,16 +186,16 @@ mount1(p, uap, segflag)
|
|||||||
* Silently enforce MNT_NOSUID and MNT_NODEV for non-root users
|
* Silently enforce MNT_NOSUID and MNT_NODEV for non-root users
|
||||||
*/
|
*/
|
||||||
if (suser_xxx(p->p_ucred, 0, 0))
|
if (suser_xxx(p->p_ucred, 0, 0))
|
||||||
SCARG(uap, flags) |= MNT_NOSUID | MNT_NODEV;
|
fsflags |= MNT_NOSUID | MNT_NODEV;
|
||||||
/*
|
/*
|
||||||
* Get vnode to be covered
|
* Get vnode to be covered
|
||||||
*/
|
*/
|
||||||
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, segflag, SCARG(uap, path), p);
|
NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, fspath, p);
|
||||||
if ((error = namei(&nd)) != 0)
|
if ((error = namei(&nd)) != 0)
|
||||||
return (error);
|
return (error);
|
||||||
NDFREE(&nd, NDF_ONLY_PNBUF);
|
NDFREE(&nd, NDF_ONLY_PNBUF);
|
||||||
vp = nd.ni_vp;
|
vp = nd.ni_vp;
|
||||||
if (SCARG(uap, flags) & MNT_UPDATE) {
|
if (fsflags & MNT_UPDATE) {
|
||||||
if ((vp->v_flag & VROOT) == 0) {
|
if ((vp->v_flag & VROOT) == 0) {
|
||||||
vput(vp);
|
vput(vp);
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
@ -167,7 +207,7 @@ mount1(p, uap, segflag)
|
|||||||
* We only allow the filesystem to be reloaded if it
|
* We only allow the filesystem to be reloaded if it
|
||||||
* is currently mounted read-only.
|
* is currently mounted read-only.
|
||||||
*/
|
*/
|
||||||
if ((SCARG(uap, flags) & MNT_RELOAD) &&
|
if ((fsflags & MNT_RELOAD) &&
|
||||||
((mp->mnt_flag & MNT_RDONLY) == 0)) {
|
((mp->mnt_flag & MNT_RDONLY) == 0)) {
|
||||||
vput(vp);
|
vput(vp);
|
||||||
return (EOPNOTSUPP); /* Needs translation */
|
return (EOPNOTSUPP); /* Needs translation */
|
||||||
@ -195,7 +235,7 @@ mount1(p, uap, segflag)
|
|||||||
}
|
}
|
||||||
vp->v_flag |= VMOUNT;
|
vp->v_flag |= VMOUNT;
|
||||||
mtx_unlock(&vp->v_interlock);
|
mtx_unlock(&vp->v_interlock);
|
||||||
mp->mnt_flag |= SCARG(uap, flags) &
|
mp->mnt_flag |= fsflags &
|
||||||
(MNT_RELOAD | MNT_FORCE | MNT_UPDATE | MNT_SNAPSHOT);
|
(MNT_RELOAD | MNT_FORCE | MNT_UPDATE | MNT_SNAPSHOT);
|
||||||
VOP_UNLOCK(vp, 0, p);
|
VOP_UNLOCK(vp, 0, p);
|
||||||
goto update;
|
goto update;
|
||||||
@ -218,13 +258,8 @@ mount1(p, uap, segflag)
|
|||||||
vput(vp);
|
vput(vp);
|
||||||
return (ENOTDIR);
|
return (ENOTDIR);
|
||||||
}
|
}
|
||||||
if ((error = copyinstrfrom(SCARG(uap, type),
|
|
||||||
fstypename, MFSNAMELEN, NULL, segflag)) != 0) {
|
|
||||||
vput(vp);
|
|
||||||
return (error);
|
|
||||||
}
|
|
||||||
for (vfsp = vfsconf; vfsp; vfsp = vfsp->vfc_next)
|
for (vfsp = vfsconf; vfsp; vfsp = vfsp->vfc_next)
|
||||||
if (!strcmp(vfsp->vfc_name, fstypename))
|
if (!strcmp(vfsp->vfc_name, fstype))
|
||||||
break;
|
break;
|
||||||
if (vfsp == NULL) {
|
if (vfsp == NULL) {
|
||||||
linker_file_t lf;
|
linker_file_t lf;
|
||||||
@ -234,7 +269,7 @@ mount1(p, uap, segflag)
|
|||||||
vput(vp);
|
vput(vp);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
error = linker_load_file(fstypename, &lf);
|
error = linker_load_file(fstype, &lf);
|
||||||
if (error || lf == NULL) {
|
if (error || lf == NULL) {
|
||||||
vput(vp);
|
vput(vp);
|
||||||
if (lf == NULL)
|
if (lf == NULL)
|
||||||
@ -244,7 +279,7 @@ mount1(p, uap, segflag)
|
|||||||
lf->userrefs++;
|
lf->userrefs++;
|
||||||
/* lookup again, see if the VFS was loaded */
|
/* lookup again, see if the VFS was loaded */
|
||||||
for (vfsp = vfsconf; vfsp; vfsp = vfsp->vfc_next)
|
for (vfsp = vfsconf; vfsp; vfsp = vfsp->vfc_next)
|
||||||
if (!strcmp(vfsp->vfc_name, fstypename))
|
if (!strcmp(vfsp->vfc_name, fstype))
|
||||||
break;
|
break;
|
||||||
if (vfsp == NULL) {
|
if (vfsp == NULL) {
|
||||||
lf->userrefs--;
|
lf->userrefs--;
|
||||||
@ -274,16 +309,19 @@ mount1(p, uap, segflag)
|
|||||||
vfsp->vfc_refcount++;
|
vfsp->vfc_refcount++;
|
||||||
mp->mnt_stat.f_type = vfsp->vfc_typenum;
|
mp->mnt_stat.f_type = vfsp->vfc_typenum;
|
||||||
mp->mnt_flag |= vfsp->vfc_flags & MNT_VISFLAGMASK;
|
mp->mnt_flag |= vfsp->vfc_flags & MNT_VISFLAGMASK;
|
||||||
strncpy(mp->mnt_stat.f_fstypename, vfsp->vfc_name, MFSNAMELEN);
|
strncpy(mp->mnt_stat.f_fstypename, fstype, MFSNAMELEN);
|
||||||
|
mp->mnt_stat.f_fstypename[MFSNAMELEN - 1] = '\0';
|
||||||
mp->mnt_vnodecovered = vp;
|
mp->mnt_vnodecovered = vp;
|
||||||
mp->mnt_stat.f_owner = p->p_ucred->cr_uid;
|
mp->mnt_stat.f_owner = p->p_ucred->cr_uid;
|
||||||
|
strncpy(mp->mnt_stat.f_mntonname, fspath, MNAMELEN);
|
||||||
|
mp->mnt_stat.f_mntonname[MNAMELEN - 1] = '\0';
|
||||||
mp->mnt_iosize_max = DFLTPHYS;
|
mp->mnt_iosize_max = DFLTPHYS;
|
||||||
VOP_UNLOCK(vp, 0, p);
|
VOP_UNLOCK(vp, 0, p);
|
||||||
update:
|
update:
|
||||||
/*
|
/*
|
||||||
* Set the mount level flags.
|
* Set the mount level flags.
|
||||||
*/
|
*/
|
||||||
if (SCARG(uap, flags) & MNT_RDONLY)
|
if (fsflags & MNT_RDONLY)
|
||||||
mp->mnt_flag |= MNT_RDONLY;
|
mp->mnt_flag |= MNT_RDONLY;
|
||||||
else if (mp->mnt_flag & MNT_RDONLY)
|
else if (mp->mnt_flag & MNT_RDONLY)
|
||||||
mp->mnt_kern_flag |= MNTK_WANTRDWR;
|
mp->mnt_kern_flag |= MNTK_WANTRDWR;
|
||||||
@ -291,7 +329,7 @@ update:
|
|||||||
MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_NOATIME |
|
MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_NOATIME |
|
||||||
MNT_NOSYMFOLLOW | MNT_IGNORE |
|
MNT_NOSYMFOLLOW | MNT_IGNORE |
|
||||||
MNT_NOCLUSTERR | MNT_NOCLUSTERW | MNT_SUIDDIR);
|
MNT_NOCLUSTERR | MNT_NOCLUSTERW | MNT_SUIDDIR);
|
||||||
mp->mnt_flag |= SCARG(uap, flags) & (MNT_NOSUID | MNT_NOEXEC |
|
mp->mnt_flag |= fsflags & (MNT_NOSUID | MNT_NOEXEC |
|
||||||
MNT_NODEV | MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_FORCE |
|
MNT_NODEV | MNT_SYNCHRONOUS | MNT_UNION | MNT_ASYNC | MNT_FORCE |
|
||||||
MNT_NOSYMFOLLOW | MNT_IGNORE |
|
MNT_NOSYMFOLLOW | MNT_IGNORE |
|
||||||
MNT_NOATIME | MNT_NOCLUSTERR | MNT_NOCLUSTERW | MNT_SUIDDIR);
|
MNT_NOATIME | MNT_NOCLUSTERR | MNT_NOCLUSTERW | MNT_SUIDDIR);
|
||||||
@ -300,7 +338,7 @@ update:
|
|||||||
* XXX The final recipients of VFS_MOUNT just overwrite the ndp they
|
* XXX The final recipients of VFS_MOUNT just overwrite the ndp they
|
||||||
* get. No freeing of cn_pnbuf.
|
* get. No freeing of cn_pnbuf.
|
||||||
*/
|
*/
|
||||||
error = VFS_MOUNT(mp, SCARG(uap, path), SCARG(uap, data), &nd, p);
|
error = VFS_MOUNT(mp, fspath, fsdata, &nd, p);
|
||||||
if (mp->mnt_flag & MNT_UPDATE) {
|
if (mp->mnt_flag & MNT_UPDATE) {
|
||||||
if (mp->mnt_kern_flag & MNTK_WANTRDWR)
|
if (mp->mnt_kern_flag & MNTK_WANTRDWR)
|
||||||
mp->mnt_flag &= ~MNT_RDONLY;
|
mp->mnt_flag &= ~MNT_RDONLY;
|
||||||
|
@ -74,7 +74,6 @@ fdesc_mount(mp, path, data, ndp, p)
|
|||||||
struct proc *p;
|
struct proc *p;
|
||||||
{
|
{
|
||||||
int error = 0;
|
int error = 0;
|
||||||
u_int size;
|
|
||||||
struct fdescmount *fmp;
|
struct fdescmount *fmp;
|
||||||
struct vnode *rvp;
|
struct vnode *rvp;
|
||||||
|
|
||||||
@ -98,8 +97,6 @@ fdesc_mount(mp, path, data, ndp, p)
|
|||||||
mp->mnt_data = (qaddr_t) fmp;
|
mp->mnt_data = (qaddr_t) fmp;
|
||||||
vfs_getnewfsid(mp);
|
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);
|
bzero(mp->mnt_stat.f_mntfromname, MNAMELEN);
|
||||||
bcopy("fdesc", mp->mnt_stat.f_mntfromname, sizeof("fdesc"));
|
bcopy("fdesc", mp->mnt_stat.f_mntfromname, sizeof("fdesc"));
|
||||||
(void)fdesc_statfs(mp, &mp->mnt_stat, p);
|
(void)fdesc_statfs(mp, &mp->mnt_stat, p);
|
||||||
|
@ -191,8 +191,6 @@ nullfs_mount(mp, path, data, ndp, p)
|
|||||||
mp->mnt_data = (qaddr_t) xmp;
|
mp->mnt_data = (qaddr_t) xmp;
|
||||||
vfs_getnewfsid(mp);
|
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,
|
(void) copyinstr(args.target, mp->mnt_stat.f_mntfromname, MNAMELEN - 1,
|
||||||
&size);
|
&size);
|
||||||
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
|
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
|
||||||
|
@ -133,8 +133,6 @@ portal_mount(mp, path, data, ndp, p)
|
|||||||
mp->mnt_data = (qaddr_t) fmp;
|
mp->mnt_data = (qaddr_t) fmp;
|
||||||
vfs_getnewfsid(mp);
|
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,
|
(void)copyinstr(args.pa_config,
|
||||||
mp->mnt_stat.f_mntfromname, MNAMELEN - 1, &size);
|
mp->mnt_stat.f_mntfromname, MNAMELEN - 1, &size);
|
||||||
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
|
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
|
||||||
|
@ -221,8 +221,6 @@ umapfs_mount(mp, path, data, ndp, p)
|
|||||||
mp->mnt_data = (qaddr_t) amp;
|
mp->mnt_data = (qaddr_t) amp;
|
||||||
vfs_getnewfsid(mp);
|
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,
|
(void) copyinstr(args.target, mp->mnt_stat.f_mntfromname, MNAMELEN - 1,
|
||||||
&size);
|
&size);
|
||||||
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
|
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
|
||||||
|
@ -253,9 +253,6 @@ union_mount(mp, path, data, ndp, p)
|
|||||||
mp->mnt_data = (qaddr_t) um;
|
mp->mnt_data = (qaddr_t) um;
|
||||||
vfs_getnewfsid(mp);
|
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) {
|
switch (um->um_op) {
|
||||||
case UNMNT_ABOVE:
|
case UNMNT_ABOVE:
|
||||||
cp = "<above>:";
|
cp = "<above>:";
|
||||||
|
@ -345,9 +345,6 @@ msdosfs_mount(mp, path, data, ndp, p)
|
|||||||
msdosfs_unmount(mp, MNT_FORCE, p);
|
msdosfs_unmount(mp, MNT_FORCE, p);
|
||||||
return error;
|
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,
|
(void) copyinstr(args.fspec, mp->mnt_stat.f_mntfromname, MNAMELEN - 1,
|
||||||
&size);
|
&size);
|
||||||
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
|
bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
|
||||||
|
@ -764,7 +764,7 @@ nfs_mount(mp, path, data, ndp, p)
|
|||||||
struct nfs_args args;
|
struct nfs_args args;
|
||||||
struct sockaddr *nam;
|
struct sockaddr *nam;
|
||||||
struct vnode *vp;
|
struct vnode *vp;
|
||||||
char pth[MNAMELEN], hst[MNAMELEN];
|
char hst[MNAMELEN];
|
||||||
size_t len;
|
size_t len;
|
||||||
u_char nfh[NFSX_V3FHMAX];
|
u_char nfh[NFSX_V3FHMAX];
|
||||||
|
|
||||||
@ -810,10 +810,6 @@ nfs_mount(mp, path, data, ndp, p)
|
|||||||
error = copyin((caddr_t)args.fh, (caddr_t)nfh, args.fhsize);
|
error = copyin((caddr_t)args.fh, (caddr_t)nfh, args.fhsize);
|
||||||
if (error)
|
if (error)
|
||||||
return (error);
|
return (error);
|
||||||
error = copyinstr(path, pth, MNAMELEN-1, &len);
|
|
||||||
if (error)
|
|
||||||
return (error);
|
|
||||||
bzero(&pth[len], MNAMELEN - len);
|
|
||||||
error = copyinstr(args.hostname, hst, MNAMELEN-1, &len);
|
error = copyinstr(args.hostname, hst, MNAMELEN-1, &len);
|
||||||
if (error)
|
if (error)
|
||||||
return (error);
|
return (error);
|
||||||
@ -823,7 +819,7 @@ nfs_mount(mp, path, data, ndp, p)
|
|||||||
if (error)
|
if (error)
|
||||||
return (error);
|
return (error);
|
||||||
args.fh = nfh;
|
args.fh = nfh;
|
||||||
error = mountnfs(&args, mp, nam, pth, hst, &vp);
|
error = mountnfs(&args, mp, nam, path, hst, &vp);
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -764,7 +764,7 @@ nfs_mount(mp, path, data, ndp, p)
|
|||||||
struct nfs_args args;
|
struct nfs_args args;
|
||||||
struct sockaddr *nam;
|
struct sockaddr *nam;
|
||||||
struct vnode *vp;
|
struct vnode *vp;
|
||||||
char pth[MNAMELEN], hst[MNAMELEN];
|
char hst[MNAMELEN];
|
||||||
size_t len;
|
size_t len;
|
||||||
u_char nfh[NFSX_V3FHMAX];
|
u_char nfh[NFSX_V3FHMAX];
|
||||||
|
|
||||||
@ -810,10 +810,6 @@ nfs_mount(mp, path, data, ndp, p)
|
|||||||
error = copyin((caddr_t)args.fh, (caddr_t)nfh, args.fhsize);
|
error = copyin((caddr_t)args.fh, (caddr_t)nfh, args.fhsize);
|
||||||
if (error)
|
if (error)
|
||||||
return (error);
|
return (error);
|
||||||
error = copyinstr(path, pth, MNAMELEN-1, &len);
|
|
||||||
if (error)
|
|
||||||
return (error);
|
|
||||||
bzero(&pth[len], MNAMELEN - len);
|
|
||||||
error = copyinstr(args.hostname, hst, MNAMELEN-1, &len);
|
error = copyinstr(args.hostname, hst, MNAMELEN-1, &len);
|
||||||
if (error)
|
if (error)
|
||||||
return (error);
|
return (error);
|
||||||
@ -823,7 +819,7 @@ nfs_mount(mp, path, data, ndp, p)
|
|||||||
if (error)
|
if (error)
|
||||||
return (error);
|
return (error);
|
||||||
args.fh = nfh;
|
args.fh = nfh;
|
||||||
error = mountnfs(&args, mp, nam, pth, hst, &vp);
|
error = mountnfs(&args, mp, nam, path, hst, &vp);
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,16 +376,12 @@ ntfs_mount (
|
|||||||
/*
|
/*
|
||||||
* Since this is a new mount, we want the names for
|
* Since this is a new mount, we want the names for
|
||||||
* the device and the mount point copied in. If an
|
* the device and the mount point copied in. If an
|
||||||
* error occurs, the mountpoint is discarded by the
|
* error occurs, the mountpoint is discarded by the
|
||||||
* upper level code.
|
* 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)*/
|
/* Save "mounted from" info for mount point (NULL pad)*/
|
||||||
copyinstr( args.fspec, /* device name*/
|
copyinstr( args.fspec, /* device name*/
|
||||||
mp->mnt_stat.f_mntfromname, /* save area*/
|
mp->mnt_stat.f_mntfromname, /* save area*/
|
||||||
|
@ -146,7 +146,6 @@ static int nwfs_mount(struct mount *mp, char *path, caddr_t data,
|
|||||||
struct nameidata *ndp, struct proc *p)
|
struct nameidata *ndp, struct proc *p)
|
||||||
{
|
{
|
||||||
struct nwfs_args args; /* will hold data from mount request */
|
struct nwfs_args args; /* will hold data from mount request */
|
||||||
size_t size;
|
|
||||||
int error;
|
int error;
|
||||||
struct nwmount *nmp = NULL;
|
struct nwmount *nmp = NULL;
|
||||||
struct ncp_conn *conn = 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 &
|
nmp->m.dir_mode = (nmp->m.dir_mode &
|
||||||
(S_IRWXU|S_IRWXG|S_IRWXO)) | S_IFDIR;
|
(S_IRWXU|S_IRWXG|S_IRWXO)) | S_IFDIR;
|
||||||
if ((error = nwfs_initnls(nmp)) != 0) goto bad;
|
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;
|
pc = mp->mnt_stat.f_mntfromname;
|
||||||
pe = pc+sizeof(mp->mnt_stat.f_mntfromname);
|
pe = pc+sizeof(mp->mnt_stat.f_mntfromname);
|
||||||
bzero(pc, MNAMELEN);
|
bzero(pc, MNAMELEN);
|
||||||
|
@ -404,7 +404,8 @@ extern char *mountrootfsname;
|
|||||||
* exported vnode operations
|
* exported vnode operations
|
||||||
*/
|
*/
|
||||||
int dounmount __P((struct mount *, int, struct proc *));
|
int dounmount __P((struct mount *, int, struct proc *));
|
||||||
int mount1 __P((struct proc *p, struct mount_args *uap, int segflag));
|
int vfs_mount __P((struct proc *p, char *type, char *path, int flags,
|
||||||
|
void *data));
|
||||||
int vfs_setpublicfs /* set publicly exported fs */
|
int vfs_setpublicfs /* set publicly exported fs */
|
||||||
__P((struct mount *, struct netexport *, struct export_args *));
|
__P((struct mount *, struct netexport *, struct export_args *));
|
||||||
int vfs_lock __P((struct mount *)); /* lock a vfs */
|
int vfs_lock __P((struct mount *)); /* lock a vfs */
|
||||||
|
@ -323,9 +323,8 @@ ffs_mount(mp, path, data, ndp, p)
|
|||||||
* We need the name for the mount point (also used for
|
* We need the name for the mount point (also used for
|
||||||
* "last mounted on") copied in. If an error occurs,
|
* "last mounted on") copied in. If an error occurs,
|
||||||
* the mount point is discarded by the upper level code.
|
* the mount point is discarded by the upper level code.
|
||||||
|
* Note that vfs_mount() populates f_mntonname for us.
|
||||||
*/
|
*/
|
||||||
copyinstr(path, mp->mnt_stat.f_mntonname, MNAMELEN - 1, &size);
|
|
||||||
bzero( mp->mnt_stat.f_mntonname + size, MNAMELEN - size);
|
|
||||||
if ((error = ffs_mountfs(devvp, mp, p, M_FFSNODE)) != 0) {
|
if ((error = ffs_mountfs(devvp, mp, p, M_FFSNODE)) != 0) {
|
||||||
vrele(devvp);
|
vrele(devvp);
|
||||||
return (error);
|
return (error);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user