From 7574183ba60629e5b9201273367d5a2932041a3c Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Sun, 20 Sep 2020 01:46:07 +0300 Subject: [PATCH] Make qemu driver build with QEMU 3.x --- qemu_driver.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/qemu_driver.c b/qemu_driver.c index 8ff7655e..3bcea75e 100644 --- a/qemu_driver.c +++ b/qemu_driver.c @@ -183,7 +183,11 @@ static int vitastor_probe_blocksizes(BlockDriverState *bs, BlockSizes *bsz) return 0; } -static int coroutine_fn vitastor_co_create_opts(BlockDriver *drv, const char *url, QemuOpts *opts, Error **errp) +static int coroutine_fn vitastor_co_create_opts( +#if QEMU_VERSION_MAJOR >= 4 + BlockDriver *drv, +#endif + const char *url, QemuOpts *opts, Error **errp) { QDict *options; int ret; @@ -204,7 +208,11 @@ out: return ret; } -static int coroutine_fn vitastor_co_truncate(BlockDriverState *bs, int64_t offset, bool exact, PreallocMode prealloc, Error **errp) +static int coroutine_fn vitastor_co_truncate(BlockDriverState *bs, int64_t offset, +#if QEMU_VERSION_MAJOR >= 4 + bool exact, +#endif + PreallocMode prealloc, Error **errp) { VitastorClient *client = bs->opaque; @@ -349,7 +357,9 @@ static BlockDriver bdrv_vitastor = { .bdrv_parse_filename = vitastor_parse_filename, .bdrv_has_zero_init = bdrv_has_zero_init_1, +#if QEMU_VERSION_MAJOR >= 4 .bdrv_has_zero_init_truncate = bdrv_has_zero_init_1, +#endif .bdrv_get_info = vitastor_get_info, .bdrv_getlength = vitastor_getlength, .bdrv_probe_blocksizes = vitastor_probe_blocksizes, @@ -377,7 +387,9 @@ static BlockDriver bdrv_vitastor = { .bdrv_co_pwritev = vitastor_co_pwritev, .bdrv_co_flush_to_disk = vitastor_co_flush, +#if QEMU_VERSION_MAJOR >= 4 .strong_runtime_opts = vitastor_strong_runtime_opts, +#endif }; static void vitastor_block_init(void)