[dm-devel] [PATCH v2 08/11] libmultipath: warn only once about deprecated options
mwilck at suse.com
mwilck at suse.com
Fri Mar 18 22:33:36 UTC 2022
From: Martin Wilck <mwilck at suse.com>
Signed-off-by: Martin Wilck <mwilck at suse.com>
---
libmultipath/dict.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/libmultipath/dict.c b/libmultipath/dict.c
index 2af9764..26cbe78 100644
--- a/libmultipath/dict.c
+++ b/libmultipath/dict.c
@@ -279,7 +279,11 @@ static int \
def_ ## option ## _handler (struct config *conf, vector strvec, \
const char *file, int line_nr) \
{ \
- condlog(2, "%s line %d, \"" #option "\" is deprecated and will be disabled in a future release", file, line_nr); \
+ static bool warned; \
+ if (!warned) { \
+ condlog(2, "%s line %d, \"" #option "\" is deprecated and will be disabled in a future release", file, line_nr); \
+ warned = true; \
+ } \
return function (strvec, &conf->option, file, line_nr); \
}
@@ -829,14 +833,19 @@ static int
def_config_dir_handler(struct config *conf, vector strvec, const char *file,
int line_nr)
{
+ static bool warned;
+
/* this is only valid in the main config file */
if (conf->processed_main_config) {
condlog(1, "%s line %d, config_dir option only valid in /etc/multipath.conf",
file, line_nr);
return 0;
}
- condlog(2, "%s line %d, \"config_dir\" is deprecated and will be disabled in a future release",
- file, line_nr);
+ if (!warned) {
+ condlog(2, "%s line %d, \"config_dir\" is deprecated and will be disabled in a future release",
+ file, line_nr);
+ warned = true;
+ }
return set_path(strvec, &conf->config_dir, file, line_nr);
}
declare_def_snprint(config_dir, print_str)
--
2.35.1
More information about the dm-devel
mailing list