diff options
author | Gaurav <gaurav@gluster.com> | 2011-01-31 04:25:38 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2011-02-04 00:39:26 -0800 |
commit | 5f8e2cab86eab7f5ee5b4bb9b649376e476c740c (patch) | |
tree | 2a40f4806584dbafe1e0c2d44dbb509de28cbeb4 /xlators/mgmt/glusterd/src | |
parent | f3648c88ebc6d58a10854d564d3fc2c82290ce13 (diff) |
Logging : Use of uuid_utoa and uuid_utoa_r.
Signed-off-by: Gaurav <gaurav@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 2308 (Threadsafe uuid to string conversion function)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2308
Diffstat (limited to 'xlators/mgmt/glusterd/src')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-handler.c | 46 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-store.c | 29 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 18 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volgen.c | 4 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd.c | 8 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd3_1-mops.c | 43 |
6 files changed, 51 insertions, 97 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index 9aca4bd4b55..aafae5dadfe 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -72,11 +72,9 @@ glusterd_handle_friend_req (rpcsvc_request_t *req, uuid_t uuid, glusterd_friend_req_ctx_t *ctx = NULL; char rhost[UNIX_PATH_MAX + 1] = {0}; uuid_t friend_uuid = {0}; - char uuid_str[50] = {0,}; dict_t *dict = NULL; - uuid_unparse (uuid, uuid_str); - uuid_parse (uuid_str, friend_uuid); + uuid_parse (uuid_utoa (uuid), friend_uuid); if (!port) port = GF_DEFAULT_BASE_PORT; @@ -246,7 +244,7 @@ glusterd_add_peer_detail_to_dict (glusterd_peerinfo_t *peerinfo, GF_ASSERT (friends); snprintf (key, 256, "friend%d.uuid", count); - uuid_unparse (peerinfo->uuid, peerinfo->uuid_str); + uuid_utoa_r (peerinfo->uuid, peerinfo->uuid_str); ret = dict_set_str (friends, key, peerinfo->uuid_str); if (ret) goto out; @@ -409,7 +407,6 @@ glusterd_handle_cluster_lock (rpcsvc_request_t *req) { gd1_mgmt_cluster_lock_req lock_req = {{0},}; int32_t ret = -1; - char str[50] = {0,}; glusterd_op_lock_ctx_t *ctx = NULL; GF_ASSERT (req); @@ -419,10 +416,9 @@ glusterd_handle_cluster_lock (rpcsvc_request_t *req) req->rpc_err = GARBAGE_ARGS; goto out; } - uuid_unparse (lock_req.uuid, str); gf_log ("glusterd", GF_LOG_NORMAL, - "Received LOCK from uuid: %s", str); + "Received LOCK from uuid: %s", uuid_utoa (lock_req.uuid)); ctx = GF_CALLOC (1, sizeof (*ctx), gf_gld_mt_op_lock_ctx_t); @@ -447,7 +443,6 @@ int glusterd_handle_stage_op (rpcsvc_request_t *req) { int32_t ret = -1; - char str[50] = {0,}; gd1_mgmt_stage_op_req stage_req = {{0,}}; glusterd_op_stage_ctx_t *ctx = NULL; @@ -459,9 +454,8 @@ glusterd_handle_stage_op (rpcsvc_request_t *req) goto out; } - uuid_unparse (stage_req.uuid, str); gf_log ("glusterd", GF_LOG_NORMAL, - "Received stage op from uuid: %s", str); + "Received stage op from uuid: %s", uuid_utoa (stage_req.uuid)); ctx = GF_CALLOC (1, sizeof (*ctx), gf_gld_mt_op_stage_ctx_t); @@ -496,7 +490,6 @@ int glusterd_handle_commit_op (rpcsvc_request_t *req) { int32_t ret = -1; - char str[50] = {0,}; gd1_mgmt_commit_op_req commit_req = {{0},}; glusterd_op_commit_ctx_t *ctx = NULL; @@ -508,10 +501,9 @@ glusterd_handle_commit_op (rpcsvc_request_t *req) goto out; } - uuid_unparse (commit_req.uuid, str); gf_log ("glusterd", GF_LOG_NORMAL, - "Received commit op from uuid: %s", str); + "Received commit op from uuid: %s", uuid_utoa (commit_req.uuid)); ctx = GF_CALLOC (1, sizeof (*ctx), gf_gld_mt_op_commit_ctx_t); @@ -762,7 +754,6 @@ glusterd_handle_create_volume (rpcsvc_request_t *req) char *free_ptr = NULL; char *trans_type = NULL; uuid_t volume_id = {0,}; - char volid[64] = {0,}; glusterd_brickinfo_t *tmpbrkinfo = NULL; glusterd_volinfo_t tmpvolinfo = {{0},}; @@ -833,8 +824,7 @@ glusterd_handle_create_volume (rpcsvc_request_t *req) } uuid_generate (volume_id); - uuid_unparse (volume_id, volid); - free_ptr = gf_strdup (volid); + free_ptr = gf_strdup (uuid_utoa (volume_id)); ret = dict_set_dynstr (dict, "volume-id", free_ptr); if (ret) { gf_log ("", GF_LOG_ERROR, "unable to set volume-id"); @@ -1524,7 +1514,7 @@ glusterd_handle_remove_brick (rpcsvc_request_t *req) if ((volinfo->type == GF_CLUSTER_TYPE_NONE) || (volinfo->brick_count <= volinfo->sub_count)) continue; - + pos = 0; list_for_each_entry (tmp, &volinfo->bricks, brick_list) { @@ -2000,7 +1990,6 @@ glusterd_handle_cluster_unlock (rpcsvc_request_t *req) { gd1_mgmt_cluster_unlock_req unlock_req = {{0}, }; int32_t ret = -1; - char str[50] = {0, }; glusterd_op_lock_ctx_t *ctx = NULL; GF_ASSERT (req); @@ -2011,10 +2000,9 @@ glusterd_handle_cluster_unlock (rpcsvc_request_t *req) goto out; } - uuid_unparse (unlock_req.uuid, str); gf_log ("glusterd", GF_LOG_NORMAL, - "Received UNLOCK from uuid: %s", str); + "Received UNLOCK from uuid: %s", uuid_utoa (unlock_req.uuid)); ctx = GF_CALLOC (1, sizeof (*ctx), gf_gld_mt_op_lock_ctx_t); @@ -2114,7 +2102,6 @@ glusterd_handle_incoming_friend_req (rpcsvc_request_t *req) { int32_t ret = -1; gd1_mgmt_friend_req friend_req = {{0},}; - char str[50] = {0,}; GF_ASSERT (req); if (!gd_xdr_to_mgmt_friend_req (req->msg[0], &friend_req)) { @@ -2122,10 +2109,9 @@ glusterd_handle_incoming_friend_req (rpcsvc_request_t *req) req->rpc_err = GARBAGE_ARGS; goto out; } - uuid_unparse (friend_req.uuid, str); gf_log ("glusterd", GF_LOG_NORMAL, - "Received probe from uuid: %s", str); + "Received probe from uuid: %s", uuid_utoa (friend_req.uuid)); ret = glusterd_handle_friend_req (req, friend_req.uuid, friend_req.hostname, friend_req.port, &friend_req); @@ -2142,7 +2128,6 @@ glusterd_handle_incoming_unfriend_req (rpcsvc_request_t *req) { int32_t ret = -1; gd1_mgmt_friend_req friend_req = {{0},}; - char str[50]; char remote_hostname[UNIX_PATH_MAX + 1] = {0,}; GF_ASSERT (req); @@ -2151,10 +2136,9 @@ glusterd_handle_incoming_unfriend_req (rpcsvc_request_t *req) req->rpc_err = GARBAGE_ARGS; goto out; } - uuid_unparse (friend_req.uuid, str); gf_log ("glusterd", GF_LOG_NORMAL, - "Received unfriend from uuid: %s", str); + "Received unfriend from uuid: %s", uuid_utoa (friend_req.uuid)); ret = glusterd_remote_hostname_get (req, remote_hostname, sizeof (remote_hostname)); @@ -2224,7 +2208,6 @@ glusterd_handle_friend_update (rpcsvc_request_t *req) { int32_t ret = -1; gd1_mgmt_friend_update friend_req = {{0},}; - char str[50] = {0,}; glusterd_peerinfo_t *peerinfo = NULL; glusterd_conf_t *priv = NULL; xlator_t *this = NULL; @@ -2252,16 +2235,15 @@ glusterd_handle_friend_update (rpcsvc_request_t *req) req->rpc_err = GARBAGE_ARGS; goto out; } - uuid_unparse (friend_req.uuid, str); ret = glusterd_friend_find (friend_req.uuid, NULL, &tmp); if (ret) { gf_log ("", GF_LOG_CRITICAL, "Received friend update request " - "from unknown peer %s", str); + "from unknown peer %s", uuid_utoa (friend_req.uuid)); goto out; } gf_log ("glusterd", GF_LOG_NORMAL, - "Received friend update from uuid: %s", str); + "Received friend update from uuid: %s", uuid_utoa (friend_req.uuid)); if (friend_req.friends.friends_len) { /* Unserialize the dictionary */ @@ -2352,7 +2334,6 @@ int glusterd_handle_probe_query (rpcsvc_request_t *req) { int32_t ret = -1; - char str[50]; xlator_t *this = NULL; glusterd_conf_t *conf = NULL; gd1_mgmt_probe_req probe_req = {{0},}; @@ -2374,14 +2355,13 @@ glusterd_handle_probe_query (rpcsvc_request_t *req) this = THIS; conf = this->private; - uuid_unparse (probe_req.uuid, str); if (probe_req.port) port = probe_req.port; else port = GF_DEFAULT_BASE_PORT; gf_log ("glusterd", GF_LOG_NORMAL, - "Received probe from uuid: %s", str); + "Received probe from uuid: %s", uuid_utoa (probe_req.uuid)); ret = glusterd_remote_hostname_get (req, remote_hostname, sizeof (remote_hostname)); diff --git a/xlators/mgmt/glusterd/src/glusterd-store.c b/xlators/mgmt/glusterd/src/glusterd-store.c index fa67c23e979..f2e14b0b3ce 100644 --- a/xlators/mgmt/glusterd/src/glusterd-store.c +++ b/xlators/mgmt/glusterd/src/glusterd-store.c @@ -47,6 +47,7 @@ #include "glusterd1.h" #include "cli1.h" #include "rpc-clnt.h" +#include "common-utils.h" #include <sys/resource.h> #include <inttypes.h> @@ -381,9 +382,9 @@ glusterd_store_create_volume (glusterd_volinfo_t *volinfo) if (ret) goto out; - uuid_unparse (volinfo->volume_id, buf); ret = glusterd_store_save_value (volinfo->shandle, - GLUSTERD_STORE_KEY_VOL_ID, buf); + GLUSTERD_STORE_KEY_VOL_ID, + uuid_utoa (volinfo->volume_id)); if (ret) goto out; @@ -676,7 +677,6 @@ glusterd_store_handle_truncate (glusterd_store_handle_t *handle) int32_t glusterd_store_uuid () { - char str[GLUSTERD_UUID_LEN] = {0,}; glusterd_conf_t *priv = NULL; char path[PATH_MAX] = {0,}; int32_t ret = -1; @@ -684,8 +684,6 @@ glusterd_store_uuid () priv = THIS->private; - uuid_unparse (priv->uuid, str); - snprintf (path, PATH_MAX, "%s/%s", priv->workdir, GLUSTERD_INFO_FILE); @@ -702,7 +700,7 @@ glusterd_store_uuid () } ret = glusterd_store_save_value (priv->handle, GLUSTERD_STORE_UUID_KEY, - str); + uuid_utoa (priv->uuid)); if (ret) { gf_log ("", GF_LOG_CRITICAL, "Storing uuid failed" @@ -874,7 +872,7 @@ glusterd_store_iter_get_matching (glusterd_store_iter_t *iter, } GF_FREE (tmp_key); GF_FREE (tmp_value); - ret = glusterd_store_iter_get_next (iter, &tmp_key, + ret = glusterd_store_iter_get_next (iter, &tmp_key, &tmp_value); } out: @@ -1224,9 +1222,9 @@ glusterd_store_update_volume (glusterd_volinfo_t *volinfo) if (ret) goto out; - uuid_unparse (volinfo->volume_id, buf); ret = glusterd_store_save_value (volinfo->shandle, - GLUSTERD_STORE_KEY_VOL_ID, buf); + GLUSTERD_STORE_KEY_VOL_ID, + uuid_utoa (volinfo->volume_id)); if (ret) goto out; @@ -1256,7 +1254,6 @@ glusterd_store_delete_peerinfo (glusterd_peerinfo_t *peerinfo) glusterd_conf_t *priv = NULL; char peerdir[PATH_MAX] = {0,}; char filepath[PATH_MAX] = {0,}; - char str[512] = {0,}; char hostname_path[PATH_MAX] = {0,}; @@ -1280,9 +1277,9 @@ glusterd_store_delete_peerinfo (glusterd_peerinfo_t *peerinfo) goto out; } } else { - uuid_unparse (peerinfo->uuid, str); - snprintf (filepath, PATH_MAX, "%s/%s", peerdir, str); + snprintf (filepath, PATH_MAX, "%s/%s", peerdir, + uuid_utoa (peerinfo->uuid)); snprintf (hostname_path, PATH_MAX, "%s/%s", peerdir, peerinfo->hostname); @@ -1313,7 +1310,6 @@ glusterd_store_update_peerinfo (glusterd_peerinfo_t *peerinfo) glusterd_conf_t *priv = NULL; char peerdir[PATH_MAX] = {0,}; char filepath[PATH_MAX] = {0,}; - char str[512] = {0,}; char buf[4096] = {0,}; char hostname_path[PATH_MAX] = {0,}; @@ -1345,9 +1341,9 @@ glusterd_store_update_peerinfo (glusterd_peerinfo_t *peerinfo) goto out; } } else { - uuid_unparse (peerinfo->uuid, str); - snprintf (filepath, PATH_MAX, "%s/%s", peerdir, str); + snprintf (filepath, PATH_MAX, "%s/%s", peerdir, + uuid_utoa (peerinfo->uuid)); snprintf (hostname_path, PATH_MAX, "%s/%s", peerdir, peerinfo->hostname); @@ -1374,7 +1370,8 @@ glusterd_store_update_peerinfo (glusterd_peerinfo_t *peerinfo) } ret = glusterd_store_save_value (peerinfo->shandle, - GLUSTERD_STORE_KEY_PEER_UUID, str); + GLUSTERD_STORE_KEY_PEER_UUID, + uuid_utoa (peerinfo->uuid)); if (ret) goto out; diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index db0b0b385c5..0fac9e3b402 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -224,15 +224,14 @@ glusterd_lock (uuid_t uuid) int ret = -1; GF_ASSERT (uuid); - uuid_unparse (uuid, new_owner_str); glusterd_get_lock_owner (&owner); if (!uuid_is_null (owner)) { - uuid_unparse (owner, owner_str); gf_log ("glusterd", GF_LOG_ERROR, "Unable to get lock" - " for uuid: %s, lock held by: %s", new_owner_str, - owner_str); + " for uuid: %s, lock held by: %s", + uuid_utoa_r (uuid, new_owner_str), + uuid_utoa_r (owner, owner_str)); goto out; } @@ -240,7 +239,7 @@ glusterd_lock (uuid_t uuid) if (!ret) { gf_log ("glusterd", GF_LOG_NORMAL, "Cluster lock held by" - " %s", new_owner_str); + " %s", uuid_utoa (uuid)); } out: @@ -257,7 +256,6 @@ glusterd_unlock (uuid_t uuid) int32_t ret = -1; GF_ASSERT (uuid); - uuid_unparse (uuid, new_owner_str); glusterd_get_lock_owner (&owner); @@ -269,9 +267,9 @@ glusterd_unlock (uuid_t uuid) ret = uuid_compare (uuid, owner); if (ret) { - uuid_unparse (owner, owner_str); gf_log ("glusterd", GF_LOG_ERROR, "Cluster lock held by %s" - " ,unlock req from %s!", owner_str, new_owner_str); + " ,unlock req from %s!", uuid_utoa_r (owner ,owner_str) + , uuid_utoa_r (uuid, new_owner_str)); goto out; } @@ -1224,7 +1222,6 @@ glusterd_add_volume_to_dict (glusterd_volinfo_t *volinfo, char key[512] = {0,}; glusterd_brickinfo_t *brickinfo = NULL; int32_t i = 1; - char uuid_str[50] = {0,}; char *volume_id_str = NULL; glusterd_volopt_ctx_t ctx = {0}; @@ -1272,8 +1269,7 @@ glusterd_add_volume_to_dict (glusterd_volinfo_t *volinfo, if (ret) goto out; - uuid_unparse (volinfo->volume_id, uuid_str); - volume_id_str = gf_strdup (uuid_str); + volume_id_str = gf_strdup (uuid_utoa (volinfo->volume_id)); if (!volume_id_str) goto out; diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c index a87d26f7921..bf3147738fa 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volgen.c +++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c @@ -1284,7 +1284,6 @@ build_nfs_graph (glusterfs_graph_t *graph, dict_t *mod_dict) char *skey = NULL; char *enable_ino32 = NULL; char *mem_factor = NULL; - char volume_id[64] = {0,}; int ret = 0; this = THIS; @@ -1336,8 +1335,7 @@ build_nfs_graph (glusterfs_graph_t *graph, dict_t *mod_dict) gf_log ("", GF_LOG_ERROR, "Out of memory"); goto out; } - uuid_unparse (voliter->volume_id, volume_id); - ret = xlator_set_option (nfsxl, skey, volume_id); + ret = xlator_set_option (nfsxl, skey, uuid_utoa (voliter->volume_id)); GF_FREE (skey); if (ret) goto out; diff --git a/xlators/mgmt/glusterd/src/glusterd.c b/xlators/mgmt/glusterd/src/glusterd.c index a0189662201..1d6517a4a72 100644 --- a/xlators/mgmt/glusterd/src/glusterd.c +++ b/xlators/mgmt/glusterd/src/glusterd.c @@ -44,6 +44,7 @@ #include "glusterd-op-sm.h" #include "glusterd-store.h" #include "glusterd-utils.h" +#include "common-utils.h" static uuid_t glusterd_uuid; extern struct rpcsvc_program glusterd1_mop_prog; @@ -73,7 +74,6 @@ static int glusterd_uuid_init (int flag) { int ret = -1; - char str[50] = {0,}; glusterd_conf_t *priv = NULL; priv = THIS->private; @@ -81,19 +81,17 @@ glusterd_uuid_init (int flag) if (!flag) { ret = glusterd_retrieve_uuid (); if (!ret) { - uuid_unparse (priv->uuid, str); uuid_copy (glusterd_uuid, priv->uuid); gf_log ("glusterd", GF_LOG_NORMAL, - "retrieved UUID: %s", str); + "retrieved UUID: %s", uuid_utoa (priv->uuid)); return 0; } } uuid_generate (glusterd_uuid); - uuid_unparse (glusterd_uuid, str); gf_log ("glusterd", GF_LOG_NORMAL, - "generated UUID: %s",str); + "generated UUID: %s", uuid_utoa (glusterd_uuid)); uuid_copy (priv->uuid, glusterd_uuid); ret = glusterd_store_uuid (); diff --git a/xlators/mgmt/glusterd/src/glusterd3_1-mops.c b/xlators/mgmt/glusterd/src/glusterd3_1-mops.c index 09b6b175444..04ced866ab3 100644 --- a/xlators/mgmt/glusterd/src/glusterd3_1-mops.c +++ b/xlators/mgmt/glusterd/src/glusterd3_1-mops.c @@ -33,6 +33,7 @@ #include "glusterd.h" #include "protocol-common.h" #include "glusterd-utils.h" +#include "common-utils.h" #include <sys/uio.h> @@ -55,7 +56,6 @@ glusterd3_1_probe_cbk (struct rpc_req *req, struct iovec *iov, gd1_mgmt_probe_rsp rsp = {{0},}; glusterd_conf_t *conf = NULL; int ret = 0; - char str[50] = {0,}; glusterd_peerinfo_t *peerinfo = NULL; glusterd_friend_sm_event_t *event = NULL; glusterd_probe_ctx_t *ctx = NULL; @@ -73,11 +73,10 @@ glusterd3_1_probe_cbk (struct rpc_req *req, struct iovec *iov, //rsp.op_errno = EINVAL; goto out; } - uuid_unparse (rsp.uuid, str); gf_log ("glusterd", GF_LOG_NORMAL, "Received probe resp from uuid: %s, host: %s", - str, rsp.hostname); + uuid_utoa (rsp.uuid), rsp.hostname); if (rsp.op_ret != 0) { ctx = ((call_frame_t *)myframe)->local; ((call_frame_t *)myframe)->local = NULL; @@ -141,7 +140,6 @@ glusterd3_1_friend_add_cbk (struct rpc_req * req, struct iovec *iov, glusterd_friend_sm_event_t *event = NULL; glusterd_friend_sm_event_type_t event_type = GD_FRIEND_EVENT_NONE; glusterd_peerinfo_t *peerinfo = NULL; - char str[50] = {0,}; int32_t op_ret = -1; int32_t op_errno = -1; glusterd_probe_ctx_t *ctx = NULL; @@ -162,20 +160,19 @@ glusterd3_1_friend_add_cbk (struct rpc_req * req, struct iovec *iov, rsp.op_errno = EINVAL; goto out; } - uuid_unparse (rsp.uuid, str); op_ret = rsp.op_ret; op_errno = rsp.op_errno; gf_log ("glusterd", GF_LOG_NORMAL, "Received %s from uuid: %s, host: %s, port: %d", - (op_ret)?"RJT":"ACC", str, rsp.hostname, rsp.port); + (op_ret)?"RJT":"ACC", uuid_utoa (rsp.uuid), rsp.hostname, rsp.port); ret = glusterd_friend_find (rsp.uuid, rsp.hostname, &peerinfo); if (ret) { gf_log ("", GF_LOG_ERROR, "received friend add response from" - " unknown peer uuid: %s", str); + " unknown peer uuid: %s", uuid_utoa (rsp.uuid)); goto out; } @@ -239,7 +236,6 @@ glusterd3_1_friend_remove_cbk (struct rpc_req * req, struct iovec *iov, glusterd_friend_sm_event_t *event = NULL; glusterd_friend_sm_event_type_t event_type = GD_FRIEND_EVENT_NONE; glusterd_peerinfo_t *peerinfo = NULL; - char str[50] = {0,}; int32_t op_ret = -1; int32_t op_errno = -1; glusterd_probe_ctx_t *ctx = NULL; @@ -264,14 +260,13 @@ glusterd3_1_friend_remove_cbk (struct rpc_req * req, struct iovec *iov, rsp.op_errno = EINVAL; goto respond; } - uuid_unparse (rsp.uuid, str); op_ret = rsp.op_ret; op_errno = rsp.op_errno; gf_log ("glusterd", GF_LOG_NORMAL, "Received %s from uuid: %s, host: %s, port: %d", - (op_ret)?"RJT":"ACC", str, rsp.hostname, rsp.port); + (op_ret)?"RJT":"ACC", uuid_utoa (rsp.uuid), rsp.hostname, rsp.port); inject: ret = glusterd_friend_find (rsp.uuid, ctx->hostname, &peerinfo); @@ -369,7 +364,6 @@ glusterd3_1_cluster_lock_cbk (struct rpc_req *req, struct iovec *iov, int32_t op_ret = -1; glusterd_op_sm_event_type_t event_type = GD_OP_EVENT_NONE; glusterd_peerinfo_t *peerinfo = NULL; - char str[50] = {0,}; GF_ASSERT (req); @@ -386,19 +380,18 @@ glusterd3_1_cluster_lock_cbk (struct rpc_req *req, struct iovec *iov, rsp.op_errno = EINVAL; goto out; } - uuid_unparse (rsp.uuid, str); op_ret = rsp.op_ret; gf_log ("glusterd", GF_LOG_NORMAL, "Received %s from uuid: %s", - (op_ret)?"RJT":"ACC", str); + (op_ret)?"RJT":"ACC", uuid_utoa (rsp.uuid)); ret = glusterd_friend_find (rsp.uuid, NULL, &peerinfo); if (ret) { gf_log ("", GF_LOG_CRITICAL, "Lock response received from " - "unknown peer: %s", str); + "unknown peer: %s", uuid_utoa (rsp.uuid)); } if (op_ret) { @@ -429,7 +422,6 @@ glusterd3_1_cluster_unlock_cbk (struct rpc_req *req, struct iovec *iov, int32_t op_ret = -1; glusterd_op_sm_event_type_t event_type = GD_OP_EVENT_NONE; glusterd_peerinfo_t *peerinfo = NULL; - char str[50] = {0,}; GF_ASSERT (req); @@ -447,19 +439,18 @@ glusterd3_1_cluster_unlock_cbk (struct rpc_req *req, struct iovec *iov, rsp.op_errno = EINVAL; goto out; } - uuid_unparse (rsp.uuid, str); op_ret = rsp.op_ret; gf_log ("glusterd", GF_LOG_NORMAL, "Received %s from uuid: %s", - (op_ret)?"RJT":"ACC", str); + (op_ret)?"RJT":"ACC", uuid_utoa (rsp.uuid)); ret = glusterd_friend_find (rsp.uuid, NULL, &peerinfo); if (ret) { gf_log ("", GF_LOG_CRITICAL, "Unlock response received from " - "unknown peer %s", str); + "unknown peer %s", uuid_utoa (rsp.uuid)); } if (op_ret) { @@ -547,7 +538,6 @@ glusterd3_1_stage_op_cbk (struct rpc_req *req, struct iovec *iov, int32_t op_ret = -1; glusterd_op_sm_event_type_t event_type = GD_OP_EVENT_NONE; glusterd_peerinfo_t *peerinfo = NULL; - char str[50] = {0,}; dict_t *dict = NULL; GF_ASSERT (req); @@ -567,7 +557,6 @@ glusterd3_1_stage_op_cbk (struct rpc_req *req, struct iovec *iov, rsp.op_errstr = "error"; goto out; } - uuid_unparse (rsp.uuid, str); if (rsp.dict.dict_len) { /* Unserialize the dictionary */ @@ -591,13 +580,13 @@ glusterd3_1_stage_op_cbk (struct rpc_req *req, struct iovec *iov, gf_log ("glusterd", GF_LOG_NORMAL, "Received %s from uuid: %s", - (op_ret)?"RJT":"ACC", str); + (op_ret)?"RJT":"ACC", uuid_utoa (rsp.uuid)); ret = glusterd_friend_find (rsp.uuid, NULL, &peerinfo); if (ret) { gf_log ("", GF_LOG_CRITICAL, "Stage response received from " - "unknown peer: %s", str); + "unknown peer: %s", uuid_utoa (rsp.uuid)); } if (op_ret) { @@ -667,7 +656,6 @@ glusterd3_1_commit_op_cbk (struct rpc_req *req, struct iovec *iov, int32_t op_ret = -1; glusterd_op_sm_event_type_t event_type = GD_OP_EVENT_NONE; glusterd_peerinfo_t *peerinfo = NULL; - char str[50] = {0,}; dict_t *dict = NULL; @@ -690,7 +678,6 @@ glusterd3_1_commit_op_cbk (struct rpc_req *req, struct iovec *iov, event_type = GD_OP_EVENT_RCVD_RJT; goto out; } - uuid_unparse (rsp.uuid, str); if (rsp.dict.dict_len) { /* Unserialize the dictionary */ @@ -714,13 +701,13 @@ glusterd3_1_commit_op_cbk (struct rpc_req *req, struct iovec *iov, gf_log ("glusterd", GF_LOG_NORMAL, "Received %s from uuid: %s", - (op_ret)?"RJT":"ACC", str); + (op_ret)?"RJT":"ACC", uuid_utoa (rsp.uuid)); ret = glusterd_friend_find (rsp.uuid, NULL, &peerinfo); if (ret) { gf_log ("", GF_LOG_CRITICAL, "Commit response received from " - "unknown peer: %s", str); + "unknown peer: %s", uuid_utoa (rsp.uuid)); } if (op_ret) { @@ -957,7 +944,6 @@ glusterd3_1_friend_update (call_frame_t *frame, xlator_t *this, glusterd_friend_update_ctx_t *ctx = NULL; dict_t *friends = NULL; char key[100] = {0,}; - char uuid_buf[50] = {0,}; char *dup_buf = NULL; int32_t count = 0; char *dict_buf = NULL; @@ -987,9 +973,8 @@ glusterd3_1_friend_update (call_frame_t *frame, xlator_t *this, if (GD_FRIEND_UPDATE_ADD == ctx->op) { list_for_each_entry (peerinfo, &priv->peers, uuid_list) { count++; - uuid_unparse (peerinfo->uuid, uuid_buf); snprintf (key, sizeof (key), "friend%d.uuid", count); - dup_buf = gf_strdup (uuid_buf); + dup_buf = gf_strdup (uuid_utoa (peerinfo->uuid)); ret = dict_set_dynstr (friends, key, dup_buf); if (ret) goto out; |