From: Marius Bakke <marius@devup.no>
To: Martin Wilck <mwilck@suse.com>, dm-devel@redhat.com
Cc: Xose Vazquez Perez <xose.vazquez@gmail.com>
Subject: [PATCH v2] multipath: Fix compiler warnings when built without systemd.
Date: Wed, 17 Jun 2020 01:11:26 +0200 [thread overview]
Message-ID: <20200616231126.18538-1-marius@devup.no> (raw)
In-Reply-To: <d909fc0a2383f028ae7c3ad00c142193ca8d9ae7.camel@suse.com>
Add ifdef guards for code that is unused when systemd is not available.
---
libmultipath/config.c | 6 ++++--
multipathd/main.c | 10 +++++++++-
2 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/libmultipath/config.c b/libmultipath/config.c
index b4d87689..658bec8b 100644
--- a/libmultipath/config.c
+++ b/libmultipath/config.c
@@ -696,9 +696,9 @@ process_config_dir(struct config *conf, char *dir)
pthread_cleanup_pop(1);
}
+#ifdef USE_SYSTEMD
static void set_max_checkint_from_watchdog(struct config *conf)
{
-#ifdef USE_SYSTEMD
char *envp = getenv("WATCHDOG_USEC");
unsigned long checkint;
@@ -714,8 +714,8 @@ static void set_max_checkint_from_watchdog(struct config *conf)
condlog(3, "enabling watchdog, interval %ld", checkint);
conf->use_watchdog = true;
}
-#endif
}
+#endif
struct config *
load_config (char * file)
@@ -789,7 +789,9 @@ load_config (char * file)
/*
* fill the voids left in the config file
*/
+#ifdef USE_SYSTEMD
set_max_checkint_from_watchdog(conf);
+#endif
if (conf->max_checkint == 0) {
if (conf->checkint == CHECKINT_UNDEF)
conf->checkint = DEFAULT_CHECKINT;
diff --git a/multipathd/main.c b/multipathd/main.c
index 8baf9abe..ac8ae4c2 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -176,6 +176,7 @@ daemon_status(void)
/*
* I love you too, systemd ...
*/
+#ifdef USE_SYSTEMD
static const char *
sd_notify_status(enum daemon_status state)
{
@@ -195,7 +196,6 @@ sd_notify_status(enum daemon_status state)
return NULL;
}
-#ifdef USE_SYSTEMD
static void do_sd_notify(enum daemon_status old_state,
enum daemon_status new_state)
{
@@ -247,7 +247,9 @@ enum daemon_status wait_for_state_change_if(enum daemon_status oldstate,
static void __post_config_state(enum daemon_status state)
{
if (state != running_state && running_state != DAEMON_SHUTDOWN) {
+#ifdef USE_SYSTEMD
enum daemon_status old_state = running_state;
+#endif
running_state = state;
pthread_cond_broadcast(&config_cond);
@@ -272,7 +274,9 @@ int set_config_state(enum daemon_status state)
pthread_cleanup_push(config_cleanup, NULL);
pthread_mutex_lock(&config_lock);
if (running_state != state) {
+#ifdef USE_SYSTEMD
enum daemon_status old_state = running_state;
+#endif
if (running_state == DAEMON_SHUTDOWN)
rc = EINVAL;
@@ -2280,7 +2284,9 @@ checkerloop (void *ap)
struct timespec last_time;
struct config *conf;
int foreign_tick = 0;
+#ifdef USE_SYSTEMD
bool use_watchdog;
+#endif
pthread_cleanup_push(rcu_unregister, NULL);
rcu_register_thread();
@@ -2294,7 +2300,9 @@ checkerloop (void *ap)
/* use_watchdog is set from process environment and never changes */
conf = get_multipath_config();
+#ifdef USE_SYSTEMD
use_watchdog = conf->use_watchdog;
+#endif
put_multipath_config(conf);
while (1) {
--
2.26.2
next prev parent reply other threads:[~2020-06-16 23:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-16 17:55 [PATCH] multipath-tools: Fix compiler warnings when built without systemd Marius Bakke
2020-06-12 2:25 ` Xose Vazquez Perez
2020-06-16 21:53 ` Martin Wilck
2020-06-16 23:11 ` Marius Bakke [this message]
2020-06-17 7:28 ` [PATCH v2] multipath: " Martin Wilck
2020-06-16 23:17 ` [PATCH] multipath-tools: " Marius Bakke
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=20200616231126.18538-1-marius@devup.no \
--to=marius@devup.no \
--cc=dm-devel@redhat.com \
--cc=mwilck@suse.com \
--cc=xose.vazquez@gmail.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.