Revision 6eea90eb block/vdi.c
b/block/vdi.c | ||
---|---|---|
437 | 437 |
s->header = header; |
438 | 438 |
|
439 | 439 |
bmap_size = header.blocks_in_image * sizeof(uint32_t); |
440 |
s->bmap = qemu_malloc(bmap_size);
|
|
441 |
if (bdrv_read(s->hd, s->bmap_sector,
|
|
442 |
(uint8_t *)s->bmap, bmap_size / SECTOR_SIZE) < 0) {
|
|
440 |
bmap_size = (bmap_size + SECTOR_SIZE - 1) / SECTOR_SIZE;
|
|
441 |
s->bmap = qemu_malloc(bmap_size * SECTOR_SIZE);
|
|
442 |
if (bdrv_read(s->hd, s->bmap_sector, (uint8_t *)s->bmap, bmap_size) < 0) {
|
|
443 | 443 |
goto fail_free_bmap; |
444 | 444 |
} |
445 | 445 |
|
... | ... | |
817 | 817 |
#endif |
818 | 818 |
#if defined(CONFIG_VDI_STATIC_IMAGE) |
819 | 819 |
} else if (!strcmp(options->name, BLOCK_OPT_STATIC)) { |
820 |
image_type = VDI_TYPE_STATIC; |
|
820 |
if (options->value.n) { |
|
821 |
image_type = VDI_TYPE_STATIC; |
|
822 |
} |
|
821 | 823 |
#endif |
822 | 824 |
} |
823 | 825 |
options++; |
... | ... | |
845 | 847 |
header.disk_size = bytes; |
846 | 848 |
header.block_size = block_size; |
847 | 849 |
header.blocks_in_image = blocks; |
850 |
if (image_type == VDI_TYPE_STATIC) { |
|
851 |
header.blocks_allocated = blocks; |
|
852 |
} |
|
848 | 853 |
uuid_generate(header.uuid_image); |
849 | 854 |
uuid_generate(header.uuid_last_snap); |
850 | 855 |
/* There is no need to set header.uuid_link or header.uuid_parent here. */ |
Also available in: Unified diff