mirror of
https://git.proxmox.com/git/qemu
synced 2025-08-13 18:59:27 +00:00
vpc: Implement .bdrv_has_zero_init
Depending on the subformat, has_zero_init on VHD must behave like raw and query the underlying storage (fixed) or like other sparse formats that can always return 1 (dynamic, differencing). Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
8ed610a1c9
commit
72c6cc94da
13
block/vpc.c
13
block/vpc.c
@ -786,6 +786,18 @@ static int vpc_create(const char *filename, QEMUOptionParameter *options)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int vpc_has_zero_init(BlockDriverState *bs)
|
||||||
|
{
|
||||||
|
BDRVVPCState *s = bs->opaque;
|
||||||
|
struct vhd_footer *footer = (struct vhd_footer *) s->footer_buf;
|
||||||
|
|
||||||
|
if (cpu_to_be32(footer->type) == VHD_FIXED) {
|
||||||
|
return bdrv_has_zero_init(bs->file);
|
||||||
|
} else {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void vpc_close(BlockDriverState *bs)
|
static void vpc_close(BlockDriverState *bs)
|
||||||
{
|
{
|
||||||
BDRVVPCState *s = bs->opaque;
|
BDRVVPCState *s = bs->opaque;
|
||||||
@ -828,6 +840,7 @@ static BlockDriver bdrv_vpc = {
|
|||||||
.bdrv_write = vpc_co_write,
|
.bdrv_write = vpc_co_write,
|
||||||
|
|
||||||
.create_options = vpc_create_options,
|
.create_options = vpc_create_options,
|
||||||
|
.bdrv_has_zero_init = vpc_has_zero_init,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void bdrv_vpc_init(void)
|
static void bdrv_vpc_init(void)
|
||||||
|
Loading…
Reference in New Issue
Block a user