Patchwork [v3,5/6] block: add bdrv_map()

login
register
mail settings
Submitter Devin Nakamura
Date July 13, 2011, 12:57 p.m.
Message ID <1310561864-18964-5-git-send-email-devin122@gmail.com>
Download mbox | patch
Permalink /patch/104508/
State New
Headers show

Comments

Devin Nakamura - July 13, 2011, 12:57 p.m.
Signed-off-by: Devin Nakamura <devin122@gmail.com>
---
 block.c |   14 ++++++++++++++
 block.h |    2 ++
 2 files changed, 16 insertions(+), 0 deletions(-)

Patch

diff --git a/block.c b/block.c
index cda600b..86a4752 100644
--- a/block.c
+++ b/block.c
@@ -3091,3 +3091,17 @@  int bdrv_get_mapping(BlockDriverState *bs, uint64_t *guest_offset,
     return drv->bdrv_get_mapping(bs, guest_offset, host_offset,
         contiguous_bytes);
 }
+
+int bdrv_map(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_map) {
+        return -ENOTSUP;
+    }
+    return drv->bdrv_map(bs, guest_offset, host_offset,
+        contiguous_bytes);
+}
diff --git a/block.h b/block.h
index c40223d..baf6f10 100644
--- a/block.h
+++ b/block.h
@@ -257,6 +257,8 @@  int bdrv_open_conversion_target(BlockDriverState **bs, BlockDriverState *file,
                                 const char *target_fmt);
 int bdrv_get_mapping(BlockDriverState *bs, uint64_t *guest_offset,
                      uint64_t *host_offset, uint64_t *contiguous_bytes);
+int bdrv_map(BlockDriverState *bs, uint64_t *guest_offset,
+             uint64_t *host_offset, uint64_t *contiguous_bytes);
 typedef enum {
     BLKDBG_L1_UPDATE,