diff options
author | Luiz Capitulino <lcapitulino@redhat.com> | 2010-02-10 23:49:55 -0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2010-02-19 15:18:17 -0600 |
commit | d711326ad903bc03349c065b8d3242ffd38d4809 (patch) | |
tree | 42d268432284b7266c57db7d2b96ba5906e96f30 /hw | |
parent | c05dfc55daf1448c01747bdfad1197545a009d57 (diff) | |
download | qemu-d711326ad903bc03349c065b8d3242ffd38d4809.tar.gz qemu-d711326ad903bc03349c065b8d3242ffd38d4809.tar.bz2 qemu-d711326ad903bc03349c065b8d3242ffd38d4809.zip |
Monitor: Convert pci_device_hot_add() to cmd_new_ret()
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/pci-hotplug.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/hw/pci-hotplug.c b/hw/pci-hotplug.c index 0fb96f06fd..6cc70d52c5 100644 --- a/hw/pci-hotplug.c +++ b/hw/pci-hotplug.c @@ -254,7 +254,7 @@ void pci_device_hot_add_print(Monitor *mon, const QObject *data) * * { "domain": 0, "bus": 0, "slot": 5, "function": 0 } */ -void pci_device_hot_add(Monitor *mon, const QDict *qdict, QObject **ret_data) +int pci_device_hot_add(Monitor *mon, const QDict *qdict, QObject **ret_data) { PCIDevice *dev = NULL; const char *pci_addr = qdict_get_str(qdict, "pci_addr"); @@ -273,20 +273,26 @@ void pci_device_hot_add(Monitor *mon, const QDict *qdict, QObject **ret_data) if (!strcmp(pci_addr, "auto")) pci_addr = NULL; - if (strcmp(type, "nic") == 0) + if (strcmp(type, "nic") == 0) { dev = qemu_pci_hot_add_nic(mon, pci_addr, opts); - else if (strcmp(type, "storage") == 0) + } else if (strcmp(type, "storage") == 0) { dev = qemu_pci_hot_add_storage(mon, pci_addr, opts); - else + } else { monitor_printf(mon, "invalid type: %s\n", type); + return -1; + } if (dev) { *ret_data = qobject_from_jsonf("{ 'domain': 0, 'bus': %d, 'slot': %d, " "'function': %d }", pci_bus_num(dev->bus), PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn)); - } else + } else { monitor_printf(mon, "failed to add %s\n", opts); + return -1; + } + + return 0; } #endif |