summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/common-utils.c14
-rw-r--r--libglusterfs/src/common-utils.h2
-rw-r--r--libglusterfs/src/dict.h1
3 files changed, 17 insertions, 0 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index 38623dc79ac..931cc66fbbc 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -47,6 +47,7 @@
#include "glusterfs.h"
#include "stack.h"
#include "globals.h"
+#include "md5.h"
typedef int32_t (*rw_op_t)(int32_t fd, char *buf, int32_t size);
typedef int32_t (*rwv_op_t)(int32_t fd, const struct iovec *buf, int32_t size);
@@ -1711,3 +1712,16 @@ uuid_utoa_r (uuid_t uuid, char *dst)
uuid_unparse (uuid, dst);
return dst;
}
+
+void _get_md5_str (char *out_str, size_t outlen,
+ const uint8_t *input, int n)
+{
+ uint8_t out[MD5_DIGEST_LEN] = {0};
+ int j = 0;
+
+ GF_ASSERT (outlen >= (2*MD5_DIGEST_LEN + 1));
+ get_md5 (out, input, n);
+ for (j = 0; j < MD5_DIGEST_LEN; j++)
+ snprintf(out_str + j * 2, outlen-j*2, "%02x", out[j]);
+
+}
diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h
index 0d93e5bee91..96a7c3e4ff9 100644
--- a/libglusterfs/src/common-utils.h
+++ b/libglusterfs/src/common-utils.h
@@ -353,5 +353,7 @@ char valid_internet_address (char *address);
char *uuid_utoa (uuid_t uuid);
char *uuid_utoa_r (uuid_t uuid, char *dst);
+void _get_md5_str (char *out_str, size_t outlen,
+ const uint8_t *input, int n);
#endif /* _COMMON_UTILS_H */
diff --git a/libglusterfs/src/dict.h b/libglusterfs/src/dict.h
index 417967051bb..ac587f59acd 100644
--- a/libglusterfs/src/dict.h
+++ b/libglusterfs/src/dict.h
@@ -127,6 +127,7 @@ void *data_to_bin (data_t *data);
void *data_to_ptr (data_t *data);
data_t *get_new_data ();
+data_t * data_copy (data_t *old);
dict_t *get_new_dict_full (int size_hint);
dict_t *get_new_dict ();