summaryrefslogtreecommitdiffstats
path: root/block.c
diff options
context:
space:
mode:
authorManuel Bentele2020-10-07 10:51:06 +0200
committerManuel Bentele2022-12-07 15:51:14 +0100
commita1f0676733467957c47b2a18c0c9929fd71b613d (patch)
tree325a95d516d0625e0ae5da4649cc76fa674ea460 /block.c
parentRevert "hw/loongarch/virt: Add cfi01 pflash device" (diff)
downloadqemu-block_qcow2_cluster_info.tar.gz
qemu-block_qcow2_cluster_info.tar.xz
qemu-block_qcow2_cluster_info.zip
block: Add driver callback to get cluster informationblock_qcow2_cluster_info
Signed-off-by: Manuel Bentele <development@manuel-bentele.de>
Diffstat (limited to 'block.c')
-rw-r--r--block.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/block.c b/block.c
index a18f052374..e73b262871 100644
--- a/block.c
+++ b/block.c
@@ -6304,6 +6304,23 @@ BlockStatsSpecific *bdrv_get_specific_stats(BlockDriverState *bs)
return drv->bdrv_get_specific_stats(bs);
}
+#ifdef CONFIG_BDRV_CLUSTER_INFO
+int bdrv_get_cluster_info(BlockDriverState *bs, uint64_t offset)
+{
+ BlockDriver *drv = bs->drv;
+
+ if (!drv) {
+ return -ENOMEDIUM;
+ }
+
+ if (drv->bdrv_get_cluster_info) {
+ return drv->bdrv_get_cluster_info(bs, offset);
+ }
+
+ return -ENOTSUP;
+}
+#endif
+
void bdrv_debug_event(BlockDriverState *bs, BlkdebugEvent event)
{
IO_CODE();