From: Max Reitz <mreitz@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Fam Zheng <famz@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Max Reitz <mreitz@redhat.com>
Subject: [Qemu-devel] [PATCH v5 2/6] block: Add bdrv_get_specific_info
Date: Mon, 23 Sep 2013 14:09:18 +0200 [thread overview]
Message-ID: <1379938162-14005-3-git-send-email-mreitz@redhat.com> (raw)
In-Reply-To: <1379938162-14005-1-git-send-email-mreitz@redhat.com>
Add a function for retrieving an ImageInfoSpecific object from a block
driver.
Signed-off-by: Max Reitz <mreitz@redhat.com>
---
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);
--
1.8.3.1
next prev parent reply other threads:[~2013-09-23 12:09 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-23 12:09 [Qemu-devel] [PATCH v5 0/6] Provide additional info through qemu-img info Max Reitz
2013-09-23 12:09 ` [Qemu-devel] [PATCH v5 1/6] qapi: Add ImageInfoSpecific type Max Reitz
2013-09-30 16:04 ` Eric Blake
2013-09-23 12:09 ` Max Reitz [this message]
2013-09-30 16:09 ` [Qemu-devel] [PATCH v5 2/6] block: Add bdrv_get_specific_info Eric Blake
2013-09-23 12:09 ` [Qemu-devel] [PATCH v5 3/6] block/qapi: Human-readable ImageInfoSpecific dump Max Reitz
2013-09-30 16:18 ` Eric Blake
2013-09-23 12:09 ` [Qemu-devel] [PATCH v5 4/6] qcow2: Add support for ImageInfoSpecific Max Reitz
2013-09-30 16:25 ` Eric Blake
2013-09-23 12:09 ` [Qemu-devel] [PATCH v5 5/6] qemu-iotests: Discard specific info in _img_info Max Reitz
2013-09-30 17:14 ` Eric Blake
2013-10-01 8:25 ` Max Reitz
2013-09-23 12:09 ` [Qemu-devel] [PATCH v5 6/6] qemu-iotests: Additional info from qemu-img info Max Reitz
2013-09-30 17:19 ` Eric Blake
2013-10-01 9:19 ` Max Reitz
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=1379938162-14005-3-git-send-email-mreitz@redhat.com \
--to=mreitz@redhat.com \
--cc=famz@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.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).