On Fri, Jul 13, 2018 at 4:34 PM QI Fuli <[email protected]> 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 <[email protected]> [..] > 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 [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
