From: Vladimir Sementsov-Ogievskiy Date: Tue, 1 Jun 2021 07:52:16 +0000 (+0300) Subject: block/vvfat: inherit child_vvfat_qcow from child_of_bds X-Git-Tag: v6.1.0-rc0~89^2~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8081f064e404dd524b3c43248b2084dee9d32d7c;p=thirdparty%2Fqemu.git block/vvfat: inherit child_vvfat_qcow from child_of_bds Recently we've fixed a crash by adding .get_parent_aio_context handler to child_vvfat_qcow. Now we want it to support .get_parent_desc as well. child_vvfat_qcow wants to implement own .inherit_options, it's not bad. But omitting all other handlers is a bad idea. Let's inherit the class from child_of_bds instead, similar to chain_child_class and detach_by_driver_cb_class in test-bdrv-drain.c. Signed-off-by: Vladimir Sementsov-Ogievskiy Message-Id: <20210601075218.79249-5-vsementsov@virtuozzo.com> Signed-off-by: Kevin Wolf --- diff --git a/block/vvfat.c b/block/vvfat.c index 86d99c899cf..ae9d387da75 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -3127,11 +3127,7 @@ static void vvfat_qcow_options(BdrvChildRole role, bool parent_is_format, qdict_set_default_str(child_options, BDRV_OPT_CACHE_NO_FLUSH, "on"); } -static const BdrvChildClass child_vvfat_qcow = { - .parent_is_bds = true, - .inherit_options = vvfat_qcow_options, - .get_parent_aio_context = child_of_bds_get_parent_aio_context, -}; +static BdrvChildClass child_vvfat_qcow; static int enable_write_target(BlockDriverState *bs, Error **errp) { @@ -3268,6 +3264,8 @@ static BlockDriver bdrv_vvfat = { static void bdrv_vvfat_init(void) { + child_vvfat_qcow = child_of_bds; + child_vvfat_qcow.inherit_options = vvfat_qcow_options; bdrv_register(&bdrv_vvfat); }