From 67cfd3f816bbfef71696cc96fd9947419c4742d2 Mon Sep 17 00:00:00 2001 From: Luiz Capitulino Date: Mon, 29 Mar 2010 16:14:45 -0300 Subject: [PATCH 10/23] Monitor: Convert pci_device_hot_remove() to cmd_new_ret() RH-Author: Luiz Capitulino Message-id: <1269879298-30711-11-git-send-email-lcapitulino@redhat.com> Patchwork-id: 8174 O-Subject: [PATCH 10/23] Monitor: Convert pci_device_hot_remove() to cmd_new_ret() Bugzilla: 563491 RH-Acked-by: Markus Armbruster RH-Acked-by: Juan Quintela RH-Acked-by: Kevin Wolf Signed-off-by: Luiz Capitulino Signed-off-by: Anthony Liguori (cherry picked from commit 053801bc4950ec797ab8b47b4189dcdf2a1fc016) --- hw/pci-hotplug.c | 14 +++++++------- qemu-monitor.hx | 2 +- sysemu.h | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) Signed-off-by: Eduardo Habkost --- hw/pci-hotplug.c | 14 +++++++------- qemu-monitor.hx | 2 +- sysemu.h | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/hw/pci-hotplug.c b/hw/pci-hotplug.c index 3680357..a587f31 100644 --- a/hw/pci-hotplug.c +++ b/hw/pci-hotplug.c @@ -321,26 +321,26 @@ int pci_device_hot_add(Monitor *mon, const QDict *qdict, QObject **ret_data) } #endif -void pci_device_hot_remove(Monitor *mon, const char *pci_addr) +int pci_device_hot_remove(Monitor *mon, const char *pci_addr) { PCIDevice *d; int dom, bus; unsigned slot; if (pci_read_devaddr(mon, pci_addr, &dom, &bus, &slot)) { - return; + return -1; } d = pci_find_device(pci_find_root_bus(0), bus, slot, 0); if (!d) { monitor_printf(mon, "slot %d empty\n", slot); - return; + return -1; } - qdev_unplug(&d->qdev); + return qdev_unplug(&d->qdev); } -void do_pci_device_hot_remove(Monitor *mon, const QDict *qdict, - QObject **ret_data) +int do_pci_device_hot_remove(Monitor *mon, const QDict *qdict, + QObject **ret_data) { - pci_device_hot_remove(mon, qdict_get_str(qdict, "pci_addr")); + return pci_device_hot_remove(mon, qdict_get_str(qdict, "pci_addr")); } diff --git a/qemu-monitor.hx b/qemu-monitor.hx index 0ddf249..45af766 100644 --- a/qemu-monitor.hx +++ b/qemu-monitor.hx @@ -829,7 +829,7 @@ ETEXI .params = "[[:]:]", .help = "hot remove PCI device", .user_print = monitor_user_noop, - .mhandler.cmd_new = do_pci_device_hot_remove, + .cmd_new_ret = do_pci_device_hot_remove, }, #endif diff --git a/sysemu.h b/sysemu.h index 2593426..c27018f 100644 --- a/sysemu.h +++ b/sysemu.h @@ -222,9 +222,9 @@ DriveInfo *add_init_drive(const char *opts); void pci_device_hot_add_print(Monitor *mon, const QObject *data); int pci_device_hot_add(Monitor *mon, const QDict *qdict, QObject **ret_data); void drive_hot_add(Monitor *mon, const QDict *qdict); -void pci_device_hot_remove(Monitor *mon, const char *pci_addr); -void do_pci_device_hot_remove(Monitor *mon, const QDict *qdict, - QObject **ret_data); +int pci_device_hot_remove(Monitor *mon, const char *pci_addr); +int do_pci_device_hot_remove(Monitor *mon, const QDict *qdict, + QObject **ret_data); /* serial ports */ -- 1.7.0.3