From d6c99b6134f1eb90b3a8020c3538101df266e9b5 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Thu, 6 Sep 2012 00:13:04 +0530 Subject: libglusterfs/dict: make 'dict_t' a opaque object * ie, don't dereference dict_t pointer, instead use APIs everywhere * other than dict_t only 'data_t' should be the valid export from dict.h * added 'dict_foreach_fnmatch()' API * changed dict_lookup() to use data_t, instead of data_pair_t Change-Id: I400bb0dd55519a7c5d2a107e67c8e7a7207228dc Signed-off-by: Amar Tumballi BUG: 850917 Reviewed-on: http://review.gluster.org/3829 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- libglusterfs/src/graph-print.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'libglusterfs/src/graph-print.c') diff --git a/libglusterfs/src/graph-print.c b/libglusterfs/src/graph-print.c index 667129864..862a93000 100644 --- a/libglusterfs/src/graph-print.c +++ b/libglusterfs/src/graph-print.c @@ -92,7 +92,6 @@ glusterfs_graph_print (struct gf_printer *gp, glusterfs_graph_t *graph) } while (0) xlator_t *trav = NULL; - data_pair_t *pair = NULL; xlator_list_t *xch = NULL; int ret = 0; ssize_t len = 0; @@ -105,11 +104,18 @@ glusterfs_graph_print (struct gf_printer *gp, glusterfs_graph_t *graph) GPPRINTF (gp, "volume %s\n type %s\n", trav->name, trav->type); - for (pair = trav->options->members_list; pair && pair->next; - pair = pair->next); - for (; pair; pair = pair->prev) - GPPRINTF (gp, " option %s %s\n", pair->key, - pair->value->data); + 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); + if (ret) + goto out; if (trav->children) { GPPRINTF (gp, " subvolumes"); -- cgit