From patchwork Thu Mar 26 01:12:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Levitsky X-Patchwork-Id: 11458947 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E3BED1392 for ; Thu, 26 Mar 2020 01:13:40 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A9D8320714 for ; Thu, 26 Mar 2020 01:13:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="YtV2QNrE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A9D8320714 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:45106 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHH5X-0004ch-RW for patchwork-qemu-devel@patchwork.kernel.org; Wed, 25 Mar 2020 21:13:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47529) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jHH4h-0003Dy-0d for qemu-devel@nongnu.org; Wed, 25 Mar 2020 21:12:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jHH4f-0002RL-9C for qemu-devel@nongnu.org; Wed, 25 Mar 2020 21:12:46 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:43033) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jHH4f-0002RB-5z for qemu-devel@nongnu.org; Wed, 25 Mar 2020 21:12:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585185164; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vctC7j7kRY+bPM7QJMYrBVDvD/94paUzUaEE3U440Qs=; b=YtV2QNrE/r2UPE+wXZSZNlTj2a/zUGeP081p2pNNu9Mm9wg4f8Ah4KRgU2yxOjHZIs16kM XhmOun3agcaJBVsjrtntSN9vdOOrwbkskiLP387pjOgEdGFfphVQeSqdMdQ/kg1fWNDTsy 2KIJotvQxDlS1XaCBpcfjXfFN96WHUo= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-47-wQVRCCAKOHSmsNssm94diA-1; Wed, 25 Mar 2020 21:12:41 -0400 X-MC-Unique: wQVRCCAKOHSmsNssm94diA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4A2A28017CC; Thu, 26 Mar 2020 01:12:39 +0000 (UTC) Received: from maximlenovopc.usersys.redhat.com (unknown [10.35.206.153]) by smtp.corp.redhat.com (Postfix) with ESMTP id D62B110027A9; Thu, 26 Mar 2020 01:12:32 +0000 (UTC) From: Maxim Levitsky To: qemu-devel@nongnu.org Subject: [PATCH 1/2] block: pass BlockDriver reference to the .bdrv_co_create Date: Thu, 26 Mar 2020 03:12:17 +0200 Message-Id: <20200326011218.29230-2-mlevitsk@redhat.com> In-Reply-To: <20200326011218.29230-1-mlevitsk@redhat.com> References: <20200326011218.29230-1-mlevitsk@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 216.205.24.74 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Kevin Wolf , integration@gluster.org, sheepdog@lists.wpkg.org, Stefan Hajnoczi , qemu-block@nongnu.org, Jason Dillaman , Jeff Cody , Stefan Weil , Peter Lieven , "Richard W.M. Jones" , Max Reitz , "Denis V. Lunev" , Ronnie Sahlberg , Paolo Bonzini , Liu Yuan , Maxim Levitsky Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" This will allow to reuse a single generic .bdrv_co_create implementation for several drivers. No functional changes. Signed-off-by: Maxim Levitsky --- block.c | 3 ++- block/crypto.c | 3 ++- block/file-posix.c | 4 +++- block/file-win32.c | 4 +++- block/gluster.c | 3 ++- block/nfs.c | 4 +++- block/parallels.c | 3 ++- block/qcow.c | 3 ++- block/qcow2.c | 4 +++- block/qed.c | 3 ++- block/raw-format.c | 4 +++- block/rbd.c | 3 ++- block/sheepdog.c | 4 +++- block/ssh.c | 4 +++- block/vdi.c | 4 +++- block/vhdx.c | 3 ++- block/vmdk.c | 4 +++- block/vpc.c | 6 ++++-- include/block/block_int.h | 3 ++- 19 files changed, 49 insertions(+), 20 deletions(-) diff --git a/block.c b/block.c index cccae5add9..ff23e20443 100644 --- a/block.c +++ b/block.c @@ -483,7 +483,8 @@ static void coroutine_fn bdrv_create_co_entry(void *opaque) CreateCo *cco = opaque; assert(cco->drv); - ret = cco->drv->bdrv_co_create_opts(cco->filename, cco->opts, &local_err); + ret = cco->drv->bdrv_co_create_opts(cco->drv, + cco->filename, cco->opts, &local_err); error_propagate(&cco->err, local_err); cco->ret = ret; } diff --git a/block/crypto.c b/block/crypto.c index 4425ebeb47..d577f89659 100644 --- a/block/crypto.c +++ b/block/crypto.c @@ -601,7 +601,8 @@ fail: return ret; } -static int coroutine_fn block_crypto_co_create_opts_luks(const char *filename, +static int coroutine_fn block_crypto_co_create_opts_luks(BlockDriver *drv, + const char *filename, QemuOpts *opts, Error **errp) { diff --git a/block/file-posix.c b/block/file-posix.c index 9bc3838b2a..65bc980bc4 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -2405,7 +2405,9 @@ out: return result; } -static int coroutine_fn raw_co_create_opts(const char *filename, QemuOpts *opts, +static int coroutine_fn raw_co_create_opts(BlockDriver *drv, + const char *filename, + QemuOpts *opts, Error **errp) { BlockdevCreateOptions options; diff --git a/block/file-win32.c b/block/file-win32.c index 77e8ff7b68..15859839a1 100644 --- a/block/file-win32.c +++ b/block/file-win32.c @@ -588,7 +588,9 @@ static int raw_co_create(BlockdevCreateOptions *options, Error **errp) return 0; } -static int coroutine_fn raw_co_create_opts(const char *filename, QemuOpts *opts, +static int coroutine_fn raw_co_create_opts(BlockDriver *drv, + const char *filename, + QemuOpts *opts, Error **errp) { BlockdevCreateOptions options; diff --git a/block/gluster.c b/block/gluster.c index 4fa4a77a47..0aa1f2cda4 100644 --- a/block/gluster.c +++ b/block/gluster.c @@ -1130,7 +1130,8 @@ out: return ret; } -static int coroutine_fn qemu_gluster_co_create_opts(const char *filename, +static int coroutine_fn qemu_gluster_co_create_opts(BlockDriver *drv, + const char *filename, QemuOpts *opts, Error **errp) { diff --git a/block/nfs.c b/block/nfs.c index 9a6311e270..cc2413d5ab 100644 --- a/block/nfs.c +++ b/block/nfs.c @@ -662,7 +662,9 @@ out: return ret; } -static int coroutine_fn nfs_file_co_create_opts(const char *url, QemuOpts *opts, +static int coroutine_fn nfs_file_co_create_opts(BlockDriver *drv, + const char *url, + QemuOpts *opts, Error **errp) { BlockdevCreateOptions *create_options; diff --git a/block/parallels.c b/block/parallels.c index 7a01997659..6d4ed77f16 100644 --- a/block/parallels.c +++ b/block/parallels.c @@ -609,7 +609,8 @@ exit: goto out; } -static int coroutine_fn parallels_co_create_opts(const char *filename, +static int coroutine_fn parallels_co_create_opts(BlockDriver *drv, + const char *filename, QemuOpts *opts, Error **errp) { diff --git a/block/qcow.c b/block/qcow.c index fce8989868..8973e4e565 100644 --- a/block/qcow.c +++ b/block/qcow.c @@ -934,7 +934,8 @@ exit: return ret; } -static int coroutine_fn qcow_co_create_opts(const char *filename, +static int coroutine_fn qcow_co_create_opts(BlockDriver *drv, + const char *filename, QemuOpts *opts, Error **errp) { BlockdevCreateOptions *create_options = NULL; diff --git a/block/qcow2.c b/block/qcow2.c index d1da3d91db..5f65fce924 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -3558,7 +3558,9 @@ out: return ret; } -static int coroutine_fn qcow2_co_create_opts(const char *filename, QemuOpts *opts, +static int coroutine_fn qcow2_co_create_opts(BlockDriver *drv, + const char *filename, + QemuOpts *opts, Error **errp) { BlockdevCreateOptions *create_options = NULL; diff --git a/block/qed.c b/block/qed.c index d8c4e5fb1e..1af9b3cb1d 100644 --- a/block/qed.c +++ b/block/qed.c @@ -720,7 +720,8 @@ out: return ret; } -static int coroutine_fn bdrv_qed_co_create_opts(const char *filename, +static int coroutine_fn bdrv_qed_co_create_opts(BlockDriver *drv, + const char *filename, QemuOpts *opts, Error **errp) { diff --git a/block/raw-format.c b/block/raw-format.c index 3a76ec7dd2..93b25e1b6b 100644 --- a/block/raw-format.c +++ b/block/raw-format.c @@ -419,7 +419,9 @@ 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, +static int coroutine_fn raw_co_create_opts(BlockDriver *drv, + const char *filename, + QemuOpts *opts, Error **errp) { return bdrv_create_file(filename, opts, errp); diff --git a/block/rbd.c b/block/rbd.c index 84115d34b4..e637639a07 100644 --- a/block/rbd.c +++ b/block/rbd.c @@ -437,7 +437,8 @@ static int qemu_rbd_co_create(BlockdevCreateOptions *options, Error **errp) return qemu_rbd_do_create(options, NULL, NULL, errp); } -static int coroutine_fn qemu_rbd_co_create_opts(const char *filename, +static int coroutine_fn qemu_rbd_co_create_opts(BlockDriver *drv, + const char *filename, QemuOpts *opts, Error **errp) { diff --git a/block/sheepdog.c b/block/sheepdog.c index cfa84338a2..a8a7e32a41 100644 --- a/block/sheepdog.c +++ b/block/sheepdog.c @@ -2157,7 +2157,9 @@ out: return ret; } -static int coroutine_fn sd_co_create_opts(const char *filename, QemuOpts *opts, +static int coroutine_fn sd_co_create_opts(BlockDriver *drv, + const char *filename, + QemuOpts *opts, Error **errp) { BlockdevCreateOptions *create_options = NULL; diff --git a/block/ssh.c b/block/ssh.c index b4375cf7d2..84e92821c0 100644 --- a/block/ssh.c +++ b/block/ssh.c @@ -963,7 +963,9 @@ fail: return ret; } -static int coroutine_fn ssh_co_create_opts(const char *filename, QemuOpts *opts, +static int coroutine_fn ssh_co_create_opts(BlockDriver *drv, + const char *filename, + QemuOpts *opts, Error **errp) { BlockdevCreateOptions *create_options; diff --git a/block/vdi.c b/block/vdi.c index 0142da7233..e1a11f2aa0 100644 --- a/block/vdi.c +++ b/block/vdi.c @@ -896,7 +896,9 @@ static int coroutine_fn vdi_co_create(BlockdevCreateOptions *create_options, return vdi_co_do_create(create_options, DEFAULT_CLUSTER_SIZE, errp); } -static int coroutine_fn vdi_co_create_opts(const char *filename, QemuOpts *opts, +static int coroutine_fn vdi_co_create_opts(BlockDriver *drv, + const char *filename, + QemuOpts *opts, Error **errp) { QDict *qdict = NULL; diff --git a/block/vhdx.c b/block/vhdx.c index f02d2611be..33e57cd656 100644 --- a/block/vhdx.c +++ b/block/vhdx.c @@ -2046,7 +2046,8 @@ delete_and_exit: return ret; } -static int coroutine_fn vhdx_co_create_opts(const char *filename, +static int coroutine_fn vhdx_co_create_opts(BlockDriver *drv, + const char *filename, QemuOpts *opts, Error **errp) { diff --git a/block/vmdk.c b/block/vmdk.c index 8466051bc9..218d9c9800 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -2588,7 +2588,9 @@ exit: return blk; } -static int coroutine_fn vmdk_co_create_opts(const char *filename, QemuOpts *opts, +static int coroutine_fn vmdk_co_create_opts(BlockDriver *drv, + const char *filename, + QemuOpts *opts, Error **errp) { Error *local_err = NULL; diff --git a/block/vpc.c b/block/vpc.c index a65550298e..6df75e22dc 100644 --- a/block/vpc.c +++ b/block/vpc.c @@ -1089,8 +1089,10 @@ out: return ret; } -static int coroutine_fn vpc_co_create_opts(const char *filename, - QemuOpts *opts, Error **errp) +static int coroutine_fn vpc_co_create_opts(BlockDriver *drv, + const char *filename, + QemuOpts *opts, + Error **errp) { BlockdevCreateOptions *create_options = NULL; QDict *qdict; diff --git a/include/block/block_int.h b/include/block/block_int.h index ae9c4da4d0..57c8ea24b2 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -135,7 +135,8 @@ struct BlockDriver { void (*bdrv_close)(BlockDriverState *bs); int coroutine_fn (*bdrv_co_create)(BlockdevCreateOptions *opts, Error **errp); - int coroutine_fn (*bdrv_co_create_opts)(const char *filename, + int coroutine_fn (*bdrv_co_create_opts)(BlockDriver *drv, + const char *filename, QemuOpts *opts, Error **errp); int (*bdrv_make_empty)(BlockDriverState *bs);