summaryrefslogtreecommitdiff
path: root/block/blkverify.c
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2013-12-20 19:28:16 +0100
committerKevin Wolf <kwolf@redhat.com>2014-01-22 12:07:18 +0100
commit70b6198acc9643c3ce801e5cf4c24274722f2f4a (patch)
treecea7c03f20ace5bd2b96b6ab4b097ca7a416c59e /block/blkverify.c
parent4373593d5111a8ed3b6d47ad4a458ee28ec942e3 (diff)
downloadqemu-70b6198acc9643c3ce801e5cf4c24274722f2f4a.tar.gz
blkverify: Allow command-line configuration
Introduce the "test" and "raw" options for specifying images. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/blkverify.c')
-rw-r--r--block/blkverify.c25
1 files changed, 5 insertions, 20 deletions
diff --git a/block/blkverify.c b/block/blkverify.c
index e15ac4ca69..dc14290420 100644
--- a/block/blkverify.c
+++ b/block/blkverify.c
@@ -122,7 +122,6 @@ static int blkverify_open(BlockDriverState *bs, QDict *options, int flags,
BDRVBlkverifyState *s = bs->opaque;
QemuOpts *opts;
Error *local_err = NULL;
- const char *filename, *raw;
int ret;
opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
@@ -133,33 +132,19 @@ static int blkverify_open(BlockDriverState *bs, QDict *options, int flags,
goto fail;
}
- /* Parse the raw image filename */
- raw = qemu_opt_get(opts, "x-raw");
- if (raw == NULL) {
- error_setg(errp, "Could not retrieve raw image filename");
- ret = -EINVAL;
- goto fail;
- }
-
- ret = bdrv_file_open(&bs->file, raw, NULL, NULL, flags, &local_err);
+ /* Open the raw file */
+ ret = bdrv_open_image(&bs->file, qemu_opt_get(opts, "x-raw"), options,
+ "raw", flags, true, false, &local_err);
if (ret < 0) {
error_propagate(errp, local_err);
goto fail;
}
/* Open the test file */
- filename = qemu_opt_get(opts, "x-image");
- if (filename == NULL) {
- error_setg(errp, "Could not retrieve test image filename");
- ret = -EINVAL;
- goto fail;
- }
-
- s->test_file = bdrv_new("");
- ret = bdrv_open(s->test_file, filename, NULL, flags, NULL, &local_err);
+ ret = bdrv_open_image(&s->test_file, qemu_opt_get(opts, "x-image"), options,
+ "test", flags, false, false, &local_err);
if (ret < 0) {
error_propagate(errp, local_err);
- bdrv_unref(s->test_file);
s->test_file = NULL;
goto fail;
}