On Fri, 2010-02-26 at 17:26 -0300, Luiz Capitulino wrote:
>  This patch fixes both. One question, though:
> 
> > @@ -2332,6 +2331,7 @@ static int do_balloon(Monitor *mon, const QDict 
> > *params,
> >          return -1;
> >      }
> >  
> > +    cb(opaque, NULL);
> >      return 0;
> >  }
> 
>  Can't (or shouldn't) this be called by common code upon handler
> completion?

The explicit cb() call is only needed for synchronous commands that want
to use this API.  For asynchronous commands, the top-half (ie.
do_info_balloon) returns right away and the callback is called when the
asynchronous command completes (in hw/virtio-balloon.c).  Since
do_balloon() is completely finished when it returns, it has to manually
call cb().

If we decide to merge all commands into this new API in the future, then
we could have common code call the cb() for all synchronous commands.
For now, I just implemented do_balloon() this way as a proof of concept
to show that synchronous commands can use the API. 

-- 
Thanks,
Adam



Reply via email to