]> git.proxmox.com Git - mirror_qemu.git/commitdiff
block: Introduce BDS.file_child
authorKevin Wolf <kwolf@redhat.com>
Mon, 15 Jun 2015 12:11:51 +0000 (14:11 +0200)
committerKevin Wolf <kwolf@redhat.com>
Fri, 16 Oct 2015 13:34:29 +0000 (15:34 +0200)
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>
block.c
include/block/block_int.h

diff --git a/block.c b/block.c
index 1f90b4773fd37c8a65ead2c2d6d9ead164bed3d6..75afed118be381bf592c429d6a0a6bc325f3037d 100644 (file)
--- 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 */
index 14ad4c334b184264211de44f0276f15903b31e59..d0dd93e5afb88c8d9ebd59200177dc5271f40291 100644 (file)
@@ -381,6 +381,7 @@ struct BlockDriverState {
     BlockDriverState *backing_hd;
     BdrvChild *backing_child;
     BlockDriverState *file;
+    BdrvChild *file_child;
 
     NotifierList close_notifiers;