diff options
author | Mohamed Ashiq <ashiq333@gmail.com> | 2015-05-19 15:53:19 +0530 |
---|---|---|
committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2015-06-25 01:50:53 -0700 |
commit | a1e32fbcfbfaf6e4c63e140b3b90a80dc748a269 (patch) | |
tree | 5eb99dd6e79798d8549bca070fd1f243029a5aaa /libglusterfs/src/client_t.c | |
parent | 9df8366174d57e3cd948d19efa9cdbadecfc012d (diff) |
call-stub,circ-buff,client_t,compat,dict/libglusterfs : Porting to a new logging framework
Change-Id: Ie7d180e0ab2fed1270d66504606d1b2522884020
BUG: 1194640
Signed-off-by: Mohamed Ashiq <ashiq333@gmail.com>
Reviewed-on: http://review.gluster.org/10828
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'libglusterfs/src/client_t.c')
-rw-r--r-- | libglusterfs/src/client_t.c | 67 |
1 files changed, 42 insertions, 25 deletions
diff --git a/libglusterfs/src/client_t.c b/libglusterfs/src/client_t.c index 9e6c90eba41..1b7d0caafc9 100644 --- a/libglusterfs/src/client_t.c +++ b/libglusterfs/src/client_t.c @@ -14,7 +14,7 @@ #include "client_t.h" #include "list.h" #include "rpcsvc.h" - +#include "libglusterfs-messages.h" static int gf_client_chain_client_entries (cliententry_t *entries, uint32_t startidx, @@ -23,7 +23,8 @@ gf_client_chain_client_entries (cliententry_t *entries, uint32_t startidx, uint32_t i = 0; if (!entries) { - gf_log_callingfn ("client_t", GF_LOG_WARNING, "!entries"); + gf_msg_callingfn ("client_t", GF_LOG_WARNING, EINVAL, + LG_MSG_INVALID_ARG, "!entries"); return -1; } @@ -48,7 +49,8 @@ gf_client_clienttable_expand (clienttable_t *clienttable, uint32_t nr) int ret = -1; if (clienttable == NULL || nr <= clienttable->max_clients) { - gf_log_callingfn ("client_t", GF_LOG_ERROR, "invalid argument"); + gf_msg_callingfn ("client_t", GF_LOG_ERROR, EINVAL, + LG_MSG_INVALID_ARG, "invalid argument"); ret = EINVAL; goto out; } @@ -102,7 +104,8 @@ gf_clienttable_alloc (void) result = gf_client_clienttable_expand (clienttable, GF_CLIENTTABLE_INITIAL_SIZE); if (result != 0) { - gf_log ("client_t", GF_LOG_ERROR, + gf_msg ("client_t", GF_LOG_ERROR, 0, + LG_MSG_EXPAND_CLIENT_TABLE_FAILED, "gf_client_clienttable_expand failed"); GF_FREE (clienttable); return NULL; @@ -121,7 +124,8 @@ gf_client_clienttable_destroy (clienttable_t *clienttable) int32_t i = 0; if (!clienttable) { - gf_log_callingfn ("client_t", GF_LOG_WARNING, "!clienttable"); + gf_msg_callingfn ("client_t", GF_LOG_WARNING, EINVAL, + LG_MSG_INVALID_ARG, "!clienttable"); return; } @@ -163,7 +167,8 @@ gf_client_get (xlator_t *this, struct rpcsvc_auth_data *cred, char *client_uid) unsigned int i = 0; if (this == NULL || client_uid == NULL) { - gf_log_callingfn ("client_t", GF_LOG_ERROR, "invalid argument"); + gf_msg_callingfn ("client_t", GF_LOG_ERROR, EINVAL, + LG_MSG_INVALID_ARG, "invalid argument"); errno = EINVAL; return NULL; } @@ -270,9 +275,10 @@ unlock: UNLOCK (&clienttable->lock); if (client) - gf_log_callingfn ("client_t", GF_LOG_DEBUG, "%s: bind_ref: %d, " - "ref: %d", client->client_uid, - client->ref.bind, client->ref.count); + gf_msg_callingfn ("client_t", GF_LOG_DEBUG, 0, LG_MSG_BIND_REF, + "%s: bind_ref: %d, ref: %d", + client->client_uid, client->ref.bind, + client->ref.count); return client; } @@ -289,8 +295,9 @@ gf_client_put (client_t *client, gf_boolean_t *detached) if (bind_ref == 0) unref = _gf_true; - gf_log_callingfn ("client_t", GF_LOG_DEBUG, "%s: bind_ref: %d, ref: %d," - " unref: %d", client->client_uid, client->ref.bind, + gf_msg_callingfn ("client_t", GF_LOG_DEBUG, 0, LG_MSG_BIND_REF, "%s: " + "bind_ref: %d, ref: %d, unref: %d", + client->client_uid, client->ref.bind, client->ref.count, unref); if (unref) { if (detached) @@ -303,13 +310,15 @@ client_t * gf_client_ref (client_t *client) { if (!client) { - gf_log_callingfn ("client_t", GF_LOG_ERROR, "null client"); + gf_msg_callingfn ("client_t", GF_LOG_ERROR, EINVAL, + LG_MSG_INVALID_ARG, "null client"); return NULL; } INCREMENT_ATOMIC (client->ref.lock, client->ref.count); - gf_log_callingfn ("client_t", GF_LOG_DEBUG, "%s: ref-count %d", - client->client_uid, client->ref.count); + gf_msg_callingfn ("client_t", GF_LOG_DEBUG, 0, LG_MSG_REF_COUNT, "%s: " + "ref-count %d", client->client_uid, + client->ref.count); return client; } @@ -322,7 +331,8 @@ client_destroy (client_t *client) xlator_t *xtrav = NULL; if (client == NULL){ - gf_log_callingfn ("xlator", GF_LOG_ERROR, "invalid argument"); + gf_msg_callingfn ("xlator", GF_LOG_ERROR, EINVAL, + LG_MSG_INVALID_ARG, "invalid argument"); goto out; } @@ -384,16 +394,18 @@ gf_client_unref (client_t *client) int refcount; if (!client) { - gf_log_callingfn ("client_t", GF_LOG_ERROR, "client is NULL"); + gf_msg_callingfn ("client_t", GF_LOG_ERROR, EINVAL, + LG_MSG_INVALID_ARG, "client is NULL"); return; } refcount = DECREMENT_ATOMIC (client->ref.lock, client->ref.count); - gf_log_callingfn ("client_t", GF_LOG_DEBUG, "%s: ref-count %d", - client->client_uid, (int)client->ref.count); + gf_msg_callingfn ("client_t", GF_LOG_DEBUG, 0, LG_MSG_REF_COUNT, "%s: " + "ref-count %d", client->client_uid, + (int)client->ref.count); if (refcount == 0) { - gf_log (THIS->name, GF_LOG_INFO, "Shutting down connection %s", - client->client_uid); + gf_msg (THIS->name, GF_LOG_INFO, 0, LG_MSG_DISCONNECT_CLIENT, + "Shutting down connection %s", client->client_uid); client_destroy (client); } } @@ -577,7 +589,8 @@ clienttable_dump (clienttable_t *clienttable, char *prefix) ret = TRY_LOCK (&clienttable->lock); { if (ret) { - gf_log ("client_t", GF_LOG_WARNING, + gf_msg ("client_t", GF_LOG_WARNING, 0, + LG_MSG_LOCK_GAIN_FAILED, "Unable to acquire lock"); return; } @@ -674,7 +687,8 @@ gf_client_dump_fdtables_to_dict (xlator_t *this, dict_t *dict) ret = TRY_LOCK (&clienttable->lock); { if (ret) { - gf_log ("client_t", GF_LOG_WARNING, + gf_msg ("client_t", GF_LOG_WARNING, 0, + LG_MSG_LOCK_GAIN_FAILED, "Unable to acquire lock"); return -1; } @@ -716,7 +730,8 @@ gf_client_dump_fdtables (xlator_t *this) ret = TRY_LOCK (&clienttable->lock); { if (ret) { - gf_log ("client_t", GF_LOG_WARNING, + gf_msg ("client_t", GF_LOG_WARNING, 0, + LG_MSG_LOCK_GAIN_FAILED, "Unable to acquire lock"); return -1; } @@ -781,7 +796,8 @@ gf_client_dump_inodes_to_dict (xlator_t *this, dict_t *dict) ret = TRY_LOCK (&clienttable->lock); { if (ret) { - gf_log ("client_t", GF_LOG_WARNING, + gf_msg ("client_t", GF_LOG_WARNING, 0, + LG_MSG_LOCK_GAIN_FAILED, "Unable to acquire lock"); return -1; } @@ -842,7 +858,8 @@ gf_client_dump_inodes (xlator_t *this) ret = TRY_LOCK (&clienttable->lock); { if (ret) { - gf_log ("client_t", GF_LOG_WARNING, + gf_msg ("client_t", GF_LOG_WARNING, 0, + LG_MSG_LOCK_GAIN_FAILED, "Unable to acquire lock"); goto out; } |