From nobody Sun Oct 5 21:12:42 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1547739532325217.07721447081622; Thu, 17 Jan 2019 07:38:52 -0800 (PST) Received: from localhost ([127.0.0.1]:46739 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gk9kp-0004xS-4z for importer@patchew.org; Thu, 17 Jan 2019 10:38:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38759) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gk9ft-00016t-Go for qemu-devel@nongnu.org; Thu, 17 Jan 2019 10:33:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gk9fs-0005TZ-Lh for qemu-devel@nongnu.org; Thu, 17 Jan 2019 10:33:45 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41070) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gk9fn-0004s2-Iu; Thu, 17 Jan 2019 10:33:41 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 83DD08E3E7; Thu, 17 Jan 2019 15:33:26 +0000 (UTC) Received: from blue.redhat.com (ovpn-116-153.phx2.redhat.com [10.3.116.153]) by smtp.corp.redhat.com (Postfix) with ESMTP id CA7C817264; Thu, 17 Jan 2019 15:33:25 +0000 (UTC) From: Eric Blake To: qemu-devel@nongnu.org Date: Thu, 17 Jan 2019 09:33:19 -0600 Message-Id: <20190117153321.29749-2-eblake@redhat.com> In-Reply-To: <20190117153321.29749-1-eblake@redhat.com> References: <20190117153321.29749-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 17 Jan 2019 15:33:26 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 1/3] block: Expose protocol-specific data to 'qemu-img info' X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, vsementsov@virtuozzo.com, "open list:Block layer core" , Markus Armbruster , Max Reitz , jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" 'qemu-img info' is useful for showing additional information about an image - but sometimes the interesting information is specific to the protocol rather than to the format layer. Set the groundwork for showing this information; further patches will then enable specific pieces of information. Signed-off-by: Eric Blake --- qapi/block-core.json | 6 +++++- block/qapi.c | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/qapi/block-core.json b/qapi/block-core.json index 91685be6c29..f28d5f5fc76 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -152,6 +152,9 @@ # @format-specific: structure supplying additional format-specific # information (since 1.7) # +# @protocol-specific: structure supplying additional protocol-specific +# information (since 4.0) +# # Since: 1.3 # ## @@ -162,7 +165,8 @@ '*backing-filename': 'str', '*full-backing-filename': 'str', '*backing-filename-format': 'str', '*snapshots': ['SnapshotInfo= '], '*backing-image': 'ImageInfo', - '*format-specific': 'ImageInfoSpecific' } } + '*format-specific': 'ImageInfoSpecific', + '*protocol-specific': 'ImageInfoSpecific' } } ## # @ImageCheck: diff --git a/block/qapi.c b/block/qapi.c index c66f949db83..a8d104ba8ce 100644 --- a/block/qapi.c +++ b/block/qapi.c @@ -284,6 +284,9 @@ void bdrv_query_image_info(BlockDriverState *bs, } info->format_specific =3D bdrv_get_specific_info(bs); info->has_format_specific =3D info->format_specific !=3D NULL; + info->protocol_specific =3D + bs->file ? bdrv_get_specific_info(bs->file->bs) : NULL; + info->has_protocol_specific =3D info->protocol_specific !=3D NULL; backing_filename =3D bs->backing_file; if (backing_filename[0] !=3D '\0') { @@ -870,4 +873,8 @@ void bdrv_image_info_dump(fprintf_function func_fprintf= , void *f, func_fprintf(f, "Format specific information:\n"); bdrv_image_info_specific_dump(func_fprintf, f, info->format_specif= ic); } + if (info->has_protocol_specific) { + func_fprintf(f, "Protocol specific information:\n"); + bdrv_image_info_specific_dump(func_fprintf, f, info->protocol_spec= ific); + } } --=20 2.20.1