13.06.2019 1:09, Max Reitz wrote: > 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 c0a05beec3..cfefb00104 100644 > --- a/include/block/block_int.h > +++ b/include/block/block_int.h > @@ -1181,6 +1181,9 @@ void bdrv_root_unref_child(BdrvChild *child); > int bdrv_child_try_set_perm(BdrvChild *c, uint64_t perm, uint64_t shared, > 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 856d9b58be..59d1d4b2b1 100644 > --- a/block.c > +++ b/block.c > @@ -1711,8 +1711,6 @@ static int bdrv_child_check_perm(BdrvChild *c, > BlockReopenQueue *q, > GSList *ignore_children, 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; > @@ -1904,8 +1902,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; > -- Best regards, Vladimir