From: Dan Williams <dan.j.williams@intel.com>
To: "Qi, Fuli" <qi.fuli@jp.fujitsu.com>
Cc: Keiichiro Tokunaga <tokunaga.keiich@jp.fujitsu.com>,
linux-nvdimm <linux-nvdimm@lists.01.org>
Subject: Re: [ndctl PATCH v13 2/5] ndctl, monitor: add main ndctl monitor configuration file
Date: Mon, 15 Oct 2018 17:23:33 -0700 [thread overview]
Message-ID: <CAPcyv4h4VaLXV2Mj8VcZmvREyn=YtgC0AtBV1SEdDJ3YDKY5=Q@mail.gmail.com> (raw)
In-Reply-To: <20180713233350.7148-3-qi.fuli@jp.fujitsu.com>
On Fri, Jul 13, 2018 at 4:34 PM QI Fuli <qi.fuli@jp.fujitsu.com> wrote:
>
> This patch adds the main configuration file(/etc/ndctl/monitor.conf)
> of ndctl monitor. It contains the configuration directives that give
> ndctl monitor instructions. Users can change the configuration by
> editing this file or using [--config-file] option to override this
> file. The changed value will work after restart ndctl monitor service.
>
> Signed-off-by: QI Fuli <qi.fuli@jp.fujitsu.com>
[..]
> diff --git a/ndctl/monitor.c b/ndctl/monitor.c
> index 12317d0..8300250 100644
> --- a/ndctl/monitor.c
> +++ b/ndctl/monitor.c
[..]
> @@ -454,6 +454,108 @@ dimm_event_all:
> return 0;
> }
>
> +static void parse_config(const char **arg, char *key, char *val, char *ident)
> +{
> + struct strbuf value = STRBUF_INIT;
> + size_t arg_len = *arg ? strlen(*arg) : 0;
> +
> + if (!ident || !key || (strcmp(ident, key) != 0))
> + return;
> +
> + if (arg_len) {
> + strbuf_add(&value, *arg, arg_len);
> + strbuf_addstr(&value, " ");
> + }
> + strbuf_addstr(&value, val);
> + *arg = strbuf_detach(&value, NULL);
> +}
> +
> +static int read_config_file(struct ndctl_ctx *ctx, struct monitor *_monitor,
> + struct util_filter_params *_param)
> +{
Hi,
I have a future cleanup request. I've just come across, ciniparser
[1]. It would be great if we could drop the open coded implementation
and just use that library. We use ccan modules for other portions of
ndctl.
[1]: https://ccodearchive.net/info/ciniparser.html
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm
next prev parent reply other threads:[~2018-10-16 0:23 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-13 23:33 [ndctl PATCH v13 0/5] ndctl, monitor: add ndctl monitor daemon QI Fuli
2018-07-13 23:33 ` [ndctl PATCH v13 1/5] ndctl, monitor: add a new command - monitor QI Fuli
2018-07-13 23:33 ` [ndctl PATCH v13 2/5] ndctl, monitor: add main ndctl monitor configuration file QI Fuli
2018-10-16 0:23 ` Dan Williams [this message]
2018-10-16 4:09 ` qi.fuli
2018-11-05 8:05 ` qi.fuli
2018-07-13 23:33 ` [ndctl PATCH v13 3/5] ndctl, monitor: add the unit file of systemd for ndctl-monitor service QI Fuli
2018-07-13 23:33 ` [ndctl PATCH v13 4/5] ndctl, documentation: add man page for monitor QI Fuli
2018-07-13 23:33 ` [ndctl PATCH v13 5/5] ndctl, test: add a new unit test " QI Fuli
2018-07-19 0:42 ` [ndctl PATCH v13 0/5] ndctl, monitor: add ndctl monitor daemon Verma, Vishal L
2018-07-19 1:02 ` Qi, Fuli
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='CAPcyv4h4VaLXV2Mj8VcZmvREyn=YtgC0AtBV1SEdDJ3YDKY5=Q@mail.gmail.com' \
--to=dan.j.williams@intel.com \
--cc=linux-nvdimm@lists.01.org \
--cc=qi.fuli@jp.fujitsu.com \
--cc=tokunaga.keiich@jp.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 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).