From: Steve Dickson <SteveD@RedHat.com>
To: Justin Mitchell <jumitche@redhat.com>,
Linux NFS Mailing list <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH] nfs-utils: Allow setting of commented out values in nfs.conf
Date: Thu, 29 Nov 2018 14:47:04 -0500 [thread overview]
Message-ID: <92dc60df-e956-5c85-08be-32fa1ad4efad@RedHat.com> (raw)
In-Reply-To: <1540480050.8177.2.camel@redhat.com>
On 10/25/18 11:07 AM, Justin Mitchell wrote:
> When using nfsconf tool to set values, allow it to uncomment a setting
> it finds in the relevant section if it would otherwise have had to create
> a new one.
>
> Signed-off-by: Justin Mitchell <jumitche@redhat.com>
Committed... Sorry it too so long....
steved.
> ---
> support/nfs/conffile.c | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/support/nfs/conffile.c b/support/nfs/conffile.c
> index 3845b94..713f81b 100644
> --- a/support/nfs/conffile.c
> +++ b/support/nfs/conffile.c
> @@ -1830,6 +1830,8 @@ conf_write(const char *filename, const char *section, const char *arg,
>
> /* this is the section we care about */
> if (where != NULL && is_section(where->text, section, arg)) {
> + struct outbuffer *section_start = where;
> +
> /* is there an existing assignment */
> while ((where = TAILQ_NEXT(where, link)) != NULL) {
> if (is_tag(where->text, tag)) {
> @@ -1838,6 +1840,26 @@ conf_write(const char *filename, const char *section, const char *arg,
> }
> }
>
> + /* no active assignment, but is there a commented one */
> + if (!found) {
> + where = section_start;
> + while ((where = TAILQ_NEXT(where, link)) != NULL) {
> + if (is_comment(where->text)) {
> + char *cline = where->text;
> + while (isspace(*cline)) cline++;
> +
> + if (*cline != '#') continue;
> + cline++;
> +
> + if (is_tag(cline, tag)) {
> + found = true;
> + break;
> + }
> + }
> + }
> + }
> +
> + /* replace the located tag with an updated one */
> if (found) {
> struct outbuffer *prev = TAILQ_PREV(where, tailhead, link);
> bool again = false;
>
prev parent reply other threads:[~2018-11-29 19:47 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-25 15:07 [PATCH] nfs-utils: Allow setting of commented out values in nfs.conf Justin Mitchell
2018-11-29 19:47 ` Steve Dickson [this message]
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=92dc60df-e956-5c85-08be-32fa1ad4efad@RedHat.com \
--to=steved@redhat.com \
--cc=jumitche@redhat.com \
--cc=linux-nfs@vger.kernel.org \
/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