[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v5 13/15] libxl_qmp: Store advertised QEMU version in libxl__ev_qmp
Anthony PERARD writes ("[PATCH v5 13/15] libxl_qmp: Store advertised QEMU version in libxl__ev_qmp"): > This will be used in a later patch. ... > + /* read-only when Connected */ > + struct { > + int major; > + int minor; > + int micro; > + } qemu_version; This should surely say `and not to be accessed by the caller the rest of the time' ? > diff --git a/tools/libxl/libxl_qmp.c b/tools/libxl/libxl_qmp.c > index 90308b1598..77380a869c 100644 > --- a/tools/libxl/libxl_qmp.c > +++ b/tools/libxl/libxl_qmp.c > @@ -1440,12 +1440,28 @@ static int qmp_ev_handle_message(libxl__egc *egc, > const libxl__json_object *resp) > { > EGC_GC; > + const libxl__json_object *o; > libxl__qmp_message_type type = qmp_response_type(resp); > > switch (type) { > case LIBXL__QMP_MESSAGE_TYPE_QMP: > /* greeting message */ > assert(ev->qmp_state == qmp_state_connecting); > + > + /* Store advertised QEMU version */ > + o = libxl__json_map_get("QMP", resp, JSON_MAP); > + o = libxl__json_map_get("version", o, JSON_MAP); > + o = libxl__json_map_get("qemu", o, JSON_MAP); > + ev->qemu_version.major = libxl__json_object_get_integer( > + libxl__json_map_get("major", o, JSON_INTEGER)); > + ev->qemu_version.minor = libxl__json_object_get_integer( > + libxl__json_map_get("minor", o, JSON_INTEGER)); > + ev->qemu_version.micro = libxl__json_object_get_integer( > + libxl__json_map_get("micro", o, JSON_INTEGER)); This is quite repetitive. Can we have a macro or a loop or something ? Maybe a macro so we can have #define FISH_VSN(thing) ... FISH_VSN(major); FISH_VSN(minor); FISH_VSN(micro); #undef FISH_VSN or whatever you want to call it. Ian. _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |