diff options
author | Kevin Wolf <kwolf@redhat.com> | 2015-04-08 13:43:47 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2015-06-12 17:04:59 +0200 |
commit | f3930ed0bb1945b59da8e591072b5c79606d0760 (patch) | |
tree | bbc19fff220e6e2291622b755259549adf733a17 /block | |
parent | 18edf289a8951f3a48caff3b5fe17f2d414c2924 (diff) |
block: Move flag inheritance to bdrv_open_inherit()
Instead of letting every caller of bdrv_open() determine the right flags
for its child node manually and pass them to the function, pass the
parent node and the role of the newly opened child (like backing file,
protocol layer, etc.).
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block')
-rw-r--r-- | block/blkdebug.c | 2 | ||||
-rw-r--r-- | block/blkverify.c | 4 | ||||
-rw-r--r-- | block/quorum.c | 4 | ||||
-rw-r--r-- | block/vmdk.c | 5 |
4 files changed, 7 insertions, 8 deletions
diff --git a/block/blkdebug.c b/block/blkdebug.c index 1e92607ef3..bc247f46f5 100644 --- a/block/blkdebug.c +++ b/block/blkdebug.c @@ -429,7 +429,7 @@ static int blkdebug_open(BlockDriverState *bs, QDict *options, int flags, /* Open the backing file */ assert(bs->file == NULL); ret = bdrv_open_image(&bs->file, qemu_opt_get(opts, "x-image"), options, "image", - flags | BDRV_O_PROTOCOL, false, &local_err); + bs, &child_file, false, &local_err); if (ret < 0) { error_propagate(errp, local_err); goto out; diff --git a/block/blkverify.c b/block/blkverify.c index 438dff8bcb..d277e63220 100644 --- a/block/blkverify.c +++ b/block/blkverify.c @@ -125,7 +125,7 @@ static int blkverify_open(BlockDriverState *bs, QDict *options, int flags, /* Open the raw file */ assert(bs->file == NULL); ret = bdrv_open_image(&bs->file, qemu_opt_get(opts, "x-raw"), options, - "raw", flags | BDRV_O_PROTOCOL, false, &local_err); + "raw", bs, &child_file, false, &local_err); if (ret < 0) { error_propagate(errp, local_err); goto fail; @@ -134,7 +134,7 @@ static int blkverify_open(BlockDriverState *bs, QDict *options, int flags, /* Open the test file */ assert(s->test_file == NULL); ret = bdrv_open_image(&s->test_file, qemu_opt_get(opts, "x-image"), options, - "test", flags, false, &local_err); + "test", bs, &child_format, false, &local_err); if (ret < 0) { error_propagate(errp, local_err); s->test_file = NULL; diff --git a/block/quorum.c b/block/quorum.c index a33881a387..77e55b2775 100644 --- a/block/quorum.c +++ b/block/quorum.c @@ -935,8 +935,8 @@ static int quorum_open(BlockDriverState *bs, QDict *options, int flags, ret = snprintf(indexstr, 32, "children.%d", i); assert(ret < 32); - ret = bdrv_open_image(&s->bs[i], NULL, options, indexstr, flags, - false, &local_err); + ret = bdrv_open_image(&s->bs[i], NULL, options, indexstr, bs, + &child_format, false, &local_err); if (ret < 0) { goto close_exit; } diff --git a/block/vmdk.c b/block/vmdk.c index aad051b867..3284bec691 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -852,9 +852,8 @@ static int vmdk_parse_extents(const char *desc, BlockDriverState *bs, ret = snprintf(extent_opt_prefix, 32, "extents.%d", s->num_extents); assert(ret < 32); - ret = bdrv_open_image(&extent_file, extent_path, - options, extent_opt_prefix, - bs->open_flags | BDRV_O_PROTOCOL, false, errp); + ret = bdrv_open_image(&extent_file, extent_path, options, + extent_opt_prefix, bs, &child_file, false, errp); g_free(extent_path); if (ret) { return ret; |