From nobody Wed Nov 5 20:03:29 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 1536705425989407.2122219392679; Tue, 11 Sep 2018 15:37:05 -0700 (PDT) Received: from localhost ([::1]:59833 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fzrHM-0000FO-SN for importer@patchew.org; Tue, 11 Sep 2018 18:37:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36166) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fzrDI-0003wj-7X for qemu-devel@nongnu.org; Tue, 11 Sep 2018 18:32:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fzrDH-0006hu-69 for qemu-devel@nongnu.org; Tue, 11 Sep 2018 18:32:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42678) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fzrDE-0006fA-EO; Tue, 11 Sep 2018 18:32:48 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 83BD5C05D3E0; Tue, 11 Sep 2018 22:32:47 +0000 (UTC) Received: from localhost (ovpn-116-183.phx2.redhat.com [10.3.116.183]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7467E60BE0; Tue, 11 Sep 2018 22:32:41 +0000 (UTC) From: Jeff Cody To: qemu-devel@nongnu.org Date: Tue, 11 Sep 2018 18:32:30 -0400 Message-Id: <5b49a980f2cde6610ab1df41bb0277d00b5db893.1536704901.git.jcody@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 11 Sep 2018 22:32:47 +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] [PATCH v4 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: kwolf@redhat.com, qemu-block@nongnu.org, libvir-list@redhat.com, jsnow@redhat.com, qemu-stable@nongnu.org, mreitz@redhat.com 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 --- 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