From f2feebbd93c251ec0098a9ccf808f7cb1da7f67c Mon Sep 17 00:00:00 2001 From: Kevin Wolf Date: Wed, 14 Apr 2010 17:30:35 +0200 Subject: block: bdrv_has_zero_init This fixes the problem that qemu-img's use of no_zero_init only considered the no_zero_init flag of the format driver, but not of the underlying protocols. Between the raw/file split and this fix, converting to host devices is broken. Signed-off-by: Kevin Wolf --- block.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'block.c') diff --git a/block.c b/block.c index eb1d562..56835af 100644 --- a/block.c +++ b/block.c @@ -1282,6 +1282,19 @@ void bdrv_flush_all(void) } } +int bdrv_has_zero_init(BlockDriverState *bs) +{ + assert(bs->drv); + + if (bs->drv->no_zero_init) { + return 0; + } else if (bs->file) { + return bdrv_has_zero_init(bs->file); + } + + return 1; +} + /* * Returns true iff the specified sector is present in the disk image. Drivers * not implementing the functionality are assumed to not support backing files, -- cgit v1.1