From patchwork Fri Sep 30 20:34:48 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 117208 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 94C6DB6F7E for ; Sat, 1 Oct 2011 06:48:03 +1000 (EST) Received: from localhost ([::1]:57665 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R9jou-0001fM-EV for incoming@patchwork.ozlabs.org; Fri, 30 Sep 2011 16:36:32 -0400 Received: from eggs.gnu.org ([140.186.70.92]:60380) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R9jo9-00006H-Fv for qemu-devel@nongnu.org; Fri, 30 Sep 2011 16:35:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R9jo4-0008GN-Jc for qemu-devel@nongnu.org; Fri, 30 Sep 2011 16:35:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:17824) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R9jo4-0008Fx-Bl for qemu-devel@nongnu.org; Fri, 30 Sep 2011 16:35:40 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p8UKZYfK010707 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 30 Sep 2011 16:35:34 -0400 Received: from localhost (ovpn-113-111.phx2.redhat.com [10.3.113.111]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p8UKZXrp028778; Fri, 30 Sep 2011 16:35:34 -0400 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Fri, 30 Sep 2011 17:34:48 -0300 Message-Id: <1317414891-4042-24-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1317414891-4042-1-git-send-email-lcapitulino@redhat.com> References: <1317414891-4042-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, aliguori@us.ibm.com, mdroth@linux.vnet.ibm.com, armbru@redhat.com Subject: [Qemu-devel] [PATCH 23/26] qapi: Convert quit X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Anthony Liguori Signed-off-by: Luiz Capitulino --- hmp-commands.hx | 2 +- hmp.c | 6 ++++++ hmp.h | 1 + monitor.c | 12 ------------ qapi-schema.json | 11 +++++++++++ qmp-commands.hx | 5 +---- qmp.c | 6 ++++++ 7 files changed, 26 insertions(+), 17 deletions(-) diff --git a/hmp-commands.hx b/hmp-commands.hx index 9e1cca8..2163e6f 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -43,7 +43,7 @@ ETEXI .params = "", .help = "quit the emulator", .user_print = monitor_user_noop, - .mhandler.cmd_new = do_quit, + .mhandler.cmd = hmp_quit, }, STEXI diff --git a/hmp.c b/hmp.c index 30c6cc9..7695dfc 100644 --- a/hmp.c +++ b/hmp.c @@ -93,3 +93,9 @@ void hmp_info_chardev(Monitor *mon) qapi_free_ChardevInfoList(char_info); } + +void hmp_quit(Monitor *mon, const QDict *qdict) +{ + monitor_suspend(mon); + qmp_quit(NULL); +} diff --git a/hmp.h b/hmp.h index 7388f9a..a3dfafd 100644 --- a/hmp.h +++ b/hmp.h @@ -23,5 +23,6 @@ void hmp_info_kvm(Monitor *mon); void hmp_info_status(Monitor *mon); void hmp_info_uuid(Monitor *mon); void hmp_info_chardev(Monitor *mon); +void hmp_quit(Monitor *mon, const QDict *qdict); #endif diff --git a/monitor.c b/monitor.c index 11363d5..e5baea1 100644 --- a/monitor.c +++ b/monitor.c @@ -945,18 +945,6 @@ static void do_trace_print_events(Monitor *mon) trace_print_events((FILE *)mon, &monitor_fprintf); } -/** - * do_quit(): Quit QEMU execution - */ -static int do_quit(Monitor *mon, const QDict *qdict, QObject **ret_data) -{ - monitor_suspend(mon); - no_shutdown = 0; - qemu_system_shutdown_request(); - - return 0; -} - #ifdef CONFIG_VNC static int change_vnc_password(const char *password) { diff --git a/qapi-schema.json b/qapi-schema.json index 35434c1..3810463 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -225,3 +225,14 @@ ## { 'command': 'query-commands', 'returns': ['CommandInfo'] } +## +# @quit: +# +# This command will cause the QEMU process to exit gracefully. While every +# attempt is made to send the QMP response before terminating, this is not +# guaranteed. When using this interface, a premature EOF would not be +# unexpected. +# +# Since: 0.14.0 +## +{ 'command': 'quit' } diff --git a/qmp-commands.hx b/qmp-commands.hx index 0fda5c3..151a5fa 100644 --- a/qmp-commands.hx +++ b/qmp-commands.hx @@ -63,10 +63,7 @@ EQMP { .name = "quit", .args_type = "", - .params = "", - .help = "quit the emulator", - .user_print = monitor_user_noop, - .mhandler.cmd_new = do_quit, + .mhandler.cmd_new = qmp_marshal_input_quit, }, SQMP diff --git a/qmp.c b/qmp.c index 58337c7..1d380b6 100644 --- a/qmp.c +++ b/qmp.c @@ -70,3 +70,9 @@ UuidInfo *qmp_query_uuid(Error **errp) return info; } +void qmp_quit(Error **err) +{ + no_shutdown = 0; + qemu_system_shutdown_request(); +} +