Remove oldnfs leftovers from mountd(8).

Reviewed by:	rmacklem@
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Edward Tomasz Napierala 2015-04-29 12:33:00 +00:00
parent 4b5c9cf62f
commit 79b8680737
2 changed files with 11 additions and 34 deletions

View File

@ -38,7 +38,7 @@
mount requests
.Sh SYNOPSIS
.Nm
.Op Fl 2delnorS
.Op Fl 2delnrS
.Op Fl h Ar bindip
.Op Fl p Ar port
.Op Ar exportsfile ...
@ -69,8 +69,7 @@ Output debugging information.
will not detach from the controlling terminal and will print
debugging messages to stderr.
.It Fl e
The new NFS server that includes NFSv4 support is now the default, so this
option is now a no-op and should be considered deprecated.
Ignored; included for backward compatibility.
.It Fl h Ar bindip
Specify specific IP addresses to bind to for TCP and UDP requests.
This option may be specified multiple times.
@ -98,9 +97,6 @@ This should only be specified if there are clients such as PC's,
that require it.
It will automatically clear the vfs.nfsrv.nfs_privport sysctl flag, which
controls if the kernel will accept NFS requests from reserved ports only.
.It Fl o
This flag forces the system to run the old NFS server, which does not
have NFSv4 support in it.
.It Fl p Ar port
Force
.Nm

View File

@ -253,7 +253,6 @@ static int have_v6 = 1;
int v4root_phase = 0;
char v4root_dirpath[PATH_MAX + 1];
int run_v4server = 1;
int has_publicfh = 0;
struct pidfh *pfh = NULL;
@ -312,7 +311,7 @@ main(int argc, char **argv)
else
close(s);
while ((c = getopt(argc, argv, "2deh:lnop:rS")) != -1)
while ((c = getopt(argc, argv, "2deh:lnp:rS")) != -1)
switch (c) {
case '2':
force_v2 = 1;
@ -332,9 +331,6 @@ main(int argc, char **argv)
case 'l':
dolog = 1;
break;
case 'o':
run_v4server = 0;
break;
case 'p':
endptr = NULL;
svcport = (in_port_t)strtoul(optarg, &endptr, 10);
@ -371,19 +367,9 @@ main(int argc, char **argv)
usage();
};
/*
* Unless the "-o" option was specified, try and run "nfsd".
* If "-o" was specified, try and run "nfsserver".
*/
if (run_v4server > 0) {
if (modfind("nfsd") < 0) {
/* Not present in kernel, try loading it */
if (kldload("nfsd") < 0 || modfind("nfsd") < 0)
errx(1, "NFS server is not available");
}
} else if (modfind("nfsserver") < 0) {
if (modfind("nfsd") < 0) {
/* Not present in kernel, try loading it */
if (kldload("nfsserver") < 0 || modfind("nfsserver") < 0)
if (kldload("nfsd") < 0 || modfind("nfsd") < 0)
errx(1, "NFS server is not available");
}
@ -1697,8 +1683,7 @@ get_exportlist(void)
*/
bzero(&eargs, sizeof (eargs));
eargs.export.ex_flags = MNT_DELEXPORT;
if (run_v4server > 0 &&
nfssvc(NFSSVC_V4ROOTEXPORT, (caddr_t)&eargs) < 0 &&
if (nfssvc(NFSSVC_V4ROOTEXPORT, (caddr_t)&eargs) < 0 &&
errno != ENOENT)
syslog(LOG_ERR, "Can't delete exports for V4:");
@ -1803,7 +1788,7 @@ get_exportlist(void)
/*
* If there was no public fh, clear any previous one set.
*/
if (run_v4server > 0 && has_publicfh == 0)
if (has_publicfh == 0)
(void) nfssvc(NFSSVC_NOPUBLICFH, NULL);
/* Resume the nfsd. If they weren't suspended, this is harmless. */
@ -2400,7 +2385,7 @@ do_mount(struct exportlist *ep, struct grouplist *grp, int exflags,
{
struct statfs fsb1;
struct addrinfo *ai;
struct export_args ea, *eap;
struct export_args *eap;
char errmsg[255];
char *cp;
int done;
@ -2410,10 +2395,7 @@ do_mount(struct exportlist *ep, struct grouplist *grp, int exflags,
int ret;
struct nfsex_args nfsea;
if (run_v4server > 0)
eap = &nfsea.export;
else
eap = &ea;
eap = &nfsea.export;
cp = NULL;
savedc = '\0';
@ -2493,8 +2475,7 @@ do_mount(struct exportlist *ep, struct grouplist *grp, int exflags,
*/
if (v4root_phase == 2) {
nfsea.fspec = v4root_dirpath;
if (run_v4server > 0 &&
nfssvc(NFSSVC_V4ROOTEXPORT, (caddr_t)&nfsea) < 0) {
if (nfssvc(NFSSVC_V4ROOTEXPORT, (caddr_t)&nfsea) < 0) {
syslog(LOG_ERR, "Exporting V4: failed");
return (2);
}
@ -2583,7 +2564,7 @@ do_mount(struct exportlist *ep, struct grouplist *grp, int exflags,
* If this is the public directory, get the file handle
* and load it into the kernel via the nfssvc() syscall.
*/
if (run_v4server > 0 && (exflags & MNT_EXPUBLIC) != 0) {
if ((exflags & MNT_EXPUBLIC) != 0) {
fhandle_t fh;
char *public_name;