[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 2/6] libxl: add libxl__qmp_run_command_flexarray() function
On Thu, Sep 08, 2016 at 09:20:22AM +0200, Juergen Gross wrote: > Add a function libxl__qmp_run_command_flexarray() to run a qmp command > with an array of arguments. The arguments are name-value pairs stored > in a flexarray. > > Signed-off-by: Juergen Gross <jgross@xxxxxxxx> Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx> > --- > tools/libxl/libxl_internal.h | 3 +++ > tools/libxl/libxl_qmp.c | 16 ++++++++++++++++ > 2 files changed, 19 insertions(+) > > diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h > index 3f29aa6..ecbfdad 100644 > --- a/tools/libxl/libxl_internal.h > +++ b/tools/libxl/libxl_internal.h > @@ -1753,6 +1753,9 @@ typedef struct libxl__qmp_handler libxl__qmp_handler; > */ > _hidden libxl__qmp_handler *libxl__qmp_initialize(libxl__gc *gc, > uint32_t domid); > +_hidden int libxl__qmp_run_command_flexarray(libxl__gc *gc, int domid, > + const char *cmd, > + flexarray_t *array); > /* ask to QEMU the serial port information and store it in xenstore. */ > _hidden int libxl__qmp_query_serial(libxl__qmp_handler *qmp); > _hidden int libxl__qmp_pci_add(libxl__gc *gc, int d, libxl_device_pci > *pcidev); > diff --git a/tools/libxl/libxl_qmp.c b/tools/libxl/libxl_qmp.c > index 0d8d5f4..f8addf9 100644 > --- a/tools/libxl/libxl_qmp.c > +++ b/tools/libxl/libxl_qmp.c > @@ -827,6 +827,22 @@ static int qmp_run_command(libxl__gc *gc, int domid, > return rc; > } > > +int libxl__qmp_run_command_flexarray(libxl__gc *gc, int domid, > + const char *cmd, flexarray_t *array) > +{ > + libxl__json_object *args = NULL; > + int i; > + void *name, *value; > + > + for (i = 0; i < array->count; i += 2) { > + flexarray_get(array, i, &name); > + flexarray_get(array, i + 1, &value); > + qmp_parameters_add_string(gc, &args, (char *)name, (char *)value); > + } > + > + return qmp_run_command(gc, domid, cmd, args, NULL, NULL); > +} > + > int libxl__qmp_pci_add(libxl__gc *gc, int domid, libxl_device_pci *pcidev) > { > libxl__qmp_handler *qmp = NULL; > -- > 2.6.6 > _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |