diff options
author | Amar Tumballi <amarts@redhat.com> | 2012-09-06 00:13:04 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2012-09-06 00:34:15 -0700 |
commit | d6c99b6134f1eb90b3a8020c3538101df266e9b5 (patch) | |
tree | a5ec27bcf3136ddfda5ce5f21917bea50ad3be58 /xlators/mgmt/glusterd/src/glusterd-store.c | |
parent | 54b71368ef290bc579f113e683a82b09893fb50a (diff) |
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 <amarts@redhat.com>
BUG: 850917
Reviewed-on: http://review.gluster.org/3829
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-store.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-store.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c index eef42fb341b..d11454bc4ba 100644 --- a/xlators/mgmt/glusterd/src/glusterd-store.c +++ b/xlators/mgmt/glusterd/src/glusterd-store.c @@ -541,7 +541,7 @@ out: return ret; } -static void +static int _storeslaves (dict_t *this, char *key, data_t *value, void *data) { int32_t ret = 0; @@ -556,12 +556,12 @@ _storeslaves (dict_t *this, char *key, data_t *value, void *data) GF_ASSERT (value && value->data); if ((!shandle) || (shandle->fd <= 0) || (!shandle->path)) - return; + return -1; if (!key) - return; + return -1; if (!value || !value->data) - return; + return -1; gf_log ("", GF_LOG_DEBUG, "Storing in volinfo:key= %s, val=%s", key, value->data); @@ -570,12 +570,13 @@ _storeslaves (dict_t *this, char *key, data_t *value, void *data) if (ret) { gf_log ("", GF_LOG_ERROR, "Unable to write into store" " handle for path: %s", shandle->path); - return; + return -1; } + return 0; } -void _storeopts (dict_t *this, char *key, data_t *value, void *data) +int _storeopts (dict_t *this, char *key, data_t *value, void *data) { int32_t ret = 0; int32_t exists = 0; @@ -590,12 +591,12 @@ void _storeopts (dict_t *this, char *key, data_t *value, void *data) GF_ASSERT (value && value->data); if ((!shandle) || (shandle->fd <= 0) || (!shandle->path)) - return; + return -1; if (!key) - return; + return -1; if (!value || !value->data) - return; + return -1; if (is_key_glusterd_hooks_friendly (key)) { exists = 1; @@ -611,15 +612,16 @@ void _storeopts (dict_t *this, char *key, data_t *value, void *data) } else { gf_log ("", GF_LOG_DEBUG, "Discarding:key= %s, val=%s", key, value->data); - return; + return 0; } ret = glusterd_store_save_value (shandle->fd, key, (char*)value->data); if (ret) { gf_log ("", GF_LOG_ERROR, "Unable to write into store" " handle for path: %s", shandle->path); - return; + return -1; } + return 0; } int32_t |