On 01/27/2015 12:45 PM, Max Reitz wrote: > There are several BlockBackend functions which, in theory, cannot fail. > This patch makes them cope with the BlockDriverState pointer being NULL > by making them fall back to some default action like ignoring the value > in setters and returning the default in getters. > > Signed-off-by: Max Reitz <mre...@redhat.com> > --- > block/block-backend.c | 70 > ++++++++++++++++++++++++++++++++++++++++----------- > 1 file changed, 55 insertions(+), 15 deletions(-) >
> @@ -926,22 +944,32 @@ void *blk_blockalign(BlockBackend *blk, size_t size) > > bool blk_op_is_blocked(BlockBackend *blk, BlockOpType op, Error **errp) > { > + if (!blk->bs) { > + return false; > + } > + > return bdrv_op_is_blocked(blk->bs, op, errp); > } I don't know if this is correct - maybe a no-medium drive should block actions like commit by default? If my design question gets answered satisfactorily that you went with the right default, then Reviewed-by: Eric Blake <ebl...@redhat.com> -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature