From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48947) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fzn3L-0005un-CN for qemu-devel@nongnu.org; Tue, 11 Sep 2018 14:06:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fzn3K-0000EB-DE for qemu-devel@nongnu.org; Tue, 11 Sep 2018 14:06:19 -0400 References: <78d2f47b07325fce34a03b115159830f662b7f90.1536642773.git.jcody@redhat.com> From: John Snow Message-ID: <332cf739-566c-d1a8-8423-6ee45f75aeb3@redhat.com> Date: Tue, 11 Sep 2018 14:06:12 -0400 MIME-Version: 1.0 In-Reply-To: <78d2f47b07325fce34a03b115159830f662b7f90.1536642773.git.jcody@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1/2] block/rbd: pull out qemu_rbd_convert_options List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jeff Cody , qemu-devel@nongnu.org Cc: kwolf@redhat.com, qemu-stable@nongnu.org, qemu-block@nongnu.org, armbru@redhat.com On 09/11/2018 01:15 AM, Jeff Cody wrote: > Code movement to pull the conversion from Qdict to BlockdevOptionsRbd > into a helper function. > > 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..a8e79d01d2 100644 > --- a/block/rbd.c > +++ b/block/rbd.c > @@ -655,12 +655,34 @@ failed_opts: > return r; > } > > +static int qemu_rbd_convert_options(BlockDriverState *bs, QDict *options, > + BlockdevOptionsRbd **opts, Error **errp) > +{ > + Visitor *v; > + Error *local_err = NULL; > + > + /* Convert the remaining options into a QAPI object */ > + v = 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 = bs->opaque; > BlockdevOptionsRbd *opts = NULL; > - Visitor *v; > const QDictEntry *e; > Error *local_err = NULL; > char *keypairs, *secretid; > @@ -676,19 +698,9 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags, > qdict_del(options, "password-secret"); > } > > - /* Convert the remaining options into a QAPI object */ > - v = qobject_input_visitor_new_flat_confused(options, errp); > - if (!v) { > - r = -EINVAL; > - goto out; > - } > - > - visit_type_BlockdevOptionsRbd(v, NULL, &opts, &local_err); > - visit_free(v); > - > + r = qemu_rbd_convert_options(bs, options, &opts, &local_err); > if (local_err) { > error_propagate(errp, local_err); > - r = -EINVAL; > goto out; > } > > Reviewed-by: John Snow