From nobody Fri May 2 16:06:59 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.zoho.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; Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org> Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1492783017402140.5934421956398; Fri, 21 Apr 2017 06:56:57 -0700 (PDT) Received: from localhost ([::1]:59799 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>) id 1d1Z3P-0004fl-Td for importer@patchew.org; Fri, 21 Apr 2017 09:56:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51731) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <jcody@redhat.com>) id 1d1Yts-00055O-OY for qemu-devel@nongnu.org; Fri, 21 Apr 2017 09:47:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <jcody@redhat.com>) id 1d1Ytr-0002Tf-Ls for qemu-devel@nongnu.org; Fri, 21 Apr 2017 09:47:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55880) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from <jcody@redhat.com>) id 1d1Ytm-0002Rf-7p; Fri, 21 Apr 2017 09:46:58 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 22D03C08E2B3; Fri, 21 Apr 2017 13:46:57 +0000 (UTC) Received: from localhost (ovpn-116-76.phx2.redhat.com [10.3.116.76]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A4B0977FC1; Fri, 21 Apr 2017 13:46:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 22D03C08E2B3 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jcody@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 22D03C08E2B3 From: Jeff Cody <jcody@redhat.com> To: qemu-block@nongnu.org Date: Fri, 21 Apr 2017 09:46:42 -0400 Message-Id: <20170421134644.10239-11-jcody@redhat.com> In-Reply-To: <20170421134644.10239-1-jcody@redhat.com> References: <20170421134644.10239-1-jcody@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 21 Apr 2017 13:46:57 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 10/12] block/rbd - update variable names to more apt names X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <http://lists.nongnu.org/archive/html/qemu-devel/> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Cc: peter.maydell@linaro.org, jcody@redhat.com, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org> X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Update 'clientname' to be 'user', which tracks better with both the QAPI and rados variable naming. Update 'name' to be 'image_name', as it indicates the rbd image. Naming it 'image' would have been ideal, but we are using that for the rados_image_t value returned by rbd_open(). Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Jeff Cody <jcody@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com> Message-id: b7ec1fb2e1cf36f9b6911631447a5b0422590b7d.1491597120.git.jcody@r= edhat.com --- block/rbd.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/block/rbd.c b/block/rbd.c index 1c43171..35853c9 100644 --- a/block/rbd.c +++ b/block/rbd.c @@ -94,7 +94,7 @@ typedef struct BDRVRBDState { rados_t cluster; rados_ioctx_t io_ctx; rbd_image_t image; - char *name; + char *image_name; char *snap; } BDRVRBDState; =20 @@ -350,7 +350,7 @@ static int qemu_rbd_create(const char *filename, QemuOp= ts *opts, Error **errp) int64_t bytes =3D 0; int64_t objsize; int obj_order =3D 0; - const char *pool, *name, *conf, *clientname, *keypairs; + const char *pool, *image_name, *conf, *user, *keypairs; const char *secretid; rados_t cluster; rados_ioctx_t io_ctx; @@ -393,11 +393,11 @@ static int qemu_rbd_create(const char *filename, Qemu= Opts *opts, Error **errp) */ pool =3D qdict_get_try_str(options, "pool"); conf =3D qdict_get_try_str(options, "conf"); - clientname =3D qdict_get_try_str(options, "user"); - name =3D qdict_get_try_str(options, "image"); + user =3D qdict_get_try_str(options, "user"); + image_name =3D qdict_get_try_str(options, "image"); keypairs =3D qdict_get_try_str(options, "=3Dkeyvalue-pairs"); =20 - ret =3D rados_create(&cluster, clientname); + ret =3D rados_create(&cluster, user); if (ret < 0) { error_setg_errno(errp, -ret, "error initializing"); goto exit; @@ -434,7 +434,7 @@ static int qemu_rbd_create(const char *filename, QemuOp= ts *opts, Error **errp) goto shutdown; } =20 - ret =3D rbd_create(io_ctx, name, bytes, &obj_order); + ret =3D rbd_create(io_ctx, image_name, bytes, &obj_order); if (ret < 0) { error_setg_errno(errp, -ret, "error rbd create"); } @@ -540,7 +540,7 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *o= ptions, int flags, Error **errp) { BDRVRBDState *s =3D bs->opaque; - const char *pool, *snap, *conf, *clientname, *name, *keypairs; + const char *pool, *snap, *conf, *user, *image_name, *keypairs; const char *secretid; QemuOpts *opts; Error *local_err =3D NULL; @@ -567,24 +567,24 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict = *options, int flags, pool =3D qemu_opt_get(opts, "pool"); conf =3D qemu_opt_get(opts, "conf"); snap =3D qemu_opt_get(opts, "snapshot"); - clientname =3D qemu_opt_get(opts, "user"); - name =3D qemu_opt_get(opts, "image"); + user =3D qemu_opt_get(opts, "user"); + image_name =3D qemu_opt_get(opts, "image"); keypairs =3D qemu_opt_get(opts, "=3Dkeyvalue-pairs"); =20 - if (!pool || !name) { + if (!pool || !image_name) { error_setg(errp, "Parameters 'pool' and 'image' are required"); r =3D -EINVAL; goto failed_opts; } =20 - r =3D rados_create(&s->cluster, clientname); + r =3D rados_create(&s->cluster, user); if (r < 0) { error_setg_errno(errp, -r, "error initializing"); goto failed_opts; } =20 s->snap =3D g_strdup(snap); - s->name =3D g_strdup(name); + s->image_name =3D g_strdup(image_name); =20 /* try default location when conf=3DNULL, but ignore failure */ r =3D rados_conf_read_file(s->cluster, conf); @@ -636,9 +636,10 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *= options, int flags, } =20 /* rbd_open is always r/w */ - r =3D rbd_open(s->io_ctx, s->name, &s->image, s->snap); + r =3D rbd_open(s->io_ctx, s->image_name, &s->image, s->snap); if (r < 0) { - error_setg_errno(errp, -r, "error reading header from %s", s->name= ); + error_setg_errno(errp, -r, "error reading header from %s", + s->image_name); goto failed_open; } =20 @@ -660,7 +661,7 @@ failed_open: failed_shutdown: rados_shutdown(s->cluster); g_free(s->snap); - g_free(s->name); + g_free(s->image_name); failed_opts: qemu_opts_del(opts); g_free(mon_host); @@ -674,7 +675,7 @@ static void qemu_rbd_close(BlockDriverState *bs) rbd_close(s->image); rados_ioctx_destroy(s->io_ctx); g_free(s->snap); - g_free(s->name); + g_free(s->image_name); rados_shutdown(s->cluster); } =20 --=20 2.9.3