diff options
author | Alberto Garcia <berto@igalia.com> | 2019-03-12 18:48:40 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2019-03-12 20:30:14 +0100 |
commit | 2cad1ebe701eccfe3b5a6b1eb277c4f3c5055665 (patch) | |
tree | e9d6c38ee2f0e2d72352e2320f70043a3aaa089f /include/block/block_int.h | |
parent | 9d6459d21a6e630264ead21558d940366d2f2450 (diff) | |
download | qemu-2cad1ebe701eccfe3b5a6b1eb277c4f3c5055665.zip |
block: Allow freezing BdrvChild links
Our permission system is useful to define what operations are allowed
on a certain block node and includes things like BLK_PERM_WRITE or
BLK_PERM_RESIZE among others.
One of the permissions is BLK_PERM_GRAPH_MOD which allows "changing
the node that this BdrvChild points to". The exact meaning of this has
never been very clear, but it can be understood as "change any of the
links connected to the node". This can be used to prevent changing a
backing link, but it's too coarse.
This patch adds a new 'frozen' attribute to BdrvChild, which forbids
detaching the link from the node it points to, and new API to freeze
and unfreeze a backing chain.
After this change a few functions can fail, so they need additional
checks.
Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'include/block/block_int.h')
-rw-r--r-- | include/block/block_int.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/block/block_int.h b/include/block/block_int.h index a23cabaddd..438feba4e5 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -711,6 +711,12 @@ struct BdrvChild { uint64_t backup_perm; uint64_t backup_shared_perm; + /* + * This link is frozen: the child can neither be replaced nor + * detached from the parent. + */ + bool frozen; + QLIST_ENTRY(BdrvChild) next; QLIST_ENTRY(BdrvChild) next_parent; }; |