Patchwork [v2,3/5] block: add bdrv_get_mapping()

login
register
mail settings
Submitter Devin Nakamura
Date July 11, 2011, 7:55 p.m.
Message ID <1310414150-4344-1-git-send-email-devin122@gmail.com>
Download mbox | patch
Permalink /patch/104278/
State New
Headers show

Comments

Devin Nakamura - July 11, 2011, 7:55 p.m.
Signed-off-by: Devin Nakamura <devin122@gmail.com>
---
 block.c |   14 ++++++++++++++
 block.h |    2 ++
 2 files changed, 16 insertions(+), 0 deletions(-)
Kevin Wolf - July 13, 2011, 10:35 a.m.
Am 11.07.2011 21:55, schrieb Devin Nakamura:
> Signed-off-by: Devin Nakamura <devin122@gmail.com>
> ---
>  block.c |   14 ++++++++++++++
>  block.h |    2 ++
>  2 files changed, 16 insertions(+), 0 deletions(-)

I only received patches 3-5 for v2, the first two seem to be missing.

Kevin

Patch

diff --git a/block.c b/block.c
index 97d5a6b..3874ed5 100644
--- a/block.c
+++ b/block.c
@@ -3037,3 +3037,17 @@  int bdrv_open_conversion_target(BlockDriverState **bs,
     (*bs)->opaque = qemu_malloc(drv->instance_size);
     return drv->bdrv_open_conversion_target(*bs, filename, options);
 }
+
+int bdrv_get_mapping(BlockDriverState *bs, uint64_t *guest_offset,
+                     uint64_t *host_offset, uint64_t *contiguous_bytes)
+{
+    BlockDriver *drv = bs->drv;
+    if (!drv) {
+        return -ENOMEDIUM;
+    }
+    if (!drv->bdrv_get_mapping) {
+        return -ENOTSUP;
+    }
+    return drv->bdrv_get_mapping(bs, guest_offset, host_offset,
+        contiguous_bytes);
+}
diff --git a/block.h b/block.h
index da87afb..8207389 100644
--- a/block.h
+++ b/block.h
@@ -252,6 +252,8 @@  int bdrv_in_use(BlockDriverState *bs);
 
 int bdrv_open_conversion_target(BlockDriverState **bs, char *filename,
                                 char *target_fmt, QEMUOptionParameter *options);
+int bdrv_get_mapping(BlockDriverState *bs, uint64_t *guest_offset,
+                     uint64_t *host_offset, uint64_t *contiguous_bytes);
 typedef enum {
     BLKDBG_L1_UPDATE,