[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 56/65] qemu-img: Use blk_new_open() in img_open()
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 56/65] qemu-img: Use blk_new_open() in img_open() |
Date: |
Fri, 13 Feb 2015 16:24:52 +0000 |
From: Max Reitz <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
qemu-img.c | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
diff --git a/qemu-img.c b/qemu-img.c
index 8790546..7dea370 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -293,32 +293,24 @@ static BlockBackend *img_open(const char *id, const char
*filename,
{
BlockBackend *blk;
BlockDriverState *bs;
- BlockDriver *drv;
char password[256];
Error *local_err = NULL;
- int ret;
-
- blk = blk_new_with_bs(id, &error_abort);
- bs = blk_bs(blk);
+ QDict *options = NULL;
if (fmt) {
- drv = bdrv_find_format(fmt);
- if (!drv) {
- error_report("Unknown file format '%s'", fmt);
- goto fail;
- }
- } else {
- drv = NULL;
+ options = qdict_new();
+ qdict_put(options, "driver", qstring_from_str(fmt));
}
- ret = bdrv_open(&bs, filename, NULL, NULL, flags, drv, &local_err);
- if (ret < 0) {
+ blk = blk_new_open(id, filename, NULL, options, flags, &local_err);
+ if (!blk) {
error_report("Could not open '%s': %s", filename,
error_get_pretty(local_err));
error_free(local_err);
goto fail;
}
+ bs = blk_bs(blk);
if (bdrv_is_encrypted(bs) && require_io) {
qprintf(quiet, "Disk image '%s' is encrypted.\n", filename);
if (read_password(password, sizeof(password)) < 0) {
--
2.1.0
- [Qemu-devel] [PULL 44/65] qtest: Add scripts/qtest.py, (continued)
- [Qemu-devel] [PULL 44/65] qtest: Add scripts/qtest.py, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 45/65] qemu-iotests: Add VM method qtest() to iotests.py, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 42/65] qtest: Fix deadloop by running main loop AIO context's timers, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 46/65] qemu-iotests: Allow caller to disable underscore convertion for qmp, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 48/65] qemu-img: Fix qemu-img convert -n, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 50/65] block: Lift some BDS functions to the BlockBackend, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 49/65] iotests: Add test for qemu-img convert to NBD, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 51/65] block: Add blk_new_open(), Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 47/65] qemu-iotests: Add 093 for IO throttling, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 52/65] block: Add Error parameter to bdrv_find_protocol(), Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 56/65] qemu-img: Use blk_new_open() in img_open(),
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 57/65] qemu-img: Use blk_new_open() in img_rebase(), Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 53/65] iotests: Add test for driver=qcow2, format=qcow2, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 60/65] qemu-io: Use blk_new_open() in openfile(), Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 58/65] qemu-img: Use BlockBackend as far as possible, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 55/65] block/xen: Use blk_new_open() in blk_connect(), Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 59/65] qemu-nbd: Use blk_new_open() in main(), Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 63/65] block: Clamp BlockBackend requests, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 64/65] block: Remove "growable" from BDS, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 62/65] qemu-io: Use BlockBackend, Stefan Hajnoczi, 2015/02/13
- [Qemu-devel] [PULL 65/65] block: Keep bdrv_check*_request()'s return value, Stefan Hajnoczi, 2015/02/13