On Tue, Dec 05, 2017 at 01:51:40PM +0800, Peter Xu wrote:
> In monitor_qmp_read(), we have the hack to temporarily replace the
> cur_mon pointer.  Now we move this hack deeper inside the QMP dispatcher
> routine since the Monitor pointer can be passed in to that using the new
> JSON Parser opaque field now.
> 
> This does not make much sense as a single patch.  However, this will be
> a big step for the next patch, when the QMP dispatcher routine will be
> split from the QMP parser.
> 
> Reviewed-by: Eric Blake <ebl...@redhat.com>
> Reviewed-by: Fam Zheng <f...@redhat.com>
> Signed-off-by: Peter Xu <pet...@redhat.com>
> ---
>  monitor.c | 19 ++++++++++---------
>  1 file changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/monitor.c b/monitor.c
> index ab80d32c70..322dfb5f31 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -3813,7 +3813,7 @@ static void handle_qmp_command(JSONMessageParser 
> *parser, GQueue *tokens,
>  {
>      QObject *req, *rsp = NULL, *id = NULL;
>      QDict *qdict = NULL;
> -    Monitor *mon = cur_mon;
> +    Monitor *mon = opaque, *old_mon;

Or without the new opaque argument:

MonitorQMP *mon_qmp = container_of(parser, MonitorQMP, parser);
Monitor *mon = container_of(mon_qmp, Monitor, qmp);

Attachment: signature.asc
Description: PGP signature

Reply via email to