From nobody Fri Apr 19 21:50:08 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1669204448; cv=none; d=zohomail.com; s=zohoarc; b=hEaQOpBxi8tPIxw2je1Sys6fzy29c+BYPYprV3vCZLiexty1rzIKvkC0T/mufy3NAr7lW5/r09z20Hezu5VdaR2qeXgtaPpkoIN5ryYzZe5BAigOxavKzybj77CVvvJ0G7/QFx7jZ0O0CmmxJMNcUbs3EvFh3lf3lGB/vg7Hv8U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1669204448; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jPfvAxicqjZEdZqZsMILhHeGv+h7HqHaHsq0Ekh/5O4=; b=MkAAZ0YgsxOPj/+MKFNLE6Mcv8t1MbgUsxo4cqQ8X7kLUtelBRxPqeYGpO0wOi0mePtLZr6nhvIIU2Ylyb6wR5AS8LRrt1RMN7bIJyL2/EvS078DdcPCQ2I62WpSk/VDHhyhgscrkDbW6FqvTS5MSNUSivOyq0FWhrcK3djPyRQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1669204448404804.1704606285879; Wed, 23 Nov 2022 03:54:08 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oxo9I-0002eE-D7; Wed, 23 Nov 2022 06:42:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oxo9G-0002c1-CZ for qemu-devel@nongnu.org; Wed, 23 Nov 2022 06:42:38 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oxo9D-00060e-UK for qemu-devel@nongnu.org; Wed, 23 Nov 2022 06:42:38 -0500 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-425-vHAi8g9UNRi-z8Jvs7R3dw-1; Wed, 23 Nov 2022 06:42:34 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9978F3C0F236; Wed, 23 Nov 2022 11:42:33 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id 42F6EC2C8CA; Wed, 23 Nov 2022 11:42:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1669203755; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jPfvAxicqjZEdZqZsMILhHeGv+h7HqHaHsq0Ekh/5O4=; b=c6/fV6yXVz9iUMJMw3ouGRc2ruorYRNlahZ7YK7pUd7UazvGP3lz6anmU/WhwavUp1vbpg TqnYSsdYUjfKFKp0hiajQH2AHwhr5M4x5K6ZboKnJcEtxsc1CsJnobKNxd2PQzzsGtJWCQ 4ohnZWPn6yBHVFkJh/Xe7dNxDnGkPsU= X-MC-Unique: vHAi8g9UNRi-z8Jvs7R3dw-1 From: Emanuele Giuseppe Esposito To: qemu-block@nongnu.org Cc: Kevin Wolf , Hanna Reitz , John Snow , Vladimir Sementsov-Ogievskiy , Eric Blake , Fam Zheng , Stefan Hajnoczi , "Denis V. Lunev" , Stefan Weil , Jeff Cody , Cleber Rosa , qemu-devel@nongnu.org, Emanuele Giuseppe Esposito Subject: [PATCH v5 09/15] block: bdrv_create_file is a coroutine_fn Date: Wed, 23 Nov 2022 06:42:21 -0500 Message-Id: <20221123114227.85757-10-eesposit@redhat.com> In-Reply-To: <20221123114227.85757-1-eesposit@redhat.com> References: <20221123114227.85757-1-eesposit@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=eesposit@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1669204450472100001 Content-Type: text/plain; charset="utf-8" It is always called in coroutine_fn callbacks, therefore it can directly call bdrv_co_create(). Rename it to bdrv_co_create_file too. Signed-off-by: Emanuele Giuseppe Esposito Reviewed-by: Kevin Wolf --- block.c | 5 +++-- block/crypto.c | 2 +- block/parallels.c | 2 +- block/qcow.c | 2 +- block/qcow2.c | 4 ++-- block/qed.c | 2 +- block/raw-format.c | 2 +- block/vdi.c | 2 +- block/vhdx.c | 2 +- block/vmdk.c | 2 +- block/vpc.c | 2 +- include/block/block-global-state.h | 3 ++- 12 files changed, 16 insertions(+), 14 deletions(-) diff --git a/block.c b/block.c index 8a7f87f783..8207f93353 100644 --- a/block.c +++ b/block.c @@ -724,7 +724,8 @@ out: return ret; } =20 -int bdrv_create_file(const char *filename, QemuOpts *opts, Error **errp) +int coroutine_fn bdrv_co_create_file(const char *filename, QemuOpts *opts, + Error **errp) { QemuOpts *protocol_opts; BlockDriver *drv; @@ -765,7 +766,7 @@ int bdrv_create_file(const char *filename, QemuOpts *op= ts, Error **errp) goto out; } =20 - ret =3D bdrv_create(drv, filename, protocol_opts, errp); + ret =3D bdrv_co_create(drv, filename, protocol_opts, errp); out: qemu_opts_del(protocol_opts); qobject_unref(qdict); diff --git a/block/crypto.c b/block/crypto.c index 2fb8add458..bbeb9f437c 100644 --- a/block/crypto.c +++ b/block/crypto.c @@ -703,7 +703,7 @@ static int coroutine_fn block_crypto_co_create_opts_luk= s(BlockDriver *drv, } =20 /* Create protocol layer */ - ret =3D bdrv_create_file(filename, opts, errp); + ret =3D bdrv_co_create_file(filename, opts, errp); if (ret < 0) { goto fail; } diff --git a/block/parallels.c b/block/parallels.c index fa08c1104b..bbea2f2221 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -646,7 +646,7 @@ static int coroutine_fn parallels_co_create_opts(BlockD= river *drv, } =20 /* Create and open the file (protocol layer) */ - ret =3D bdrv_create_file(filename, opts, errp); + ret =3D bdrv_co_create_file(filename, opts, errp); if (ret < 0) { goto done; } diff --git a/block/qcow.c b/block/qcow.c index daa38839ab..18e17a5b12 100644 --- a/block/qcow.c +++ b/block/qcow.c @@ -973,7 +973,7 @@ static int coroutine_fn qcow_co_create_opts(BlockDriver= *drv, } =20 /* Create and open the file (protocol layer) */ - ret =3D bdrv_create_file(filename, opts, errp); + ret =3D bdrv_co_create_file(filename, opts, errp); if (ret < 0) { goto fail; } diff --git a/block/qcow2.c b/block/qcow2.c index 4d6666d3ff..7cc49a3a6c 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -3871,7 +3871,7 @@ static int coroutine_fn qcow2_co_create_opts(BlockDri= ver *drv, } =20 /* Create and open the file (protocol layer) */ - ret =3D bdrv_create_file(filename, opts, errp); + ret =3D bdrv_co_create_file(filename, opts, errp); if (ret < 0) { goto finish; } @@ -3886,7 +3886,7 @@ static int coroutine_fn qcow2_co_create_opts(BlockDri= ver *drv, /* Create and open an external data file (protocol layer) */ val =3D qdict_get_try_str(qdict, BLOCK_OPT_DATA_FILE); if (val) { - ret =3D bdrv_create_file(val, opts, errp); + ret =3D bdrv_co_create_file(val, opts, errp); if (ret < 0) { goto finish; } diff --git a/block/qed.c b/block/qed.c index c2691a85b1..9d54c8eec5 100644 --- a/block/qed.c +++ b/block/qed.c @@ -778,7 +778,7 @@ static int coroutine_fn bdrv_qed_co_create_opts(BlockDr= iver *drv, } =20 /* Create and open the file (protocol layer) */ - ret =3D bdrv_create_file(filename, opts, errp); + ret =3D bdrv_co_create_file(filename, opts, errp); if (ret < 0) { goto fail; } diff --git a/block/raw-format.c b/block/raw-format.c index a68014ef0b..28905b09ee 100644 --- a/block/raw-format.c +++ b/block/raw-format.c @@ -433,7 +433,7 @@ static int coroutine_fn raw_co_create_opts(BlockDriver = *drv, QemuOpts *opts, Error **errp) { - return bdrv_create_file(filename, opts, errp); + return bdrv_co_create_file(filename, opts, errp); } =20 static int raw_open(BlockDriverState *bs, QDict *options, int flags, diff --git a/block/vdi.c b/block/vdi.c index c0c111c4b9..479bcfe820 100644 --- a/block/vdi.c +++ b/block/vdi.c @@ -934,7 +934,7 @@ static int coroutine_fn vdi_co_create_opts(BlockDriver = *drv, qdict =3D qemu_opts_to_qdict_filtered(opts, NULL, &vdi_create_opts, tr= ue); =20 /* Create and open the file (protocol layer) */ - ret =3D bdrv_create_file(filename, opts, errp); + ret =3D bdrv_co_create_file(filename, opts, errp); if (ret < 0) { goto done; } diff --git a/block/vhdx.c b/block/vhdx.c index bad9ca691b..4c929800fe 100644 --- a/block/vhdx.c +++ b/block/vhdx.c @@ -2084,7 +2084,7 @@ static int coroutine_fn vhdx_co_create_opts(BlockDriv= er *drv, } =20 /* Create and open the file (protocol layer) */ - ret =3D bdrv_create_file(filename, opts, errp); + ret =3D bdrv_co_create_file(filename, opts, errp); if (ret < 0) { goto fail; } diff --git a/block/vmdk.c b/block/vmdk.c index 0c32bf2e83..afd3471915 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -2294,7 +2294,7 @@ static int coroutine_fn vmdk_create_extent(const char= *filename, int ret; BlockBackend *blk =3D NULL; =20 - ret =3D bdrv_create_file(filename, opts, errp); + ret =3D bdrv_co_create_file(filename, opts, errp); if (ret < 0) { goto exit; } diff --git a/block/vpc.c b/block/vpc.c index 95841f259a..6ee95dcb96 100644 --- a/block/vpc.c +++ b/block/vpc.c @@ -1111,7 +1111,7 @@ static int coroutine_fn vpc_co_create_opts(BlockDrive= r *drv, } =20 /* Create and open the file (protocol layer) */ - ret =3D bdrv_create_file(filename, opts, errp); + ret =3D bdrv_co_create_file(filename, opts, errp); if (ret < 0) { goto fail; } diff --git a/include/block/block-global-state.h b/include/block/block-globa= l-state.h index 00e0cf8aea..387a7cbb2e 100644 --- a/include/block/block-global-state.h +++ b/include/block/block-global-state.h @@ -57,7 +57,8 @@ BlockDriver *bdrv_find_protocol(const char *filename, BlockDriver *bdrv_find_format(const char *format_name); int bdrv_create(BlockDriver *drv, const char* filename, QemuOpts *opts, Error **errp); -int bdrv_create_file(const char *filename, QemuOpts *opts, Error **errp); +int coroutine_fn bdrv_co_create_file(const char *filename, QemuOpts *opts, + Error **errp); =20 BlockDriverState *bdrv_new(void); int bdrv_append(BlockDriverState *bs_new, BlockDriverState *bs_top, --=20 2.31.1