From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:55257) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UMwze-0001Ht-K5 for qemu-devel@nongnu.org; Tue, 02 Apr 2013 04:55:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UMwzd-0000Oc-0r for qemu-devel@nongnu.org; Tue, 02 Apr 2013 04:55:02 -0400 Received: from e28smtp02.in.ibm.com ([122.248.162.2]:42779) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UMwzc-0000O4-7P for qemu-devel@nongnu.org; Tue, 02 Apr 2013 04:55:00 -0400 Received: from /spool/local by e28smtp02.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 2 Apr 2013 14:20:11 +0530 Received: from d28relay01.in.ibm.com (d28relay01.in.ibm.com [9.184.220.58]) by d28dlp02.in.ibm.com (Postfix) with ESMTP id F32EA3940023 for ; Tue, 2 Apr 2013 14:24:52 +0530 (IST) Received: from d28av03.in.ibm.com (d28av03.in.ibm.com [9.184.220.65]) by d28relay01.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r328skbH262602 for ; Tue, 2 Apr 2013 14:24:46 +0530 Received: from d28av03.in.ibm.com (loopback [127.0.0.1]) by d28av03.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r328spe1010831 for ; Tue, 2 Apr 2013 19:54:51 +1100 Message-ID: <515A9CB3.1090105@linux.vnet.ibm.com> Date: Tue, 02 Apr 2013 16:54:11 +0800 From: Wenchao Xia MIME-Version: 1.0 References: <1363961953-13561-1-git-send-email-xiawenc@linux.vnet.ibm.com> <1363961953-13561-12-git-send-email-xiawenc@linux.vnet.ibm.com> <20130328095412.GA3077@dhcp-200-207.str.redhat.com> <5154FE04.5020506@linux.vnet.ibm.com> <20130402080906.GC2341@dhcp-200-207.str.redhat.com> In-Reply-To: <20130402080906.GC2341@dhcp-200-207.str.redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH V10 11/17] qmp: add ImageInfo in BlockDeviceInfo used by query-block List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: aliguori@us.ibm.com, stefanha@gmail.com, qemu-devel@nongnu.org, armbru@redhat.com, pbonzini@redhat.com, lcapitulino@redhat.com 于 2013-4-2 16:09, Kevin Wolf 写道: > Am 29.03.2013 um 03:35 hat Wenchao Xia geschrieben: >> 于 2013-3-28 17:54, Kevin Wolf 写道: >>> Am 22.03.2013 um 15:19 hat Wenchao Xia geschrieben: >>>> Now image info will be retrieved as an embbed json object inside >>>> BlockDeviceInfo, backing chain info and all related internal snapshot >>>> info can be got in the enhanced recursive structure of ImageInfo. >>>> >>>> Signed-off-by: Wenchao Xia >>>> --- >>>> block/qapi.c | 39 ++++++++++++++++++++++++++-- >>>> include/block/qapi.h | 4 ++- >>>> qapi-schema.json | 5 +++- >>>> qmp-commands.hx | 67 +++++++++++++++++++++++++++++++++++++++++++++++++- >>>> 4 files changed, 109 insertions(+), 6 deletions(-) >>>> >>>> diff --git a/block/qapi.c b/block/qapi.c >>>> index df73f5b..9051947 100644 >>>> --- a/block/qapi.c >>>> +++ b/block/qapi.c >>>> @@ -200,9 +200,15 @@ int bdrv_query_image_info(BlockDriverState *bs, >>>> return 0; >>>> } >>>> >>>> -BlockInfo *bdrv_query_info(BlockDriverState *bs) >>>> +/* return 0 on success, and @p_info will be set only on success. */ >>>> +int bdrv_query_info(BlockDriverState *bs, >>>> + BlockInfo **p_info, >>>> + Error **errp) >>>> { >>>> BlockInfo *info = g_malloc0(sizeof(*info)); >>>> + BlockDriverState *bs0; >>>> + ImageInfo **p_image_info; >>>> + int ret = 0; >>> >>> ret is never changed, so this function always returns 0. I would suggest >>> to drop ret and make the function return type void. >>> >> My bad, I forgot to set its value, the interface is intend to return >> negative error number and errp both on fail. > > Why do you need two separate error reporting mechanisms? Shouldn't only > errp be enough? > > Kevin > Returned value can tell caller what error it is, like -ENOMEDIUM. Although it is not used by caller now, but I feel better to have it just like +int bdrv_query_snapshot_info_list(BlockDriverState *bs, + SnapshotInfoList **p_list, + Error **errp) in patch 5/17. -- Best Regards Wenchao Xia