diff mbox

[2/3] block/gluster: rename [server, volname, image] -> [host, volume, path]

Message ID 1445256783-28558-2-git-send-email-prasanna.kalever@redhat.com
State New
Headers show

Commit Message

Prasanna Kumar Kalever Oct. 19, 2015, 12:13 p.m. UTC
for example in 'servers' tuple values we use 'server' variable for key 'host'
in the code, it will be quite messy to have colliding names for variables,
so to maintain better readability and makes it consistent with other existing
code as well as the input keys/options, this patch renames the following
variables
'server'  -> 'host'
'image'   -> 'path'
'volname' -> 'volume'

Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
---
 block/gluster.c | 54 +++++++++++++++++++++++++++---------------------------
 1 file changed, 27 insertions(+), 27 deletions(-)

Comments

Eric Blake Oct. 19, 2015, 8:10 p.m. UTC | #1
On 10/19/2015 06:13 AM, Prasanna Kumar Kalever wrote:
> for example in 'servers' tuple values we use 'server' variable for key 'host'
> in the code, it will be quite messy to have colliding names for variables,
> so to maintain better readability and makes it consistent with other existing
> code as well as the input keys/options, this patch renames the following
> variables
> 'server'  -> 'host'
> 'image'   -> 'path'
> 'volname' -> 'volume'
> 
> Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
> ---
>  block/gluster.c | 54 +++++++++++++++++++++++++++---------------------------
>  1 file changed, 27 insertions(+), 27 deletions(-)
> 

As mentioned on 1/3, I suspect you want to reorder your series to put
this one first.

Seems fairly mechanical.
diff mbox

Patch

diff --git a/block/gluster.c b/block/gluster.c
index dd076fe..e1f9b21 100644
--- a/block/gluster.c
+++ b/block/gluster.c
@@ -35,14 +35,14 @@  typedef struct BDRVGlusterState {
 } BDRVGlusterState;
 
 typedef struct GlusterServerConf {
-    char *server;
+    char *host;
     int port;
     char *transport;
 } GlusterServerConf;
 
 typedef struct GlusterConf {
-    char *volname;
-    char *image;
+    char *volume;
+    char *path;
     GlusterServerConf *gsconf;
 } GlusterConf;
 
@@ -90,10 +90,10 @@  static QemuOptsList runtime_tuple_opts = {
 static void qemu_gluster_gconf_free(GlusterConf *gconf)
 {
     if (gconf) {
-        g_free(gconf->volname);
-        g_free(gconf->image);
+        g_free(gconf->volume);
+        g_free(gconf->path);
         if (gconf->gsconf) {
-            g_free(gconf->gsconf[0].server);
+            g_free(gconf->gsconf[0].host);
             g_free(gconf->gsconf[0].transport);
             g_free(gconf->gsconf);
             gconf->gsconf = NULL;
@@ -117,19 +117,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.
  *
@@ -138,10 +138,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.
  *
@@ -150,9 +150,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:
  *
@@ -161,7 +161,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
  */
@@ -216,9 +216,9 @@  static int qemu_gluster_parseuri(GlusterConf **pgconf, const char *filename)
             ret = -EINVAL;
             goto out;
         }
-        gconf->gsconf[0].server = g_strdup(qp->p[0].value);
+        gconf->gsconf[0].host = g_strdup(qp->p[0].value);
     } else {
-        gconf->gsconf[0].server = g_strdup(uri->server ? uri->server : "localhost");
+        gconf->gsconf[0].host = g_strdup(uri->server ? uri->server : "localhost");
         if (uri->port) {
             gconf->gsconf[0].port = uri->port;
         } else {
@@ -247,14 +247,14 @@  static struct glfs *qemu_gluster_glfs_init(GlusterConf *gconf, int num_servers,
     int old_errno;
     int i;
 
-    glfs = glfs_new(gconf->volname);
+    glfs = glfs_new(gconf->volume);
     if (!glfs) {
         goto out;
     }
 
     for (i = 0; i < num_servers; i++) {
         ret = glfs_set_volfile_server(glfs, gconf->gsconf[i].transport,
-                                      gconf->gsconf[i].server,
+                                      gconf->gsconf[i].host,
                                       gconf->gsconf[i].port);
         if (ret < 0) {
             goto out;
@@ -274,8 +274,8 @@  static struct glfs *qemu_gluster_glfs_init(GlusterConf *gconf, int num_servers,
     if (ret) {
         error_setg_errno(errp, errno,
                          "Error: Gluster connection failed for given hosts "
-                         "volume:'%s' path:'%s' host1: %s", gconf->volname,
-                         gconf->image, gconf->gsconf[0].server);
+                         "volume:'%s' path:'%s' host1: %s", gconf->volume,
+                         gconf->path, gconf->gsconf[0].host);
 
         /* glfs_init sometimes doesn't set errno although docs suggest that */
         if (errno == 0)
@@ -454,7 +454,7 @@  static int qemu_gluster_parsejson(GlusterConf **pgconf, QDict *options)
                                "option");
         goto out;
     }
-    gconf->volname = g_strdup(ptr);
+    gconf->volume = g_strdup(ptr);
 
     ptr = qemu_opt_get(opts, GLUSTER_OPT_PATH);
     if (!ptr) {
@@ -462,7 +462,7 @@  static int qemu_gluster_parsejson(GlusterConf **pgconf, QDict *options)
                                "option");
         goto out;
     }
-    gconf->image = g_strdup(ptr);
+    gconf->path = g_strdup(ptr);
 
     qemu_opts_del(opts);
 
@@ -484,7 +484,7 @@  static int qemu_gluster_parsejson(GlusterConf **pgconf, QDict *options)
                                    "requires 'host' option", i);
             goto out;
         }
-        gconf->gsconf[i].server = g_strdup(ptr);
+        gconf->gsconf[i].host = g_strdup(ptr);
 
         ptr = qemu_opt_get(opts, GLUSTER_OPT_TRANSPORT);
         /* check whether transport type specified in json command is valid */
@@ -644,7 +644,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;
     }
@@ -692,7 +692,7 @@  static int qemu_gluster_reopen_prepare(BDRVReopenState *state,
         goto exit;
     }
 
-    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;
@@ -839,7 +839,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;