qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 06/12] monitor: remove mhandler.cmd_new


From: Marc-André Lureau
Subject: Re: [Qemu-devel] [PATCH v2 06/12] monitor: remove mhandler.cmd_new
Date: Fri, 5 Aug 2016 09:00:30 -0400 (EDT)

Hi

----- Original Message -----
> address@hidden writes:
> 
> > From: Marc-André Lureau <address@hidden>
> >
> > This is no longer necessary, now that middle mode has been removed.
> 
> Well, middle mode hasn't been removed just yet, only its use.  Perhaps:
> 
>     This is no longer necessary now that we aren't using middle mode
>     anymore.

ok

> 
> > Signed-off-by: Marc-André Lureau <address@hidden>
> > ---
> >  monitor.c                     |  13 +--
> >  docs/writing-qmp-commands.txt |   8 +-
> >  hmp-commands-info.hx          | 118 ++++++++++++------------
> >  hmp-commands.hx               | 208
> >  +++++++++++++++++++++---------------------
> >  4 files changed, 170 insertions(+), 177 deletions(-)
> >
> > diff --git a/monitor.c b/monitor.c
> > index 5bbe4bb..642be2e 100644
> > --- a/monitor.c
> > +++ b/monitor.c
> > @@ -130,13 +130,10 @@ typedef struct mon_cmd_t {
> >      const char *args_type;
> >      const char *params;
> >      const char *help;
> > -    union {
> > -        void (*cmd)(Monitor *mon, const QDict *qdict);
> > -        void (*cmd_new)(QDict *params, QObject **ret_data, Error **errp);
> > -    } mhandler;
> > -    /* @sub_table is a list of 2nd level of commands. If it do not exist,
> > -     * mhandler should be used. If it exist, sub_table[?].mhandler should
> > be
> > -     * used, and mhandler of 1st level plays the role of help function.
> > +    void (*cmd)(Monitor *mon, const QDict *qdict);
> > +    /* @sub_table is a list of 2nd level of commands. If it does not
> > exist,
> > +     * cmd should be used. If it exists, sub_table[?].cmd should be
> > +     * used, and cmd of 1st level plays the role of help function.
> >       */
> >      struct mon_cmd_t *sub_table;
> >      void (*command_completion)(ReadLineState *rs, int nb_args, const char
> >      *str);
> > @@ -2960,7 +2957,7 @@ static void handle_hmp_command(Monitor *mon, const
> > char *cmdline)
> >          return;
> >      }
> >  
> > -    cmd->mhandler.cmd(mon, qdict);
> > +    cmd->cmd(mon, qdict);
> >      QDECREF(qdict);
> >  }
> >  
> > diff --git a/docs/writing-qmp-commands.txt b/docs/writing-qmp-commands.txt
> > index 59aa77a..6208715 100644
> > --- a/docs/writing-qmp-commands.txt
> > +++ b/docs/writing-qmp-commands.txt
> > @@ -127,7 +127,6 @@ following at the bottom:
> >      {
> >          .name       = "hello-world",
> >          .args_type  = "",
> > -        .mhandler.cmd_new = qmp_marshal_hello_world,
> >      },
> >  
> 
> Uh, doesn't this belong to the previous commit?
> 
> >  You're done. Now build qemu, run it as suggested in the "Testing" section,
> > @@ -179,7 +178,6 @@ The last step is to update the qmp-commands.hx file:
> >      {
> >          .name       = "hello-world",
> >          .args_type  = "message:s?",
> > -        .mhandler.cmd_new = qmp_marshal_hello_world,
> >      },
> >  
> 
> Likewise.
> 
> >  Notice that the "args_type" member got our "message" argument. The
> >  character
> > @@ -337,7 +335,7 @@ we should add it to the hmp-commands.hx file:
> >          .args_type  = "message:s?",
> >          .params     = "hello-world [message]",
> >          .help       = "Print message to the standard output",
> > -        .mhandler.cmd = hmp_hello_world,
> > +        .cmd        = hmp_hello_world,
> >      },
> >  
> >  STEXI
> > @@ -459,7 +457,6 @@ The last step is to add the correspoding entry in the
> > qmp-commands.hx file:
> >      {
> >          .name       = "query-alarm-clock",
> >          .args_type  = "",
> > -        .mhandler.cmd_new = qmp_marshal_query_alarm_clock,
> >      },
> 
> Likewise.
> 
> >  
> >  Time to test the new command. Build qemu, run it as described in the
> >  "Testing"
> > @@ -518,7 +515,7 @@ in the monitor.c file. The entry for the "info
> > alarmclock" follows:
> >          .args_type  = "",
> >          .params     = "",
> >          .help       = "show information about the alarm clock",
> > -        .mhandler.info = hmp_info_alarm_clock,
> > +        .cmd        = hmp_info_alarm_clock,
> >      },
> >  
> >  To test this, run qemu and type "info alarmclock" in the user monitor.
> > @@ -605,7 +602,6 @@ To test this you have to add the corresponding
> > qmp-commands.hx entry:
> >      {
> >          .name       = "query-alarm-methods",
> >          .args_type  = "",
> > -        .mhandler.cmd_new = qmp_marshal_query_alarm_methods,
> >      },
> >  
> 
> Likewise.


Ok those are from the documentation and can be moved to previous commit.

> 
> >  Now Build qemu, run it as explained in the "Testing" section and try our
> >  new
> > diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
> > index 74446c6..19729e5 100644
> > --- a/hmp-commands-info.hx
> > +++ b/hmp-commands-info.hx
> > @@ -18,7 +18,7 @@ ETEXI
> >          .args_type  = "",
> >          .params     = "",
> >          .help       = "show the version of QEMU",
> > -        .mhandler.cmd = hmp_info_version,
> > +        .cmd        = hmp_info_version,
> >      },
> >  
> >  STEXI
> [More of the same snipped...]

However those belong with this commit (I am not sure if you meant that they 
should also be moved)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]