qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, jsnow@redhat.com, vsementsov@virtuozzo.com,
	Markus Armbruster <armbru@redhat.com>,
	Max Reitz <mreitz@redhat.com>,
	"open list:Block layer core" <qemu-block@nongnu.org>
Subject: [Qemu-devel] [PATCH 1/3] block: Expose protocol-specific data to 'qemu-img info'
Date: Thu, 17 Jan 2019 09:33:19 -0600	[thread overview]
Message-ID: <20190117153321.29749-2-eblake@redhat.com> (raw)
In-Reply-To: <20190117153321.29749-1-eblake@redhat.com>

'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 <eblake@redhat.com>
---
 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     = bdrv_get_specific_info(bs);
     info->has_format_specific = info->format_specific != NULL;
+    info->protocol_specific =
+        bs->file ? bdrv_get_specific_info(bs->file->bs) : NULL;
+    info->has_protocol_specific = info->protocol_specific != NULL;

     backing_filename = bs->backing_file;
     if (backing_filename[0] != '\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_specific);
     }
+    if (info->has_protocol_specific) {
+        func_fprintf(f, "Protocol specific information:\n");
+        bdrv_image_info_specific_dump(func_fprintf, f, info->protocol_specific);
+    }
 }
-- 
2.20.1

  reply	other threads:[~2019-01-17 15:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-17 15:33 [Qemu-devel] [RFC PATCH 0/3] Expand 'qemu-img info' to show protocol details Eric Blake
2019-01-17 15:33 ` Eric Blake [this message]
2019-01-17 16:39   ` [Qemu-devel] [PATCH 1/3] block: Expose protocol-specific data to 'qemu-img info' Kevin Wolf
2019-01-17 17:46     ` Eric Blake
2019-01-18 14:20   ` Vladimir Sementsov-Ogievskiy
2019-01-17 15:33 ` [Qemu-devel] [PATCH 2/3] file: Expose some protocol-specific information Eric Blake
2019-01-18 14:08   ` Vladimir Sementsov-Ogievskiy
2019-01-18 16:15     ` Eric Blake
2019-01-17 15:33 ` [Qemu-devel] [PATCH 3/3] RFC: nbd: Expose " Eric Blake
2019-01-17 16:06 ` [Qemu-devel] [RFC PATCH 0/3] Expand 'qemu-img info' to show protocol details Daniel P. Berrangé
2019-01-17 16:15   ` Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190117153321.29749-2-eblake@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).