Index: sys/gnu/ext2fs/ext2_mount.h
===================================================================
RCS file: /space2/ncvs/src/sys/gnu/ext2fs/ext2_mount.h,v
retrieving revision 1.24
diff -u -p -r1.24 ext2_mount.h
--- sys/gnu/ext2fs/ext2_mount.h	14 May 2002 17:14:01 -0000	1.24
+++ sys/gnu/ext2fs/ext2_mount.h	23 May 2002 19:11:11 -0000
@@ -37,14 +37,6 @@
 #ifndef _SYS_GNU_EXT2FS_EXT2_MOUNT_H_
 #define _SYS_GNU_EXT2FS_EXT2_MOUNT_H_
 
-/*
- * Arguments to mount ext2fs filesystems
- */
-struct ext2_args {
-	char	*fspec;			/* block special device to mount */
-	struct	export_args export;	/* network export information */
-};
-
 #ifdef _KERNEL
 
 #ifdef MALLOC_DECLARE
Index: sys/gnu/ext2fs/ext2_vfsops.c
===================================================================
RCS file: /space2/ncvs/src/sys/gnu/ext2fs/ext2_vfsops.c,v
retrieving revision 1.96
diff -u -p -r1.96 ext2_vfsops.c
--- sys/gnu/ext2fs/ext2_vfsops.c	18 May 2002 22:18:17 -0000	1.96
+++ sys/gnu/ext2fs/ext2_vfsops.c	24 May 2002 15:56:44 -0000
@@ -66,8 +66,7 @@
 static int ext2_fhtovp(struct mount *, struct fid *, struct vnode **);
 static int ext2_flushfiles(struct mount *mp, int flags, struct thread *td);
 static int ext2_init(struct vfsconf *);
-static int ext2_mount(struct mount *,
-	    char *, caddr_t, struct nameidata *, struct thread *);
+static int ext2_mount(struct mount *, struct nameidata *, struct thread *);
 static int ext2_mountfs(struct vnode *, struct mount *, struct thread *);
 static int ext2_reload(struct mount *mountp, struct ucred *cred,
 			struct thread *td);
