On 05/04/2017 11:52 AM, Kevin Wolf wrote: > Format drivers for inactive nodes don't need write/resize permissions on > their bs->file and can share write/resize with another VM (in fact, this > is the whole point of keeping images inactive). Represent this fact in > the op blocker system, so that image locking does the right thing > without special-casing inactive images. > > Signed-off-by: Kevin Wolf <[email protected]> > --- > block.c | 35 +++++++++++++++++++++++++++++++++-- > include/block/block.h | 1 + > 2 files changed, 34 insertions(+), 2 deletions(-) > > diff --git a/block.c b/block.c > index 773bd64..cd89467 100644 > --- a/block.c > +++ b/block.c > @@ -192,11 +192,20 @@ void path_combine(char *dest, int dest_size, > } > } > > +/* Returns whether the image file is opened as read-only. Note that this can > + * return false and writing to the image file is still not possible because > the
s/false and/false but/
s/is still not/still not be/
> + * image is inactivated. */
> bool bdrv_is_read_only(BlockDriverState *bs)
> {
> return bs->read_only;
> }
>
> +/* Returns whether the image file can be written to right now */
> +bool bdrv_is_writable(BlockDriverState *bs)
> +{
> + return !bdrv_is_read_only(bs) && !(bs->open_flags & BDRV_O_INACTIVE);
> +}
Nice.
Up to you if you think the grammar suggestion helps.
Reviewed-by: Eric Blake <[email protected]>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
