qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC v5 14/26] monitor: introduce monitor_qmp_respond()


From: Peter Xu
Subject: Re: [Qemu-devel] [RFC v5 14/26] monitor: introduce monitor_qmp_respond()
Date: Sat, 16 Dec 2017 13:52:54 +0800
User-agent: Mutt/1.9.1 (2017-09-22)

On Wed, Dec 13, 2017 at 05:35:33PM +0000, Stefan Hajnoczi wrote:
> On Tue, Dec 05, 2017 at 01:51:48PM +0800, Peter Xu wrote:
> > A tiny refactoring, preparing to split the QMP dispatcher away.
> > 
> > Reviewed-by: Fam Zheng <address@hidden>
> > Signed-off-by: Peter Xu <address@hidden>
> > ---
> >  monitor.c | 48 +++++++++++++++++++++++++++++++-----------------
> >  1 file changed, 31 insertions(+), 17 deletions(-)
> > 
> > diff --git a/monitor.c b/monitor.c
> > index 9666115259..35d8925636 100644
> > --- a/monitor.c
> > +++ b/monitor.c
> > @@ -3877,6 +3877,36 @@ static int monitor_can_read(void *opaque)
> >      return (mon->suspend_cnt == 0) ? 1 : 0;
> >  }
> >  
> > +/*
> > + * When rsp/err/id is passed in, the function will be responsible for
> > + * the cleanup.
> > + */
> 
> Please document this function fully.  I had to look at the
> implementation to learn how the arguments work:
> 
> 1. This function takes ownership of rsp, err, and id.  (Please use this
> exact wording because the function does not perform the "cleanup" when
> refcount > 1.)
> 2. rsp, err, and id may be NULL.
> 3. If err != NULL then rsp must be NULL.

Will steal the lines.  Thanks!

Also, I'll add an assert() to make sure (3) is true, in case any rsp
refcount is leaked when accidentally provided with err.

-- 
Peter Xu



reply via email to

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