linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Frank Sorenson <sorenson@redhat.com>
To: linux-nfs@vger.kernel.org
Cc: steved@redhat.com
Subject: [PATCH nfs-utils] Allow 'debug' configuration option to accept '0' and '1'
Date: Tue,  4 Oct 2022 12:40:15 -0500	[thread overview]
Message-ID: <20221004174015.1362841-1-sorenson@redhat.com> (raw)

In the example /etc/nfs.conf file, most sections include
a commented-out 'debug = 0' line, suggesting that '0' is
the default.  In addition, the manpages for some of the
utilities state that debugging can be enabled by setting
'debug = 1' in the nfs.conf file.

However, neither '0' nor '1' is accepted as a valid option
for 'debug' while parsing the nfs.conf file.

Add '0' and '1' to the valid strings when parsing 'debug',
with '0' not changing any debugging settings, and '1'
enabling all debugging.

Signed-off-by: Frank Sorenson <sorenson@redhat.com>
---
 support/nfs/xlog.c   | 7 +++++--
 systemd/nfs.conf.man | 6 ++++++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/support/nfs/xlog.c b/support/nfs/xlog.c
index e5861b9d..fa125cef 100644
--- a/support/nfs/xlog.c
+++ b/support/nfs/xlog.c
@@ -46,11 +46,13 @@ int export_errno = 0;
 
 static void	xlog_toggle(int sig);
 static struct xlog_debugfac	debugnames[] = {
+	{ "0",		0, },
 	{ "general",	D_GENERAL, },
 	{ "call",	D_CALL, },
 	{ "auth",	D_AUTH, },
 	{ "parse",	D_PARSE, },
 	{ "all",	D_ALL, },
+	{ "1",		D_ALL, },
 	{ NULL,		0, },
 };
 
@@ -119,13 +121,14 @@ xlog_sconfig(char *kind, int on)
 {
 	struct xlog_debugfac	*tbl = debugnames;
 
-	while (tbl->df_name != NULL && strcasecmp(tbl->df_name, kind)) 
+	while (tbl->df_name != NULL && strcasecmp(tbl->df_name, kind))
 		tbl++;
 	if (!tbl->df_name) {
 		xlog (L_WARNING, "Invalid debug facility: %s\n", kind);
 		return;
 	}
-	xlog_config(tbl->df_fac, on);
+	if (tbl->df_fac)
+		xlog_config(tbl->df_fac, on);
 }
 
 void
diff --git a/systemd/nfs.conf.man b/systemd/nfs.conf.man
index e74083e9..b95c05a6 100644
--- a/systemd/nfs.conf.man
+++ b/systemd/nfs.conf.man
@@ -98,6 +98,12 @@ value, which can be one or more from the list
 .BR parse ,
 .BR all .
 When a list is given, the members should be comma-separated.
+The values
+.BR 0
+and
+.BR 1
+are also accepted, with '0' making no changes to the debug level, and '1' equivalent to specifying 'all'.
+
 .TP
 .B general
 Recognized values:
-- 
2.37.2


             reply	other threads:[~2022-10-04 17:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-04 17:40 Frank Sorenson [this message]
2022-10-17 19:13 ` [PATCH nfs-utils] Allow 'debug' configuration option to accept '0' and '1' Steve Dickson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221004174015.1362841-1-sorenson@redhat.com \
    --to=sorenson@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=steved@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).