Re: [Qemu-block] [Qemu-devel] [PATCH v2 05/11] monitor: Move cmd_table to MonitorHMP

2019-06-12 Thread Kevin Wolf
Am 12.06.2019 um 13:45 hat Markus Armbruster geschrieben:
> Kevin Wolf  writes:
> 
> > Monitor.cmd_table contains the handlers for HMP commands, so there is no
> > reason to keep it in the state shared with QMP. Move it to MonitorHMP.
> >
> > Signed-off-by: Kevin Wolf 
> > Reviewed-by: Dr. David Alan Gilbert 
> > ---
> >  monitor.c | 23 +++
> >  1 file changed, 15 insertions(+), 8 deletions(-)
> >
> > diff --git a/monitor.c b/monitor.c
> > index f8730e4462..56af8ed448 100644
> > --- a/monitor.c
> > +++ b/monitor.c
> > @@ -191,7 +191,6 @@ struct Monitor {
> >  bool use_io_thread;
> >  
> >  gchar *mon_cpu_path;
> > -mon_cmd_t *cmd_table;
> >  QTAILQ_ENTRY(Monitor) entry;
> >  
> >  /*
> > @@ -219,6 +218,7 @@ struct MonitorHMP {
> >   * These members can be safely accessed without locks.
> >   */
> >  ReadLineState *rs;
> > +mon_cmd_t *cmd_table;
> >  };
> >  
> >  typedef struct {
> > @@ -720,13 +720,19 @@ static void monitor_data_init(Monitor *mon, int 
> > flags, bool skip_flush,
> >  memset(mon, 0, sizeof(Monitor));
> >  qemu_mutex_init(>mon_lock);
> >  mon->outbuf = qstring_new();
> > -/* Use *mon_cmds by default. */
> > -mon->cmd_table = mon_cmds;
> 
> As far as I can tell, this is the only assignment to Monitor member
> cmd_table.  Why not delete it outright, and use mon_cmds directly?
> Preferably renamed to something like hmp_cmds.

Good idea, I'll do that.

Kevin



Re: [Qemu-block] [Qemu-devel] [PATCH v2 05/11] monitor: Move cmd_table to MonitorHMP

2019-06-12 Thread Markus Armbruster
Kevin Wolf  writes:

> Monitor.cmd_table contains the handlers for HMP commands, so there is no
> reason to keep it in the state shared with QMP. Move it to MonitorHMP.
>
> Signed-off-by: Kevin Wolf 
> Reviewed-by: Dr. David Alan Gilbert 
> ---
>  monitor.c | 23 +++
>  1 file changed, 15 insertions(+), 8 deletions(-)
>
> diff --git a/monitor.c b/monitor.c
> index f8730e4462..56af8ed448 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -191,7 +191,6 @@ struct Monitor {
>  bool use_io_thread;
>  
>  gchar *mon_cpu_path;
> -mon_cmd_t *cmd_table;
>  QTAILQ_ENTRY(Monitor) entry;
>  
>  /*
> @@ -219,6 +218,7 @@ struct MonitorHMP {
>   * These members can be safely accessed without locks.
>   */
>  ReadLineState *rs;
> +mon_cmd_t *cmd_table;
>  };
>  
>  typedef struct {
> @@ -720,13 +720,19 @@ static void monitor_data_init(Monitor *mon, int flags, 
> bool skip_flush,
>  memset(mon, 0, sizeof(Monitor));
>  qemu_mutex_init(>mon_lock);
>  mon->outbuf = qstring_new();
> -/* Use *mon_cmds by default. */
> -mon->cmd_table = mon_cmds;

As far as I can tell, this is the only assignment to Monitor member
cmd_table.  Why not delete it outright, and use mon_cmds directly?
Preferably renamed to something like hmp_cmds.

[...]