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>
This commit is contained in:
parent
68e517a8d7
commit
1fdd693308
12
block.c
12
block.c
@ -1487,11 +1487,17 @@ static int bdrv_open_inherit(BlockDriverState **pbs, const char *filename,
|
|||||||
|
|
||||||
assert(file == NULL);
|
assert(file == NULL);
|
||||||
bs->open_flags = flags;
|
bs->open_flags = flags;
|
||||||
ret = bdrv_open_image(&file, filename, options, "file",
|
|
||||||
bs, &child_file, true, &local_err);
|
bs->file_child = bdrv_open_child(filename, options, "file", bs,
|
||||||
if (ret < 0) {
|
&child_file, true, &local_err);
|
||||||
|
if (local_err) {
|
||||||
|
ret = -EINVAL;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bs->file_child) {
|
||||||
|
file = bs->file_child->bs;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Image format probing */
|
/* Image format probing */
|
||||||
|
@ -381,6 +381,7 @@ struct BlockDriverState {
|
|||||||
BlockDriverState *backing_hd;
|
BlockDriverState *backing_hd;
|
||||||
BdrvChild *backing_child;
|
BdrvChild *backing_child;
|
||||||
BlockDriverState *file;
|
BlockDriverState *file;
|
||||||
|
BdrvChild *file_child;
|
||||||
|
|
||||||
NotifierList close_notifiers;
|
NotifierList close_notifiers;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user