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

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

Comments

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

Patch

diff --git a/block.c b/block.c
index 86a4752..0f38aff 100644
--- a/block.c
+++ b/block.c
@@ -3105,3 +3105,15 @@  int bdrv_map(BlockDriverState *bs, uint64_t *guest_offset,
     return drv->bdrv_map(bs, guest_offset, host_offset,
         contiguous_bytes);
 }
+
+int bdrv_copy_header(BlockDriverState *bs)
+{
+    BlockDriver *drv = bs->drv;
+    if (!drv) {
+        return -ENOMEDIUM;
+    }
+    if (!drv->bdrv_copy_header) {
+        return -ENOTSUP;
+    }
+    return drv->bdrv_copy_header(bs);
+}
diff --git a/block.h b/block.h
index baf6f10..169866c 100644
--- a/block.h
+++ b/block.h
@@ -259,6 +259,8 @@  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);
+int bdrv_copy_header(BlockDriverState *bs);
+
 typedef enum {
     BLKDBG_L1_UPDATE,