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/mount/fuse | |
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/mount/fuse')
-rw-r--r-- | xlators/mount/fuse/src/fuse-bridge.c | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index 619f488d7c7..1ad774e1b45 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -2871,7 +2871,6 @@ fuse_xattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, data_t *value_data = NULL; int ret = -1; int32_t len = 0; - data_pair_t *trav = NULL; state = frame->root->state; finh = state->finh; @@ -2900,25 +2899,33 @@ fuse_xattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, /* we need to invoke fuse_filter_xattr() twice. Once * while counting size and then while filling buffer */ - trav = dict->members_list; - while (trav) { - if (!fuse_filter_xattr (this, trav->key)) - len += strlen (trav->key) + 1; - trav = trav->next; - } /* while(trav) */ + int _get_total_len (dict_t *d, char *k, data_t *v, + void *tmp) + { + if (!fuse_filter_xattr (this, k)) + len += strlen (k) + 1; + return 0; + } + dict_foreach (dict, _get_total_len, NULL); + value = alloca (len + 1); if (!value) goto out; + len = 0; - trav = dict->members_list; - while (trav) { - if (!fuse_filter_xattr (this, trav->key)) { - strcpy (value + len, trav->key); - value[len + strlen (trav->key)] = '\0'; - len += strlen (trav->key) + 1; + + int _set_listxattr_keys (dict_t *d, char *k, data_t *v, + void *tmp) + { + if (!fuse_filter_xattr (this, k)) { + strcpy (value + len, k); + value[len + strlen (k)] = '\0'; + len += strlen (k) + 1; } - trav = trav->next; - } /* while(trav) */ + return 0; + } + dict_foreach (dict, _set_listxattr_keys, NULL); + send_fuse_xattr (this, finh, value, len, state->size); } /* if(state->name)...else */ } else { |