summaryrefslogtreecommitdiffstats
path: root/block.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2015-06-15 14:11:51 +0200
committerKevin Wolf <kwolf@redhat.com>2015-10-16 15:34:29 +0200
commit1fdd69330872ef91d92482472eef79350d2f379b (patch)
tree571c753d8aa3d47221b3ce8ba018b4ffc3479ee1 /block.c
parent68e517a8d7d89298235913a514af70364e559b78 (diff)
downloadhqemu-1fdd69330872ef91d92482472eef79350d2f379b.zip
hqemu-1fdd69330872ef91d92482472eef79350d2f379b.tar.gz
block: Introduce BDS.file_child
Store the BdrvChild for bs->file. At this point, bs->file_child->bs just duplicates the bs->file pointer. Later, it will completely replace it. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Alberto Garcia <berto@igalia.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Jeff Cody <jcody@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/block.c b/block.c
index 1f90b47..75afed1 100644
--- a/block.c
+++ b/block.c
@@ -1487,11 +1487,17 @@ static int bdrv_open_inherit(BlockDriverState **pbs, const char *filename,
assert(file == NULL);
bs->open_flags = flags;
- ret = bdrv_open_image(&file, filename, options, "file",
- bs, &child_file, true, &local_err);
- if (ret < 0) {
+
+ bs->file_child = bdrv_open_child(filename, options, "file", bs,
+ &child_file, true, &local_err);
+ if (local_err) {
+ ret = -EINVAL;
goto fail;
}
+
+ if (bs->file_child) {
+ file = bs->file_child->bs;
+ }
}
/* Image format probing */
OpenPOWER on IntegriCloud