[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 05/61] block: Add bdrv_get_specific_info
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL 05/61] block: Add bdrv_get_specific_info |
Date: |
Fri, 11 Oct 2013 17:04:55 +0200 |
From: Max Reitz <address@hidden>
Add a function for retrieving an ImageInfoSpecific object from a block
driver.
Signed-off-by: Max Reitz <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
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 d7ca37e..43acaad 100644
--- a/block.c
+++ b/block.c
@@ -3322,6 +3322,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 211087a..17b26b2 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -168,6 +168,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.1.4
- [Qemu-devel] [PULL 00/61] Block patches, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 01/61] blockjob: rename BlockJobType to BlockJobDriver, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 02/61] qapi: Introduce enum BlockJobType, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 03/61] qapi: make use of new BlockJobType, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 04/61] qapi: Add ImageInfoSpecific type, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 05/61] block: Add bdrv_get_specific_info,
Kevin Wolf <=
- [Qemu-devel] [PULL 06/61] block/qapi: Human-readable ImageInfoSpecific dump, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 07/61] qcow2: Add support for ImageInfoSpecific, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 09/61] qemu-iotests: Additional info from qemu-img info, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 10/61] qcow2: Alignment of snapshot table entries, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 08/61] qemu-iotests: Discard specific info in _img_info, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 11/61] qcow2: Use pread for inactive L1 in overlap check, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 12/61] qcow2: Free preallocated zero clusters, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 13/61] qcow2: Always use error path on writing snapshots, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 14/61] qcow2: Free allocated snapshot table on error, Kevin Wolf, 2013/10/11
- [Qemu-devel] [PULL 16/61] block/get_block_status: avoid redundant callouts on raw devices, Kevin Wolf, 2013/10/11