Re: [PATCH v4 3/4] kdb: Simplify kdb_defcmd macro logic

From: Sumit Garg
Date: Mon Jul 12 2021 - 03:53:13 EST


On Sat, 10 Jul 2021 at 03:07, Doug Anderson <dianders@xxxxxxxxxxxx> wrote:
>
> Hi,
>
> On Fri, Jul 9, 2021 at 3:43 AM Sumit Garg <sumit.garg@xxxxxxxxxx> wrote:
> >
> > Switch to use a linked list instead of dynamic array which makes
> > allocation of kdb macro and traversing the kdb macro commands list
> > simpler.
> >
> > Suggested-by: Daniel Thompson <daniel.thompson@xxxxxxxxxx>
> > Signed-off-by: Sumit Garg <sumit.garg@xxxxxxxxxx>
> > ---
> > kernel/debug/kdb/kdb_main.c | 107 +++++++++++++++++++-----------------
> > 1 file changed, 58 insertions(+), 49 deletions(-)
> >
> > diff --git a/kernel/debug/kdb/kdb_main.c b/kernel/debug/kdb/kdb_main.c
> > index 6d9ff4048e7d..371983c03223 100644
> > --- a/kernel/debug/kdb/kdb_main.c
> > +++ b/kernel/debug/kdb/kdb_main.c
> > @@ -654,13 +654,16 @@ static void kdb_cmderror(int diag)
> > * zero for success, a kdb diagnostic if error
> > */
> > struct kdb_macro_t {
> > - int count;
> > - bool usable;
> > - kdbtab_t cmd;
> > - char **command;
> > + kdbtab_t cmd; /* Macro command */
> > + struct list_head statements; /* Associated statement list */
> > };
> > +
> > +struct kdb_macro_statement_t {
> > + char *statement; /* Statement name */
>
> This is still not really the name. This is the actual statement,
> right? Like it might contain "ftdump -1", right? It seems really weird
> to call that the "name". You could drop the word "name", or change
> this to "Statement text", or just totally drop the comment.
>

Let me use "Statement text" instead.

> Other than that this looks good to me.
>
> Reviewed-by: Douglas Anderson <dianders@xxxxxxxxxxxx>

Thanks,
-Sumit