Am 28.06.2013 um 21:32 hat Eric Blake geschrieben:
> On 06/28/2013 08:32 AM, Federico Simoncelli wrote:
> > This patch adds the optional file entry to the query-block output.
> > The value is a json-object representing the information about the
> > underlying file or device (when present).
> > 
> > Signed-off-by: Federico Simoncelli <fsimo...@redhat.com>
> > ---
> >  block/qapi.c               |    9 ++++++++-
> >  qapi-schema.json           |    4 +++-
> >  qmp-commands.hx            |    8 ++++++++
> >  tests/qemu-iotests/043.out |   15 +++++++++++++++
> >  4 files changed, 34 insertions(+), 2 deletions(-)
> 
> Reviewed-by: Eric Blake <ebl...@redhat.com>
> 
> > +++ b/block/qapi.c
> > @@ -119,7 +119,7 @@ void bdrv_query_image_info(BlockDriverState *bs,
> >  
> >      info->filename        = g_strdup(bs->filename);
> >      info->format          = g_strdup(bdrv_get_format_name(bs));
> > -    info->virtual_size    = total_sectors * 512;
> > +    info->virtual_size    = bdrv_getlength(bs);
> 
> This change seems independently useful, but I'm not sure if it's worth
> splitting out into a separate patch.

It probably is, because (a) it's a separate logical change and (b) this
isn't entirely correct. bdrv_getlength() can fail, so we need to do more
than just changing this one line. If bdrv_getlength() fails we should
error out instead of outputting a negative size.

Kevin

Reply via email to