summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_mount.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2004-12-06 16:39:05 +0000
committerphk <phk@FreeBSD.org>2004-12-06 16:39:05 +0000
commite196d800834b17b34ab2b098462739d2da4b3a24 (patch)
treee1d3fc56ba2e67b2df174c9bcab04d77c1557422 /sys/kern/vfs_mount.c
parentebd6438ae16fb25f9f0412f8b01b740ca32cb53c (diff)
downloadFreeBSD-src-e196d800834b17b34ab2b098462739d2da4b3a24.zip
FreeBSD-src-e196d800834b17b34ab2b098462739d2da4b3a24.tar.gz
Change the first argument of vfs_cmount() to a handy struct mntarg* and
call it accordingly. (No filesystems implement vfs_cmount() yet, so this is a no-op commit)
Diffstat (limited to 'sys/kern/vfs_mount.c')
-rw-r--r--sys/kern/vfs_mount.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c
index 2e50c4b..cea921f 100644
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -508,6 +508,7 @@ mount(td, uap)
char *fstype;
char *fspath;
struct vfsconf *vfsp;
+ struct mntarg *ma = NULL;
int error;
/* Kick out MNT_ROOTFS early as it is legal internally */
@@ -515,27 +516,33 @@ mount(td, uap)
return (EINVAL);
fstype = malloc(MFSNAMELEN, M_TEMP, M_WAITOK);
- fspath = malloc(MNAMELEN, M_TEMP, M_WAITOK);
/*
* vfs_mount() actually takes a kernel string for `type' and
* `path' now, so extract them.
*/
error = copyinstr(uap->type, fstype, MFSNAMELEN, NULL);
- if (error == 0)
- error = copyinstr(uap->path, fspath, MNAMELEN, NULL);
- if (error == 0) {
+ mtx_lock(&Giant); /* XXX ? */
+ vfsp = vfs_byname_kld(fstype, td, &error);
+ mtx_unlock(&Giant); /* XXX ? */
+ if (vfsp == NULL) {
+ free(fstype, M_TEMP);
+ return (ENOENT);
+ }
+ fspath = malloc(MNAMELEN, M_TEMP, M_WAITOK);
+ error = copyinstr(uap->path, fspath, MNAMELEN, NULL);
+ if (error == 0 && vfsp->vfc_vfsops->vfs_cmount != NULL) {
+ ma = mount_argsu(ma, "fstype", uap->type, MNAMELEN);
+ ma = mount_argsu(ma, "fspath", uap->path, MNAMELEN);
+ ma = mount_argb(ma, uap->flags & MNT_RDONLY, "noro");
+ ma = mount_argb(ma, !(uap->flags & MNT_NOSUID), "nosuid");
+ ma = mount_argb(ma, !(uap->flags & MNT_NOEXEC), "noexec");
+ error = vfsp->vfc_vfsops->vfs_cmount(
+ ma, uap->data, uap->flags, td);
+ } else if (error == 0) {
mtx_lock(&Giant);
- vfsp = vfs_byname_kld(fstype, td, &error);
- if (vfsp != NULL) {
- if (vfsp->vfc_vfsops->vfs_cmount != NULL) {
- error = vfsp->vfc_vfsops->vfs_cmount(
- fspath, uap->data, uap->flags, td);
- } else {
- error = vfs_domount(td, fstype, fspath,
- uap->flags, uap->data, 1);
- }
- }
+ error = vfs_domount(td, fstype, fspath,
+ uap->flags, uap->data, 1);
mtx_unlock(&Giant);
}
free(fstype, M_TEMP);
OpenPOWER on IntegriCloud