From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37667) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtZZJ-0008HS-AH for qemu-devel@nongnu.org; Mon, 01 Jul 2013 04:34:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UtZZG-00038E-CU for qemu-devel@nongnu.org; Mon, 01 Jul 2013 04:34:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:10217) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UtZZG-00037m-4s for qemu-devel@nongnu.org; Mon, 01 Jul 2013 04:34:38 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r618YabG008062 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 1 Jul 2013 04:34:37 -0400 Date: Mon, 1 Jul 2013 10:34:34 +0200 From: Kevin Wolf Message-ID: <20130701083434.GA9000@dhcp-200-207.str.redhat.com> References: <1372429950-20923-1-git-send-email-fsimonce@redhat.com> <51CDE4D7.7090402@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <51CDE4D7.7090402@redhat.com> Subject: Re: [Qemu-devel] [PATCH] block: add the optional file entry to query-block List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Federico Simoncelli , qemu-devel@nongnu.org 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 > > --- > > 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 > > > +++ 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