[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [Qemu-devel] [PATCH 4/6] block: Base permissions on rw
From: |
Eric Blake |
Subject: |
Re: [Qemu-block] [Qemu-devel] [PATCH 4/6] block: Base permissions on rw state after reopen |
Date: |
Fri, 15 Sep 2017 13:58:34 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 |
On 09/15/2017 05:10 AM, Kevin Wolf wrote:
> When new permissions are calculated during bdrv_reopen(), they need to
> be based on the state of the graph as it will be after the reopen has
> completed, not on the current state of the involved nodes.
>
> This patch makes bdrv_is_writable() optionally accept a BlockReopenQueue
> from which the new flags are taken. This is then used for determining
> the new bs->file permissions of format drivers as soon as we add the
> code to actually pass a non-NULL reopen queue to the .bdrv_child_perm
> callbacks.
>
> While moving bdrv_is_writable(), make it static. It isn't used outside
> block.c.
>
> Signed-off-by: Kevin Wolf <address@hidden>
> ---
> include/block/block.h | 1 -
> block.c | 52
> ++++++++++++++++++++++++++++++++++++---------------
> 2 files changed, 37 insertions(+), 16 deletions(-)
>
> + * Return the flags that @bs will have after the reopens in @q have
> + * successfully completed. If @q is NULL (or @bs is not contained in @q),
> + * return the current flags.
> + */
> +static int bdrv_reopen_get_flags(BlockReopenQueue *q, BlockDriverState *bs)
> +/* Returns whether the image file can be written to after the reopen queue @q
> + * has been successfully applied, or right now if @q is NULL. */
> +static bool bdrv_is_writable(BlockDriverState *bs, BlockReopenQueue *q)
Is it worth having both functions with arguments in the same order?
> +{
> + int flags = bdrv_reopen_get_flags(q, bs);
> +
No real semantic impact to leave it as is, but it would avoid the odd
swap of arguments here. So either way,
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-block] [PATCH 1/6] qemu-io: Reset qemuio_blk permissions before each command, (continued)
- [Qemu-block] [PATCH 1/6] qemu-io: Reset qemuio_blk permissions before each command, Kevin Wolf, 2017/09/15
- [Qemu-block] [PATCH 3/6] block: Add reopen queue to bdrv_check_perm(), Kevin Wolf, 2017/09/15
- [Qemu-block] [PATCH 4/6] block: Base permissions on rw state after reopen, Kevin Wolf, 2017/09/15
- Re: [Qemu-block] [Qemu-devel] [PATCH 4/6] block: Base permissions on rw state after reopen,
Eric Blake <=
- [Qemu-block] [PATCH 2/6] block: Add reopen_queue to bdrv_child_perm(), Kevin Wolf, 2017/09/15
- [Qemu-block] [PATCH 5/6] block: reopen: Queue children after their parents, Kevin Wolf, 2017/09/15
- [Qemu-block] [PATCH 6/6] block: Fix permissions after bdrv_reopen(), Kevin Wolf, 2017/09/15
- [Qemu-block] [PATCH 7/6] qemu-iotests: Test change-backing-file command, Kevin Wolf, 2017/09/15