aboutsummaryrefslogtreecommitdiff
path: root/block/vmdk.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2011-08-20 22:09:37 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2011-08-20 23:01:08 -0500
commit7267c0947d7e8ae5dff7bafd932c3bc285f43e5c (patch)
tree9aa05d6e05ed83e67bf014f6745a3081b8407dc5 /block/vmdk.c
parent14015304b662e8f8ccce46c5a6927af6a14c510b (diff)
Use glib memory allocation and free functions
qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'block/vmdk.c')
-rw-r--r--block/vmdk.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/block/vmdk.c b/block/vmdk.c
index 37478d2553..8da87acef0 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -167,11 +167,11 @@ static void vmdk_free_extents(BlockDriverState *bs)
BDRVVmdkState *s = bs->opaque;
for (i = 0; i < s->num_extents; i++) {
- qemu_free(s->extents[i].l1_table);
- qemu_free(s->extents[i].l2_cache);
- qemu_free(s->extents[i].l1_backup_table);
+ g_free(s->extents[i].l1_table);
+ g_free(s->extents[i].l2_cache);
+ g_free(s->extents[i].l1_backup_table);
}
- qemu_free(s->extents);
+ g_free(s->extents);
}
static uint32_t vmdk_read_cid(BlockDriverState *bs, int parent)
@@ -289,7 +289,7 @@ static VmdkExtent *vmdk_add_extent(BlockDriverState *bs,
VmdkExtent *extent;
BDRVVmdkState *s = bs->opaque;
- s->extents = qemu_realloc(s->extents,
+ s->extents = g_realloc(s->extents,
(s->num_extents + 1) * sizeof(VmdkExtent));
extent = &s->extents[s->num_extents];
s->num_extents++;
@@ -321,7 +321,7 @@ static int vmdk_init_tables(BlockDriverState *bs, VmdkExtent *extent)
/* read the L1 table */
l1_size = extent->l1_size * sizeof(uint32_t);
- extent->l1_table = qemu_malloc(l1_size);
+ extent->l1_table = g_malloc(l1_size);
ret = bdrv_pread(extent->file,
extent->l1_table_offset,
extent->l1_table,
@@ -334,7 +334,7 @@ static int vmdk_init_tables(BlockDriverState *bs, VmdkExtent *extent)
}
if (extent->l1_backup_table_offset) {
- extent->l1_backup_table = qemu_malloc(l1_size);
+ extent->l1_backup_table = g_malloc(l1_size);
ret = bdrv_pread(extent->file,
extent->l1_backup_table_offset,
extent->l1_backup_table,
@@ -348,12 +348,12 @@ static int vmdk_init_tables(BlockDriverState *bs, VmdkExtent *extent)
}
extent->l2_cache =
- qemu_malloc(extent->l2_size * L2_CACHE_SIZE * sizeof(uint32_t));
+ g_malloc(extent->l2_size * L2_CACHE_SIZE * sizeof(uint32_t));
return 0;
fail_l1b:
- qemu_free(extent->l1_backup_table);
+ g_free(extent->l1_backup_table);
fail_l1:
- qemu_free(extent->l1_table);
+ g_free(extent->l1_table);
return ret;
}
@@ -564,7 +564,7 @@ static int vmdk_open_desc_file(BlockDriverState *bs, int flags)
/* try to open parent images, if exist */
if (vmdk_parent_open(bs)) {
- qemu_free(s->extents);
+ g_free(s->extents);
return -EINVAL;
}
s->parent_cid = vmdk_read_cid(bs, 1);