diff options
author | Kevin Wolf <kwolf@redhat.com> | 2016-12-19 15:21:48 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2017-02-28 20:40:36 +0100 |
commit | 6b1a044afb363f03b51c9d0218bef44a34ea98c3 (patch) | |
tree | 15a63fbf16840c39c0b921308e6b52dce757ee11 /include/block/block_int.h | |
parent | d7010dfb685506cc4addd102627205f85fcd0fe7 (diff) |
block: Default .bdrv_child_perm() for format drivers
Almost all format drivers have the same characteristics as far as
permissions are concerned: They have one or more children for storing
their own data and, more importantly, metadata (can be written to and
grow even without external write requests, must be protected against
other writers and present consistent data) and optionally a backing file
(this is just data, so like for a filter, it only depends on what the
parent nodes need).
This provides a default implementation that can be shared by most of
our format drivers.
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 'include/block/block_int.h')
-rw-r--r-- | include/block/block_int.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/block/block_int.h b/include/block/block_int.h index 17f4c2d6cd..eb0598e580 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -880,6 +880,14 @@ void bdrv_filter_default_perms(BlockDriverState *bs, BdrvChild *c, uint64_t perm, uint64_t shared, uint64_t *nperm, uint64_t *nshared); +/* Default implementation for BlockDriver.bdrv_child_perm() that can be used by + * (non-raw) image formats: Like above for bs->backing, but for bs->file it + * requires WRITE | RESIZE for read-write images, always requires + * CONSISTENT_READ and doesn't share WRITE. */ +void bdrv_format_default_perms(BlockDriverState *bs, BdrvChild *c, + const BdrvChildRole *role, + uint64_t perm, uint64_t shared, + uint64_t *nperm, uint64_t *nshared); const char *bdrv_get_parent_name(const BlockDriverState *bs); void blk_dev_change_media_cb(BlockBackend *blk, bool load); |