From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:54575) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RLGsw-0001qy-15 for qemu-devel@nongnu.org; Tue, 01 Nov 2011 12:08:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RLGsu-0004jU-J0 for qemu-devel@nongnu.org; Tue, 01 Nov 2011 12:08:21 -0400 Received: from smtp02.citrix.com ([66.165.176.63]:23018) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RLGsu-0004j5-7m for qemu-devel@nongnu.org; Tue, 01 Nov 2011 12:08:20 -0400 From: Anthony PERARD Date: Tue, 1 Nov 2011 16:07:19 +0000 Message-ID: <1320163646-24291-7-git-send-email-anthony.perard@citrix.com> In-Reply-To: <1320163646-24291-1-git-send-email-anthony.perard@citrix.com> References: <1320163646-24291-1-git-send-email-anthony.perard@citrix.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH V3 06/13] libxl_qmp: Introduce list of arguments to qmp_send List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: QEMU-devel , Stefano Stabellini Cc: Anthony PERARD , Xen Devel Signed-off-by: Anthony PERARD Acked-by: Ian Campbell --- tools/libxl/libxl_qmp.c | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-) diff --git a/tools/libxl/libxl_qmp.c b/tools/libxl/libxl_qmp.c index ddc0a4d..43c7d04 100644 --- a/tools/libxl/libxl_qmp.c +++ b/tools/libxl/libxl_qmp.c @@ -72,7 +72,7 @@ struct libxl__qmp_handler { }; static int qmp_send(libxl__qmp_handler *qmp, - const char *cmd, + const char *cmd, libxl_key_value_list *args, qmp_callback_t callback, void *opaque); static const int QMP_SOCKET_CONNECT_TIMEOUT = 5; @@ -161,7 +161,8 @@ static int qmp_capabilities_callback(libxl__qmp_handler *qmp, static int enable_qmp_capabilities(libxl__qmp_handler *qmp) { - return qmp_send(qmp, "qmp_capabilities", qmp_capabilities_callback, NULL); + return qmp_send(qmp, "qmp_capabilities", NULL, + qmp_capabilities_callback, NULL); } /* @@ -429,7 +430,7 @@ static int qmp_next(libxl__gc *gc, libxl__qmp_handler *qmp) } static int qmp_send(libxl__qmp_handler *qmp, - const char *cmd, + const char *cmd, libxl_key_value_list *args, qmp_callback_t callback, void *opaque) { yajl_gen_config conf = { 0, NULL }; @@ -448,6 +449,10 @@ static int qmp_send(libxl__qmp_handler *qmp, libxl__yajl_gen_asciiz(hand, cmd); libxl__yajl_gen_asciiz(hand, "id"); yajl_gen_integer(hand, ++qmp->last_id_used); + if (args) { + libxl__yajl_gen_asciiz(hand, "arguments"); + libxl_key_value_list_gen_json(hand, args); + } yajl_gen_map_close(hand); s = yajl_gen_get_buf(hand, &buf, &len); @@ -491,6 +496,7 @@ error: } static int qmp_synchronous_send(libxl__qmp_handler *qmp, const char *cmd, + libxl_key_value_list *args, qmp_callback_t callback, void *opaque, int ask_timeout) { @@ -498,7 +504,7 @@ static int qmp_synchronous_send(libxl__qmp_handler *qmp, const char *cmd, int ret = 0; libxl__gc gc = LIBXL_INIT_GC(qmp->ctx); - id = qmp_send(qmp, cmd, callback, opaque); + id = qmp_send(qmp, cmd, args, callback, opaque); if (id <= 0) { return -1; } @@ -586,7 +592,7 @@ void libxl__qmp_cleanup(libxl__gc *gc, uint32_t domid) int libxl__qmp_query_serial(libxl__qmp_handler *qmp) { - return qmp_synchronous_send(qmp, "query-chardev", + return qmp_synchronous_send(qmp, "query-chardev", NULL, register_serials_chardev_callback, NULL, qmp->timeout); } -- Anthony PERARD