summaryrefslogtreecommitdiff
path: root/blockdev.c
diff options
context:
space:
mode:
authorLuiz Capitulino <lcapitulino@redhat.com>2011-11-25 14:57:10 -0200
committerLuiz Capitulino <lcapitulino@redhat.com>2011-12-06 11:40:01 -0200
commit5e7caacb2583e6a4657fec51a92147f33c5bae43 (patch)
tree08713dd453821a703edd198a298f1106d93afe88 /blockdev.c
parentd72f326431e280a619a0fd55e27d3737747f8178 (diff)
downloadqemu-5e7caacb2583e6a4657fec51a92147f33c5bae43.tar.gz
qemu-5e7caacb2583e6a4657fec51a92147f33c5bae43.tar.bz2
qemu-5e7caacb2583e6a4657fec51a92147f33c5bae43.zip
qapi: Convert block_resize
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'blockdev.c')
-rw-r--r--blockdev.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/blockdev.c b/blockdev.c
index aba7aaf174..527040487c 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -861,27 +861,23 @@ int do_drive_del(Monitor *mon, const QDict *qdict, QObject **ret_data)
* existing QERR_ macro mess is cleaned up. A good example for better
* error reports can be found in the qemu-img resize code.
*/
-int do_block_resize(Monitor *mon, const QDict *qdict, QObject **ret_data)
+void qmp_block_resize(const char *device, int64_t size, Error **errp)
{
- const char *device = qdict_get_str(qdict, "device");
- int64_t size = qdict_get_int(qdict, "size");
BlockDriverState *bs;
bs = bdrv_find(device);
if (!bs) {
- qerror_report(QERR_DEVICE_NOT_FOUND, device);
- return -1;
+ error_set(errp, QERR_DEVICE_NOT_FOUND, device);
+ return;
}
if (size < 0) {
- qerror_report(QERR_UNDEFINED_ERROR);
- return -1;
+ error_set(errp, QERR_UNDEFINED_ERROR);
+ return;
}
if (bdrv_truncate(bs, size)) {
- qerror_report(QERR_UNDEFINED_ERROR);
- return -1;
+ error_set(errp, QERR_UNDEFINED_ERROR);
+ return;
}
-
- return 0;
}