multipath-tools: compilation fixes
cover multipath-tools: compilation fixes
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
[email protected]
https://www.redhat.com/mailman/listinfo/dm-devel
PATCH 1/3 libdmmp: fix compilation on newer json-c releases
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.
--- libdmmp/libdmmp_private.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
libdmmp/libdmmp_private.h +2 -2
@@ -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; \ } \
Signature · 7 lines
2.28.0 -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel
PATCH 2/3 libmultipath: fix compilation on systems without systemd
In reply to Anthony IliopoulosHide 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.
--- libmultipath/config.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
libmultipath/config.c +4 -2
@@ -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 ;
Signature · 7 lines
2.28.0 -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel
PATCH 3/3 multipathd: fix compilation on systems without systemd
In reply to Anthony IliopoulosHide 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.
--- multipathd/main.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
multipathd/main.c +9 -1
@@ -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;
Signature · 7 lines
2.28.0 -- dm-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/dm-devel