From patchwork Thu Aug 13 13:50:04 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 31304 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 bilbo.ozlabs.org (Postfix) with ESMTPS id EE7A0B6F31 for ; Fri, 14 Aug 2009 00:01:14 +1000 (EST) Received: from localhost ([127.0.0.1]:58640 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mbarf-0004Ya-9W for incoming@patchwork.ozlabs.org; Thu, 13 Aug 2009 10:01:11 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mbai5-0000N6-K8 for qemu-devel@nongnu.org; Thu, 13 Aug 2009 09:51:17 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mbai0-0000Ek-Cb for qemu-devel@nongnu.org; Thu, 13 Aug 2009 09:51:16 -0400 Received: from [199.232.76.173] (port=33490 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mbahz-0000EH-Uo for qemu-devel@nongnu.org; Thu, 13 Aug 2009 09:51:12 -0400 Received: from mx2.redhat.com ([66.187.237.31]:45067) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mbahz-0003Dm-7p for qemu-devel@nongnu.org; Thu, 13 Aug 2009 09:51:11 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n7DDpATB023177; Thu, 13 Aug 2009 09:51:10 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n7DDp9Tj027240; Thu, 13 Aug 2009 09:51:09 -0400 Received: from localhost (vpn-10-83.bos.redhat.com [10.16.10.83]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n7DDp7t9012107; Thu, 13 Aug 2009 09:51:08 -0400 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Thu, 13 Aug 2009 10:50:04 -0300 Message-Id: <1250171428-29308-6-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1250171428-29308-1-git-send-email-lcapitulino@redhat.com> References: <1250171428-29308-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: aliguori@us.ibm.com, avi@redhat.com Subject: [Qemu-devel] [PATCH 05/29] Add wrappers to functions used by the Monitor 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 Some functions exported to be used by the Monitor as command handlers are also called in other places as regular functions. When those functions got ported to use the Monitor dictionary to pass argments, the callers will have to setup a dictionary to be able to call them. To avoid this problem, this commit add wrappers to those functions, so that we change the wrapper to accept the dictionary, letting the current functions as is. The following wrappers are being added: - do_help_cmd() - do_pci_device_hot_remove() - qemu_loadvm() Signed-off-by: Luiz Capitulino --- hw/pci-hotplug.c | 5 +++++ monitor.c | 5 +++++ qemu-monitor.hx | 4 ++-- savevm.c | 7 ++++++- sysemu.h | 2 ++ vl.c | 2 +- 6 files changed, 21 insertions(+), 4 deletions(-) diff --git a/hw/pci-hotplug.c b/hw/pci-hotplug.c index 4da916c..678993e 100644 --- a/hw/pci-hotplug.c +++ b/hw/pci-hotplug.c @@ -200,6 +200,11 @@ void pci_device_hot_remove(Monitor *mon, const char *pci_addr) qemu_system_device_hot_add(bus, slot, 0); } +void do_pci_device_hot_remove(Monitor *mon, const char *pci_addr) +{ + pci_device_hot_remove(mon, pci_addr); +} + static int pci_match_fn(void *dev_private, void *arg) { PCIDevice *dev = dev_private; diff --git a/monitor.c b/monitor.c index 362322b..73f6c36 100644 --- a/monitor.c +++ b/monitor.c @@ -251,6 +251,11 @@ static void help_cmd(Monitor *mon, const char *name) } } +static void do_help_cmd(Monitor *mon, const char *name) +{ + help_cmd(mon, name); +} + static void do_commit(Monitor *mon, const char *device) { int all_devices; diff --git a/qemu-monitor.hx b/qemu-monitor.hx index 11bdb2c..8936e93 100644 --- a/qemu-monitor.hx +++ b/qemu-monitor.hx @@ -9,7 +9,7 @@ STEXI @table @option ETEXI - { "help|?", "s?", help_cmd, "[cmd]", "show the help" }, + { "help|?", "s?", do_help_cmd, "[cmd]", "show the help" }, STEXI @item help or ? [@var{cmd}] Show the help for all commands or just for command @var{cmd}. @@ -519,7 +519,7 @@ Hot-add PCI device. ETEXI #if defined(TARGET_I386) - { "pci_del", "s", pci_device_hot_remove, "[[:]:]", "hot remove PCI device" }, + { "pci_del", "s", do_pci_device_hot_remove, "[[:]:]", "hot remove PCI device" }, #endif STEXI @item pci_del diff --git a/savevm.c b/savevm.c index 570377f..9f988e6 100644 --- a/savevm.c +++ b/savevm.c @@ -1145,7 +1145,7 @@ void do_savevm(Monitor *mon, const char *name) vm_start(); } -void do_loadvm(Monitor *mon, const char *name) +void qemu_loadvm(Monitor *mon, const char *name) { DriveInfo *dinfo; BlockDriverState *bs, *bs1; @@ -1217,6 +1217,11 @@ void do_loadvm(Monitor *mon, const char *name) vm_start(); } +void do_loadvm(Monitor *mon, const char *name) +{ + qemu_loadvm(mon, name); +} + void do_delvm(Monitor *mon, const char *name) { DriveInfo *dinfo; diff --git a/sysemu.h b/sysemu.h index dffb2f1..84810e0 100644 --- a/sysemu.h +++ b/sysemu.h @@ -52,6 +52,7 @@ void qemu_system_reset(void); void do_savevm(Monitor *mon, const char *name); void do_loadvm(Monitor *mon, const char *name); +void qemu_loadvm(Monitor *mon, const char *name); void do_delvm(Monitor *mon, const char *name); void do_info_snapshots(Monitor *mon); @@ -205,6 +206,7 @@ void destroy_bdrvs(dev_match_fn *match_fn, void *arg); void pci_device_hot_add(Monitor *mon, const char *pci_addr, const char *type, const char *opts); void drive_hot_add(Monitor *mon, const char *pci_addr, const char *opts); +void do_pci_device_hot_remove(Monitor *mon, const char *pci_addr); void pci_device_hot_remove(Monitor *mon, const char *pci_addr); void pci_device_hot_remove_success(int pcibus, int slot); diff --git a/vl.c b/vl.c index 8b2b289..401cb6a 100644 --- a/vl.c +++ b/vl.c @@ -6037,7 +6037,7 @@ int main(int argc, char **argv, char **envp) } if (loadvm) - do_loadvm(cur_mon, loadvm); + qemu_loadvm(cur_mon, loadvm); if (incoming) { autostart = 0;