diff options
author | Kevin Wolf <kwolf@redhat.com> | 2016-12-20 23:25:12 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2017-02-28 20:40:36 +0100 |
commit | 78e421c9fbed9d501d7ada84ddc786a92178a71d (patch) | |
tree | 6b0d8db332f421f827650e4090c70ad3e0401260 | |
parent | 91ef38257ad225f7fa17a6583fb792c0be9e8acf (diff) |
block: Require .bdrv_child_perm() with child nodes
All block drivers that can have child nodes implement .bdrv_child_perm()
now. Make this officially a requirement by asserting that only drivers
without children can omit .bdrv_child_perm().
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Acked-by: Fam Zheng <famz@redhat.com>
-rw-r--r-- | block.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -1360,8 +1360,9 @@ static int bdrv_check_perm(BlockDriverState *bs, uint64_t cumulative_perms, cumulative_shared_perms, errp); } - /* Drivers may not have .bdrv_child_perm() */ + /* Drivers that never have children can omit .bdrv_child_perm() */ if (!drv->bdrv_child_perm) { + assert(QLIST_EMPTY(&bs->children)); return 0; } @@ -1420,8 +1421,9 @@ static void bdrv_set_perm(BlockDriverState *bs, uint64_t cumulative_perms, drv->bdrv_set_perm(bs, cumulative_perms, cumulative_shared_perms); } - /* Drivers may not have .bdrv_child_perm() */ + /* Drivers that never have children can omit .bdrv_child_perm() */ if (!drv->bdrv_child_perm) { + assert(QLIST_EMPTY(&bs->children)); return; } |