From ef2f1c82e10bdf7536194dab2c5ff70c03ab4a89 Mon Sep 17 00:00:00 2001 From: rodrigc Date: Tue, 21 Nov 2006 01:53:18 +0000 Subject: Convert mount_nfs from old mount(2) API to new nmount(2) API. Reviewed by: mohans --- sbin/mount_nfs/mount_nfs.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'sbin/mount_nfs') diff --git a/sbin/mount_nfs/mount_nfs.c b/sbin/mount_nfs/mount_nfs.c index 7607f65..4858a5d 100644 --- a/sbin/mount_nfs/mount_nfs.c +++ b/sbin/mount_nfs/mount_nfs.c @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -249,7 +250,9 @@ main(int argc, char *argv[]) int c; struct nfs_args *nfsargsp; struct nfs_args nfsargs; + struct iovec *iov; int mntflags, altflags, num; + int iovlen; char *name, *p, *spec; char mntpath[MAXPATHLEN]; @@ -257,6 +260,9 @@ main(int argc, char *argv[]) altflags = 0; nfsargs = nfsdefargs; nfsargsp = &nfsargs; + iov = NULL; + iovlen = 0; + while ((c = getopt(argc, argv, "23a:bcdD:g:I:iLlNo:PR:r:sTt:w:x:U")) != -1) switch (c) { @@ -454,7 +460,11 @@ main(int argc, char *argv[]) /* resolve the mountpoint with realpath(3) */ (void)checkpath(name, mntpath); - if (mount("nfs", mntpath, mntflags, nfsargsp)) + build_iovec(&iov, &iovlen, "nfs_args", nfsargsp, sizeof(*nfsargsp)); + build_iovec(&iov, &iovlen, "fstype", "nfs", (size_t)-1); + build_iovec(&iov, &iovlen, "fspath", mntpath, (size_t)-1); + + if (nmount(iov, iovlen, mntflags)) err(1, "%s", mntpath); exit(0); -- cgit v1.1