Rename debug to mountd_debug to avoid overlap in rump tests

This commit is contained in:
joerg 2020-04-23 00:22:01 +00:00
parent dae9bc894f
commit 1ae5c388e8
3 changed files with 31 additions and 31 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: get_net.c,v 1.2 2015/12/24 01:41:19 christos Exp $ */
/* $NetBSD: get_net.c,v 1.3 2020/04/23 00:22:01 joerg Exp $ */
/*
* Copyright (c) 1989, 1993
@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
__RCSID("$NetBSD: get_net.c,v 1.2 2015/12/24 01:41:19 christos Exp $");
__RCSID("$NetBSD: get_net.c,v 1.3 2020/04/23 00:22:01 joerg Exp $");
#include <sys/types.h>
#include <netdb.h>
@ -52,7 +52,7 @@ __RCSID("$NetBSD: get_net.c,v 1.2 2015/12/24 01:41:19 christos Exp $");
#ifdef TEST
int opt_flags;
const int ninumeric = NI_NUMERICHOST;
int debug = 1;
int mountd_debug = 1;
#endif
static int
@ -145,7 +145,7 @@ get_net(char *cp, struct netmsk *net, int maskflg)
sin.sin_family = AF_INET;
sin.sin_len = sizeof sin;
sin.sin_addr = inet_makeaddr(inet_network(cp), 0);
if (debug)
if (mountd_debug)
fprintf(stderr, "get_net: '%s' v4 addr %x\n",
cp, sin.sin_addr.s_addr);
sa = (struct sockaddr *)&sin;

View File

@ -1,4 +1,4 @@
/* $NetBSD: mountd.c,v 1.130 2018/01/09 03:31:13 christos Exp $ */
/* $NetBSD: mountd.c,v 1.131 2020/04/23 00:22:01 joerg Exp $ */
/*
* Copyright (c) 1989, 1993
@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\
#if 0
static char sccsid[] = "@(#)mountd.c 8.15 (Berkeley) 5/1/95";
#else
__RCSID("$NetBSD: mountd.c,v 1.130 2018/01/09 03:31:13 christos Exp $");
__RCSID("$NetBSD: mountd.c,v 1.131 2020/04/23 00:22:01 joerg Exp $");
#endif
#endif /* not lint */
@ -238,7 +238,7 @@ int opt_flags;
static int have_v6 = 1;
const int ninumeric = NI_NUMERICHOST;
int debug = DEBUGGING;
int mountd_debug = DEBUGGING;
#if 0
static void SYSLOG(int, const char *,...);
#endif
@ -369,7 +369,7 @@ main(int argc, char **argv)
forcedport = atoi(optarg);
break;
case 'd':
debug = 1;
mountd_debug = 1;
break;
case 'N':
noprivports = 1;
@ -414,16 +414,16 @@ main(int argc, char **argv)
grphead = NULL;
exphead = NULL;
mlhead = NULL;
openlog("mountd", LOG_PID | (debug ? LOG_PERROR : 0), LOG_DAEMON);
openlog("mountd", LOG_PID | (mountd_debug ? LOG_PERROR : 0), LOG_DAEMON);
(void)signal(SIGSYS, no_nfs);
if (debug)
if (mountd_debug)
(void)fprintf(stderr, "Getting export list.\n");
get_exportlist(0);
if (debug)
if (mountd_debug)
(void)fprintf(stderr, "Getting mount list.\n");
get_mountlist();
if (debug)
if (mountd_debug)
(void)fprintf(stderr, "Here we go.\n");
(void)signal(SIGTERM, send_umntall);
@ -547,7 +547,7 @@ main(int argc, char **argv)
exit(1);
}
if (debug == 0) {
if (mountd_debug == 0) {
daemon(0, 0);
(void)signal(SIGINT, SIG_IGN);
(void)signal(SIGQUIT, SIG_IGN);
@ -612,16 +612,16 @@ mntsrv(struct svc_req *rqstp, SVCXPRT *transp)
syslog(LOG_ERR, "Can't send reply");
return;
case MOUNTPROC_MNT:
if (debug)
if (mountd_debug)
fprintf(stderr,
"got mount request from %s\n", numerichost);
if (!svc_getargs(transp, xdr_dir, rpcpath)) {
if (debug)
if (mountd_debug)
fprintf(stderr, "-> garbage args\n");
svcerr_decode(transp);
return;
}
if (debug)
if (mountd_debug)
fprintf(stderr,
"-> rpcpath: %s\n", rpcpath);
/*
@ -638,14 +638,14 @@ mntsrv(struct svc_req *rqstp, SVCXPRT *transp)
(!S_ISDIR(stb.st_mode) && !S_ISREG(stb.st_mode)) ||
statvfs1(rdirpath, &fsb, ST_WAIT) < 0) {
(void)chdir("/"); /* Just in case realpath doesn't */
if (debug)
if (mountd_debug)
(void)fprintf(stderr, "-> stat failed on %s\n",
rdirpath);
if (!svc_sendreply(transp, (xdrproc_t)xdr_long, (caddr_t) &bad))
syslog(LOG_ERR, "Can't send reply");
return;
}
if (debug)
if (mountd_debug)
fprintf(stderr,
"-> dirpath: %s\n", rdirpath);
/* Check in the exports list */
@ -696,7 +696,7 @@ mntsrv(struct svc_req *rqstp, SVCXPRT *transp)
add_mlist(host, rdirpath, hostset);
else
add_mlist(numerichost, rdirpath, hostset);
if (debug)
if (mountd_debug)
(void)fprintf(stderr, "Mount successful.\n");
} else {
if (!svc_sendreply(transp, (xdrproc_t)xdr_long, (caddr_t) &bad))
@ -992,12 +992,12 @@ parse_directory(const char *line, size_t lineno, struct grouplist *tgrp,
*ep = get_exp();
(*ep)->ex_fs = fsp->f_fsidx;
(*ep)->ex_fsdir = estrdup(fsp->f_mntonname);
if (debug)
if (mountd_debug)
(void)fprintf(stderr,
"Making new ep fs=0x%x,0x%x\n",
fsp->f_fsidx.__fsid_val[0], fsp->f_fsidx.__fsid_val[1]);
} else {
if (debug)
if (mountd_debug)
(void)fprintf(stderr,
"Found ep fs=0x%x,0x%x\n",
fsp->f_fsidx.__fsid_val[0], fsp->f_fsidx.__fsid_val[1]);
@ -1078,14 +1078,14 @@ get_exportlist(int n)
* Don't exit here; we can still reload the config
* after a SIGHUP.
*/
if (debug)
if (mountd_debug)
(void)fprintf(stderr, "Can't open %s: %s\n", exname,
strerror(errno));
return;
}
dirhead = NULL;
while ((line = fparseln(exp_file, &len, &lineno, NULL, 0)) != NULL) {
if (debug)
if (mountd_debug)
(void)fprintf(stderr, "Got line %s\n", line);
cp = line;
nextfield(&cp, &endcp);
@ -1130,7 +1130,7 @@ get_exportlist(int n)
line, (unsigned long)lineno);
goto badline;
}
if (debug)
if (mountd_debug)
(void)fprintf(stderr, "doing opt %s\n",
cp);
got_nondir = 1;
@ -1184,7 +1184,7 @@ get_exportlist(int n)
if (!has_host) {
grp->gr_type = GT_HOST;
if (debug)
if (mountd_debug)
(void)fprintf(stderr,
"Adding a default entry\n");
/* add a default group and make the grp list NULL */
@ -1482,7 +1482,7 @@ bitcmp(void *dst, void *src, int bitlen)
bytelen = bitlen / 8;
bitsleft = bitlen % 8;
if (debug) {
if (mountd_debug) {
printf("comparing:\n");
for (i = 0; i < (bitsleft ? bytelen + 1 : bytelen); i++)
printf("%02x", p1[i]);
@ -1755,7 +1755,7 @@ do_opt(const char *line, size_t lineno, char **cpp, char **endcpp,
} else if (cpoptarg && (!strcmp(cpopt, "network") ||
!strcmp(cpopt, "n"))) {
if (strchr(cpoptarg, '/') != NULL) {
if (debug)
if (mountd_debug)
fprintf(stderr, "setting OP_MASKLEN\n");
opt_flags |= OP_MASKLEN;
}
@ -1850,7 +1850,7 @@ get_host(const char *line, size_t lineno, const char *cp,
ai->ai_flags |= AI_CANONNAME;
} else
ai->ai_flags &= ~AI_CANONNAME;
if (debug)
if (mountd_debug)
(void)fprintf(stderr, "got host %s\n", ai->ai_canonname);
ai = ai->ai_next;
}
@ -2278,7 +2278,7 @@ SYSLOG(int pri, const char *fmt,...)
va_start(ap, fmt);
if (debug)
if (mountd_debug)
vfprintf(stderr, fmt, ap);
else
vsyslog(pri, fmt, ap);

View File

@ -1,4 +1,4 @@
/* $NetBSD: mountd.h,v 1.3 2015/12/29 04:30:43 pgoyette Exp $ */
/* $NetBSD: mountd.h,v 1.4 2020/04/23 00:22:01 joerg Exp $ */
/*
* Copyright (c) 1989, 1993
@ -43,7 +43,7 @@
#define OP_MASKLEN 0x200
extern int opt_flags;
extern int debug;
extern int mountd_debug;
extern const int ninumeric;
struct netmsk {