]> git.proxmox.com Git - qemu.git/commitdiff
block: Add bdrv_get_specific_info
authorMax Reitz <mreitz@redhat.com>
Wed, 9 Oct 2013 08:46:16 +0000 (10:46 +0200)
committerKevin Wolf <kwolf@redhat.com>
Fri, 11 Oct 2013 08:52:54 +0000 (10:52 +0200)
Add a function for retrieving an ImageInfoSpecific object from a block
driver.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block.c
block/qapi.c
include/block/block.h
include/block/block_int.h

diff --git a/block.c b/block.c
index d7ca37e6adb33cbb32141e7e838fb25979ef82bf..43acaadbcec2b2f470cfbf41fc20044a2826287d 100644 (file)
--- 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)
 {
index 782051c65d1bed484ca6c38d7bb207ee1e9e9623..ab1dd24b765f21d7b0f8cc1bc6035acc30eaf80a 100644 (file)
@@ -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);
index f808550959cbb4b1488966ed307b9b97ce1d6d9c..e26512472d62e0a0d54cf981f186e74ade989c26 100644 (file)
@@ -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,
index 211087aa9170f8f9a583877360391c16c2715b9b..17b26b2a9fbaa39255c1e6fb076020c216b989ab 100644 (file)
@@ -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);