Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Aug 2014 12:04:40 +0000 (UTC)
From:      Bjoern A. Zeeb <bz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r269583 - head/sbin/mount_nfs
Message-ID:  <53e0c858.58ac.ffb65c4@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bz
Date: Tue Aug  5 12:04:40 2014
New Revision: 269583
URL: http://svnweb.freebsd.org/changeset/base/269583

Log:
  Provide -o vers= support for mount_nfs.
  
  Our mount_nfs does use -o nfsv<2|3|4> or -2 or -3 to specify the version.
  OSX (these days), Solaris, and Linux use -o vers=<2,3,4>.
  
  With the upcoming autofs support we can make a lot of (entrerprisy) setups
  getting mount options from LDAP just work by providing -o vers= compatibility.
  
  PR:		192379
  Reviewed by:	wblock, bjk (man page), rmacklem, emaste
  MFC after:	3 days
  Sponsored by:	DARPA,AFRL

Modified:
  head/sbin/mount_nfs/mount_nfs.8
  head/sbin/mount_nfs/mount_nfs.c

Modified: head/sbin/mount_nfs/mount_nfs.8
==============================================================================
--- head/sbin/mount_nfs/mount_nfs.8	Tue Aug  5 11:50:16 2014	(r269582)
+++ head/sbin/mount_nfs/mount_nfs.8	Tue Aug  5 12:04:40 2014	(r269583)
@@ -28,7 +28,7 @@
 .\"	@(#)mount_nfs.8	8.3 (Berkeley) 3/29/95
 .\" $FreeBSD$
 .\"
-.Dd December 7, 2013
+.Dd August 5, 2014
 .Dt MOUNT_NFS 8
 .Os
 .Sh NAME
@@ -371,6 +371,14 @@ tune the timeout
 interval.)
 .It Cm udp
 Use UDP transport.
+.It Cm vers Ns = Ns Aq Ar vers_number
+Use the specified version number for NFS requests.
+See the
+.Cm nfsv2 ,
+.Cm nfsv3 ,
+and 
+.Cm nfsv4
+options for details.
 .It Cm wcommitsize Ns = Ns Aq Ar value
 Set the maximum pending write commit size to the specified value.
 This determines the maximum amount of pending write data that the NFS
@@ -466,6 +474,26 @@ Same as
 Same as
 .Fl o Cm retrans Ns = Ns Aq Ar value
 .El
+.Pp
+The following
+.Fl o
+named options are equivalent to other
+.Fl o
+named options and are supported for compatibility with other
+operating systems (e.g., Linux, Solaris, and OSX) to ease usage of
+.Xr autofs 5
+support.
+.Bl -tag -width indent
+.It Fl o Cm vers Ns = Ns 2
+Same as
+.Fl o Cm nfsv2
+.It Fl o Cm vers Ns = Ns 3
+Same as
+.Fl o Cm nfsv3
+.It Fl o Cm vers Ns = Ns 4
+Same as
+.Fl o Cm nfsv4
+.El
 .Sh SEE ALSO
 .Xr nmount 2 ,
 .Xr unmount 2 ,

Modified: head/sbin/mount_nfs/mount_nfs.c
==============================================================================
--- head/sbin/mount_nfs/mount_nfs.c	Tue Aug  5 11:50:16 2014	(r269582)
+++ head/sbin/mount_nfs/mount_nfs.c	Tue Aug  5 12:04:40 2014	(r269583)
@@ -310,6 +310,32 @@ main(int argc, char *argv[])
 					if (*p || num <= 0)
 						errx(1, "illegal maxgroups value -- %s", val);
 					//set_rpc_maxgrouplist(num);
+				} else if (strcmp(opt, "vers") == 0) {
+					num = strtol(val, &p, 10);
+					if (*p || num <= 0)
+						errx(1, "illegal vers value -- "
+						    "%s", val);
+					switch (num) {
+					case 2:
+						mountmode = V2;
+						break;
+					case 3:
+						mountmode = V3;
+						build_iovec(&iov, &iovlen,
+						    "nfsv3", NULL, 0);
+						break;
+					case 4:
+						mountmode = V4;
+						fstype = "nfs";
+						nfsproto = IPPROTO_TCP;
+						if (portspec == NULL)
+							portspec = "2049";
+						break;
+					default:
+						errx(1, "illegal nfs version "
+						    "value -- %s", val);
+					}
+					pass_flag_to_nmount=0;
 				}
 				if (pass_flag_to_nmount)
 					build_iovec(&iov, &iovlen, opt, val,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?53e0c858.58ac.ffb65c4>