WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH 5/7] libxl_qmp, Return the callback return code i

On Fri, 2011-10-07 at 16:23 +0100, Anthony PERARD wrote:
> >> @@ -416,7 +418,7 @@ static int qmp_next(libxl__gc *gc,
> libxl__qmp_handler *qmp)
> >>                  s = end + 2;
> >>
> >>                  if (o) {
> >> -                    qmp_handle_response(qmp, o);
> >> +                    rc = qmp_handle_response(qmp, o);
> >
> > If rc now indicates error do we need to bail straight away or need
> to
> > keep going around this loop? (Or is it certain we will immediately
> fall
> > out of the loop after this?)
> 
> We can not be sure that we will return, because it could be another
> message in the butffer. So I should return if there is a protocol
> error. But I think that I should keep seperate the return code of a
> callback, so only the interested function (qmp_synchronous_send) will
> read it (and return to the caller).

I think this means the caller cannot tell which request or how many
errors have occurred in total.

I think that the callbacks should take a success/error code. If that
particular function is interested in propagating the error then they can
save it in their opaque data pointer to be retrieved by the caller of
the sync_send.

Another alternative could be to add an rc member to callback_id_pair
(making it more of a qmp request handle than an callback/id pair) and
push the allocation/free of that datastructure back up into the caller
of qmp_send (perhaps many callers of sync_send would just use an on
stack variable). Callers could then check the result of a specific
request by looking at that new member.

Ian.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>