From patchwork Tue Jul 19 16:57:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prasanna Kumar Kalever X-Patchwork-Id: 9237851 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3145460574 for ; Tue, 19 Jul 2016 16:59:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F6FF26A5C for ; Tue, 19 Jul 2016 16:59:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 11B0526C2F; Tue, 19 Jul 2016 16:59:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7000526A5C for ; Tue, 19 Jul 2016 16:59:16 +0000 (UTC) Received: from localhost ([::1]:57272 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPYMV-0002xk-LV for patchwork-qemu-devel@patchwork.kernel.org; Tue, 19 Jul 2016 12:59:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46668) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPYLb-0002Dl-Ct for qemu-devel@nongnu.org; Tue, 19 Jul 2016 12:58:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPYLY-0003IB-5G for qemu-devel@nongnu.org; Tue, 19 Jul 2016 12:58:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46121) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPYLX-0003HT-Sr for qemu-devel@nongnu.org; Tue, 19 Jul 2016 12:58:16 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4F7477F7BA for ; Tue, 19 Jul 2016 16:58:15 +0000 (UTC) Received: from dhcp1-86.lab.eng.blr.redhat.com (vpn1-7-24.sin2.redhat.com [10.67.7.24]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6JGvsJS028546; Tue, 19 Jul 2016 12:58:07 -0400 From: Prasanna Kumar Kalever To: qemu-devel@nongnu.org Date: Tue, 19 Jul 2016 22:27:29 +0530 Message-Id: <1468947453-5433-2-git-send-email-prasanna.kalever@redhat.com> In-Reply-To: <1468947453-5433-1-git-send-email-prasanna.kalever@redhat.com> References: <1468947453-5433-1-git-send-email-prasanna.kalever@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 19 Jul 2016 16:58:15 +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 v20 1/5] block/gluster: rename [server, volname, image] -> [host, volume, path] 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, pkrempa@redhat.com, Prasanna Kumar Kalever , vbellur@redhat.com, jcody@redhat.com, armbru@redhat.com, rtalur@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP A future patch will add support for multiple gluster servers. Existing terminology is a bit unusual in relation to what names are used by other networked devices, and doesn't map very well to the terminology we expect to use for multiple servers. Therefore, rename the following options: 'server' -> 'host' 'image' -> 'path' 'volname' -> 'volume' Signed-off-by: Prasanna Kumar Kalever Reviewed-by: Eric Blake Reviewed-by: Jeff Cody --- block/gluster.c | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/block/gluster.c b/block/gluster.c index 16f7778..f1ac9a2 100644 --- a/block/gluster.c +++ b/block/gluster.c @@ -29,10 +29,10 @@ typedef struct BDRVGlusterState { } BDRVGlusterState; typedef struct GlusterConf { - char *server; + char *host; int port; - char *volname; - char *image; + char *volume; + char *path; char *transport; int debug_level; } GlusterConf; @@ -40,9 +40,9 @@ typedef struct GlusterConf { static void qemu_gluster_gconf_free(GlusterConf *gconf) { if (gconf) { - g_free(gconf->server); - g_free(gconf->volname); - g_free(gconf->image); + g_free(gconf->host); + g_free(gconf->volume); + g_free(gconf->path); g_free(gconf->transport); g_free(gconf); } @@ -62,19 +62,19 @@ static int parse_volume_options(GlusterConf *gconf, char *path) if (*p == '\0') { return -EINVAL; } - gconf->volname = g_strndup(q, p - q); + gconf->volume = g_strndup(q, p - q); - /* image */ + /* path */ p += strspn(p, "/"); if (*p == '\0') { return -EINVAL; } - gconf->image = g_strdup(p); + gconf->path = g_strdup(p); return 0; } /* - * file=gluster[+transport]://[server[:port]]/volname/image[?socket=...] + * file=gluster[+transport]://[host[:port]]/volume/path[?socket=...] * * 'gluster' is the protocol. * @@ -83,10 +83,10 @@ static int parse_volume_options(GlusterConf *gconf, char *path) * tcp, unix and rdma. If a transport type isn't specified, then tcp * type is assumed. * - * 'server' specifies the server where the volume file specification for + * 'host' specifies the host where the volume file specification for * the given volume resides. This can be either hostname, ipv4 address * or ipv6 address. ipv6 address needs to be within square brackets [ ]. - * If transport type is 'unix', then 'server' field should not be specified. + * If transport type is 'unix', then 'host' field should not be specified. * The 'socket' field needs to be populated with the path to unix domain * socket. * @@ -95,9 +95,9 @@ static int parse_volume_options(GlusterConf *gconf, char *path) * default port. If the transport type is unix, then 'port' should not be * specified. * - * 'volname' is the name of the gluster volume which contains the VM image. + * 'volume' is the name of the gluster volume which contains the VM image. * - * 'image' is the path to the actual VM image that resides on gluster volume. + * 'path' is the path to the actual VM image that resides on gluster volume. * * Examples: * @@ -106,7 +106,7 @@ static int parse_volume_options(GlusterConf *gconf, char *path) * file=gluster+tcp://1.2.3.4:24007/testvol/dir/a.img * file=gluster+tcp://[1:2:3:4:5:6:7:8]/testvol/dir/a.img * file=gluster+tcp://[1:2:3:4:5:6:7:8]:24007/testvol/dir/a.img - * file=gluster+tcp://server.domain.com:24007/testvol/dir/a.img + * file=gluster+tcp://host.domain.com:24007/testvol/dir/a.img * file=gluster+unix:///testvol/dir/a.img?socket=/tmp/glusterd.socket * file=gluster+rdma://1.2.3.4:24007/testvol/a.img */ @@ -157,9 +157,9 @@ static int qemu_gluster_parseuri(GlusterConf *gconf, const char *filename) ret = -EINVAL; goto out; } - gconf->server = g_strdup(qp->p[0].value); + gconf->host = g_strdup(qp->p[0].value); } else { - gconf->server = g_strdup(uri->server ? uri->server : "localhost"); + gconf->host = g_strdup(uri->server ? uri->server : "localhost"); gconf->port = uri->port; } @@ -180,18 +180,18 @@ static struct glfs *qemu_gluster_init(GlusterConf *gconf, const char *filename, ret = qemu_gluster_parseuri(gconf, filename); if (ret < 0) { - error_setg(errp, "Usage: file=gluster[+transport]://[server[:port]]/" - "volname/image[?socket=...]"); + error_setg(errp, "Usage: file=gluster[+transport]://[host[:port]]/" + "volume/path[?socket=...]"); errno = -ret; goto out; } - glfs = glfs_new(gconf->volname); + glfs = glfs_new(gconf->volume); if (!glfs) { goto out; } - ret = glfs_set_volfile_server(glfs, gconf->transport, gconf->server, + ret = glfs_set_volfile_server(glfs, gconf->transport, gconf->host, gconf->port); if (ret < 0) { goto out; @@ -205,9 +205,9 @@ static struct glfs *qemu_gluster_init(GlusterConf *gconf, const char *filename, ret = glfs_init(glfs); if (ret) { error_setg_errno(errp, errno, - "Gluster connection failed for server=%s port=%d " - "volume=%s image=%s transport=%s", gconf->server, - gconf->port, gconf->volname, gconf->image, + "Gluster connection failed for host=%s port=%d " + "volume=%s path=%s transport=%s", gconf->host, + gconf->port, gconf->volume, gconf->path, gconf->transport); /* glfs_init sometimes doesn't set errno although docs suggest that */ @@ -373,7 +373,7 @@ static int qemu_gluster_open(BlockDriverState *bs, QDict *options, qemu_gluster_parse_flags(bdrv_flags, &open_flags); - s->fd = glfs_open(s->glfs, gconf->image, open_flags); + s->fd = glfs_open(s->glfs, gconf->path, open_flags); if (!s->fd) { ret = -errno; } @@ -439,7 +439,7 @@ static int qemu_gluster_reopen_prepare(BDRVReopenState *state, } #endif - reop_s->fd = glfs_open(reop_s->glfs, gconf->image, open_flags); + reop_s->fd = glfs_open(reop_s->glfs, gconf->path, open_flags); if (reop_s->fd == NULL) { /* reops->glfs will be cleaned up in _abort */ ret = -errno; @@ -587,7 +587,7 @@ static int qemu_gluster_create(const char *filename, goto out; } - fd = glfs_creat(glfs, gconf->image, + fd = glfs_creat(glfs, gconf->path, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, S_IRUSR | S_IWUSR); if (!fd) { ret = -errno;