Re: [PATCH v2 08/11] libmultipath: warn only once about deprecated options

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 18, 2022 at 5:33 PM <mwilck@xxxxxxxx> wrote:
>
> From: Martin Wilck <mwilck@xxxxxxxx>
>
> Signed-off-by: Martin Wilck <mwilck@xxxxxxxx>

Reviewed-by: Benjamin Marzinski <bmarzins@xxxxxxxxxx>

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

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




[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux