diff options
author | Kevin Wolf <kwolf@redhat.com> | 2016-12-20 16:23:46 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2017-02-28 20:40:36 +0100 |
commit | 91ef38257ad225f7fa17a6583fb792c0be9e8acf (patch) | |
tree | d2b9fb9279f42106392fc9cb74d18d4a45ead62a /block/vvfat.c | |
parent | 862f215fabf31c80c953155fcb223fea5320bbdf (diff) | |
download | qemu-91ef38257ad225f7fa17a6583fb792c0be9e8acf.zip qemu-91ef38257ad225f7fa17a6583fb792c0be9e8acf.tar.gz qemu-91ef38257ad225f7fa17a6583fb792c0be9e8acf.tar.bz2 |
vvfat: Implement .bdrv_child_perm()
vvfat is the last remaining driver that can have children, but doesn't
implement .bdrv_child_perm() yet. The default handlers aren't suitable
here, so let's implement a very simple driver-specific one that protects
the internal child from being used by other users as good as our
permissions permit.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Acked-by: Fam Zheng <famz@redhat.com>
Diffstat (limited to 'block/vvfat.c')
-rw-r--r-- | block/vvfat.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/block/vvfat.c b/block/vvfat.c index 7f230be..72b482c 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -3052,6 +3052,27 @@ err: return ret; } +static void vvfat_child_perm(BlockDriverState *bs, BdrvChild *c, + const BdrvChildRole *role, + uint64_t perm, uint64_t shared, + uint64_t *nperm, uint64_t *nshared) +{ + BDRVVVFATState *s = bs->opaque; + + assert(c == s->qcow || role == &child_backing); + + if (c == s->qcow) { + /* This is a private node, nobody should try to attach to it */ + *nperm = BLK_PERM_CONSISTENT_READ | BLK_PERM_WRITE; + *nshared = BLK_PERM_WRITE_UNCHANGED; + } else { + /* The backing file is there so 'commit' can use it. vvfat doesn't + * access it in any way. */ + *nperm = 0; + *nshared = BLK_PERM_ALL; + } +} + static void vvfat_close(BlockDriverState *bs) { BDRVVVFATState *s = bs->opaque; @@ -3077,6 +3098,7 @@ static BlockDriver bdrv_vvfat = { .bdrv_file_open = vvfat_open, .bdrv_refresh_limits = vvfat_refresh_limits, .bdrv_close = vvfat_close, + .bdrv_child_perm = vvfat_child_perm, .bdrv_co_preadv = vvfat_co_preadv, .bdrv_co_pwritev = vvfat_co_pwritev, |