Re: [PATCH v2 13/24] dyndbg: combine flags & mask into a struct, use that
From: Petr Mladek
Date: Mon Jun 15 2020 - 11:14:18 EST
On Sat 2020-06-13 09:57:27, Jim Cromie wrote:
> combine flags & mask into a struct, and replace those 2 parameters in
> 3 functions: ddebug_change, ddebug_parse_flags, ddebug_read_flags,
> altering the derefs in them accordingly.
>
> This simplifies the 3 function sigs, preparing for more changes.
> We dont yet need mask from ddebug_read_flags, but will soon.
> ---
> lib/dynamic_debug.c | 46 +++++++++++++++++++++++----------------------
> 1 file changed, 24 insertions(+), 22 deletions(-)
>
> diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
> index 93c627e9c094..8dc073a6e8a4 100644
> --- a/lib/dynamic_debug.c
> +++ b/lib/dynamic_debug.c
> @@ -62,6 +62,11 @@ struct ddebug_iter {
> unsigned int idx;
> };
>
> +struct flagsettings {
Please. use underscore to help with parsing such a long names.
I mean use: flags_settings.
> + unsigned int flags;
> + unsigned int mask;
> +};
static int ddebug_change(const struct ddebug_query *query,
> - unsigned int pflags, unsigned int mask)
> + struct flagsettings *mods)
> -static int ddebug_read_flags(const char *str, unsigned int *flags)
> +static int ddebug_read_flags(const char *str, struct flagsettings *f)
> -static int ddebug_parse_flags(const char *str, unsigned int *flagsp,
> - unsigned int *maskp)
> +static int ddebug_parse_flags(const char *str, struct flagsettings *mods)
What "mods" stands for, please?
I have to say that using a parameter called "mods" in a function
called parse_flags() is inconsistent and confusing.
Best Regards,
Petr