aboutsummaryrefslogtreecommitdiff
path: root/blockdev.c
diff options
context:
space:
mode:
authorLuiz Capitulino <lcapitulino@redhat.com>2011-12-07 16:02:36 -0200
committerLuiz Capitulino <lcapitulino@redhat.com>2012-01-18 10:23:39 -0200
commitc245b6a37d76670c3ba7b9063bac943bb998bb7c (patch)
tree95cf2e606d25f167bb3b956018d60787700f7c95 /blockdev.c
parent92d48558edb14666a2851068db4c2095664e0fbc (diff)
qapi: Convert eject
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'blockdev.c')
-rw-r--r--blockdev.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/blockdev.c b/blockdev.c
index 9ee5bae6cd..124fbe6c1b 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -683,27 +683,17 @@ static void eject_device(BlockDriverState *bs, int force, Error **errp)
bdrv_close(bs);
}
-int do_eject(Monitor *mon, const QDict *qdict, QObject **ret_data)
+void qmp_eject(const char *device, bool has_force, bool force, Error **errp)
{
BlockDriverState *bs;
- int force = qdict_get_try_bool(qdict, "force", 0);
- const char *filename = qdict_get_str(qdict, "device");
- Error *err = NULL;
- bs = bdrv_find(filename);
+ bs = bdrv_find(device);
if (!bs) {
- qerror_report(QERR_DEVICE_NOT_FOUND, filename);
- return -1;
- }
-
- eject_device(bs, force, &err);
- if (error_is_set(&err)) {
- qerror_report_err(err);
- error_free(err);
- return -1;
+ error_set(errp, QERR_DEVICE_NOT_FOUND, device);
+ return;
}
- return 0;
+ eject_device(bs, force, errp);
}
void qmp_block_passwd(const char *device, const char *password, Error **errp)