diff options
| author | Csaba Henk <csaba@gluster.com> | 2010-10-02 07:30:39 +0000 | 
|---|---|---|
| committer | Vijay Bellur <vijay@dev.gluster.com> | 2010-10-02 06:30:23 -0700 | 
| commit | ef44323b4ba58fa8c1eb89105851983f828dd91b (patch) | |
| tree | dcbfd98a87e1987145ab97366527b4e6e8900902 /libglusterfs/src/graph.y | |
| parent | 067d0e476abe42f1e290039cb903928080e90d8d (diff) | |
volgen: reimplement volgen
Generating a volfile occurs in two steps:
- Build a graph (ie, glusterfs_graph_t instance) by graph manipulation
  primitives
- Write out the graph to a file by the the graph printing API.
Graph builder routines can optionally make use of a "modifier dict",
which can contain overrides wrt. volume options. This can be used
for a "dry-run" graph generation.
Signed-off-by: Csaba Henk <csaba@gluster.com>
Signed-off-by: Vijay Bellur <vijay@dev.gluster.com>
BUG: 1750 (clean up volgen)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1750
Diffstat (limited to 'libglusterfs/src/graph.y')
| -rw-r--r-- | libglusterfs/src/graph.y | 40 | 
1 files changed, 3 insertions, 37 deletions
diff --git a/libglusterfs/src/graph.y b/libglusterfs/src/graph.y index 14afaae64..19dfff0fd 100644 --- a/libglusterfs/src/graph.y +++ b/libglusterfs/src/graph.y @@ -30,6 +30,7 @@  #include <sys/wait.h>  #include "xlator.h" +#include "graph-utils.h"  #include "logging.h"  static int new_volume (char *name); @@ -270,9 +271,6 @@ volume_sub (char *sub)  {          extern int       yylineno;          xlator_t        *trav = NULL; -        xlator_list_t   *xlchild = NULL; -        xlator_list_t   *tmp = NULL; -        xlator_list_t   *xlparent = NULL;          int              ret = 0;          if (!sub) { @@ -306,45 +304,13 @@ volume_sub (char *sub)                  goto out;          } -        xlparent = (void *) GF_CALLOC (1, sizeof (*xlparent), -                                       gf_common_mt_xlator_list_t); - -        if (!xlparent) { -                gf_log ("parser", GF_LOG_ERROR, "Out of memory"); -                ret = -1; -                goto out; -        } - -        xlparent->xlator = curr; - -        tmp = trav->parents; -        if (tmp == NULL) { -                trav->parents = xlparent; -        } else { -                while (tmp->next) -                        tmp = tmp->next; -                tmp->next = xlparent; -        } - -        xlchild = (void *) GF_CALLOC (1, sizeof(*xlchild), -                                      gf_common_mt_xlator_list_t); -        if (!xlchild) { +	ret = glusterfs_xlator_link (curr, trav); +	if (ret) {                  gf_log ("parser", GF_LOG_ERROR, "Out of memory");                  ret = -1;                  goto out;          } -        xlchild->xlator = trav; - -        tmp = curr->children; -        if (tmp == NULL) { -                curr->children = xlchild; -        } else { -                while (tmp->next) -                        tmp = tmp->next; -                tmp->next = xlchild; -        } -          gf_log ("parser", GF_LOG_TRACE, "child:%s->%s", curr->name, sub);  out:  | 
