diff mbox series

[ndctl,4/7] ndctl/monitor: Unify definition of default monitor configfile path

Message ID 154596781985.164521.10399375562523595499.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive)
State New, archived
Headers show
Series ndctl/monitor: Cleanups and fixes | expand

Commit Message

Dan Williams Dec. 28, 2018, 3:30 a.m. UTC
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 mbox series

Patch

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;