summaryrefslogtreecommitdiff
path: root/block/raw-format.c
diff options
context:
space:
mode:
authorMax Reitz <mreitz@redhat.com>2019-07-24 19:12:32 +0200
committerMax Reitz <mreitz@redhat.com>2019-08-19 17:13:26 +0200
commit1dcaf52760ccaa2e019164c887b8436ac6c5d8ea (patch)
tree51e70c5a585d2f3f6062719d843cdf00d9e573c3 /block/raw-format.c
parentceaca56feee6a1d682c882300855cad44a67ec8e (diff)
downloadqemu-1dcaf52760ccaa2e019164c887b8436ac6c5d8ea.zip
block: Implement .bdrv_has_zero_init_truncate()
We need to implement .bdrv_has_zero_init_truncate() for every block driver that supports truncation and has a .bdrv_has_zero_init() implementation. Implement it the same way each driver implements .bdrv_has_zero_init(). This is at least not any more unsafe than what we had before. Signed-off-by: Max Reitz <mreitz@redhat.com> Message-id: 20190724171239.8764-5-mreitz@redhat.com Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'block/raw-format.c')
-rw-r--r--block/raw-format.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/block/raw-format.c b/block/raw-format.c
index bffd424dd0..42c28cc29a 100644
--- a/block/raw-format.c
+++ b/block/raw-format.c
@@ -413,6 +413,11 @@ static int raw_has_zero_init(BlockDriverState *bs)
return bdrv_has_zero_init(bs->file->bs);
}
+static int raw_has_zero_init_truncate(BlockDriverState *bs)
+{
+ return bdrv_has_zero_init_truncate(bs->file->bs);
+}
+
static int coroutine_fn raw_co_create_opts(const char *filename, QemuOpts *opts,
Error **errp)
{
@@ -572,6 +577,7 @@ BlockDriver bdrv_raw = {
.bdrv_co_ioctl = &raw_co_ioctl,
.create_opts = &raw_create_opts,
.bdrv_has_zero_init = &raw_has_zero_init,
+ .bdrv_has_zero_init_truncate = &raw_has_zero_init_truncate,
.strong_runtime_opts = raw_strong_runtime_opts,
.mutable_opts = mutable_opts,
};