summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorshishir gowda <shishirng@gluster.com>2011-04-12 05:19:22 +0000
committerAnand Avati <avati@gluster.com>2011-06-14 02:38:12 -0700
commit2a2060359a6991e310e6532376273bccb9cfbadc (patch)
treeefd9648fe8c778bf44cecb3c12bc29a555db6a8c /libglusterfs
parentb81ab76a2b3163b9326c5c024c7dc5f51e6ae868 (diff)
DHT: check for mis-matching user xattrs
Signed-off-by: shishir gowda <shishirng@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2717 (Detect user_xattr mismatches for dir's) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2717
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/dict.c20
-rw-r--r--libglusterfs/src/dict.h1
2 files changed, 21 insertions, 0 deletions
diff --git a/libglusterfs/src/dict.c b/libglusterfs/src/dict.c
index c8f43e316..66fe31bcd 100644
--- a/libglusterfs/src/dict.c
+++ b/libglusterfs/src/dict.c
@@ -214,6 +214,26 @@ _dict_lookup (dict_t *this, char *key)
return NULL;
}
+int32_t
+dict_lookup (dict_t *this, char *key, data_pair_t **data)
+{
+ if (!this || !key || !data) {
+ gf_log_callingfn ("dict", GF_LOG_WARNING,
+ "!this || !key || !data");
+ return -1;
+ }
+
+ LOCK (&this->lock);
+ {
+ *data = _dict_lookup (this, key);
+ }
+ UNLOCK (&this->lock);
+ if (*data)
+ return 0;
+ else
+ return -1;
+
+}
static int32_t
_dict_set (dict_t *this,
diff --git a/libglusterfs/src/dict.h b/libglusterfs/src/dict.h
index 4ddea9422..240d7d2e6 100644
--- a/libglusterfs/src/dict.h
+++ b/libglusterfs/src/dict.h
@@ -89,6 +89,7 @@ dict_t *dict_ref (dict_t *dict);
data_t *data_ref (data_t *data);
void data_unref (data_t *data);
+int32_t dict_lookup (dict_t *this, char *key, data_pair_t **data);
/*
TODO: provide converts for differnt byte sizes, signedness, and void *
*/