qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>,
	Jeff Cody <jcody@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PATCH 3/4] block/gluster: use conventional names for GlfsPreopened functions
Date: Fri, 27 Jan 2017 10:00:28 +0000	[thread overview]
Message-ID: <20170127100029.11356-4-stefanha@redhat.com> (raw)
In-Reply-To: <20170127100029.11356-1-stefanha@redhat.com>

The naming of GlfsPreopened functions is a little unusual:

glfs_set_preopened() appends items to the list.  Normally this operation
is called "add".

glfs_find_preopened() is paired with glfs_clear_preopened().  Normally
this is called "get" and "put" (or "ref" and "unref").

This patch renames these functions.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 block/gluster.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/block/gluster.c b/block/gluster.c
index 171a323..181b345 100644
--- a/block/gluster.c
+++ b/block/gluster.c
@@ -203,7 +203,7 @@ static QemuOptsList runtime_tcp_opts = {
     },
 };
 
-static void glfs_set_preopened(const char *volume, glfs_t *fs)
+static void glfs_add_preopened(const char *volume, glfs_t *fs)
 {
     GlfsPreopened *entry = NULL;
 
@@ -217,7 +217,7 @@ static void glfs_set_preopened(const char *volume, glfs_t *fs)
     QLIST_INSERT_HEAD(&glfs_list, entry, list);
 }
 
-static glfs_t *glfs_find_preopened(const char *volume)
+static glfs_t *glfs_get_preopened(const char *volume)
 {
     GlfsPreopened *entry = NULL;
 
@@ -231,7 +231,7 @@ static glfs_t *glfs_find_preopened(const char *volume)
     return NULL;
 }
 
-static void glfs_clear_preopened(glfs_t *fs)
+static void glfs_put_preopened(glfs_t *fs)
 {
     GlfsPreopened *entry = NULL;
     GlfsPreopened *next;
@@ -393,7 +393,7 @@ static struct glfs *qemu_gluster_glfs_init(BlockdevOptionsGluster *gconf,
     GlusterServerList *server;
     unsigned long long port;
 
-    glfs = glfs_find_preopened(gconf->volume);
+    glfs = glfs_get_preopened(gconf->volume);
     if (glfs) {
         return glfs;
     }
@@ -403,7 +403,7 @@ static struct glfs *qemu_gluster_glfs_init(BlockdevOptionsGluster *gconf,
         goto out;
     }
 
-    glfs_set_preopened(gconf->volume, glfs);
+    glfs_add_preopened(gconf->volume, glfs);
 
     for (server = gconf->server; server; server = server->next) {
         if (server->value->type  == GLUSTER_TRANSPORT_UNIX) {
@@ -463,7 +463,7 @@ static struct glfs *qemu_gluster_glfs_init(BlockdevOptionsGluster *gconf,
 out:
     if (glfs) {
         old_errno = errno;
-        glfs_clear_preopened(glfs);
+        glfs_put_preopened(glfs);
         errno = old_errno;
     }
     return NULL;
@@ -844,7 +844,7 @@ out:
         glfs_close(s->fd);
     }
 
-    glfs_clear_preopened(s->glfs);
+    glfs_put_preopened(s->glfs);
 
     return ret;
 }
@@ -913,7 +913,7 @@ static void qemu_gluster_reopen_commit(BDRVReopenState *state)
         glfs_close(s->fd);
     }
 
-    glfs_clear_preopened(s->glfs);
+    glfs_put_preopened(s->glfs);
 
     /* use the newly opened image / connection */
     s->fd         = reop_s->fd;
@@ -938,7 +938,7 @@ static void qemu_gluster_reopen_abort(BDRVReopenState *state)
         glfs_close(reop_s->fd);
     }
 
-    glfs_clear_preopened(reop_s->glfs);
+    glfs_put_preopened(reop_s->glfs);
 
     g_free(state->opaque);
     state->opaque = NULL;
@@ -1062,7 +1062,7 @@ static int qemu_gluster_create(const char *filename,
 out:
     g_free(tmp);
     qapi_free_BlockdevOptionsGluster(gconf);
-    glfs_clear_preopened(glfs);
+    glfs_put_preopened(glfs);
     return ret;
 }
 
@@ -1135,7 +1135,7 @@ static void qemu_gluster_close(BlockDriverState *bs)
         glfs_close(s->fd);
         s->fd = NULL;
     }
-    glfs_clear_preopened(s->glfs);
+    glfs_put_preopened(s->glfs);
 }
 
 static coroutine_fn int qemu_gluster_co_flush_to_disk(BlockDriverState *bs)
-- 
2.9.3

  parent reply	other threads:[~2017-01-27 10:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-27 10:00 [Qemu-devel] [PATCH 0/4] block/gluster: cleanups for GlfsPreopened Stefan Hajnoczi
2017-01-27 10:00 ` [Qemu-devel] [PATCH 1/4] block/gluster: fix wrong indent in glfs_find_preopened() Stefan Hajnoczi
2017-01-27 10:00 ` [Qemu-devel] [PATCH 2/4] block/gluster: drop intermediate ListElement struct Stefan Hajnoczi
2017-01-27 10:00 ` Stefan Hajnoczi [this message]
2017-01-27 10:00 ` [Qemu-devel] [PATCH 4/4] block/gluster: add missing QLIST_HEAD_INITIALIZER() Stefan Hajnoczi
2017-01-27 14:23 ` [Qemu-devel] [PATCH 0/4] block/gluster: cleanups for GlfsPreopened Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170127100029.11356-4-stefanha@redhat.com \
    --to=stefanha@redhat.com \
    --cc=jcody@redhat.com \
    --cc=prasanna.kalever@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).