aboutsummaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2009-07-28 19:49:49 +0300
committerAvi Kivity <avi@redhat.com>2009-07-28 19:49:49 +0300
commitb8b9ff0a00f98f385d9414bbc239b1996bd649e2 (patch)
tree40afaf1a14d8e3d2af0d62851b14e830010ab1f1 /block
parentRegenerate bios for multiple smbios calls fix (diff)
parentFix non-ACPI Timer Interrupt Routing - v3 (diff)
downloadqemu-kvm-b8b9ff0a00f98f385d9414bbc239b1996bd649e2.tar.gz
qemu-kvm-b8b9ff0a00f98f385d9414bbc239b1996bd649e2.tar.bz2
qemu-kvm-b8b9ff0a00f98f385d9414bbc239b1996bd649e2.zip
Merge commit 'b8c0e7d7c4e9fe3ec00757053a33605eda1c5ac4' into upstream-merge
* commit 'b8c0e7d7c4e9fe3ec00757053a33605eda1c5ac4': Fix non-ACPI Timer Interrupt Routing - v3 pci.c: remove unnecessary #ifdef DEBUG_PCI. replace bdrv_{get, put}_buffer with bdrv_{load, save}_vmstate Conflicts: pc-bios/bios.bin (dropped) Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'block')
-rw-r--r--block/qcow2.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/block/qcow2.c b/block/qcow2.c
index be507e7a9..a5bf20522 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -890,12 +890,16 @@ static void qcow_flush(BlockDriverState *bs)
bdrv_flush(s->hd);
}
+static int64_t qcow_vm_state_offset(BDRVQcowState *s)
+{
+ return (int64_t)s->l1_vm_state_index << (s->cluster_bits + s->l2_bits);
+}
+
static int qcow_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
{
BDRVQcowState *s = bs->opaque;
bdi->cluster_size = s->cluster_size;
- bdi->vm_state_offset = (int64_t)s->l1_vm_state_index <<
- (s->cluster_bits + s->l2_bits);
+ bdi->vm_state_offset = qcow_vm_state_offset(s);
return 0;
}
@@ -925,26 +929,28 @@ static void dump_refcounts(BlockDriverState *bs)
}
#endif
-static int qcow_put_buffer(BlockDriverState *bs, const uint8_t *buf,
+static int qcow_save_vmstate(BlockDriverState *bs, const uint8_t *buf,
int64_t pos, int size)
{
+ BDRVQcowState *s = bs->opaque;
int growable = bs->growable;
bs->growable = 1;
- bdrv_pwrite(bs, pos, buf, size);
+ bdrv_pwrite(bs, qcow_vm_state_offset(s) + pos, buf, size);
bs->growable = growable;
return size;
}
-static int qcow_get_buffer(BlockDriverState *bs, uint8_t *buf,
+static int qcow_load_vmstate(BlockDriverState *bs, uint8_t *buf,
int64_t pos, int size)
{
+ BDRVQcowState *s = bs->opaque;
int growable = bs->growable;
int ret;
bs->growable = 1;
- ret = bdrv_pread(bs, pos, buf, size);
+ ret = bdrv_pread(bs, qcow_vm_state_offset(s) + pos, buf, size);
bs->growable = growable;
return ret;
@@ -1001,8 +1007,8 @@ static BlockDriver bdrv_qcow2 = {
.bdrv_snapshot_list = qcow2_snapshot_list,
.bdrv_get_info = qcow_get_info,
- .bdrv_put_buffer = qcow_put_buffer,
- .bdrv_get_buffer = qcow_get_buffer,
+ .bdrv_save_vmstate = qcow_save_vmstate,
+ .bdrv_load_vmstate = qcow_load_vmstate,
.create_options = qcow_create_options,
.bdrv_check = qcow_check,