mirror of https://github.com/xemu-project/xemu.git
block: Introduce parents list
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
a2d6190048
commit
d42a8a935b
3
block.c
3
block.c
|
@ -1090,6 +1090,7 @@ static BdrvChild *bdrv_attach_child(BlockDriverState *parent_bs,
|
|||
};
|
||||
|
||||
QLIST_INSERT_HEAD(&parent_bs->children, child, next);
|
||||
QLIST_INSERT_HEAD(&child_bs->parents, child, next_parent);
|
||||
|
||||
return child;
|
||||
}
|
||||
|
@ -1097,6 +1098,7 @@ static BdrvChild *bdrv_attach_child(BlockDriverState *parent_bs,
|
|||
void bdrv_detach_child(BdrvChild *child)
|
||||
{
|
||||
QLIST_REMOVE(child, next);
|
||||
QLIST_REMOVE(child, next_parent);
|
||||
g_free(child);
|
||||
}
|
||||
|
||||
|
@ -2038,6 +2040,7 @@ static void bdrv_move_reference_fields(BlockDriverState *bs_dest,
|
|||
/* keep the same entry in bdrv_states */
|
||||
bs_dest->device_list = bs_src->device_list;
|
||||
bs_dest->blk = bs_src->blk;
|
||||
bs_dest->parents = bs_src->parents;
|
||||
|
||||
memcpy(bs_dest->op_blockers, bs_src->op_blockers,
|
||||
sizeof(bs_dest->op_blockers));
|
||||
|
|
|
@ -339,6 +339,7 @@ struct BdrvChild {
|
|||
BlockDriverState *bs;
|
||||
const BdrvChildRole *role;
|
||||
QLIST_ENTRY(BdrvChild) next;
|
||||
QLIST_ENTRY(BdrvChild) next_parent;
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -445,6 +446,7 @@ struct BlockDriverState {
|
|||
* parent node of this node. */
|
||||
BlockDriverState *inherits_from;
|
||||
QLIST_HEAD(, BdrvChild) children;
|
||||
QLIST_HEAD(, BdrvChild) parents;
|
||||
|
||||
QDict *options;
|
||||
BlockdevDetectZeroesOptions detect_zeroes;
|
||||
|
|
Loading…
Reference in New Issue