aboutsummaryrefslogtreecommitdiff
path: root/block-vmdk.c
diff options
context:
space:
mode:
authorths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-09-10 00:07:46 +0000
committerths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-09-10 00:07:46 +0000
commit49140a7748a6e8095cd93f2f58e33a9a8c78167b (patch)
tree336c55cb492e90de5b93958ec129a87fc2358f1d /block-vmdk.c
parent117b3ae6e6d27ea31e85ffe1820437d91269ed4e (diff)
Fix VMDK 2GB bug, by Filip Navara.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3158 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'block-vmdk.c')
-rw-r--r--block-vmdk.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/block-vmdk.c b/block-vmdk.c
index 0d3a804c43..35b6646d47 100644
--- a/block-vmdk.c
+++ b/block-vmdk.c
@@ -520,7 +520,6 @@ static uint64_t get_cluster_offset(BlockDriverState *bs, VmdkMetaData *m_data,
int min_index, i, j;
uint32_t min_count, *l2_table, tmp = 0;
uint64_t cluster_offset;
- int status;
if (m_data)
m_data->valid = 0;
@@ -564,19 +563,11 @@ static uint64_t get_cluster_offset(BlockDriverState *bs, VmdkMetaData *m_data,
cluster_offset = le32_to_cpu(l2_table[l2_index]);
if (!cluster_offset) {
- struct stat file_buf;
-
if (!allocate)
return 0;
// Avoid the L2 tables update for the images that have snapshots.
if (!s->is_parent) {
- status = stat(s->hd->filename, &file_buf);
- if (status == -1) {
- fprintf(stderr, "(VMDK) Fail file stat: filename =%s size=0x%llx errno=%s\n",
- s->hd->filename, (uint64_t)file_buf.st_size, strerror(errno));
- return 0;
- }
- cluster_offset = file_buf.st_size;
+ cluster_offset = bdrv_getlength(s->hd);
bdrv_truncate(s->hd, cluster_offset + (s->cluster_sectors << 9));
cluster_offset >>= 9;