aboutsummaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-04-05 21:07:26 +0000
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-04-05 21:07:26 +0000
commit8d47bb6162148e601a5700c08d5feaeec5047026 (patch)
treeb07e0e985b8263beda4813e4215b974d76189b81 /block.c
parent80acab6c50a591e1c0aaa43d14f4c3ae4f9f23b2 (diff)
Fix savevm after BDRV_FILE size enforcement
We now enforce that you cannot write beyond the end of a non-growable file. qcow2 files are not growable but we rely on them being growable to do savevm/loadvm. Temporarily allow them to be growable by introducing a new API specifically for savevm read/write operations. Reported-by: malc Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/branches/stable_0_10@7005 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'block.c')
-rw-r--r--block.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/block.c b/block.c
index bcd8431f1e..3f262fa590 100644
--- a/block.c
+++ b/block.c
@@ -1181,6 +1181,26 @@ int bdrv_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
return drv->bdrv_get_info(bs, bdi);
}
+int bdrv_put_buffer(BlockDriverState *bs, const uint8_t *buf, int64_t pos, int size)
+{
+ BlockDriver *drv = bs->drv;
+ if (!drv)
+ return -ENOMEDIUM;
+ if (!drv->bdrv_put_buffer)
+ return -ENOTSUP;
+ return drv->bdrv_put_buffer(bs, buf, pos, size);
+}
+
+int bdrv_get_buffer(BlockDriverState *bs, uint8_t *buf, int64_t pos, int size)
+{
+ BlockDriver *drv = bs->drv;
+ if (!drv)
+ return -ENOMEDIUM;
+ if (!drv->bdrv_get_buffer)
+ return -ENOTSUP;
+ return drv->bdrv_get_buffer(bs, buf, pos, size);
+}
+
/**************************************************************/
/* handling of snapshots */