From patchwork Mon Sep 23 12:09:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Reitz X-Patchwork-Id: 277160 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8E7D52C011A for ; Mon, 23 Sep 2013 22:10:07 +1000 (EST) Received: from localhost ([::1]:40244 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VO4xp-0007PJ-3o for incoming@patchwork.ozlabs.org; Mon, 23 Sep 2013 08:10:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41549) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VO4xL-0007Ms-Mt for qemu-devel@nongnu.org; Mon, 23 Sep 2013 08:09:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VO4xF-0006Tv-Fa for qemu-devel@nongnu.org; Mon, 23 Sep 2013 08:09:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32701) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VO4xF-0006Tk-6h for qemu-devel@nongnu.org; Mon, 23 Sep 2013 08:09:29 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r8NC9Sm6003449 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 23 Sep 2013 08:09:28 -0400 Received: from localhost (dhcp-200-247.str.redhat.com [10.33.200.247]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r8NC9RFx014113 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Mon, 23 Sep 2013 08:09:28 -0400 From: Max Reitz To: qemu-devel@nongnu.org Date: Mon, 23 Sep 2013 14:09:18 +0200 Message-Id: <1379938162-14005-3-git-send-email-mreitz@redhat.com> In-Reply-To: <1379938162-14005-1-git-send-email-mreitz@redhat.com> References: <1379938162-14005-1-git-send-email-mreitz@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Kevin Wolf , Fam Zheng , Stefan Hajnoczi , Max Reitz Subject: [Qemu-devel] [PATCH v5 2/6] block: Add bdrv_get_specific_info X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Add a function for retrieving an ImageInfoSpecific object from a block driver. Signed-off-by: Max Reitz Reviewed-by: Eric Blake --- block.c | 9 +++++++++ block/qapi.c | 3 +++ include/block/block.h | 1 + include/block/block_int.h | 1 + 4 files changed, 14 insertions(+) diff --git a/block.c b/block.c index a2ea39a..4360767 100644 --- a/block.c +++ b/block.c @@ -3340,6 +3340,15 @@ int bdrv_get_info(BlockDriverState *bs, BlockDriverInfo *bdi) return drv->bdrv_get_info(bs, bdi); } +ImageInfoSpecific *bdrv_get_specific_info(BlockDriverState *bs) +{ + BlockDriver *drv = bs->drv; + if (drv && drv->bdrv_get_specific_info) { + return drv->bdrv_get_specific_info(bs); + } + return NULL; +} + int bdrv_save_vmstate(BlockDriverState *bs, const uint8_t *buf, int64_t pos, int size) { diff --git a/block/qapi.c b/block/qapi.c index 782051c..ab1dd24 100644 --- a/block/qapi.c +++ b/block/qapi.c @@ -134,6 +134,9 @@ void bdrv_query_image_info(BlockDriverState *bs, info->dirty_flag = bdi.is_dirty; info->has_dirty_flag = true; } + info->format_specific = bdrv_get_specific_info(bs); + info->has_format_specific = info->format_specific != NULL; + backing_filename = bs->backing_file; if (backing_filename[0] != '\0') { info->backing_filename = g_strdup(backing_filename); diff --git a/include/block/block.h b/include/block/block.h index f808550..e265124 100644 --- a/include/block/block.h +++ b/include/block/block.h @@ -335,6 +335,7 @@ int bdrv_get_flags(BlockDriverState *bs); int bdrv_write_compressed(BlockDriverState *bs, int64_t sector_num, const uint8_t *buf, int nb_sectors); int bdrv_get_info(BlockDriverState *bs, BlockDriverInfo *bdi); +ImageInfoSpecific *bdrv_get_specific_info(BlockDriverState *bs); void bdrv_round_to_clusters(BlockDriverState *bs, int64_t sector_num, int nb_sectors, int64_t *cluster_sector_num, diff --git a/include/block/block_int.h b/include/block/block_int.h index 3eeb6fe..5de5b0e 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -162,6 +162,7 @@ struct BlockDriver { int (*bdrv_snapshot_load_tmp)(BlockDriverState *bs, const char *snapshot_name); int (*bdrv_get_info)(BlockDriverState *bs, BlockDriverInfo *bdi); + ImageInfoSpecific *(*bdrv_get_specific_info)(BlockDriverState *bs); int (*bdrv_save_vmstate)(BlockDriverState *bs, QEMUIOVector *qiov, int64_t pos);