Patchwork [v4,BUG:1750,3/3] volgen: macro cleanup

login
register
Submitter Csaba Henk
Date 2010-10-26 09:30:30
Message ID <1288085430-5086-3-git-send-email-csaba@gluster.com>
Download mbox | patch
Permalink /patch/5569/
State Accepted
Headers show

Comments

Csaba Henk - 2010-10-26 09:30:30
Signed-off-by: Csaba Henk <csaba@lowlife.hu>
---
 xlators/mgmt/glusterd/src/glusterd-volgen.c |   30 ++++++++++----------------
 1 files changed, 12 insertions(+), 18 deletions(-)

Patch

diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index 64a8761..c1b45b7 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -139,21 +139,6 @@  static struct volopt_map_entry glusterd_volopt_map[] = {
 };
 
 
-#define VOLGEN_GET_NFS_DIR(path)                                        \
-        do {                                                            \
-                glusterd_conf_t *priv = THIS->private;                  \
-                snprintf (path, PATH_MAX, "%s/nfs", priv->workdir);     \
-        } while (0);                                                    \
-
-#define VOLGEN_GET_VOLUME_DIR(path, volinfo)                            \
-        do {                                                            \
-                glusterd_conf_t *priv = THIS->private;                  \
-                snprintf (path, PATH_MAX, "%s/vols/%s", priv->workdir,  \
-                          volinfo->volname);                            \
-        } while (0);                                                    \
-
-
-
 
 /*********************************************
  *
@@ -1341,9 +1326,12 @@  get_brick_filepath (char *filename, glusterd_volinfo_t *volinfo,
 {
         char  path[PATH_MAX]   = {0,};
         char  brick[PATH_MAX]  = {0,};
+        glusterd_conf_t *priv  = NULL;
+
+        priv = THIS->private;
 
         GLUSTERD_REMOVE_SLASH_FROM_PATH (brickinfo->path, brick);
-        VOLGEN_GET_VOLUME_DIR (path, volinfo);
+        GLUSTERD_GET_VOLUME_DIR (path, volinfo, priv);
 
         snprintf (filename, PATH_MAX, "%s/%s.%s.%s.vol",
                   path, volinfo->volname,
@@ -1401,8 +1389,11 @@  static void
 get_client_filepath (char *filename, glusterd_volinfo_t *volinfo)
 {
         char  path[PATH_MAX] = {0,};
+        glusterd_conf_t *priv = NULL;
+
+        priv = THIS->private;
 
-        VOLGEN_GET_VOLUME_DIR (path, volinfo);
+        GLUSTERD_GET_VOLUME_DIR (path, volinfo, priv);
 
         snprintf (filename, PATH_MAX, "%s/%s-fuse.vol",
                   path, volinfo->volname);
@@ -1470,8 +1461,11 @@  void
 glusterd_get_nfs_filepath (char *filename)
 {
         char  path[PATH_MAX] = {0,};
+        glusterd_conf_t *priv  = NULL;
+
+        priv = THIS->private;
 
-        VOLGEN_GET_NFS_DIR (path);
+        GLUSTERD_GET_NFS_DIR (path, priv);
 
         snprintf (filename, PATH_MAX, "%s/nfs-server.vol", path);
 }