From patchwork Mon Dec 6 18:24:04 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 74448 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 397E7B708B for ; Tue, 7 Dec 2010 05:44:50 +1100 (EST) Received: from localhost ([127.0.0.1]:41717 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PPg3L-0004Yr-J1 for incoming@patchwork.ozlabs.org; Mon, 06 Dec 2010 13:44:47 -0500 Received: from [140.186.70.92] (port=36069 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PPfk1-0003Gl-Lz for qemu-devel@nongnu.org; Mon, 06 Dec 2010 13:24:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PPfk0-0004EG-K4 for qemu-devel@nongnu.org; Mon, 06 Dec 2010 13:24:49 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50242) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PPfk0-0004Dw-CC for qemu-devel@nongnu.org; Mon, 06 Dec 2010 13:24:48 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oB6IOlA4008028 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 6 Dec 2010 13:24:47 -0500 Received: from localhost ([10.3.113.17]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oB6IOkNK009696; Mon, 6 Dec 2010 13:24:46 -0500 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Mon, 6 Dec 2010 16:24:04 -0200 Message-Id: <1291659852-23028-18-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1291659852-23028-1-git-send-email-lcapitulino@redhat.com> References: <1291659852-23028-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: aliguori@us.ibm.com, armbru@redhat.com Subject: [Qemu-devel] [PATCH 17/25] Monitor: Convert do_info_vnc_print() into do_info_vnc() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The new handler directly calls qmp_query_vnc() to gather data and then prints it. This change allows us to drop the user_print callback. Signed-off-by: Luiz Capitulino --- console.h | 2 +- monitor.c | 3 +-- ui/vnc.c | 9 +++++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/console.h b/console.h index 232714b..c72f612 100644 --- a/console.h +++ b/console.h @@ -369,7 +369,7 @@ void vnc_display_init(DisplayState *ds); void vnc_display_close(DisplayState *ds); int vnc_display_open(DisplayState *ds, const char *display); int vnc_display_password(DisplayState *ds, const char *password); -void do_info_vnc_print(Monitor *mon, const QObject *data); +void do_info_vnc(Monitor *mon); void qmp_query_vnc(Monitor *mon, QObject **ret_data); char *vnc_display_local_addr(DisplayState *ds); diff --git a/monitor.c b/monitor.c index 3b86076..59b3866 100644 --- a/monitor.c +++ b/monitor.c @@ -2567,8 +2567,7 @@ static const mon_cmd_t info_cmds[] = { .args_type = "", .params = "", .help = "show the vnc server status", - .user_print = do_info_vnc_print, - .mhandler.info_new = qmp_query_vnc, + .mhandler.info = do_info_vnc, }, { .name = "name", diff --git a/ui/vnc.c b/ui/vnc.c index 4674f5e..51f6db4 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -302,15 +302,17 @@ static void info_vnc_iter(QObject *obj, void *opaque) #endif } -void do_info_vnc_print(Monitor *mon, const QObject *data) +void do_info_vnc(Monitor *mon) { QDict *server; QList *clients; + QObject *data; + qmp_query_vnc(NULL, &data); server = qobject_to_qdict(data); if (qdict_get_bool(server, "enabled") == 0) { monitor_printf(mon, "Server: disabled\n"); - return; + goto out; } monitor_printf(mon, "Server:\n"); @@ -325,6 +327,9 @@ void do_info_vnc_print(Monitor *mon, const QObject *data) } else { qlist_iter(clients, info_vnc_iter, mon); } + +out: + qobject_decref(data); } void qmp_query_vnc(Monitor *mon, QObject **ret_data)