All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Verma, Vishal L" <vishal.l.verma@intel.com>
To: "fukuri.sai@gmail.com" <fukuri.sai@gmail.com>,
	"nvdimm@lists.linux.dev" <nvdimm@lists.linux.dev>
Cc: "qi.fuli@fujitsu.com" <qi.fuli@fujitsu.com>
Subject: Re: [RFC ndctl PATCH 3/3] ndctl, rename monitor.conf to ndctl.conf
Date: Wed, 2 Jun 2021 06:33:08 +0000	[thread overview]
Message-ID: <2274eb818d2dbd2df0ff51efb73241f22be98530.camel@intel.com> (raw)
In-Reply-To: <20210516231427.64162-4-qi.fuli@fujitsu.com>

On Mon, 2021-05-17 at 08:14 +0900, QI Fuli wrote:
> From: QI Fuli <qi.fuli@fujitsu.com>
> 
> Rename monitor.conf to ndctl.conf, and make it a ndclt global
> configuration file that all commands can refer to.
> Refactor monitor to make it work with ndctl.conf.
> 
> Signed-off-by: QI Fuli <qi.fuli@fujitsu.com>
> ---
>  configure.ac                       |   8 +-
>  ndctl/Makefile.am                  |   9 +-
>  ndctl/monitor.c                    | 127 +++++------------------------
>  ndctl/{monitor.conf => ndctl.conf} |  16 +++-
>  4 files changed, 40 insertions(+), 120 deletions(-)
>  rename ndctl/{monitor.conf => ndctl.conf} (82%)
> 

[snip]

> @@ -601,6 +496,19 @@ int cmd_monitor(int argc, const char **argv, struct ndctl_ctx *ctx)
>  		"ndctl monitor [<options>]",
>  		NULL
>  	};
> +	const struct config configs[] = {
> +		CONF_STR("core:bus", &param.bus, NULL),
> +		CONF_STR("core:region", &param.region, NULL),
> +		CONF_STR("core:dimm", &param.dimm, NULL),
> +		CONF_STR("core:namespace", &param.namespace, NULL),
> +		CONF_STR("monitor:bus", &param.bus, NULL),
> +		CONF_STR("monitor:region", &param.region, NULL),
> +		CONF_STR("monitor:dimm", &param.dimm, NULL),
> +		CONF_STR("monitor:namespace", &param.namespace, NULL),
> +		CONF_STR("monitor:dimm-event", &monitor.dimm_event, NULL),
> +		//CONF_FILE("monitor:log", &monitor.log, NULL),
> +		CONF_END(),
> +	};
>  	const char *prefix = "./";
>  	struct util_filter_ctx fctx = { 0 };
>  	struct monitor_filter_arg mfa = { 0 };
> @@ -621,7 +529,10 @@ int cmd_monitor(int argc, const char **argv, struct ndctl_ctx *ctx)
>  	else
>  		monitor.ctx.log_priority = LOG_INFO;
>  
> -	rc = read_config_file(ctx, &monitor, &param);
> +	if (monitor.config_file)
> +		rc = parse_configs(monitor.config_file, configs);
> +	else
> +		rc = parse_configs(NDCTL_CONF_FILE, configs);
>  	if (rc)
>  		goto out;

If I'm reading this right, it looks like this is set up so that params
from the config file will override any params from the command line,
which I think can be surprising behavior. The command line should
always override anything in the config file.

I suspect we'll need to collect CLI params in a 'param_cli' structure,
config params in a 'param_config' structure, and then consolidate them
to create the final 'param' structure that gets passed to
util_filter_walk etc.


  reply	other threads:[~2021-06-02  6:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-16 23:14 [RFC ndctl PATCH 0/3] Rename monitor.conf to ndctl.conf as a ndctl global config file QI Fuli
2021-05-16 23:14 ` [RFC ndctl PATCH 1/3] ndctl, ccan: import ciniparser QI Fuli
2021-05-16 23:14 ` [RFC ndctl PATCH 2/3] ndctl, util: add parse-configs helper QI Fuli
2021-05-16 23:14 ` [RFC ndctl PATCH 3/3] ndctl, rename monitor.conf to ndctl.conf QI Fuli
2021-06-02  6:33   ` Verma, Vishal L [this message]
2021-06-02  5:31 ` [RFC ndctl PATCH 0/3] Rename monitor.conf to ndctl.conf as a ndctl global config file Verma, Vishal L
2021-06-02 16:47   ` Dan Williams
2021-06-02 17:15     ` Verma, Vishal L
2021-06-17  0:25       ` qi.fuli
2021-07-08  6:34         ` Verma, Vishal L

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=2274eb818d2dbd2df0ff51efb73241f22be98530.camel@intel.com \
    --to=vishal.l.verma@intel.com \
    --cc=fukuri.sai@gmail.com \
    --cc=nvdimm@lists.linux.dev \
    --cc=qi.fuli@fujitsu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.