aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorLuiz Capitulino <lcapitulino@redhat.com>2012-03-29 12:38:50 -0300
committerLuiz Capitulino <lcapitulino@redhat.com>2012-04-09 14:35:25 -0300
commita15fef21c746e3aa0a94cf7b5bd9799886236666 (patch)
treefff54a082ea3fa920725805cd44a4de3823e54e6 /hw
parent56f9107e439c32aa00d58d117a9b664551328f1e (diff)
qapi: convert device_del
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/qdev-monitor.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/hw/qdev-monitor.c b/hw/qdev-monitor.c
index fd56afed45..81d654827f 100644
--- a/hw/qdev-monitor.c
+++ b/hw/qdev-monitor.c
@@ -19,6 +19,7 @@
#include "qdev.h"
#include "monitor.h"
+#include "qmp-commands.h"
/*
* Aliases were a bad idea from the start. Let's keep them
@@ -570,26 +571,17 @@ int do_device_add(Monitor *mon, const QDict *qdict, QObject **ret_data)
return 0;
}
-int do_device_del(Monitor *mon, const QDict *qdict, QObject **ret_data)
+void qmp_device_del(const char *id, Error **errp)
{
- const char *id = qdict_get_str(qdict, "id");
- Error *local_err = NULL;
DeviceState *dev;
dev = qdev_find_recursive(sysbus_get_default(), id);
if (NULL == dev) {
- qerror_report(QERR_DEVICE_NOT_FOUND, id);
- return -1;
- }
-
- qdev_unplug(dev, &local_err);
- if (error_is_set(&local_err)) {
- qerror_report_err(local_err);
- error_free(local_err);
- return -1;
+ error_set(errp, QERR_DEVICE_NOT_FOUND, id);
+ return;
}
- return 0;
+ qdev_unplug(dev, errp);
}
void qdev_machine_init(void)