Re: [PATCH v2 13/24] dyndbg: combine flags & mask into a struct, use that
From: jim . cromie
Date: Tue Jun 16 2020 - 01:48:01 EST
On Mon, Jun 15, 2020 at 9:14 AM Petr Mladek <pmladek@xxxxxxxx> wrote:
>
> 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.
>
ok
> > + 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?
>
modifying_flags, or modifiers.
the original flags & mask bundled together
ie the pfmlt in
echo +pfmlt > control
> I have to say that using a parameter called "mods" in a function
> called parse_flags() is inconsistent and confusing.
>
does the above help ?
I could go with modifying_flags
keep in mind the name has to suit all + - = operations
I'll review all the new names. I recall you didnt like filterflags either,
so I wasnt sufficently clear there either.
Im mulling a better explanation.
> Best Regards,
> Petr