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/features | |
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/features')
-rw-r--r-- | xlators/features/index/src/index.c | 16 | ||||
-rw-r--r-- | xlators/features/marker/src/marker-common.c | 14 | ||||
-rw-r--r-- | xlators/features/marker/src/marker-common.h | 2 | ||||
-rw-r--r-- | xlators/features/marker/src/marker.c | 4 | ||||
-rw-r--r-- | xlators/features/quota/src/quota.c | 6 |
5 files changed, 18 insertions, 24 deletions
diff --git a/xlators/features/index/src/index.c b/xlators/features/index/src/index.c index 071a25b4b60..a98236c1edb 100644 --- a/xlators/features/index/src/index.c +++ b/xlators/features/index/src/index.c @@ -435,20 +435,22 @@ out: void _xattrop_index_action (xlator_t *this, inode_t *inode, dict_t *xattr) { - data_pair_t *trav = NULL; gf_boolean_t zero_xattr = _gf_true; index_inode_ctx_t *ctx = NULL; int ret = 0; - trav = xattr->members_list; - while (trav && inode) { - if (mem_0filled ((const char*)trav->value->data, - trav->value->len)) { + int _check_key_is_zero_filled (dict_t *d, char *k, data_t *v, + void *tmp) + { + if (mem_0filled ((const char*)v->data, v->len)) { zero_xattr = _gf_false; - break; + /* -1 means, no more iterations, treat as 'break' */ + return -1; } - trav = trav->next; + return 0; } + dict_foreach (xattr, _check_key_is_zero_filled, NULL); + ret = index_inode_ctx_get (inode, this, &ctx); if (ret) { gf_log (this->name, GF_LOG_ERROR, "Not able to %s %s -> index", diff --git a/xlators/features/marker/src/marker-common.c b/xlators/features/marker/src/marker-common.c index f478db7a3c6..f9e9a835a4b 100644 --- a/xlators/features/marker/src/marker-common.c +++ b/xlators/features/marker/src/marker-common.c @@ -61,18 +61,10 @@ unlock: UNLOCK (&inode->lock); return ret; } -void +int marker_filter_quota_xattr (dict_t *dict, char *key, data_t *value, void *data) { - int ret = -1; - - GF_VALIDATE_OR_GOTO ("marker", dict, out); - GF_VALIDATE_OR_GOTO ("marker", key, out); - - ret = fnmatch ("trusted.glusterfs.quota*", key, 0); - if (ret == 0) - dict_del (dict, key); -out: - return; + dict_del (dict, key); + return 0; } diff --git a/xlators/features/marker/src/marker-common.h b/xlators/features/marker/src/marker-common.h index cd68ab6a044..22860255a1d 100644 --- a/xlators/features/marker/src/marker-common.h +++ b/xlators/features/marker/src/marker-common.h @@ -23,6 +23,6 @@ int32_t marker_force_inode_ctx_get (inode_t *, xlator_t *, marker_inode_ctx_t **); -void +int marker_filter_quota_xattr (dict_t *, char *, data_t *, void *); #endif diff --git a/xlators/features/marker/src/marker.c b/xlators/features/marker/src/marker.c index a0c941b2009..eeb208eaf10 100644 --- a/xlators/features/marker/src/marker.c +++ b/xlators/features/marker/src/marker.c @@ -275,8 +275,10 @@ marker_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_log (this->name, GF_LOG_DEBUG, "Filtering the quota extended attributes"); - dict_foreach (dict, marker_filter_quota_xattr, NULL); + dict_foreach_fnmatch (dict, "trusted.glusterfs.quota*", + marker_filter_quota_xattr, NULL); } + STACK_UNWIND_STRICT (getxattr, frame, op_ret, op_errno, dict, xdata); return 0; } diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c index cb1483258ab..4a2e56bb3ec 100644 --- a/xlators/features/quota/src/quota.c +++ b/xlators/features/quota/src/quota.c @@ -2694,7 +2694,6 @@ int quota_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict, int flags, dict_t *xdata) { - data_pair_t *trav = NULL; int op_errno = EINVAL; int op_ret = -1; @@ -2703,7 +2702,7 @@ quota_setxattr (call_frame_t *frame, xlator_t *this, VALIDATE_OR_GOTO (loc, err); GF_IF_INTERNAL_XATTR_GOTO ("trusted.glusterfs.quota*", dict, - trav, op_errno, err); + op_errno, err); STACK_WIND (frame, quota_setxattr_cbk, FIRST_CHILD(this), @@ -2727,7 +2726,6 @@ int quota_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *dict, int flags, dict_t *xdata) { - data_pair_t *trav = NULL; int32_t op_ret = -1; int32_t op_errno = EINVAL; @@ -2736,7 +2734,7 @@ quota_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, VALIDATE_OR_GOTO (fd, err); GF_IF_INTERNAL_XATTR_GOTO ("trusted.glusterfs.quota*", dict, - trav, op_errno, err); + op_errno, err); STACK_WIND (frame, quota_fsetxattr_cbk, FIRST_CHILD(this), |