aboutsummaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2016-12-20 15:51:12 +0100
committerKevin Wolf <kwolf@redhat.com>2017-02-28 20:40:36 +0100
commitf68c598be6a48995ca4c7cc42fc1f6e1195ec7aa (patch)
tree2e6321dacbb20ac7f6077ce79b89a7a0355f28f8 /block.c
parent78e421c9fbed9d501d7ada84ddc786a92178a71d (diff)
block: Request real permissions in bdrv_attach_child()
Now that all block drivers with children tell us what permissions they need from each of their children, bdrv_attach_child() can use this information and make the right requirements while trying to attach new children. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Acked-by: Fam Zheng <famz@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/block.c b/block.c
index 52c1f280dc..bed236747a 100644
--- a/block.c
+++ b/block.c
@@ -1680,10 +1680,16 @@ BdrvChild *bdrv_attach_child(BlockDriverState *parent_bs,
Error **errp)
{
BdrvChild *child;
+ uint64_t perm, shared_perm;
+
+ bdrv_get_cumulative_perm(parent_bs, &perm, &shared_perm);
+
+ assert(parent_bs->drv);
+ parent_bs->drv->bdrv_child_perm(parent_bs, NULL, child_role,
+ perm, shared_perm, &perm, &shared_perm);
- /* FIXME Use real permissions */
child = bdrv_root_attach_child(child_bs, child_name, child_role,
- 0, BLK_PERM_ALL, parent_bs, errp);
+ perm, shared_perm, parent_bs, errp);
if (child == NULL) {
return NULL;
}