dm-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [dm-devel] [PATCH 0/3] multipath-tools: compilation fixes
@ 2020-10-19 11:20 Anthony Iliopoulos
  2020-10-19 11:20 ` [dm-devel] [PATCH 1/3] libdmmp: fix compilation on newer json-c releases Anthony Iliopoulos
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Anthony Iliopoulos @ 2020-10-19 11:20 UTC (permalink / raw)
  To: Christophe Varoqui; +Cc: dm-devel

Hi all,

This short series fixes compilation errors on newer json-c releases, as
well as errors due to compiler warnings on non-systemd environments.

Anthony Iliopoulos (3):
  libdmmp: fix compilation on newer json-c releases
  libmultipath: fix compilation on systems without systemd
  multipathd: fix compilation on systems without systemd

 libdmmp/libdmmp_private.h |  4 ++--
 libmultipath/config.c     |  6 ++++--
 multipathd/main.c         | 10 +++++++++-
 3 files changed, 15 insertions(+), 5 deletions(-)

--
2.28.0


--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dm-devel] [PATCH 1/3] libdmmp: fix compilation on newer json-c releases
  2020-10-19 11:20 [dm-devel] [PATCH 0/3] multipath-tools: compilation fixes Anthony Iliopoulos
@ 2020-10-19 11:20 ` Anthony Iliopoulos
  2020-10-19 11:20 ` [dm-devel] [PATCH 2/3] libmultipath: fix compilation on systems without systemd Anthony Iliopoulos
  2020-10-19 11:20 ` [dm-devel] [PATCH 3/3] multipathd: " Anthony Iliopoulos
  2 siblings, 0 replies; 4+ messages in thread
From: Anthony Iliopoulos @ 2020-10-19 11:20 UTC (permalink / raw)
  To: Christophe Varoqui; +Cc: dm-devel

json-c has removed the boolean typedefs since json-c-0.14-20200419
release (upstream commit 0992aac61f8b ("Remove the TRUE and FALSE
defines.").

Replace all occurences of TRUE/FALSE with 1/0 to unbreak compilation,
following the json-c upstream convention.

Signed-off-by: Anthony Iliopoulos <ailiop@suse.com>
---
 libdmmp/libdmmp_private.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libdmmp/libdmmp_private.h b/libdmmp/libdmmp_private.h
index ac85b63f88f3..2940082666a2 100644
--- a/libdmmp/libdmmp_private.h
+++ b/libdmmp/libdmmp_private.h
@@ -82,7 +82,7 @@ static out_type func_name(struct dmmp_context *ctx, const char *var_name) { \
 do { \
 	json_type j_type = json_type_null; \
 	json_object *j_obj_tmp = NULL; \
-	if (json_object_object_get_ex(j_obj, key, &j_obj_tmp) != TRUE) { \
+	if (json_object_object_get_ex(j_obj, key, &j_obj_tmp) != 1) { \
 		_error(ctx, "Invalid JSON output from multipathd IPC: " \
 		       "key '%s' not found", key); \
 		rc = DMMP_ERR_IPC_ERROR; \
@@ -90,7 +90,7 @@ do { \
 	} \
 	if (j_obj_tmp == NULL) { \
 		_error(ctx, "BUG: Got NULL j_obj_tmp from " \
-		       "json_object_object_get_ex() while it return TRUE"); \
+		       "json_object_object_get_ex() while it return 1"); \
 		rc = DMMP_ERR_BUG; \
 		goto out; \
 	} \
-- 
2.28.0


--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [dm-devel] [PATCH 2/3] libmultipath: fix compilation on systems without systemd
  2020-10-19 11:20 [dm-devel] [PATCH 0/3] multipath-tools: compilation fixes Anthony Iliopoulos
  2020-10-19 11:20 ` [dm-devel] [PATCH 1/3] libdmmp: fix compilation on newer json-c releases Anthony Iliopoulos
@ 2020-10-19 11:20 ` Anthony Iliopoulos
  2020-10-19 11:20 ` [dm-devel] [PATCH 3/3] multipathd: " Anthony Iliopoulos
  2 siblings, 0 replies; 4+ messages in thread
From: Anthony Iliopoulos @ 2020-10-19 11:20 UTC (permalink / raw)
  To: Christophe Varoqui; +Cc: dm-devel

Hide set_max_checkint_from_watchdog and its invocation completely behind
ifdefs to avoid breaking compilation on non-systemd environments.
Otherwise gcc bails out due to -Werror since it detects an unused
parameter to the function.

Signed-off-by: Anthony Iliopoulos <ailiop@suse.com>
---
 libmultipath/config.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libmultipath/config.c b/libmultipath/config.c
index b4d87689eab3..658bec8b81c7 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;
-- 
2.28.0


--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [dm-devel] [PATCH 3/3] multipathd: fix compilation on systems without systemd
  2020-10-19 11:20 [dm-devel] [PATCH 0/3] multipath-tools: compilation fixes Anthony Iliopoulos
  2020-10-19 11:20 ` [dm-devel] [PATCH 1/3] libdmmp: fix compilation on newer json-c releases Anthony Iliopoulos
  2020-10-19 11:20 ` [dm-devel] [PATCH 2/3] libmultipath: fix compilation on systems without systemd Anthony Iliopoulos
@ 2020-10-19 11:20 ` Anthony Iliopoulos
  2 siblings, 0 replies; 4+ messages in thread
From: Anthony Iliopoulos @ 2020-10-19 11:20 UTC (permalink / raw)
  To: Christophe Varoqui; +Cc: dm-devel

Hide sd_notify_status as well as a bunch of variables that are specific
to systemd notifications behind ifdefs. This fixes compilation on
non-systemd environments due to -Werror and gcc detecting unused
variables and functions.

Signed-off-by: Anthony Iliopoulos <ailiop@suse.com>
---
 multipathd/main.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/multipathd/main.c b/multipathd/main.c
index 8baf9abe30a6..5dd256284f61 100644
--- a/multipathd/main.c
+++ b/multipathd/main.c
@@ -173,6 +173,7 @@ daemon_status(void)
 	return NULL;
 }
 
+#ifdef USE_SYSTEMD
 /*
  * I love you too, systemd ...
  */
@@ -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();
@@ -2292,10 +2298,12 @@ checkerloop (void *ap)
 	get_monotonic_time(&last_time);
 	last_time.tv_sec -= 1;
 
+#ifdef USE_SYSTEMD
 	/* use_watchdog is set from process environment and never changes */
 	conf = get_multipath_config();
 	use_watchdog = conf->use_watchdog;
 	put_multipath_config(conf);
+#endif
 
 	while (1) {
 		struct timespec diff_time, start_time, end_time;
-- 
2.28.0


--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-10-20  8:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-19 11:20 [dm-devel] [PATCH 0/3] multipath-tools: compilation fixes Anthony Iliopoulos
2020-10-19 11:20 ` [dm-devel] [PATCH 1/3] libdmmp: fix compilation on newer json-c releases Anthony Iliopoulos
2020-10-19 11:20 ` [dm-devel] [PATCH 2/3] libmultipath: fix compilation on systems without systemd Anthony Iliopoulos
2020-10-19 11:20 ` [dm-devel] [PATCH 3/3] multipathd: " Anthony Iliopoulos

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).