From nobody Thu Dec 18 17:52:00 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1536758672025908.2901715040729; Wed, 12 Sep 2018 06:24:32 -0700 (PDT) Received: from localhost ([::1]:36291 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g058A-0003WZ-TJ for importer@patchew.org; Wed, 12 Sep 2018 09:24:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39600) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g052x-00087c-Nd for qemu-devel@nongnu.org; Wed, 12 Sep 2018 09:19:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g052r-00032h-St for qemu-devel@nongnu.org; Wed, 12 Sep 2018 09:19:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51652) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g052m-0002xw-7M; Wed, 12 Sep 2018 09:18:56 -0400 Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8B0F030E686F; Wed, 12 Sep 2018 13:18:55 +0000 (UTC) Received: from localhost (ovpn-116-183.phx2.redhat.com [10.3.116.183]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5554130001DC; Wed, 12 Sep 2018 13:18:55 +0000 (UTC) From: Jeff Cody To: qemu-block@nongnu.org Date: Wed, 12 Sep 2018 09:18:50 -0400 Message-Id: <20180912131853.1249324-2-jcody@redhat.com> In-Reply-To: <20180912131853.1249324-1-jcody@redhat.com> References: <20180912131853.1249324-1-jcody@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 12 Sep 2018 13:18:55 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 1/4] block/rbd: pull out qemu_rbd_convert_options X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , peter.maydell@linaro.org, jcody@redhat.com, qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Code movement to pull the conversion from Qdict to BlockdevOptionsRbd into a helper function. Reviewed-by: Eric Blake Reviewed-by: John Snow Signed-off-by: Jeff Cody Message-id: 5b49a980f2cde6610ab1df41bb0277d00b5db893.1536704901.git.jcody@r= edhat.com Signed-off-by: Jeff Cody --- block/rbd.c | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/block/rbd.c b/block/rbd.c index ca8e5bbace..b199450f9f 100644 --- a/block/rbd.c +++ b/block/rbd.c @@ -655,12 +655,34 @@ failed_opts: return r; } =20 +static int qemu_rbd_convert_options(QDict *options, BlockdevOptionsRbd **o= pts, + Error **errp) +{ + Visitor *v; + Error *local_err =3D NULL; + + /* Convert the remaining options into a QAPI object */ + v =3D qobject_input_visitor_new_flat_confused(options, errp); + if (!v) { + return -EINVAL; + } + + visit_type_BlockdevOptionsRbd(v, NULL, opts, &local_err); + visit_free(v); + + if (local_err) { + error_propagate(errp, local_err); + return -EINVAL; + } + + return 0; +} + static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVRBDState *s =3D bs->opaque; BlockdevOptionsRbd *opts =3D NULL; - Visitor *v; const QDictEntry *e; Error *local_err =3D NULL; char *keypairs, *secretid; @@ -676,19 +698,9 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *= options, int flags, qdict_del(options, "password-secret"); } =20 - /* Convert the remaining options into a QAPI object */ - v =3D qobject_input_visitor_new_flat_confused(options, errp); - if (!v) { - r =3D -EINVAL; - goto out; - } - - visit_type_BlockdevOptionsRbd(v, NULL, &opts, &local_err); - visit_free(v); - + r =3D qemu_rbd_convert_options(options, &opts, &local_err); if (local_err) { error_propagate(errp, local_err); - r =3D -EINVAL; goto out; } =20 --=20 2.17.1