[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] libxl: add libxl__qmp_run_command_flexarray() function
commit 9f1f7e4642f263f4e05f872aa0417b2d840e14c4 Author: Juergen Gross <jgross@xxxxxxxx> AuthorDate: Thu Sep 8 09:20:22 2016 +0200 Commit: Wei Liu <wei.liu2@xxxxxxxxxx> CommitDate: Mon Sep 12 10:17:10 2016 +0100 libxl: add libxl__qmp_run_command_flexarray() function 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 ce8e17a..01aabad 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1772,6 +1772,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 63c49c5..f6748e6 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; -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |