From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55986) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XW2Tc-0003Qp-82 for qemu-devel@nongnu.org; Mon, 22 Sep 2014 08:12:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XW2TV-00086G-O2 for qemu-devel@nongnu.org; Mon, 22 Sep 2014 08:12:20 -0400 Received: from dew.nodalink.com ([95.130.14.197]:59624) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XW2TV-0007zc-I9 for qemu-devel@nongnu.org; Mon, 22 Sep 2014 08:12:13 -0400 Date: Mon, 22 Sep 2014 12:05:56 +0000 From: =?iso-8859-1?Q?Beno=EEt?= Canet Message-ID: <20140922120556.GA20345@nodalink.com> References: <1410891148-28849-1-git-send-email-armbru@redhat.com> <1410891148-28849-21-git-send-email-armbru@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1410891148-28849-21-git-send-email-armbru@redhat.com> Subject: Re: [Qemu-devel] [PATCH v3 20/23] block/qapi: Convert qmp_query_block() to BlockBackend List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: kwolf@redhat.com, famz@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com, stefanha@redhat.com, benoit.canet@nodalink.com On Tue, Sep 16, 2014 at 08:12:25PM +0200, Markus Armbruster wrote: > Much more command code needs conversion. I start with this one > because it's using bdrv_dev_* functions, which I'm about to lift into > BlockBackend. > > While there, give bdrv_query_info() internal linkage. > > Signed-off-by: Markus Armbruster > --- > block/qapi.c | 15 ++++++++------- > include/block/qapi.h | 3 --- > 2 files changed, 8 insertions(+), 10 deletions(-) > > diff --git a/block/qapi.c b/block/qapi.c > index d071ee5..fca981d 100644 > --- a/block/qapi.c > +++ b/block/qapi.c > @@ -28,6 +28,7 @@ > #include "qapi-visit.h" > #include "qapi/qmp-output-visitor.h" > #include "qapi/qmp/types.h" > +#include "sysemu/block-backend.h" > #ifdef __linux__ > #include > #include > @@ -264,15 +265,15 @@ void bdrv_query_image_info(BlockDriverState *bs, > } > > /* @p_info will be set only on success. */ > -void bdrv_query_info(BlockDriverState *bs, > - BlockInfo **p_info, > - Error **errp) > +static void bdrv_query_info(BlockBackend *blk, BlockInfo **p_info, > + Error **errp) > { > BlockInfo *info = g_malloc0(sizeof(*info)); > + BlockDriverState *bs = blk_bs(blk); > BlockDriverState *bs0; > ImageInfo **p_image_info; > Error *local_err = NULL; > - info->device = g_strdup(bdrv_get_device_name(bs)); > + info->device = g_strdup(blk_name(blk)); > info->type = g_strdup("unknown"); > info->locked = bdrv_dev_is_medium_locked(bs); > info->removable = bdrv_dev_has_removable_media(bs); > @@ -360,12 +361,12 @@ static BlockStats *bdrv_query_stats(const BlockDriverState *bs) > BlockInfoList *qmp_query_block(Error **errp) > { > BlockInfoList *head = NULL, **p_next = &head; > - BlockDriverState *bs = NULL; > + BlockBackend *blk; > Error *local_err = NULL; > > - while ((bs = bdrv_next(bs))) { > + for (blk = blk_next(NULL); blk; blk = blk_next(blk)) { > BlockInfoList *info = g_malloc0(sizeof(*info)); > - bdrv_query_info(bs, &info->value, &local_err); > + bdrv_query_info(blk, &info->value, &local_err); > if (local_err) { > error_propagate(errp, local_err); > goto err; > diff --git a/include/block/qapi.h b/include/block/qapi.h > index 0374546..168d788 100644 > --- a/include/block/qapi.h > +++ b/include/block/qapi.h > @@ -36,9 +36,6 @@ int bdrv_query_snapshot_info_list(BlockDriverState *bs, > void bdrv_query_image_info(BlockDriverState *bs, > ImageInfo **p_info, > Error **errp); > -void bdrv_query_info(BlockDriverState *bs, > - BlockInfo **p_info, > - Error **errp); > > void bdrv_snapshot_dump(fprintf_function func_fprintf, void *f, > QEMUSnapshotInfo *sn); > -- > 1.9.3 > Reviewed-by: Benoit Canet