summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs/src')
-rw-r--r--libglusterfs/src/call-stub.c14
-rw-r--r--libglusterfs/src/circ-buff.c25
-rw-r--r--libglusterfs/src/client_t.c67
-rw-r--r--libglusterfs/src/compat.c58
-rw-r--r--libglusterfs/src/dict.c265
-rw-r--r--libglusterfs/src/dict.h9
6 files changed, 256 insertions, 182 deletions
diff --git a/libglusterfs/src/call-stub.c b/libglusterfs/src/call-stub.c
index 911ea33490..610277820d 100644
--- a/libglusterfs/src/call-stub.c
+++ b/libglusterfs/src/call-stub.c
@@ -13,7 +13,7 @@
#include "call-stub.h"
#include "mem-types.h"
-
+#include "libglusterfs-messages.h"
static call_stub_t *
stub_new (call_frame_t *frame,
@@ -2280,9 +2280,9 @@ call_resume_wind (call_stub_t *stub)
break;
default:
- gf_log_callingfn ("call-stub", GF_LOG_ERROR,
- "Invalid value of FOP (%d)",
- stub->fop);
+ gf_msg_callingfn ("call-stub", GF_LOG_ERROR, EINVAL,
+ LG_MSG_INVALID_ENTRY, "Invalid value of FOP"
+ " (%d)", stub->fop);
break;
}
out:
@@ -2490,9 +2490,9 @@ call_resume_unwind (call_stub_t *stub)
break;
default:
- gf_log_callingfn ("call-stub", GF_LOG_ERROR,
- "Invalid value of FOP (%d)",
- stub->fop);
+ gf_msg_callingfn ("call-stub", GF_LOG_ERROR, EINVAL,
+ LG_MSG_INVALID_ENTRY, "Invalid value of FOP"
+ " (%d)", stub->fop);
break;
}
out:
diff --git a/libglusterfs/src/circ-buff.c b/libglusterfs/src/circ-buff.c
index 484ce7dc93..6259282a91 100644
--- a/libglusterfs/src/circ-buff.c
+++ b/libglusterfs/src/circ-buff.c
@@ -9,6 +9,7 @@
*/
#include "circ-buff.h"
+#include "libglusterfs-messages.h"
void
cb_destroy_data (circular_buffer_t *cb,
@@ -32,8 +33,8 @@ __cb_add_entry_buffer (buffer_t *buffer, void *item)
if (buffer->use_once == _gf_true &&
buffer->used_len == buffer->size_buffer) {
- gf_log ("", GF_LOG_WARNING, "buffer %p is use once buffer",
- buffer);
+ gf_msg ("circ-buff", GF_LOG_WARNING, 0, LG_MSG_BUFFER_ERROR,
+ "buffer %p is use once buffer", buffer);
return -1;
} else {
if (buffer->used_len == buffer->size_buffer) {
@@ -59,8 +60,9 @@ __cb_add_entry_buffer (buffer_t *buffer, void *item)
buffer->cb[buffer->w_index]->data = item;
ret = gettimeofday (&buffer->cb[buffer->w_index]->tv, NULL);
if (ret == -1)
- gf_log_callingfn ("", GF_LOG_WARNING, "getting time of"
- "the day failed");
+ gf_msg_callingfn ("circ-buff", GF_LOG_WARNING, 0,
+ LG_MSG_GETTIMEOFDAY_FAILED,
+ "getting time of the day failed");
buffer->w_index++;
buffer->w_index %= buffer->size_buffer;
//used_buffer size cannot be greater than the total buffer size
@@ -90,10 +92,9 @@ cb_buffer_show (buffer_t *buffer)
{
pthread_mutex_lock (&buffer->lock);
{
- gf_log ("", GF_LOG_DEBUG, "w_index: %d, size: %"GF_PRI_SIZET
- " used_buffer: %d", buffer->w_index,
- buffer->size_buffer,
- buffer->used_len);
+ gf_msg_debug ("circ-buff", 0, "w_index: %d, size: %"
+ GF_PRI_SIZET" used_buffer: %d", buffer->w_index,
+ buffer->size_buffer, buffer->used_len);
}
pthread_mutex_unlock (&buffer->lock);
}
@@ -124,7 +125,9 @@ cb_buffer_dump (buffer_t *buffer, void *data,
if (entry)
fn (entry, data);
else
- gf_log_callingfn ("", GF_LOG_WARNING,
+ gf_msg_callingfn ("circ-buff",
+ GF_LOG_WARNING, 0,
+ LG_MSG_NULL_PTR,
"Null entry in "
"circular buffer at "
"index %d.", index);
@@ -150,8 +153,6 @@ cb_buffer_new (size_t buffer_size, gf_boolean_t use_once,
buffer = GF_CALLOC (1, sizeof (*buffer), gf_common_mt_buffer_t);
if (!buffer) {
- gf_log ("", GF_LOG_ERROR, "could not allocate the "
- "buffer");
goto out;
}
@@ -159,8 +160,6 @@ cb_buffer_new (size_t buffer_size, gf_boolean_t use_once,
sizeof (circular_buffer_t *),
gf_common_mt_circular_buffer_t);
if (!buffer->cb) {
- gf_log ("", GF_LOG_ERROR, "could not allocate the "
- "memory for the circular buffer");
GF_FREE (buffer);
buffer = NULL;
goto out;
diff --git a/libglusterfs/src/client_t.c b/libglusterfs/src/client_t.c
index 9e6c90eba4..1b7d0caafc 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;
}
diff --git a/libglusterfs/src/compat.c b/libglusterfs/src/compat.c
index 0538a3298c..e50f27bff9 100644
--- a/libglusterfs/src/compat.c
+++ b/libglusterfs/src/compat.c
@@ -25,6 +25,7 @@
#include "iatt.h"
#include "inode.h"
#include "run.h"
+#include "libglusterfs-messages.h"
#ifdef GF_SOLARIS_HOST_OS
int
@@ -41,9 +42,9 @@ solaris_fsetxattr(int fd, const char* key, const char *value, size_t size,
close (attrfd);
} else {
if (errno != ENOENT)
- gf_log ("libglusterfs", GF_LOG_ERROR,
- "Couldn't set extended attribute for %d (%d)",
- fd, errno);
+ gf_msg ("libglusterfs", GF_LOG_ERROR, errno,
+ LG_MSG_SET_ATTRIBUTE_FAILED, "Couldn't set "
+ "extended attribute for %d", fd);
return -1;
}
@@ -69,9 +70,9 @@ solaris_fgetxattr(int fd, const char* key, char *value, size_t size)
close (attrfd);
} else {
if (errno != ENOENT)
- gf_log ("libglusterfs", GF_LOG_INFO,
- "Couldn't read extended attribute for the file %d (%d)",
- fd, errno);
+ gf_msg ("libglusterfs", GF_LOG_INFO, errno,
+ LG_MSG_READ_ATTRIBUTE_FAILED, "Couldn't read "
+ "extended attribute for the file %d", fd);
if (errno == ENOENT)
errno = ENODATA;
return -1;
@@ -168,7 +169,7 @@ solaris_xattr_resolve_path (const char *real_path, char **path)
if (lstat (export_path, &statbuf)) {
ret = mkdir (export_path, 0777);
if (ret && (errno != EEXIST)) {
- gf_log (THIS->name, GF_LOG_DEBUG, "mkdir failed,"
+ gf_msg_debug (THIS->name, 0, "mkdir failed,"
" errno: %d", errno);
goto out;
}
@@ -182,9 +183,9 @@ solaris_xattr_resolve_path (const char *real_path, char **path)
if (ret) {
ret = mknod (xattr_path, S_IFREG|O_WRONLY, 0);
if (ret && (errno != EEXIST)) {
- gf_log (THIS->name, GF_LOG_WARNING,"Failed to create "
- "mapped file %s, error %d", xattr_path,
- errno);
+ gf_msg (THIS->name, GF_LOG_WARNING, errno,
+ LG_MSG_FILE_OP_FAILED, "Failed to "
+ "create mapped file %s", xattr_path);
goto out;
}
}
@@ -220,9 +221,9 @@ solaris_setxattr(const char *path, const char* key, const char *value,
ret = 0;
} else {
if (errno != ENOENT)
- gf_log ("libglusterfs", GF_LOG_ERROR,
- "Couldn't set extended attribute for %s (%d)",
- path, errno);
+ gf_msg ("libglusterfs", GF_LOG_ERROR, errno,
+ LG_MSG_SET_ATTRIBUTE_FAILED, "Couldn't set "
+ "extended attribute for %s", path);
ret = -1;
}
GF_FREE (mapped_path);
@@ -406,9 +407,9 @@ solaris_getxattr(const char *path,
close (attrfd);
} else {
if (errno != ENOENT)
- gf_log ("libglusterfs", GF_LOG_INFO,
- "Couldn't read extended attribute for the file %s (%s)",
- path, strerror (errno));
+ gf_msg ("libglusterfs", GF_LOG_INFO, errno,
+ LG_MSG_READ_ATTRIBUTE_FAILED, "Couldn't read "
+ "extended attribute for the file %s", path);
if (errno == ENOENT)
errno = ENODATA;
ret = -1;
@@ -472,14 +473,16 @@ int solaris_unlink (const char *path)
if (!ret && mapped_path) {
if (lstat(path, &stbuf)) {
- gf_log (THIS->name, GF_LOG_WARNING, "Stat failed on mapped"
- " file %s with error %d", mapped_path, errno);
+ gf_msg (THIS->name, GF_LOG_WARNING, errno,
+ LG_MSG_FILE_OP_FAILED, "Stat failed on "
+ "mapped file %s", mapped_path);
goto out;
}
if (stbuf.st_nlink == 1) {
if(remove (mapped_path))
- gf_log (THIS->name, GF_LOG_WARNING, "Failed to remove mapped "
- "file %s. Errno %d", mapped_path, errno);
+ gf_msg (THIS->name, GF_LOG_WARNING, errno,
+ LG_MSG_FILE_OP_FAILED, "Failed to "
+ "remove mapped file %s", mapped_path);
}
}
@@ -501,8 +504,9 @@ solaris_rename (const char *old_path, const char *new_path)
if (!ret && mapped_path) {
if (!remove (mapped_path))
- gf_log (THIS->name, GF_LOG_WARNING, "Failed to remove mapped "
- "file %s. Errno %d", mapped_path, errno);
+ gf_msg (THIS->name, GF_LOG_WARNING, errno,
+ LG_MSG_FILE_OP_FAILED, "Failed to remove "
+ "mapped file %s.", mapped_path);
GF_FREE (mapped_path);
}
@@ -560,18 +564,16 @@ gf_umount_lazy (char *xlname, char *path, int rmdir_flag)
#endif
ret = runner_run (&runner);
if (ret) {
- gf_log (xlname, GF_LOG_ERROR,
- "Lazy unmount of %s failed: %s",
- path, strerror (errno));
+ gf_msg (xlname, GF_LOG_ERROR, errno, LG_MSG_UNMOUNT_FAILED,
+ "Lazy unmount of %s", path);
}
#ifdef GF_LINUX_HOST_OS
if (!ret && rmdir_flag) {
ret = rmdir (path);
if (ret)
- gf_log (xlname, GF_LOG_WARNING,
- "rmdir %s failed: %s",
- path, strerror (errno));
+ gf_msg (xlname, GF_LOG_WARNING, errno,
+ LG_MSG_DIR_OP_FAILED, "rmdir %s", path);
}
#endif
diff --git a/libglusterfs/src/dict.c b/libglusterfs/src/dict.c
index 23e25b16ed..771dcbbc47 100644
--- a/libglusterfs/src/dict.c
+++ b/libglusterfs/src/dict.c
@@ -25,6 +25,7 @@
#include "byte-order.h"
#include "globals.h"
#include "statedump.h"
+#include "libglusterfs-messages.h"
struct dict_cmp {
dict_t *dict;
@@ -112,7 +113,8 @@ is_data_equal (data_t *one,
data_t *two)
{
if (!one || !two || !one->data || !two->data) {
- gf_log_callingfn ("dict", GF_LOG_ERROR,
+ gf_msg_callingfn ("dict", GF_LOG_ERROR, EINVAL,
+ LG_MSG_INVALID_ARG,
"input arguments are provided "
"with value data_t as NULL");
return -1;
@@ -152,11 +154,11 @@ key_value_cmp (dict_t *one, char *key1, data_t *value1, void *data)
}
if (value2 == NULL) {
- gf_log (THIS->name, GF_LOG_DEBUG,
- "'%s' found only on one dict", key1);
+ gf_msg_debug (THIS->name, 0, "'%s' found only on one dict",
+ key1);
} else {
- gf_log (THIS->name, GF_LOG_DEBUG, "'%s' is different in two "
- "dicts (%u, %u)", key1, value1->len, value2->len);
+ gf_msg_debug (THIS->name, 0, "'%s' is different in two dicts "
+ "(%u, %u)", key1, value1->len, value2->len);
}
return -1;
@@ -239,7 +241,7 @@ data_t *
data_copy (data_t *old)
{
if (!old) {
- gf_log_callingfn ("dict", GF_LOG_WARNING,
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, 0, LG_MSG_NULL_PTR,
"old is NULL");
return NULL;
}
@@ -274,7 +276,8 @@ _dict_lookup (dict_t *this, char *key)
{
int hashval = 0;
if (!this || !key) {
- gf_log_callingfn ("dict", GF_LOG_WARNING,
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG,
"!this || !key (%s)", key);
return NULL;
}
@@ -299,8 +302,9 @@ int32_t
dict_lookup (dict_t *this, char *key, data_t **data)
{
if (!this || !key || !data) {
- gf_log_callingfn ("dict", GF_LOG_WARNING,
- "!this || !key || !data");
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "!this || !key || "
+ "!data");
return -1;
}
@@ -330,7 +334,6 @@ _dict_set (dict_t *this, char *key, data_t *value, gf_boolean_t replace)
if (!key) {
ret = gf_asprintf (&key, "ref:%p", value);
if (-1 == ret) {
- gf_log ("dict", GF_LOG_WARNING, "asprintf failed %s", key);
return -1;
}
key_free = 1;
@@ -416,8 +419,9 @@ dict_set (dict_t *this,
int32_t ret;
if (!this || !value) {
- gf_log_callingfn ("dict", GF_LOG_WARNING,
- "!this || !value for key=%s", key);
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "!this || !value for "
+ "key=%s", key);
return -1;
}
@@ -437,7 +441,8 @@ dict_add (dict_t *this, char *key, data_t *value)
int32_t ret;
if (!this || !value) {
- gf_log_callingfn ("dict", GF_LOG_WARNING,
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG,
"!this || !value for key=%s", key);
return -1;
}
@@ -458,7 +463,8 @@ dict_get (dict_t *this, char *key)
data_pair_t *pair;
if (!this || !key) {
- gf_log_callingfn ("dict", GF_LOG_INFO,
+ gf_msg_callingfn ("dict", GF_LOG_INFO, EINVAL,
+ LG_MSG_INVALID_ARG,
"!this || key=%s", (key) ? key : "()");
return NULL;
}
@@ -481,8 +487,8 @@ dict_del (dict_t *this, char *key)
int hashval = 0;
if (!this || !key) {
- gf_log_callingfn ("dict", GF_LOG_WARNING,
- "!this || key=%s", key);
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "!this || key=%s", key);
return;
}
@@ -538,7 +544,8 @@ void
dict_destroy (dict_t *this)
{
if (!this) {
- gf_log_callingfn ("dict", GF_LOG_WARNING, "dict is NULL");
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "dict is NULL");
return;
}
@@ -576,7 +583,8 @@ dict_unref (dict_t *this)
int32_t ref;
if (!this) {
- gf_log_callingfn ("dict", GF_LOG_WARNING, "dict is NULL");
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "dict is NULL");
return;
}
@@ -595,7 +603,8 @@ dict_t *
dict_ref (dict_t *this)
{
if (!this) {
- gf_log_callingfn ("dict", GF_LOG_WARNING, "dict is NULL");
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "dict is NULL");
return NULL;
}
@@ -611,10 +620,12 @@ dict_ref (dict_t *this)
void
data_unref (data_t *this)
{
+
int32_t ref;
if (!this) {
- gf_log_callingfn ("dict", GF_LOG_WARNING, "dict is NULL");
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "dict is NULL");
return;
}
@@ -633,7 +644,8 @@ data_t *
data_ref (data_t *this)
{
if (!this) {
- gf_log_callingfn ("dict", GF_LOG_WARNING, "dict is NULL");
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "dict is NULL");
return NULL;
}
@@ -658,7 +670,7 @@ int_to_data (int64_t value)
ret = gf_asprintf (&data->data, "%"PRId64, value);
if (-1 == ret) {
- gf_log ("dict", GF_LOG_DEBUG, "asprintf failed");
+ gf_msg_debug ("dict", 0, "asprintf failed");
return NULL;
}
data->len = strlen (data->data) + 1;
@@ -677,7 +689,7 @@ data_from_int64 (int64_t value)
}
ret = gf_asprintf (&data->data, "%"PRId64, value);
if (-1 == ret) {
- gf_log ("dict", GF_LOG_DEBUG, "asprintf failed");
+ gf_msg_debug ("dict", 0, "asprintf failed");
return NULL;
}
data->len = strlen (data->data) + 1;
@@ -696,7 +708,7 @@ data_from_int32 (int32_t value)
}
ret = gf_asprintf (&data->data, "%"PRId32, value);
if (-1 == ret) {
- gf_log ("dict", GF_LOG_DEBUG, "asprintf failed");
+ gf_msg_debug ("dict", 0, "asprintf failed");
return NULL;
}
@@ -716,7 +728,7 @@ data_from_int16 (int16_t value)
}
ret = gf_asprintf (&data->data, "%"PRId16, value);
if (-1 == ret) {
- gf_log ("dict", GF_LOG_DEBUG, "asprintf failed");
+ gf_msg_debug ("dict", 0, "asprintf failed");
return NULL;
}
@@ -736,7 +748,7 @@ data_from_int8 (int8_t value)
}
ret = gf_asprintf (&data->data, "%d", value);
if (-1 == ret) {
- gf_log ("dict", GF_LOG_DEBUG, "asprintf failed");
+ gf_msg_debug ("dict", 0, "asprintf failed");
return NULL;
}
@@ -756,7 +768,7 @@ data_from_uint64 (uint64_t value)
}
ret = gf_asprintf (&data->data, "%"PRIu64, value);
if (-1 == ret) {
- gf_log ("dict", GF_LOG_DEBUG, "asprintf failed");
+ gf_msg_debug ("dict", 0, "asprintf failed");
return NULL;
}
@@ -798,7 +810,7 @@ data_from_uint32 (uint32_t value)
}
ret = gf_asprintf (&data->data, "%"PRIu32, value);
if (-1 == ret) {
- gf_log ("dict", GF_LOG_DEBUG, "asprintf failed");
+ gf_msg_debug ("dict", 0, "asprintf failed");
return NULL;
}
@@ -832,7 +844,8 @@ data_t *
data_from_ptr (void *value)
{
if (!value) {
- gf_log_callingfn ("dict", GF_LOG_WARNING, "value is NULL");
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "value is NULL");
return NULL;
}
@@ -874,7 +887,8 @@ data_t *
str_to_data (char *value)
{
if (!value) {
- gf_log_callingfn ("dict", GF_LOG_WARNING, "value is NULL");
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "value is NULL");
return NULL;
}
data_t *data = get_new_data ();
@@ -894,7 +908,8 @@ data_t *
data_from_dynstr (char *value)
{
if (!value) {
- gf_log_callingfn ("dict", GF_LOG_WARNING, "value is NULL");
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "value is NULL");
return NULL;
}
@@ -912,7 +927,8 @@ data_t *
data_from_dynmstr (char *value)
{
if (!value) {
- gf_log_callingfn ("dict", GF_LOG_WARNING, "value is NULL");
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "value is NULL");
return NULL;
}
@@ -945,7 +961,8 @@ data_t *
bin_to_data (void *value, int32_t len)
{
if (!value) {
- gf_log_callingfn ("dict", GF_LOG_WARNING, "value is NULL");
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "value is NULL");
return NULL;
}
@@ -965,7 +982,8 @@ int64_t
data_to_int64 (data_t *data)
{
if (!data) {
- gf_log_callingfn ("dict", GF_LOG_WARNING, "data is NULL");
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "data is NULL");
return -1;
}
@@ -982,7 +1000,8 @@ int32_t
data_to_int32 (data_t *data)
{
if (!data) {
- gf_log_callingfn ("dict", GF_LOG_WARNING, "data is NULL");
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "data is NULL");
return -1;
}
@@ -1002,7 +1021,8 @@ data_to_int16 (data_t *data)
int16_t value = 0;
if (!data) {
- gf_log_callingfn ("dict", GF_LOG_WARNING, "data is NULL");
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "data is NULL");
return -1;
}
@@ -1018,9 +1038,9 @@ data_to_int16 (data_t *data)
if ((value > SHRT_MAX) || (value < SHRT_MIN)) {
errno = ERANGE;
- gf_log_callingfn ("dict", GF_LOG_WARNING,
- "Error in data conversion: "
- "detected overflow");
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, errno,
+ LG_MSG_DATA_CONVERSION_ERROR, "Error in data"
+ " conversion: detected overflow");
return -1;
}
@@ -1034,7 +1054,8 @@ data_to_int8 (data_t *data)
int8_t value = 0;
if (!data) {
- gf_log_callingfn ("dict", GF_LOG_WARNING, "data is NULL");
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "data is NULL");
return -1;
}
@@ -1050,9 +1071,9 @@ data_to_int8 (data_t *data)
if ((value > SCHAR_MAX) || (value < SCHAR_MIN)) {
errno = ERANGE;
- gf_log_callingfn ("dict", GF_LOG_WARNING,
- "Error in data conversion: "
- "detected overflow");
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, errno,
+ LG_MSG_DATA_CONVERSION_ERROR, "Error in data"
+ " conversion: detected overflow");
return -1;
}
@@ -1111,7 +1132,8 @@ data_to_uint16 (data_t *data)
if ((USHRT_MAX - value) < 0) {
errno = ERANGE;
- gf_log_callingfn ("dict", GF_LOG_WARNING,
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, errno,
+ LG_MSG_DATA_CONVERSION_ERROR,
"Error in data conversion: "
"overflow detected");
return -1;
@@ -1126,7 +1148,8 @@ data_to_uint8 (data_t *data)
uint32_t value = 0;
if (!data) {
- gf_log_callingfn ("dict", GF_LOG_WARNING, "data is NULL");
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "data is NULL");
return -1;
}
@@ -1142,9 +1165,9 @@ data_to_uint8 (data_t *data)
if ((UCHAR_MAX - (uint8_t)value) < 0) {
errno = ERANGE;
- gf_log_callingfn ("dict", GF_LOG_WARNING,
- "data conversion overflow detected (%s)",
- strerror(errno));
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, errno,
+ LG_MSG_DATA_CONVERSION_ERROR, "data "
+ "conversion overflow detected");
return -1;
}
@@ -1155,7 +1178,8 @@ char *
data_to_str (data_t *data)
{
if (!data) {
- gf_log_callingfn ("dict", GF_LOG_WARNING, "data is NULL");
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "data is NULL");
return NULL;
}
return data->data;
@@ -1165,7 +1189,8 @@ void *
data_to_ptr (data_t *data)
{
if (!data) {
- gf_log_callingfn ("dict", GF_LOG_WARNING, "data is NULL");
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "data is NULL");
return NULL;
}
return data->data;
@@ -1175,7 +1200,8 @@ void *
data_to_bin (data_t *data)
{
if (!data) {
- gf_log_callingfn ("dict", GF_LOG_WARNING, "data is NULL");
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "data is NULL");
return NULL;
}
return data->data;
@@ -1193,7 +1219,8 @@ dict_remove_foreach_fn (dict_t *d, char *k,
data_t *v, void *_tmp)
{
if (!d || !k) {
- gf_log ("glusterfs", GF_LOG_WARNING, "%s is NULL",
+ gf_msg ("glusterfs", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ENTRY, "%s is NULL",
d?"key":"dictionary");
return -1;
}
@@ -1245,8 +1272,9 @@ dict_foreach_match (dict_t *dict,
void *action_data)
{
if (!dict || !match || !action) {
- gf_log_callingfn ("dict", GF_LOG_WARNING,
- "dict|match|action is NULL");
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "dict|match|action is "
+ "NULL");
return -1;
}
@@ -1348,7 +1376,8 @@ dict_copy (dict_t *dict,
dict_t *new)
{
if (!dict) {
- gf_log_callingfn ("dict", GF_LOG_WARNING, "dict is NULL");
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "dict is NULL");
return NULL;
}
@@ -1365,7 +1394,8 @@ dict_reset (dict_t *dict)
{
int32_t ret = -1;
if (!dict) {
- gf_log_callingfn ("dict", GF_LOG_WARNING, "dict is NULL");
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "dict is NULL");
goto out;
}
dict_foreach (dict, dict_remove_foreach_fn, NULL);
@@ -1412,7 +1442,8 @@ dict_get_with_ref (dict_t *this, char *key, data_t **data)
int ret = -ENOENT;
if (!this || !key || !data) {
- gf_log_callingfn ("dict", GF_LOG_WARNING,
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG,
"dict OR key (%s) is NULL", key);
ret = -EINVAL;
goto err;
@@ -2467,7 +2498,8 @@ _dict_serialized_length (dict_t *this)
count = this->count;
if (count < 0) {
- gf_log ("dict", GF_LOG_ERROR, "count (%d) < 0!", count);
+ gf_msg ("dict", GF_LOG_ERROR, EINVAL,
+ LG_MSG_COUNT_LESS_THAN_ZERO, "count (%d) < 0!", count);
goto out;
}
@@ -2475,7 +2507,8 @@ _dict_serialized_length (dict_t *this)
while (count) {
if (!pair) {
- gf_log ("dict", GF_LOG_ERROR,
+ gf_msg ("dict", GF_LOG_ERROR, EINVAL,
+ LG_MSG_COUNT_LESS_THAN_DATA_PAIRS,
"less than count data pairs found!");
goto out;
}
@@ -2483,22 +2516,23 @@ _dict_serialized_length (dict_t *this)
len += DICT_DATA_HDR_KEY_LEN + DICT_DATA_HDR_VAL_LEN;
if (!pair->key) {
- gf_log ("dict", GF_LOG_ERROR, "pair->key is null!");
+ gf_msg ("dict", GF_LOG_ERROR, EINVAL,
+ LG_MSG_NULL_PTR, "pair->key is null!");
goto out;
}
len += strlen (pair->key) + 1 /* for '\0' */;
if (!pair->value) {
- gf_log ("dict", GF_LOG_ERROR,
- "pair->value is null!");
+ gf_msg ("dict", GF_LOG_ERROR, EINVAL,
+ LG_MSG_NULL_PTR, "pair->value is null!");
goto out;
}
if (pair->value->len < 0) {
- gf_log ("dict", GF_LOG_ERROR,
- "value->len (%d) < 0",
- pair->value->len);
+ gf_msg ("dict", GF_LOG_ERROR, EINVAL,
+ LG_MSG_VALUE_LENGTH_LESS_THAN_ZERO,
+ "value->len (%d) < 0", pair->value->len);
goto out;
}
@@ -2537,7 +2571,7 @@ _dict_serialize (dict_t *this, char *buf)
if (!buf) {
- gf_log ("dict", GF_LOG_ERROR,
+ gf_msg ("dict", GF_LOG_ERROR, EINVAL, LG_MSG_INVALID_ARG,
"buf is null!");
goto out;
}
@@ -2545,7 +2579,8 @@ _dict_serialize (dict_t *this, char *buf)
count = this->count;
if (count < 0) {
- gf_log ("dict", GF_LOG_ERROR, "count (%d) < 0!", count);
+ gf_msg ("dict", GF_LOG_ERROR, 0, LG_MSG_COUNT_LESS_THAN_ZERO,
+ "count (%d) < 0!", count);
goto out;
}
@@ -2556,13 +2591,14 @@ _dict_serialize (dict_t *this, char *buf)
while (count) {
if (!pair) {
- gf_log ("dict", GF_LOG_ERROR,
+ gf_msg ("dict", GF_LOG_ERROR, 0,
+ LG_MSG_PAIRS_LESS_THAN_COUNT,
"less than count data pairs found!");
goto out;
}
if (!pair->key) {
- gf_log ("dict", GF_LOG_ERROR,
+ gf_msg ("dict", GF_LOG_ERROR, 0, LG_MSG_NULL_PTR,
"pair->key is null!");
goto out;
}
@@ -2573,7 +2609,8 @@ _dict_serialize (dict_t *this, char *buf)
buf += DICT_DATA_HDR_KEY_LEN;
if (!pair->value) {
- gf_log ("dict", GF_LOG_ERROR,
+ gf_msg ("dict", GF_LOG_ERROR, 0,
+ LG_MSG_NULL_PTR,
"pair->value is null!");
goto out;
}
@@ -2616,7 +2653,8 @@ dict_serialized_length (dict_t *this)
int ret = -EINVAL;
if (!this) {
- gf_log_callingfn ("dict", GF_LOG_WARNING, "dict is null!");
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "dict is null!");
goto out;
}
@@ -2647,7 +2685,8 @@ dict_serialize (dict_t *this, char *buf)
int ret = -1;
if (!this || !buf) {
- gf_log_callingfn ("dict", GF_LOG_WARNING, "dict is null!");
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "dict is null!");
goto out;
}
@@ -2689,32 +2728,33 @@ dict_unserialize (char *orig_buf, int32_t size, dict_t **fill)
buf = orig_buf;
if (!buf) {
- gf_log_callingfn ("dict", GF_LOG_WARNING, "buf is null!");
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "buf is null!");
goto out;
}
if (size == 0) {
- gf_log_callingfn ("dict", GF_LOG_ERROR,
- "size is 0!");
+ gf_msg_callingfn ("dict", GF_LOG_ERROR, EINVAL,
+ LG_MSG_INVALID_ARG, "size is 0!");
goto out;
}
if (!fill) {
- gf_log_callingfn ("dict", GF_LOG_ERROR,
- "fill is null!");
+ gf_msg_callingfn ("dict", GF_LOG_ERROR, EINVAL,
+ LG_MSG_INVALID_ARG, "fill is null!");
goto out;
}
if (!*fill) {
- gf_log_callingfn ("dict", GF_LOG_ERROR,
- "*fill is null!");
+ gf_msg_callingfn ("dict", GF_LOG_ERROR, EINVAL,
+ LG_MSG_INVALID_ARG, "*fill is null!");
goto out;
}
if ((buf + DICT_HDR_LEN) > (orig_buf + size)) {
- gf_log_callingfn ("dict", GF_LOG_ERROR,
- "undersized buffer passed. "
- "available (%lu) < required (%lu)",
+ gf_msg_callingfn ("dict", GF_LOG_ERROR, 0,
+ LG_MSG_UNDERSIZED_BUF, "undersized buffer "
+ "passed. available (%lu) < required (%lu)",
(long)(orig_buf + size),
(long)(buf + DICT_HDR_LEN));
goto out;
@@ -2725,7 +2765,7 @@ dict_unserialize (char *orig_buf, int32_t size, dict_t **fill)
buf += DICT_HDR_LEN;
if (count < 0) {
- gf_log ("dict", GF_LOG_ERROR,
+ gf_msg ("dict", GF_LOG_ERROR, 0, LG_MSG_COUNT_LESS_THAN_ZERO,
"count (%d) <= 0", count);
goto out;
}
@@ -2735,9 +2775,10 @@ dict_unserialize (char *orig_buf, int32_t size, dict_t **fill)
for (i = 0; i < count; i++) {
if ((buf + DICT_DATA_HDR_KEY_LEN) > (orig_buf + size)) {
- gf_log_callingfn ("dict", GF_LOG_ERROR,
- "undersized buffer passed. "
- "available (%lu) < required (%lu)",
+ gf_msg_callingfn ("dict", GF_LOG_ERROR, 0,
+ LG_MSG_UNDERSIZED_BUF, "undersized "
+ "buffer passed. available (%lu) < "
+ "required (%lu)",
(long)(orig_buf + size),
(long)(buf + DICT_DATA_HDR_KEY_LEN));
goto out;
@@ -2747,9 +2788,10 @@ dict_unserialize (char *orig_buf, int32_t size, dict_t **fill)
buf += DICT_DATA_HDR_KEY_LEN;
if ((buf + DICT_DATA_HDR_VAL_LEN) > (orig_buf + size)) {
- gf_log_callingfn ("dict", GF_LOG_ERROR,
- "undersized buffer passed. "
- "available (%lu) < required (%lu)",
+ gf_msg_callingfn ("dict", GF_LOG_ERROR, 0,
+ LG_MSG_UNDERSIZED_BUF, "undersized "
+ "buffer passed. available (%lu) < "
+ "required (%lu)",
(long)(orig_buf + size),
(long)(buf + DICT_DATA_HDR_VAL_LEN));
goto out;
@@ -2759,7 +2801,8 @@ dict_unserialize (char *orig_buf, int32_t size, dict_t **fill)
buf += DICT_DATA_HDR_VAL_LEN;
if ((buf + keylen) > (orig_buf + size)) {
- gf_log_callingfn ("dict", GF_LOG_ERROR,
+ gf_msg_callingfn ("dict", GF_LOG_ERROR, 0,
+ LG_MSG_UNDERSIZED_BUF,
"undersized buffer passed. "
"available (%lu) < required (%lu)",
(long)(orig_buf + size),
@@ -2770,7 +2813,8 @@ dict_unserialize (char *orig_buf, int32_t size, dict_t **fill)
buf += keylen + 1; /* for '\0' */
if ((buf + vallen) > (orig_buf + size)) {
- gf_log_callingfn ("dict", GF_LOG_ERROR,
+ gf_msg_callingfn ("dict", GF_LOG_ERROR, 0,
+ LG_MSG_UNDERSIZED_BUF,
"undersized buffer passed. "
"available (%lu) < required (%lu)",
(long)(orig_buf + size),
@@ -2779,7 +2823,7 @@ dict_unserialize (char *orig_buf, int32_t size, dict_t **fill)
}
value = get_new_data ();
value->len = vallen;
- value->data = memdup (buf, vallen);
+value->data = memdup (buf, vallen);
value->is_static = 0;
buf += vallen;
@@ -2810,8 +2854,7 @@ dict_allocate_and_serialize (dict_t *this, char **buf, u_int *length)
ssize_t len = 0;
if (!this || !buf) {
- gf_log_callingfn ("dict", GF_LOG_DEBUG,
- "dict OR buf is NULL");
+ gf_msg_debug ("dict", 0, "dict OR buf is NULL");
goto out;
}
@@ -2869,13 +2912,15 @@ _dict_serialize_value_with_delim (dict_t *this, char *buf, int32_t *serz_len,
data_pair_t *pair = NULL;
if (!buf) {
- gf_log ("dict", GF_LOG_ERROR, "buf is null");
+ gf_msg ("dict", GF_LOG_ERROR, EINVAL,
+ LG_MSG_INVALID_ARG, "buf is null");
goto out;
}
count = this->count;
if (count < 0) {
- gf_log ("dict", GF_LOG_ERROR, "count (%d) < 0", count);
+ gf_msg ("dict", GF_LOG_ERROR, EINVAL, LG_MSG_INVALID_ARG,
+ "count (%d) < 0", count);
goto out;
}
@@ -2883,19 +2928,22 @@ _dict_serialize_value_with_delim (dict_t *this, char *buf, int32_t *serz_len,
while (count) {
if (!pair) {
- gf_log ("dict", GF_LOG_ERROR,
+ gf_msg ("dict", GF_LOG_ERROR, 0,
+ LG_MSG_PAIRS_LESS_THAN_COUNT,
"less than count data pairs found");
goto out;
}
if (!pair->key || !pair->value) {
- gf_log ("dict", GF_LOG_ERROR,
+ gf_msg ("dict", GF_LOG_ERROR, 0,
+ LG_MSG_KEY_OR_VALUE_NULL,
"key or value is null");
goto out;
}
if (!pair->value->data) {
- gf_log ("dict", GF_LOG_ERROR,
+ gf_msg ("dict", GF_LOG_ERROR, 0,
+ LG_MSG_NULL_VALUE_IN_DICT,
"null value found in dict");
goto out;
}
@@ -2929,7 +2977,8 @@ dict_serialize_value_with_delim (dict_t *this, char *buf, int32_t *serz_len,
int ret = -1;
if (!this || !buf) {
- gf_log_callingfn ("dict", GF_LOG_WARNING, "dict is null!");
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "dict is null!");
goto out;
}
@@ -2968,16 +3017,19 @@ dict_dump_to_log (dict_t *dict)
char *format = "(%s:%s)";
if (!dict) {
- gf_log_callingfn ("dict", GF_LOG_WARNING, "dict is NULL");
+ gf_msg_callingfn ("dict", GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "dict is NULL");
return;
}
ret = dict_dump_to_str (dict, dump, sizeof(dump), format);
if (ret) {
- gf_log ("dict", GF_LOG_WARNING, "Failed to log dictionary");
+ gf_msg ("dict", GF_LOG_WARNING, 0, LG_MSG_FAILED_TO_LOG_DICT,
+ "Failed to log dictionary");
return;
}
- gf_log_callingfn ("dict", GF_LOG_INFO, "dict=%p (%s)", dict, dump);
+ gf_msg_callingfn ("dict", GF_LOG_INFO, 0, LG_MSG_DICT_ERROR,
+ "dict=%p (%s)", dict, dump);
return;
}
@@ -2991,14 +3043,15 @@ dict_dump_to_statedump (dict_t *dict, char *dict_name, char *domain)
char *format = "\n\t%s:%s";
if (!dict) {
- gf_log_callingfn (domain, GF_LOG_WARNING, "dict is NULL");
+ gf_msg_callingfn (domain, GF_LOG_WARNING, EINVAL,
+ LG_MSG_INVALID_ARG, "dict is NULL");
return;
}
ret = dict_dump_to_str (dict, dump, sizeof(dump), format);
if (ret) {
- gf_log (domain, GF_LOG_WARNING, "Failed to log dictionary %s",
- dict_name);
+ gf_msg (domain, GF_LOG_WARNING, 0, LG_MSG_FAILED_TO_LOG_DICT,
+ "Failed to log dictionary %s", dict_name);
return;
}
gf_proc_dump_build_key (key, domain, dict_name);
diff --git a/libglusterfs/src/dict.h b/libglusterfs/src/dict.h
index 46cb2a3ca5..30c12bd320 100644
--- a/libglusterfs/src/dict.h
+++ b/libglusterfs/src/dict.h
@@ -16,6 +16,7 @@
#include <pthread.h>
#include "common-utils.h"
+#include "libglusterfs-messages.h"
typedef struct _data data_t;
typedef struct _dict dict_t;
@@ -30,7 +31,8 @@ typedef struct _data_pair data_pair_t;
\
ret = dict_allocate_and_serialize (from_dict, to, &len);\
if (ret < 0) { \
- gf_log (this->name, GF_LOG_WARNING, \
+ gf_msg (this->name, GF_LOG_WARNING, 0, \
+ LG_MSG_DICT_SERIAL_FAILED, \
"failed to get serialized dict (%s)", \
(#from_dict)); \
ope = EINVAL; \
@@ -45,9 +47,10 @@ typedef struct _data_pair data_pair_t;
to = dict_new(); \
GF_VALIDATE_OR_GOTO (xl->name, to, labl); \
\
- ret = dict_unserialize (buff, len, &to); \
+ ret = dict_unserialize (buff, len, &to); \
if (ret < 0) { \
- gf_log (xl->name, GF_LOG_WARNING, \
+ gf_msg (xl->name, GF_LOG_WARNING, 0, \
+ LG_MSG_DICT_UNSERIAL_FAILED, \
"failed to unserialize dictionary (%s)", \
(#to)); \
\