summaryrefslogtreecommitdiffstats
path: root/block-qcow2.c
diff options
context:
space:
mode:
Diffstat (limited to 'block-qcow2.c')
-rw-r--r--block-qcow2.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/block-qcow2.c b/block-qcow2.c
index d99811d..6eba524 100644
--- a/block-qcow2.c
+++ b/block-qcow2.c
@@ -2721,6 +2721,31 @@ static void dump_refcounts(BlockDriverState *bs)
#endif
#endif
+static int qcow_put_buffer(BlockDriverState *bs, const uint8_t *buf,
+ int64_t pos, int size)
+{
+ int growable = bs->growable;
+
+ bs->growable = 1;
+ bdrv_pwrite(bs, pos, buf, size);
+ bs->growable = growable;
+
+ return size;
+}
+
+static int qcow_get_buffer(BlockDriverState *bs, uint8_t *buf,
+ int64_t pos, int size)
+{
+ int growable = bs->growable;
+ int ret;
+
+ bs->growable = 1;
+ ret = bdrv_pread(bs, pos, buf, size);
+ bs->growable = growable;
+
+ return ret;
+}
+
BlockDriver bdrv_qcow2 = {
.format_name = "qcow2",
.instance_size = sizeof(BDRVQcowState),
@@ -2745,5 +2770,8 @@ BlockDriver bdrv_qcow2 = {
.bdrv_snapshot_list = qcow_snapshot_list,
.bdrv_get_info = qcow_get_info,
+ .bdrv_put_buffer = qcow_put_buffer,
+ .bdrv_get_buffer = qcow_get_buffer,
+
.bdrv_create2 = qcow_create2,
};
OpenPOWER on IntegriCloud