1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-30 16:51:41 +00:00

Remove oldnfs remnants from nfsd(8).

Reviewed by:	rmacklem@
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Edward Tomasz Napierala 2015-04-30 12:55:27 +00:00
parent b19f7eece6
commit ae3e3df45c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=282272
2 changed files with 60 additions and 120 deletions

View File

@ -28,7 +28,7 @@
.\" @(#)nfsd.8 8.4 (Berkeley) 3/29/95
.\" $FreeBSD$
.\"
.Dd January 1, 2015
.Dd April 25, 2015
.Dt NFSD 8
.Os
.Sh NAME
@ -38,7 +38,7 @@
server
.Sh SYNOPSIS
.Nm
.Op Fl arduteo
.Op Fl ardute
.Op Fl n Ar num_servers
.Op Fl h Ar bindip
.Op Fl Fl maxthreads Ar max_threads
@ -112,10 +112,7 @@ Serve
.Tn UDP NFS
clients.
.It Fl e
Enable NFSv4 support.
It is enabled by default; this option should be considered deprecated.
.It Fl o
Disable NFSv4 support.
Ignored; included for backward compatibility.
.El
.Pp
For example,

View File

@ -87,8 +87,6 @@ static int nfsdcnt; /* number of children */
static int nfsdcnt_set;
static int minthreads;
static int maxthreads;
static int new_syscall;
static int run_v4server = 1; /* Force running of nfsv4 server */
static int nfssvc_nfsd; /* Set to correct NFSSVC_xxx flag */
static int stablefd = -1; /* Fd for the stable restart file */
static int backupfd; /* Fd for the backup stable restart file */
@ -156,7 +154,7 @@ main(int argc, char **argv)
socklen_t len;
int on = 1, unregister, reregister, sock;
int tcp6sock, ip6flag, tcpflag, tcpsock;
int udpflag, ecode, error, s, srvcnt;
int udpflag, ecode, error, s;
int bindhostc, bindanyflag, rpcbreg, rpcbregcnt;
int nfssvc_addsock;
int longindex = 0;
@ -167,10 +165,10 @@ main(int argc, char **argv)
nfsdcnt = DEFNFSDCNT;
unregister = reregister = tcpflag = maxsock = 0;
bindanyflag = udpflag = connect_type_cnt = bindhostc = 0;
getopt_shortopts = "ah:n:rdtueo";
getopt_shortopts = "ah:n:rdtue";
getopt_usage =
"usage:\n"
" nfsd [-ardtueo] [-h bindip]\n"
" nfsd [-ardtue] [-h bindip]\n"
" [-n numservers] [--minthreads #] [--maxthreads #]\n";
while ((ch = getopt_long(argc, argv, getopt_shortopts, longopts,
&longindex)) != -1)
@ -205,9 +203,6 @@ main(int argc, char **argv)
case 'e':
/* now a no-op, since this is the default */
break;
case 'o':
run_v4server = 0;
break;
case 0:
lopt = longopts[longindex].name;
if (!strcmp(lopt, "minthreads")) {
@ -242,17 +237,11 @@ main(int argc, char **argv)
* 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) {
/* Not present in kernel, try loading it */
if (kldload("nfsserver") < 0 || modfind("nfsserver") < 0)
errx(1, "NFS server is not available");
}
ip6flag = 1;
s = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP);
@ -392,7 +381,6 @@ main(int argc, char **argv)
* level write-back caching. (See SCSI doc for more information
* on how to prevent write-back caching on SCSI disks.)
*/
if (run_v4server > 0) {
open_stable(&stablefd, &backupfd);
if (stablefd < 0) {
syslog(LOG_ERR, "Can't open %s: %m\n", NFSD_STABLERESTART);
@ -406,41 +394,8 @@ main(int argc, char **argv)
}
nfssvc_addsock = NFSSVC_NFSDADDSOCK;
nfssvc_nfsd = NFSSVC_NFSDNFSD;
new_syscall = TRUE;
} else {
nfssvc_addsock = NFSSVC_ADDSOCK;
nfssvc_nfsd = NFSSVC_NFSD;
/*
* Figure out if the kernel supports the new-style
* NFSSVC_NFSD. Old kernels will return ENXIO because they
* don't recognise the flag value, new ones will return EINVAL
* because argp is NULL.
*/
new_syscall = FALSE;
if (nfssvc(NFSSVC_NFSD, NULL) < 0 && errno == EINVAL)
new_syscall = TRUE;
}
if (!new_syscall) {
/* If we use UDP only, we start the last server below. */
srvcnt = tcpflag ? nfsdcnt : nfsdcnt - 1;
for (i = 0; i < srvcnt; i++) {
switch ((pid = fork())) {
case -1:
syslog(LOG_ERR, "fork: %m");
nfsd_exit(1);
case 0:
break;
default:
children[i] = pid;
continue;
}
(void)signal(SIGUSR1, child_cleanup);
setproctitle("server");
start_server(0);
}
} else if (tcpflag) {
if (tcpflag) {
/*
* For TCP mode, we fork once to start the first
* kernel nfsd thread. The kernel will add more
@ -976,11 +931,6 @@ get_tuned_nfsdcount(void)
} else {
tuned_nfsdcnt = ncpu * 8;
}
if (!new_syscall && tuned_nfsdcnt > MAXNFSDCNT) {
warnx("nfsd count %d; truncated to %d", tuned_nfsdcnt,
MAXNFSDCNT);
tuned_nfsdcnt = MAXNFSDCNT;
}
return tuned_nfsdcnt;
}
@ -994,7 +944,6 @@ start_server(int master)
struct addrinfo *aip, hints;
status = 0;
if (new_syscall) {
gethostname(hostname, sizeof (hostname));
snprintf(principal, sizeof (principal), "nfs@%s", hostname);
if ((cp = strchr(hostname, '.')) == NULL ||
@ -1038,12 +987,6 @@ start_server(int master)
syslog(LOG_ERR, "nfssvc: %m");
status = 1;
}
} else {
if (nfssvc(NFSSVC_OLDNFSD, NULL) < 0) {
syslog(LOG_ERR, "nfssvc: %m");
status = 1;
}
}
if (master)
nfsd_exit(status);
else