This is useful in other files like blockdev.c to determine for example whether a node can be written to or not.
Signed-off-by: Max Reitz <mre...@redhat.com> Reviewed-by: Vladimir Sementsov-Ogievskiy <vsement...@virtuozzo.com> --- include/block/block_int.h | 3 +++ block.c | 6 ++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/block/block_int.h b/include/block/block_int.h index 786801c32f..c17df3808a 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -1205,6 +1205,9 @@ int bdrv_child_try_set_perm(BdrvChild *c, uint64_t perm, uint64_t shared, */ int bdrv_child_refresh_perms(BlockDriverState *bs, BdrvChild *c, Error **errp); +void bdrv_get_cumulative_perm(BlockDriverState *bs, + uint64_t *perm, uint64_t *shared_perm); + /* Default implementation for BlockDriver.bdrv_child_perm() that can be used by * block filters: Forward CONSISTENT_READ, WRITE, WRITE_UNCHANGED and RESIZE to * all children */ diff --git a/block.c b/block.c index 6e1ddab056..915b80153c 100644 --- a/block.c +++ b/block.c @@ -1713,8 +1713,6 @@ static int bdrv_child_check_perm(BdrvChild *c, BlockReopenQueue *q, bool *tighten_restrictions, Error **errp); static void bdrv_child_abort_perm_update(BdrvChild *c); static void bdrv_child_set_perm(BdrvChild *c, uint64_t perm, uint64_t shared); -static void bdrv_get_cumulative_perm(BlockDriverState *bs, uint64_t *perm, - uint64_t *shared_perm); typedef struct BlockReopenQueueEntry { bool prepared; @@ -1938,8 +1936,8 @@ static void bdrv_set_perm(BlockDriverState *bs, uint64_t cumulative_perms, } } -static void bdrv_get_cumulative_perm(BlockDriverState *bs, uint64_t *perm, - uint64_t *shared_perm) +void bdrv_get_cumulative_perm(BlockDriverState *bs, + uint64_t *perm, uint64_t *shared_perm) { BdrvChild *c; uint64_t cumulative_perms = 0; -- 2.21.0