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/common-utils.h | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'libglusterfs/src/common-utils.h') diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h index 3d18a29a1..7e9145717 100644 --- a/libglusterfs/src/common-utils.h +++ b/libglusterfs/src/common-utils.h @@ -171,24 +171,26 @@ void gf_print_trace (int32_t signal, glusterfs_ctx_t *ctx); } while (0) -#define GF_IF_INTERNAL_XATTR_GOTO(pattern, dict, trav, op_errno, label) \ +#define GF_IF_INTERNAL_XATTR_GOTO(pattern, dict, op_errno, label) \ do { \ if (!dict) { \ gf_log (this->name, GF_LOG_ERROR, \ "setxattr dict is null"); \ goto label; \ } \ - trav = dict->members_list; \ - while (trav) { \ - if (!fnmatch (pattern, trav->key, 0)) { \ - op_errno = EPERM; \ - gf_log (this->name, GF_LOG_ERROR, \ - "attempt to set internal" \ - " xattr: %s: %s", trav->key, \ - strerror (op_errno)); \ - goto label; \ - } \ - trav = trav->next; \ + int _handle_keyvalue_pair (dict_t *d, char *k, \ + data_t *v, void *tmp) \ + { \ + return 0; \ + } \ + if (dict_foreach_fnmatch (dict, pattern, \ + _handle_keyvalue_pair, NULL) > 0) { \ + op_errno = EPERM; \ + gf_log (this->name, GF_LOG_ERROR, \ + "attempt to set internal" \ + " xattr: %s: %s", pattern, \ + strerror (op_errno)); \ + goto label; \ } \ } while (0) -- cgit