All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: linux-nvdimm@lists.01.org
Subject: [ndctl PATCH 4/7] ndctl/monitor: Unify definition of default monitor configfile path
Date: Thu, 27 Dec 2018 19:30:19 -0800	[thread overview]
Message-ID: <154596781985.164521.10399375562523595499.stgit@dwillia2-desk3.amr.corp.intel.com> (raw)
In-Reply-To: <154596779833.164521.12632457592535372923.stgit@dwillia2-desk3.amr.corp.intel.com>

The definition of the monitor configuration file can get out of sync
with current duplication between configure.ac and ndctl/Makefile.am.
Instead, define all the variables in configure.ac and just reference
them in ndctl/Makefile.am.

Cc: QI Fuli <qi.fuli@jp.fujitsu.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 configure.ac      |    8 +++++++-
 ndctl/Makefile.am |    6 ++----
 ndctl/monitor.c   |    2 +-
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index de5b84cec670..aa07ec7bc870 100644
--- a/configure.ac
+++ b/configure.ac
@@ -154,8 +154,14 @@ fi
 AC_SUBST([systemd_unitdir])
 AM_CONDITIONAL([ENABLE_SYSTEMD_UNITS], [test "x$with_systemd" = "xyes"])
 
+ndctl_monitorconfdir=${sysconfdir}/ndctl
+ndctl_monitorconf=monitor.conf
+AC_SUBST([ndctl_monitorconfdir])
+AC_SUBST([ndctl_monitorconf])
+AC_DEFINE_UNQUOTED(NDCTL_CONF_FILE, ["$ndctl_monitorconfdir/$ndctl_monitorconf"],
+	[default ndctl monitor conf path])
+
 my_CFLAGS="\
--D DEF_CONF_FILE='\"${sysconfdir}/ndctl/monitor.conf\"' \
 -Wall \
 -Wchar-subscripts \
 -Wformat-security \
diff --git a/ndctl/Makefile.am b/ndctl/Makefile.am
index 8a5e5f87e6c5..ff01e0688afd 100644
--- a/ndctl/Makefile.am
+++ b/ndctl/Makefile.am
@@ -43,10 +43,8 @@ ndctl_SOURCES += ../test/libndctl.c \
 		 test.c
 endif
 
-monitor_config_file = monitor.conf
-monitor_configdir = $(sysconfdir)/ndctl/
-monitor_config_DATA = $(monitor_config_file)
-EXTRA_DIST += $(monitor_config_file)
+monitor_configdir = $(ndctl_monitorconfdir)
+monitor_config_DATA = $(ndctl_monitorconf)
 
 if ENABLE_SYSTEMD_UNITS
 systemd_unit_DATA = ndctl-monitor.service
diff --git a/ndctl/monitor.c b/ndctl/monitor.c
index 08219f99b12b..cef70d06beae 100644
--- a/ndctl/monitor.c
+++ b/ndctl/monitor.c
@@ -503,7 +503,7 @@ static int read_config_file(struct ndctl_ctx *ctx, struct monitor *_monitor,
 	if (_monitor->config_file)
 		config_file = strdup(_monitor->config_file);
 	else
-		config_file = strdup(DEF_CONF_FILE);
+		config_file = strdup(NDCTL_CONF_FILE);
 	if (!config_file) {
 		fail("strdup default config file failed\n");
 		rc = -ENOMEM;

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

  parent reply	other threads:[~2018-12-28  3:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-28  3:29 [ndctl PATCH 0/7] ndctl/monitor: Cleanups and fixes Dan Williams
2018-12-28  3:30 ` [ndctl PATCH 1/7] ndctl, daxctl: Split builtin.h per-command Dan Williams
2018-12-28  3:30 ` [ndctl PATCH 2/7] ndctl, daxctl: Add type-safety to command harness Dan Williams
2018-12-28  3:30 ` [ndctl PATCH 3/7] ndctl/monitor: Drop 'struct ndctl_ctx *' casts Dan Williams
2018-12-28  3:30 ` Dan Williams [this message]
2018-12-28  3:30 ` [ndctl PATCH 5/7] ndctl/monitor: Fix / cleanup log_file() Dan Williams
2018-12-28  3:30 ` [ndctl PATCH 6/7] ndctl/monitor: Drop vasprintf usage Dan Williams
2018-12-28  3:30 ` [ndctl PATCH 7/7] ndctl/monitor: Kill usage of ndctl/lib/private.h Dan Williams
2019-01-03  0:37 ` [ndctl PATCH 0/7] ndctl/monitor: Cleanups and fixes 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=154596781985.164521.10399375562523595499.stgit@dwillia2-desk3.amr.corp.intel.com \
    --to=dan.j.williams@intel.com \
    --cc=linux-nvdimm@lists.01.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 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.