@@ -84,7 +83,7 @@ MALLOC_DEFINE(M_EXT2NODE, "EXT2 node", "
 static MALLOC_DEFINE(M_EXT2MNT, "EXT2 mount", "EXT2 mount structure");
 
 static struct vfsops ext2fs_vfsops = {
-	ext2_mount,
+	NULL,
 	vfs_stdstart,
 	ext2_unmount,
 	ext2_root,		/* root inode via vget */
@@ -98,6 +97,7 @@ static struct vfsops ext2fs_vfsops = {
 	ext2_init,
 	ext2_uninit,
 	vfs_stdextattrctl,
+	ext2_mount,
 };
 
 VFS_SET(ext2fs_vfsops, ext2fs, 0);
@@ -175,27 +175,33 @@ ext2_mountroot()
  * mount system call
  */
 static int
-ext2_mount(mp, path, data, ndp, td)
+ext2_mount(mp, ndp, td)
 	struct mount *mp;
-	char *path;
-	caddr_t data;		/* this is actually a (struct ext2_args *) */
 	struct nameidata *ndp;
 	struct thread *td;
 {
+	struct export_args *export;
+	struct vfsoptlist *opts;
 	struct vnode *devvp;
-	struct ext2_args args;
 	struct ext2mount *ump = 0;
 	struct ext2_sb_info *fs;
+	char *path, *fspec;
 	size_t size;
-	int error, flags;
+	int error, flags, len;
 	mode_t accessmode;
 
+	opts = mp->mnt_optnew;
+
+	vfs_getopt(opts, "fspath", (void **)&path, NULL);
 	/* Double-check the length of path.. */
 	if (strlen(path) >= MAXMNTLEN - 1)
 		return (ENAMETOOLONG);
-	error = copyin(data, (caddr_t)&args, sizeof (struct ext2_args));
-	if (error != 0)
-		return (error);
+
+	fspec = NULL;
+	error = vfs_getopt(opts, "from", (void **)&fspec, &len);
+	if (!error && fspec[len - 1] != '\0')
+		return (EINVAL);
+
 	/*
 	 * If updating, check whether changing from read-only to
 	 * read/write; if there is no device name, that's all we do.
@@ -258,18 +264,23 @@ ext2_mount(mp, path, data, ndp, td)
 			ext2_sbupdate(ump, MNT_WAIT);
 			fs->s_rd_only = 0;
 		}
-		if (args.fspec == 0) {
-			/*
-			 * Process export requests.
-			 */
-			return (vfs_export(mp, &args.export));
+		if (fspec == NULL) {
+			error = vfs_getopt(opts, "export", (void **)&export,
+			    &len);
+			if (!error && len == sizeof(struct export_args))
+				/*
+				 * Process export requests.
+				 */
+				return (vfs_export(mp, export));
 		}
 	}
 	/*
 	 * Not an update, or updating the name: look up the name
 	 * and verify that it refers to a sensible block device.
 	 */
-	NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, td);
+	if (fspec == NULL)
+		return (EINVAL);
+	NDINIT(ndp, LOOKUP, FOLLOW, UIO_SYSSPACE, fspec, td);
 	if ((error = namei(ndp)) != 0)
 		return (error);
 	NDFREE(ndp, NDF_ONLY_PNBUF);
@@ -316,8 +327,7 @@ ext2_mount(mp, path, data, ndp, td)
 	 */
 	strncpy(fs->fs_fsmnt, path, MAXMNTLEN);
 	fs->fs_fsmnt[MAXMNTLEN - 1] = '\0';
-	(void) copyinstr(args.fspec, mp->mnt_stat.f_mntfromname, MNAMELEN - 1, 
-	    &size);
+	(void)copystr(fspec, mp->mnt_stat.f_mntfromname, MNAMELEN - 1, &size);
 	bzero(mp->mnt_stat.f_mntfromname + size, MNAMELEN - size);
 	(void)ext2_statfs(mp, &mp->mnt_stat, td);
 	return (0);
Index: sbin/mount_ext2fs/mount_ext2fs.c
===================================================================
RCS file: /space2/ncvs/src/sbin/mount_ext2fs/mount_ext2fs.c,v
retrieving revision 1.12
diff -u -p -r1.12 mount_ext2fs.c
--- sbin/mount_ext2fs/mount_ext2fs.c	21 Mar 2002 13:14:19 -0000	1.12
+++ sbin/mount_ext2fs/mount_ext2fs.c	24 May 2002 15:59:59 -0000
@@ -55,8 +55,6 @@ static const char rcsid[] =
 #include <sysexits.h>
 #include <unistd.h>
 
-#include <ufs/ufs/ufsmount.h>
-
 #include "mntopts.h"
 
 struct mntopt mopts[] = {
@@ -74,9 +72,10 @@ main(argc, argv)
 	int argc;
 	char *argv[];
 {
-	struct ufs_args args;
+	struct iovec iov[6];
+	struct export_args export;
 	int ch, mntflags;
-	char *fs_name, *options, mntpath[MAXPATHLEN];
+	char *fs_name, *options, *fspec, mntpath[MAXPATHLEN];
 	struct vfsconf vfc;
 	int error;
 
@@ -97,7 +96,7 @@ main(argc, argv)
 	if (argc != 2)
 		usage();
 
-        args.fspec = argv[0];	/* the name of the device file */
+	fspec = argv[0];	/* the name of the device file */
 	fs_name = argv[1];	/* the mount point */
 
 	/*
@@ -105,14 +104,7 @@ main(argc, argv)
 	 * slashes from the devicename if there are any.
 	 */
 	(void)checkpath(fs_name, mntpath);
-	(void)rmslashes(args.fspec, args.fspec);
-
-#define DEFAULT_ROOTUID	-2
-	args.export.ex_root = DEFAULT_ROOTUID;
-	if (mntflags & MNT_RDONLY)
-		args.export.ex_flags = MNT_EXRDONLY;
-	else
-		args.export.ex_flags = 0;
+	(void)rmslashes(fspec, fspec);
 
 	error = getvfsbyname("ext2fs", &vfc);
 	if (error && vfsisloadable("ext2fs")) {
@@ -125,8 +117,20 @@ main(argc, argv)
 	if (error)
 		errx(EX_OSERR, "ext2fs filesystem is not available");
 
-	if (mount(vfc.vfc_name, mntpath, mntflags, &args) < 0)
-		err(EX_OSERR, "%s", args.fspec);
+	iov[0].iov_base = "fstype";
+	iov[0].iov_len = sizeof("fstype");
+	iov[1].iov_base = vfc.vfc_name;
+	iov[1].iov_len = strlen(vfc.vfc_name) + 1;
+	iov[2].iov_base = "fspath";
+	iov[2].iov_len = sizeof("fspath");
+	iov[3].iov_base = mntpath;
+	iov[3].iov_len = strlen(mntpath) + 1;
+	iov[4].iov_base = "from";
+	iov[4].iov_len = sizeof("from");
+	iov[5].iov_base = fspec;
+	iov[5].iov_len = strlen(fspec) + 1;
+	if (nmount(iov, 6, mntflags) < 0)
+		err(EX_OSERR, "%s", fspec);
 	exit(0);
 }
 
