summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorKrishnan Parthasarathi <kparthas@redhat.com>2012-10-11 22:41:56 +0530
committerAnand Avati <avati@redhat.com>2012-10-11 11:58:33 -0700
commit1f2dbafc72e6b4942a47dacb3899665118d7ec6b (patch)
tree226177d56772aead79f6ad882d14d69f24fe4955 /libglusterfs
parent751da4675cf3add21e567aebb92de2c10457afee (diff)
glusterd: Moved peer rsp handling functions to glusterd-utils
- Moved inner functions used in conjunction with synctask, 'out'. Change-Id: I7fbfd9881ea58645c4295a9fa7163ddd15a45d2f BUG: 862834 Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com> Reviewed-on: http://review.gluster.org/4066 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/graph-print.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/libglusterfs/src/graph-print.c b/libglusterfs/src/graph-print.c
index 862a93000e5..d860d63b308 100644
--- a/libglusterfs/src/graph-print.c
+++ b/libglusterfs/src/graph-print.c
@@ -24,6 +24,7 @@
struct gf_printer {
ssize_t (*write) (struct gf_printer *gp, char *buf, size_t len);
void *priv;
+ int len;
};
static ssize_t
@@ -80,17 +81,30 @@ gpprintf (struct gf_printer *gp, const char *format, ...)
return ret;
}
-static int
-glusterfs_graph_print (struct gf_printer *gp, glusterfs_graph_t *graph)
-{
#define GPPRINTF(gp, fmt, ...) do { \
ret = gpprintf (gp, fmt, ## __VA_ARGS__); \
if (ret == -1) \
goto out; \
else \
- len += ret; \
+ gp->len += ret; \
} while (0)
+static int
+_print_volume_options (dict_t *d, char *k, data_t *v,
+ void *tmp)
+{
+ struct gf_printer *gp = tmp;
+ int ret = 0;
+ GPPRINTF (gp, " option %s %s\n", k, v->data);
+ return 0;
+out:
+ /* means, it is a failure */
+ return -1;
+}
+
+static int
+glusterfs_graph_print (struct gf_printer *gp, glusterfs_graph_t *graph)
+{
xlator_t *trav = NULL;
xlator_list_t *xch = NULL;
int ret = 0;
@@ -104,16 +118,7 @@ glusterfs_graph_print (struct gf_printer *gp, glusterfs_graph_t *graph)
GPPRINTF (gp, "volume %s\n type %s\n", trav->name,
trav->type);
- int _print_volume_options (dict_t *d, char *k, data_t *v,
- void *tmp)
- {
- GPPRINTF (gp, " option %s %s\n", k, v->data);
- return 0;
- out:
- /* means, it is a failure */
- return -1;
- }
- ret = dict_foreach (trav->options, _print_volume_options, NULL);
+ ret = dict_foreach (trav->options, _print_volume_options, gp);
if (ret)
goto out;
@@ -132,6 +137,7 @@ glusterfs_graph_print (struct gf_printer *gp, glusterfs_graph_t *graph)
}
out:
+ len = gp->len;
if (ret == -1) {
gf_log ("graph-print", GF_LOG_ERROR, "printing failed");