Index: mountd.c
===================================================================
RCS file: /space2/ncvs/src/sbin/mountd/mountd.c,v
retrieving revision 1.64
diff -u -p -r1.64 mountd.c
--- mountd.c	16 May 2002 04:10:32 -0000	1.64
+++ mountd.c	23 May 2002 21:55:24 -0000
@@ -925,21 +925,27 @@ get_exportlist()
 	 */
 	num = getmntinfo(&fsp, MNT_NOWAIT);
 	for (i = 0; i < num; i++) {
-		union {
-			struct ufs_args ua;
-			struct iso_args ia;
-			struct msdosfs_args da;
-			struct ntfs_args na;
-		} targs;
+		struct iovec iov[6];
+		struct export_args export;
 
 		if (!strcmp(fsp->f_fstypename, "ufs") ||
 		    !strcmp(fsp->f_fstypename, "msdosfs") ||
 		    !strcmp(fsp->f_fstypename, "ntfs") ||
 		    !strcmp(fsp->f_fstypename, "cd9660")) {
-			targs.ua.fspec = NULL;
-			targs.ua.export.ex_flags = MNT_DELEXPORT;
-			if (mount(fsp->f_fstypename, fsp->f_mntonname,
-			    fsp->f_flags | MNT_UPDATE, (caddr_t)&targs) < 0 &&
+			iov[0].iov_base = "fstype";
+			iov[0].iov_len = sizeof("fstype");
+			iov[1].iov_base = fsp->f_fstypename;
+			iov[1].iov_len = strlen(fsp->f_fstypename) + 1;
+			iov[2].iov_base = "fspath";
+			iov[2].iov_len = sizeof("fspath");
+			iov[3].iov_base = fsp->f_mntonname;
+			iov[3].iov_len = strlen(fsp->f_mntonname) + 1;
+			iov[4].iov_base = "export";
+			iov[4].iov_len = sizeof("export");
+			iov[5].iov_base = (char *)&export;
+			iov[5].iov_len = sizeof(export);
+			export.ex_flags = MNT_DELEXPORT;
+			if (nmount(iov, 6, fsp->f_flags | MNT_UPDATE) < 0 &&
 			    errno != ENOENT)
 				syslog(LOG_ERR,
 				    "can't delete exports for %s: %m",
@@ -1715,25 +1721,16 @@ do_mount(ep, grp, exflags, anoncrp, dirp
 {
 	struct statfs fsb1;
 	struct addrinfo *ai;
-	struct export_args *eap;
+	struct export_args export;
+	struct iovec iov[6];
 	char *cp = NULL;
 	int done;
 	char savedc = '\0';
-	union {
-		struct ufs_args ua;
-		struct iso_args ia;
-		struct msdosfs_args da;
-		struct ntfs_args na;
-	} args;
-
-	bzero(&args, sizeof args);
-	/* XXX, we assume that all xx_args look like ufs_args. */
-	args.ua.fspec = 0;
-	eap = &args.ua.export;
-
-	eap->ex_flags = exflags;
-	eap->ex_anon = *anoncrp;
-	eap->ex_indexfile = ep->ex_indexfile;
+
+	bzero(&export, sizeof(export));
+	export.ex_flags = exflags;
+	export.ex_anon = *anoncrp;
+	export.ex_indexfile = ep->ex_indexfile;
 	if (grp->gr_type == GT_HOST)
 		ai = grp->gr_ptr.gt_addrinfo;
 	else
@@ -1744,26 +1741,26 @@ do_mount(ep, grp, exflags, anoncrp, dirp
 		case GT_HOST:
 			if (ai->ai_addr->sa_family == AF_INET6 && have_v6 == 0)
 				goto skip;
-			eap->ex_addr = ai->ai_addr;
-			eap->ex_addrlen = ai->ai_addrlen;
-			eap->ex_masklen = 0;
+			export.ex_addr = ai->ai_addr;
+			export.ex_addrlen = ai->ai_addrlen;
+			export.ex_masklen = 0;
 			break;
 		case GT_NET:
 			if (grp->gr_ptr.gt_net.nt_net.ss_family == AF_INET6 &&
 			    have_v6 == 0)
 				goto skip;
-			eap->ex_addr =
+			export.ex_addr =
 			    (struct sockaddr *)&grp->gr_ptr.gt_net.nt_net;
-			eap->ex_addrlen = args.ua.export.ex_addr->sa_len;
-			eap->ex_mask =
+			export.ex_addrlen = export.ex_addr->sa_len;
+			export.ex_mask =
 			    (struct sockaddr *)&grp->gr_ptr.gt_net.nt_mask;
-			eap->ex_masklen = args.ua.export.ex_mask->sa_len;
+			export.ex_masklen = export.ex_mask->sa_len;
 			break;
 		case GT_DEFAULT:
-			eap->ex_addr = NULL;
-			eap->ex_addrlen = 0;
-			eap->ex_mask = NULL;
-			eap->ex_masklen = 0;
+			export.ex_addr = NULL;
+			export.ex_addrlen = 0;
+			export.ex_mask = NULL;
+			export.ex_masklen = 0;
 			break;
 		case GT_IGNORE:
 			return(0);
@@ -1782,8 +1779,19 @@ do_mount(ep, grp, exflags, anoncrp, dirp
 		 * Also, needs to know how to export all types of local
 		 * exportable filesystems and not just "ufs".
 		 */
-		while (mount(fsb->f_fstypename, dirp,
-		    fsb->f_flags | MNT_UPDATE, (caddr_t)&args) < 0) {
+		iov[0].iov_base = "fstype";
+		iov[0].iov_len = sizeof("fstype");
+		iov[1].iov_base = fsb->f_fstypename;
+		iov[1].iov_len = strlen(fsb->f_fstypename) + 1;
+		iov[2].iov_base = "fspath";
+		iov[2].iov_len = sizeof("fspath");
+		iov[3].iov_base = dirp;
+		iov[3].iov_len = strlen(dirp) + 1;
+		iov[4].iov_base = "export";
+		iov[4].iov_len = sizeof("export");
+		iov[5].iov_base = (char *)&export;
+		iov[5].iov_len = sizeof(export);
+		while (nmount(iov, 6, fsb->f_flags | MNT_UPDATE) < 0) {
 			if (cp)
 				*cp-- = savedc;
 			else
