summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/dict.h
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@zresearch.com>2009-05-15 03:55:20 -0700
committerAnand V. Avati <avati@amp.gluster.com>2009-05-16 16:40:18 +0530
commit9669c70c901474dc21ef08e49478b5f5dead8f64 (patch)
tree9040bceccf4c3aaec5966655900f7fac11de3646 /libglusterfs/src/dict.h
parentdec2674685da30d6cef157748bcf52454ec97208 (diff)
dict.c: Add dict_allocate_and_serialize
- this procedure atomically allocates a buffer and serializes dict into it. - this procedure helps avoid memory corruptions due to race conditions where in new members are added into dict between allocating a buffer for serializing and actually serializing buffer into it. Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
Diffstat (limited to 'libglusterfs/src/dict.h')
-rw-r--r--libglusterfs/src/dict.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/libglusterfs/src/dict.h b/libglusterfs/src/dict.h
index 23e0f8368f7..e2d87166ae8 100644
--- a/libglusterfs/src/dict.h
+++ b/libglusterfs/src/dict.h
@@ -76,6 +76,9 @@ int32_t dict_serialized_length (dict_t *dict);
int32_t dict_serialize (dict_t *dict, char *buf);
int32_t dict_unserialize (char *buf, int32_t size, dict_t **fill);
+int32_t
+dict_allocate_and_serialize (dict_t *this, char **buf, size_t *length);
+
int32_t dict_iovec_len (dict_t *dict);
int32_t dict_to_iovec (dict_t *dict, struct iovec *vec, int32_t count);