diff mbox series

[v2,34/37] libmultipath: print built-in values for deprecated options

Message ID 20230911163846.27197-35-mwilck@suse.com (mailing list archive)
State Not Applicable, archived
Delegated to: christophe varoqui
Headers show
Series multipath-tools: user-friendly names rework | expand

Commit Message

Martin Wilck Sept. 11, 2023, 4:38 p.m. UTC
From: Martin Wilck <mwilck@suse.com>

In the error messages we print when a deprecated option is encountered,
print the compile-time value of the option.

Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 libmultipath/dict.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

Comments

Benjamin Marzinski Sept. 13, 2023, 11:05 p.m. UTC | #1
On Mon, Sep 11, 2023 at 06:38:43PM +0200, mwilck@suse.com wrote:
> From: Martin Wilck <mwilck@suse.com>
> 
> In the error messages we print when a deprecated option is encountered,
> print the compile-time value of the option.
> 
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
> Signed-off-by: Martin Wilck <mwilck@suse.com>
> ---
>  libmultipath/dict.c | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/libmultipath/dict.c b/libmultipath/dict.c
> index f81c84a..dace343 100644
> --- a/libmultipath/dict.c
> +++ b/libmultipath/dict.c
> @@ -314,14 +314,16 @@ def_ ## option ## _handler (struct config *conf, vector strvec,		\
>  static int deprecated_handler(struct config *conf, vector strvec, const char *file,
>  			      int line_nr);
>  
> -#define declare_deprecated_handler(option)				\
> +#define declare_deprecated_handler(option, default)				\
>  static int								\
>  deprecated_ ## option ## _handler (struct config *conf, vector strvec,	\
>  				   const char *file, int line_nr)	\
>  {									\
>  	static bool warned;						\
>  	if (!warned) {							\
> -		condlog(1, "%s line %d: ignoring deprecated option \"" #option "\"", file, line_nr); \
> +		condlog(1, "%s line %d: ignoring deprecated option \""	\
> +			#option "\", using built-in value: \"%s\"",	\
> +			file, line_nr, default);			\
>  		warned = true;						\
>  	}								\
>  	return deprecated_handler(conf, strvec, file, line_nr);		\
> @@ -2057,11 +2059,11 @@ snprint_deprecated (struct config *conf, struct strbuf *buff, const void * data)
>  }
>  
>  // Deprecated keywords
> -declare_deprecated_handler(config_dir)
> -declare_deprecated_handler(disable_changed_wwids)
> -declare_deprecated_handler(getuid_callout)
> -declare_deprecated_handler(multipath_dir)
> -declare_deprecated_handler(pg_timeout)
> +declare_deprecated_handler(config_dir, CONFIG_DIR)
> +declare_deprecated_handler(disable_changed_wwids, "yes")
> +declare_deprecated_handler(getuid_callout, "(not set)")
> +declare_deprecated_handler(multipath_dir, MULTIPATH_DIR)
> +declare_deprecated_handler(pg_timeout, "(not set)")
>  
>  /*
>   * If you add or remove a keyword also update multipath/multipath.conf.5
> -- 
> 2.42.0
--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel
diff mbox series

Patch

diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index f81c84a..dace343 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -314,14 +314,16 @@  def_ ## option ## _handler (struct config *conf, vector strvec,		\
 static int deprecated_handler(struct config *conf, vector strvec, const char *file,
 			      int line_nr);
 
-#define declare_deprecated_handler(option)				\
+#define declare_deprecated_handler(option, default)				\
 static int								\
 deprecated_ ## option ## _handler (struct config *conf, vector strvec,	\
 				   const char *file, int line_nr)	\
 {									\
 	static bool warned;						\
 	if (!warned) {							\
-		condlog(1, "%s line %d: ignoring deprecated option \"" #option "\"", file, line_nr); \
+		condlog(1, "%s line %d: ignoring deprecated option \""	\
+			#option "\", using built-in value: \"%s\"",	\
+			file, line_nr, default);			\
 		warned = true;						\
 	}								\
 	return deprecated_handler(conf, strvec, file, line_nr);		\
@@ -2057,11 +2059,11 @@  snprint_deprecated (struct config *conf, struct strbuf *buff, const void * data)
 }
 
 // Deprecated keywords
-declare_deprecated_handler(config_dir)
-declare_deprecated_handler(disable_changed_wwids)
-declare_deprecated_handler(getuid_callout)
-declare_deprecated_handler(multipath_dir)
-declare_deprecated_handler(pg_timeout)
+declare_deprecated_handler(config_dir, CONFIG_DIR)
+declare_deprecated_handler(disable_changed_wwids, "yes")
+declare_deprecated_handler(getuid_callout, "(not set)")
+declare_deprecated_handler(multipath_dir, MULTIPATH_DIR)
+declare_deprecated_handler(pg_timeout, "(not set)")
 
 /*
  * If you add or remove a keyword also update multipath/multipath.conf.5