mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-09-09 00:07:57 -06:00
block: Add list of children to BlockDriverState
This allows iterating over all children of a given BDS, not only including bs->file and bs->backing_hd, but also driver-specific ones like VMDK extents or Quorum children. For bdrv_swap(), the list of children of the swapped BDS stays at that BDS (because that's where the pointers stay as well). The list head moves and pointers to it must be fixed up therefore. The list of children in the parent of the swapped BDS is not affected by the swap. The contents of the BDS objects is swapped, so the existing pointer in the parent automatically points to the newly swapped in BDS. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
parent
ae81693004
commit
6e93e7c41f
2 changed files with 45 additions and 0 deletions
|
@ -337,6 +337,12 @@ struct BdrvChildRole {
|
|||
extern const BdrvChildRole child_file;
|
||||
extern const BdrvChildRole child_format;
|
||||
|
||||
typedef struct BdrvChild {
|
||||
BlockDriverState *bs;
|
||||
const BdrvChildRole *role;
|
||||
QLIST_ENTRY(BdrvChild) next;
|
||||
} BdrvChild;
|
||||
|
||||
/*
|
||||
* Note: the function bdrv_append() copies and swaps contents of
|
||||
* BlockDriverStates, so if you add new fields to this struct, please
|
||||
|
@ -431,6 +437,8 @@ struct BlockDriverState {
|
|||
/* long-running background operation */
|
||||
BlockJob *job;
|
||||
|
||||
QLIST_HEAD(, BdrvChild) children;
|
||||
|
||||
QDict *options;
|
||||
BlockdevDetectZeroesOptions detect_zeroes;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue