summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libglusterfs/src/common-utils.c11
-rw-r--r--libglusterfs/src/common-utils.h1
-rw-r--r--xlators/features/changelog/src/changelog-misc.h20
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c8
4 files changed, 15 insertions, 25 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index ad0359d7cb2..ef76bdfe750 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -74,17 +74,6 @@ 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);
void
-md5_wrapper(const unsigned char *data, size_t len, char *md5)
-{
- unsigned short i = 0;
- unsigned short lim = MD5_DIGEST_LENGTH*2+1;
- unsigned char scratch[MD5_DIGEST_LENGTH] = {0,};
- MD5(data, len, scratch);
- for (; i < MD5_DIGEST_LENGTH; i++)
- snprintf(md5 + i * 2, lim-i*2, "%02x", scratch[i]);
-}
-
-void
gf_xxh64_wrapper(const unsigned char *data, size_t len, unsigned long long seed,
char *xxh64)
{
diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h
index 1954892ff8f..8df96c338f5 100644
--- a/libglusterfs/src/common-utils.h
+++ b/libglusterfs/src/common-utils.h
@@ -841,7 +841,6 @@ gf_ports_reserved (char *blocked_port, unsigned char *ports, uint32_t ceiling);
int gf_get_hostname_from_ip (char *client_ip, char **hostname);
gf_boolean_t gf_is_local_addr (char *hostname);
gf_boolean_t gf_is_same_address (char *host1, char *host2);
-void md5_wrapper(const unsigned char *data, size_t len, char *md5);
void gf_xxh64_wrapper(const unsigned char *data, size_t len,
unsigned long long seed, char *xxh64);
int gf_set_timestamp (const char *src, const char* dest);
diff --git a/xlators/features/changelog/src/changelog-misc.h b/xlators/features/changelog/src/changelog-misc.h
index 94d6c507bd6..93af201879e 100644
--- a/xlators/features/changelog/src/changelog-misc.h
+++ b/xlators/features/changelog/src/changelog-misc.h
@@ -36,24 +36,24 @@
"GlusterFS Changelog | version: v%d.%d | encoding : %d\n"
#define CHANGELOG_MAKE_SOCKET_PATH(brick_path, sockpath, len) do { \
- char md5_sum[MD5_DIGEST_LENGTH*2+1] = {0,}; \
- md5_wrapper((unsigned char *) brick_path, \
- strlen(brick_path), \
- md5_sum); \
+ char xxh64[GF_XXH64_DIGEST_LENGTH*2+1] = {0,}; \
+ gf_xxh64_wrapper ((unsigned char *)brick_path, \
+ strlen(brick_path), \
+ GF_XXHSUM64_DEFAULT_SEED, xxh64); \
(void) snprintf (sockpath, len, \
- CHANGELOG_UNIX_SOCK, md5_sum); \
+ CHANGELOG_UNIX_SOCK, xxh64); \
} while (0)
#define CHANGELOG_MAKE_TMP_SOCKET_PATH(brick_path, sockpath, len) do { \
unsigned long pid = 0; \
- char md5_sum[MD5_DIGEST_LENGTH*2+1] = {0,}; \
+ char xxh64[GF_XXH64_DIGEST_LENGTH*2+1] = {0,}; \
pid = (unsigned long) getpid (); \
- md5_wrapper((unsigned char *) brick_path, \
- strlen(brick_path), \
- md5_sum); \
+ gf_xxh64_wrapper ((unsigned char *)brick_path, \
+ strlen(brick_path), \
+ GF_XXHSUM64_DEFAULT_SEED, xxh64); \
(void) snprintf (sockpath, \
len, CHANGELOG_TMP_UNIX_SOCK, \
- md5_sum, pid); \
+ xxh64, pid); \
} while (0)
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index a0a2a53830a..8da9362515c 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -1842,10 +1842,12 @@ out:
void
glusterd_set_socket_filepath (char *sock_filepath, char *sockpath, size_t len)
{
- char md5_sum[MD5_DIGEST_LENGTH*2+1] = {0,};
+ char xxh64[GF_XXH64_DIGEST_LENGTH*2+1] = {0,};
- md5_wrapper ((unsigned char *) sock_filepath, strlen(sock_filepath), md5_sum);
- snprintf (sockpath, len, "%s/%s.socket", GLUSTERD_SOCK_DIR, md5_sum);
+ gf_xxh64_wrapper ((unsigned char *)sock_filepath,
+ strlen(sock_filepath),
+ GF_XXHSUM64_DEFAULT_SEED, xxh64);
+ snprintf (sockpath, len, "%s/%s.socket", GLUSTERD_SOCK_DIR, xxh64);
}
void