diff options
| author | Mohamed Ashiq <ashiq333@gmail.com> | 2015-05-19 15:53:19 +0530 | 
|---|---|---|
| committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2015-07-09 00:11:04 -0700 | 
| commit | fe68152df36f6a6529a465c0ea25568fd557a901 (patch) | |
| tree | bc7ec21e44ddd735573e290e444194068405ec45 | |
| parent | 8c20f8bd0be0a797f57a5e68473d857357a16f9e (diff) | |
call-stub,circ-buff,client_t,compat,dict/libglusterfs : Porting to a new logging framework
        Backport of http://review.gluster.org/10828
Cherry picked from a1e32fbcfbfaf6e4c63e140b3b90a80dc748a269
>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>
Change-Id: Ie7d180e0ab2fed1270d66504606d1b2522884020
BUG: 1217722
Signed-off-by: Mohamed Ashiq <ashiq333@gmail.com>
Reviewed-on: http://review.gluster.org/11406
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>
| -rw-r--r-- | libglusterfs/src/call-stub.c | 14 | ||||
| -rw-r--r-- | libglusterfs/src/circ-buff.c | 25 | ||||
| -rw-r--r-- | libglusterfs/src/client_t.c | 67 | ||||
| -rw-r--r-- | libglusterfs/src/compat.c | 58 | ||||
| -rw-r--r-- | libglusterfs/src/dict.c | 265 | ||||
| -rw-r--r-- | libglusterfs/src/dict.h | 9 | 
6 files changed, 256 insertions, 182 deletions
diff --git a/libglusterfs/src/call-stub.c b/libglusterfs/src/call-stub.c index 128dcf9e15f..f3c309520a4 100644 --- a/libglusterfs/src/call-stub.c +++ b/libglusterfs/src/call-stub.c @@ -18,7 +18,7 @@  #include "call-stub.h"  #include "mem-types.h" - +#include "libglusterfs-messages.h"  static call_stub_t *  stub_new (call_frame_t *frame, @@ -2285,9 +2285,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: @@ -2495,9 +2495,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 484ce7dc939..6259282a917 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 84257e66b09..b7462fcaec3 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"  #ifndef _CONFIG_H  #define _CONFIG_H @@ -28,7 +28,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;          } @@ -53,7 +54,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;          } @@ -107,7 +109,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; @@ -126,7 +129,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;          } @@ -168,7 +172,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;          } @@ -275,9 +280,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;  } @@ -294,8 +300,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) @@ -308,13 +315,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;  } @@ -327,7 +336,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;          } @@ -389,16 +399,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);          }  } @@ -582,7 +594,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;                  } @@ -679,7 +692,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;                  } @@ -721,7 +735,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;                  } @@ -786,7 +801,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;                  } @@ -847,7 +863,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 93e7b45a69e..2eb92306288 100644 --- a/libglusterfs/src/compat.c +++ b/libglusterfs/src/compat.c @@ -30,6 +30,7 @@  #include "iatt.h"  #include "inode.h"  #include "run.h" +#include "libglusterfs-messages.h"  #ifdef GF_SOLARIS_HOST_OS  int @@ -46,9 +47,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;          } @@ -74,9 +75,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; @@ -173,7 +174,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;                          } @@ -187,9 +188,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;                          }                  } @@ -225,9 +226,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); @@ -411,9 +412,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; @@ -477,14 +478,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);                  }          } @@ -506,8 +509,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);          } @@ -565,18 +569,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 ffc92e72724..fc8a42cfc19 100644 --- a/libglusterfs/src/dict.c +++ b/libglusterfs/src/dict.c @@ -30,6 +30,7 @@  #include "byte-order.h"  #include "globals.h"  #include "statedump.h" +#include "libglusterfs-messages.h"  struct dict_cmp {          dict_t *dict; @@ -117,7 +118,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; @@ -157,11 +159,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; @@ -244,7 +246,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;          } @@ -279,7 +281,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;          } @@ -304,8 +307,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;          } @@ -335,7 +339,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; @@ -421,8 +424,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;          } @@ -442,7 +446,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;          } @@ -463,7 +468,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;          } @@ -486,8 +492,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;          } @@ -543,7 +549,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;          } @@ -581,7 +588,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;          } @@ -600,7 +608,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;          } @@ -616,10 +625,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;          } @@ -638,7 +649,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;          } @@ -663,7 +675,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; @@ -682,7 +694,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; @@ -701,7 +713,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;          } @@ -721,7 +733,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;          } @@ -741,7 +753,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;          } @@ -761,7 +773,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;          } @@ -803,7 +815,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;          } @@ -837,7 +849,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;          } @@ -879,7 +892,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 (); @@ -899,7 +913,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;          } @@ -917,7 +932,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;          } @@ -950,7 +966,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;          } @@ -970,7 +987,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;          } @@ -987,7 +1005,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;          } @@ -1007,7 +1026,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;          } @@ -1023,9 +1043,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;          } @@ -1039,7 +1059,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;          } @@ -1055,9 +1076,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;          } @@ -1116,7 +1137,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; @@ -1131,7 +1153,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;  	} @@ -1147,9 +1170,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;  	} @@ -1160,7 +1183,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; @@ -1170,7 +1194,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; @@ -1180,7 +1205,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; @@ -1198,7 +1224,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;          } @@ -1250,8 +1277,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;          } @@ -1353,7 +1381,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;          } @@ -1370,7 +1399,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); @@ -1417,7 +1447,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; @@ -2472,7 +2503,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;          } @@ -2480,7 +2512,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;                  } @@ -2488,22 +2521,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;                  } @@ -2542,7 +2576,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;          } @@ -2550,7 +2584,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;          } @@ -2561,13 +2596,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;                  } @@ -2578,7 +2614,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;                  } @@ -2621,7 +2658,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;          } @@ -2652,7 +2690,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;          } @@ -2694,32 +2733,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; @@ -2730,7 +2770,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;          } @@ -2740,9 +2780,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; @@ -2752,9 +2793,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; @@ -2764,7 +2806,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), @@ -2775,7 +2818,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), @@ -2784,7 +2828,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; @@ -2815,8 +2859,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;          } @@ -2874,13 +2917,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;          } @@ -2888,19 +2933,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;                  } @@ -2934,7 +2982,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;          } @@ -2973,16 +3022,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;  } @@ -2996,14 +3048,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 a9004e96a50..b7e7b747d4f 100644 --- a/libglusterfs/src/dict.h +++ b/libglusterfs/src/dict.h @@ -21,6 +21,7 @@  #include <pthread.h>  #include "common-utils.h" +#include "libglusterfs-messages.h"  typedef struct _data data_t;  typedef struct _dict dict_t; @@ -35,7 +36,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;                                   \ @@ -50,9 +52,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));                                 \                                                                          \  | 
