diff options
author | rodrigc <rodrigc@FreeBSD.org> | 2006-11-21 01:53:18 +0000 |
---|---|---|
committer | rodrigc <rodrigc@FreeBSD.org> | 2006-11-21 01:53:18 +0000 |
commit | ef2f1c82e10bdf7536194dab2c5ff70c03ab4a89 (patch) | |
tree | fd8c16cd31f15d165dc137d447f35c1f0837f680 /sbin/mount_nfs | |
parent | 28fc198f34d356823830c57598526252eb6b2e1a (diff) | |
download | FreeBSD-src-ef2f1c82e10bdf7536194dab2c5ff70c03ab4a89.zip FreeBSD-src-ef2f1c82e10bdf7536194dab2c5ff70c03ab4a89.tar.gz |
Convert mount_nfs from old mount(2) API to new nmount(2) API.
Reviewed by: mohans
Diffstat (limited to 'sbin/mount_nfs')
-rw-r--r-- | sbin/mount_nfs/mount_nfs.c | 12 |
1 files changed, 11 insertions, 1 deletions
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 <sys/socket.h> #include <sys/stat.h> #include <sys/syslog.h> +#include <sys/uio.h> #include <rpc/rpc.h> #include <rpc/pmap_clnt.h> @@ -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); |