diff options
Diffstat (limited to 'libglusterfs/src')
| -rw-r--r-- | libglusterfs/src/defaults.c | 10 | ||||
| -rw-r--r-- | libglusterfs/src/globals.c | 23 | ||||
| -rw-r--r-- | libglusterfs/src/iobuf.c | 59 | ||||
| -rw-r--r-- | libglusterfs/src/latency.c | 5 | ||||
| -rw-r--r-- | libglusterfs/src/logging.c | 41 | ||||
| -rw-r--r-- | libglusterfs/src/options.c | 156 | ||||
| -rw-r--r-- | libglusterfs/src/options.h | 31 | ||||
| -rw-r--r-- | libglusterfs/src/xlator.c | 85 | 
8 files changed, 231 insertions, 179 deletions
diff --git a/libglusterfs/src/defaults.c b/libglusterfs/src/defaults.c index b7174c8a939..2a4b20cebd8 100644 --- a/libglusterfs/src/defaults.c +++ b/libglusterfs/src/defaults.c @@ -22,6 +22,7 @@  #include "xlator.h"  #include "defaults.h" +#include "libglusterfs-messages.h"  /* FAILURE_CBK function section */ @@ -2191,7 +2192,8 @@ default_ipc (call_frame_t *frame, xlator_t *this, int32_t op, dict_t *xdata)  int32_t  default_forget (xlator_t *this, inode_t *inode)  { -        gf_log_callingfn (this->name, GF_LOG_WARNING, "xlator does not " +        gf_msg_callingfn (this->name, GF_LOG_WARNING, 0, +                          LG_MSG_XLATOR_DOES_NOT_IMPLEMENT, "xlator does not "                            "implement forget_cbk");          return 0;  } @@ -2200,7 +2202,8 @@ default_forget (xlator_t *this, inode_t *inode)  int32_t  default_releasedir (xlator_t *this, fd_t *fd)  { -        gf_log_callingfn (this->name, GF_LOG_WARNING, "xlator does not " +        gf_msg_callingfn (this->name, GF_LOG_WARNING, 0, +                          LG_MSG_XLATOR_DOES_NOT_IMPLEMENT, "xlator does not "                            "implement releasedir_cbk");          return 0;  } @@ -2208,7 +2211,8 @@ default_releasedir (xlator_t *this, fd_t *fd)  int32_t  default_release (xlator_t *this, fd_t *fd)  { -        gf_log_callingfn (this->name, GF_LOG_WARNING, "xlator does not " +        gf_msg_callingfn (this->name, GF_LOG_WARNING, 0, +                          LG_MSG_XLATOR_DOES_NOT_IMPLEMENT, "xlator does not "                            "implement release_cbk");          return 0;  } diff --git a/libglusterfs/src/globals.c b/libglusterfs/src/globals.c index a875049dfec..4f48cd169b5 100644 --- a/libglusterfs/src/globals.c +++ b/libglusterfs/src/globals.c @@ -15,6 +15,7 @@  #include "xlator.h"  #include "mem-pool.h"  #include "syncop.h" +#include "libglusterfs-messages.h"  const char *gf_fop_list[GF_FOP_MAXVALUE] = {          [GF_FOP_NULL]        = "NULL", @@ -108,7 +109,9 @@ glusterfs_this_init ()          ret = pthread_key_create (&this_xlator_key, glusterfs_this_destroy);          if (ret != 0) { -                gf_log ("", GF_LOG_WARNING, "failed to create the pthread key"); +                gf_msg ("", GF_LOG_WARNING, ret, +                        LG_MSG_PTHREAD_KEY_CREATE_FAILED, "failed to create " +                        "the pthread key");                  return ret;          } @@ -333,43 +336,43 @@ gf_globals_init_once ()          ret = glusterfs_this_init ();          if (ret) { -                gf_log ("", GF_LOG_CRITICAL, +                gf_msg ("", GF_LOG_CRITICAL, 0, LG_MSG_TRANSLATOR_INIT_FAILED,                          "ERROR: glusterfs-translator init failed");                  goto out;          }          ret = glusterfs_uuid_buf_init ();          if(ret) { -                gf_log ("", GF_LOG_CRITICAL, +                gf_msg ("", GF_LOG_CRITICAL, 0, LG_MSG_UUID_BUF_INIT_FAILED,                          "ERROR: glusterfs uuid buffer init failed");                  goto out;          }          ret = glusterfs_lkowner_buf_init ();          if(ret) { -                gf_log ("", GF_LOG_CRITICAL, +                gf_msg ("", GF_LOG_CRITICAL, 0, LG_MSG_LKOWNER_BUF_INIT_FAILED,                          "ERROR: glusterfs lkowner buffer init failed");                  goto out;          }          ret = synctask_init ();          if (ret) { -                gf_log ("", GF_LOG_CRITICAL, +                gf_msg ("", GF_LOG_CRITICAL, 0, LG_MSG_SYNCTASK_INIT_FAILED,                          "ERROR: glusterfs synctask init failed");                  goto out;          }          ret = syncopctx_init ();          if (ret) { -                gf_log ("", GF_LOG_CRITICAL, +                gf_msg ("", GF_LOG_CRITICAL, 0, LG_MSG_SYNCOPCTX_INIT_FAILED,                          "ERROR: glusterfs syncopctx init failed");                  goto out;          }  out:          if (ret) { -                gf_log ("", GF_LOG_CRITICAL, "Exiting as global " -                        "initialization failed"); +                gf_msg ("", GF_LOG_CRITICAL, 0, LG_MSG_GLOBAL_INIT_FAILED, +                        "Exiting as global initialization failed");                  exit (ret);          }  } @@ -384,8 +387,8 @@ glusterfs_globals_init (glusterfs_ctx_t *ctx)          ret =  pthread_once (&globals_inited, gf_globals_init_once);          if (ret) -                gf_log ("", GF_LOG_CRITICAL, "pthread_once failed with: %d", -                        ret); +                gf_msg ("", GF_LOG_CRITICAL, ret, LG_MSG_PTHREAD_FAILED, +                        "pthread_once failed");          return ret;  } diff --git a/libglusterfs/src/iobuf.c b/libglusterfs/src/iobuf.c index 9dbf19b71d7..a4d36691cd0 100644 --- a/libglusterfs/src/iobuf.c +++ b/libglusterfs/src/iobuf.c @@ -12,7 +12,7 @@  #include "iobuf.h"  #include "statedump.h"  #include <stdio.h> - +#include "libglusterfs-messages.h"  /*    TODO: implement destroy margins and prefetching of arenas @@ -119,7 +119,8 @@ __iobuf_arena_destroy_iobufs (struct iobuf_arena *iobuf_arena)          iobuf_cnt  = iobuf_arena->page_count;          if (!iobuf_arena->iobufs) { -                gf_log_callingfn (THIS->name, GF_LOG_ERROR, "iobufs not found"); +                gf_msg_callingfn (THIS->name, GF_LOG_ERROR, 0, +                                  LG_MSG_IOBUFS_NOT_FOUND, "iobufs not found");                  return;          } @@ -192,7 +193,8 @@ __iobuf_arena_alloc (struct iobuf_pool *iobuf_pool, size_t page_size,                                        PROT_READ|PROT_WRITE,                                        MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);          if (iobuf_arena->mem_base == MAP_FAILED) { -                gf_log (THIS->name, GF_LOG_WARNING, "maping failed"); +                gf_msg (THIS->name, GF_LOG_WARNING, 0, LG_MSG_MAPPING_FAILED, +                        "mapping failed");                  goto err;          } @@ -205,7 +207,8 @@ __iobuf_arena_alloc (struct iobuf_pool *iobuf_pool, size_t page_size,          __iobuf_arena_init_iobufs (iobuf_arena);          if (!iobuf_arena->iobufs) { -                gf_log (THIS->name, GF_LOG_ERROR, "init failed"); +                gf_msg (THIS->name, GF_LOG_ERROR, 0, LG_MSG_INIT_IOBUF_FAILED, +                        "init failed");                  goto err;          } @@ -232,9 +235,9 @@ __iobuf_arena_unprune (struct iobuf_pool *iobuf_pool, size_t page_size)          index = gf_iobuf_get_arena_index (page_size);          if (index == -1) { -                gf_log ("iobuf", GF_LOG_ERROR, "page_size (%zu) of " -                        "iobufs in arena being added is greater than max " -                        "available", page_size); +                gf_msg ("iobuf", GF_LOG_ERROR, 0, LG_MSG_PAGE_SIZE_EXCEEDED, +                        "page_size (%zu) of iobufs in arena being added is " +                        "greater than max available", page_size);                  return NULL;          } @@ -257,9 +260,9 @@ __iobuf_pool_add_arena (struct iobuf_pool *iobuf_pool, size_t page_size,          index = gf_iobuf_get_arena_index (page_size);          if (index == -1) { -                gf_log ("iobuf", GF_LOG_ERROR, "page_size (%zu) of " -                        "iobufs in arena being added is greater than max " -                        "available", page_size); +                gf_msg ("iobuf", GF_LOG_ERROR, 0, LG_MSG_PAGE_SIZE_EXCEEDED, +                        "page_size (%zu) of iobufs in arena being added is " +                        "greater than max available", page_size);                  return NULL;          } @@ -270,7 +273,8 @@ __iobuf_pool_add_arena (struct iobuf_pool *iobuf_pool, size_t page_size,                                                     num_pages);          if (!iobuf_arena) { -                gf_log (THIS->name, GF_LOG_WARNING, "arena not found"); +                gf_msg (THIS->name, GF_LOG_WARNING, 0, LG_MSG_ARENA_NOT_FOUND, +                        "arena not found");                  return NULL;          }          list_add (&iobuf_arena->list, &iobuf_pool->arenas[index]); @@ -499,9 +503,9 @@ __iobuf_select_arena (struct iobuf_pool *iobuf_pool, size_t page_size)          index = gf_iobuf_get_arena_index (page_size);          if (index == -1) { -                gf_log ("iobuf", GF_LOG_ERROR, "page_size (%zu) of " -                        "iobufs in arena being added is greater than max " -                        "available", page_size); +                gf_msg ("iobuf", GF_LOG_ERROR, 0, LG_MSG_PAGE_SIZE_EXCEEDED, +                        "page_size (%zu) of iobufs in arena being added is " +                        "greater than max available", page_size);                  return NULL;          } @@ -570,8 +574,9 @@ __iobuf_get (struct iobuf_arena *iobuf_arena, size_t page_size)          if (iobuf_arena->passive_cnt == 0) {                  index = gf_iobuf_get_arena_index (page_size);                  if (index == -1) { -                        gf_log ("iobuf", GF_LOG_ERROR, "page_size (%zu) of " -                                "iobufs in arena being added is greater " +                        gf_msg ("iobuf", GF_LOG_ERROR, 0, +                                LG_MSG_PAGE_SIZE_EXCEEDED, "page_size (%zu) of" +                                " iobufs in arena being added is greater "                                  "than max available", page_size);                          goto out;                  } @@ -645,7 +650,7 @@ iobuf_get2 (struct iobuf_pool *iobuf_pool, size_t page_size)                     memory allocations */                  iobuf = iobuf_get_from_stdalloc (iobuf_pool, page_size); -                gf_log ("iobuf", GF_LOG_DEBUG, "request for iobuf of size %zu " +                gf_msg_debug ("iobuf", 0, "request for iobuf of size %zu "                          "is serviced using standard calloc() (%p) as it "                          "exceeds the maximum available buffer size",                          page_size, iobuf); @@ -687,14 +692,16 @@ iobuf_get (struct iobuf_pool *iobuf_pool)                  iobuf_arena = __iobuf_select_arena (iobuf_pool,                                                      iobuf_pool->default_page_size);                  if (!iobuf_arena) { -                        gf_log (THIS->name, GF_LOG_WARNING, "arena not found"); +                        gf_msg (THIS->name, GF_LOG_WARNING, 0, +                                LG_MSG_ARENA_NOT_FOUND, "arena not found");                          goto unlock;                  }                  iobuf = __iobuf_get (iobuf_arena,                                       iobuf_pool->default_page_size);                  if (!iobuf) { -                        gf_log (THIS->name, GF_LOG_WARNING, "iobuf not found"); +                        gf_msg (THIS->name, GF_LOG_WARNING, 0, +                                LG_MSG_IOBUF_NOT_FOUND, "iobuf not found");                          goto unlock;                  } @@ -720,7 +727,7 @@ __iobuf_put (struct iobuf *iobuf, struct iobuf_arena *iobuf_arena)          index = gf_iobuf_get_arena_index (iobuf_arena->page_size);          if (index == -1) { -                gf_log ("iobuf", GF_LOG_DEBUG, "freeing the iobuf (%p) " +                gf_msg_debug ("iobuf", 0, "freeing the iobuf (%p) "                          "allocated with standard calloc()", iobuf);                  /* free up properly without bothering about lists and all */ @@ -761,13 +768,15 @@ iobuf_put (struct iobuf *iobuf)          iobuf_arena = iobuf->iobuf_arena;          if (!iobuf_arena) { -                gf_log (THIS->name, GF_LOG_WARNING, "arena not found"); +                gf_msg (THIS->name, GF_LOG_WARNING, 0, LG_MSG_ARENA_NOT_FOUND, +                        "arena not found");                  return;          }          iobuf_pool = iobuf_arena->iobuf_pool;          if (!iobuf_pool) { -                gf_log (THIS->name, GF_LOG_WARNING, "iobuf pool not found"); +                gf_msg (THIS->name, GF_LOG_WARNING, 0, +                        LG_MSG_POOL_NOT_FOUND, "iobuf pool not found");                  return;          } @@ -1040,12 +1049,14 @@ iobuf_size (struct iobuf *iobuf)          GF_VALIDATE_OR_GOTO ("iobuf", iobuf, out);          if (!iobuf->iobuf_arena) { -                gf_log (THIS->name, GF_LOG_WARNING, "arena not found"); +                gf_msg (THIS->name, GF_LOG_WARNING, 0, LG_MSG_ARENA_NOT_FOUND, +                        "arena not found");                  goto out;          }          if (!iobuf->iobuf_arena->iobuf_pool) { -                gf_log (THIS->name, GF_LOG_WARNING, "pool not found"); +                gf_msg (THIS->name, GF_LOG_WARNING, 0, LG_MSG_POOL_NOT_FOUND, +                        "pool not found");                  goto out;          } diff --git a/libglusterfs/src/latency.c b/libglusterfs/src/latency.c index b22f729500c..611615949fa 100644 --- a/libglusterfs/src/latency.c +++ b/libglusterfs/src/latency.c @@ -19,7 +19,7 @@  #include "xlator.h"  #include "common-utils.h"  #include "statedump.h" - +#include "libglusterfs-messages.h"  void  gf_set_fop_from_fn_pointer (call_frame_t *frame, struct xlator_fops *fops, void *fn) @@ -182,7 +182,8 @@ gf_latency_toggle (int signum, glusterfs_ctx_t *ctx)  {          if (ctx) {                  ctx->measure_latency = !ctx->measure_latency; -                gf_log ("[core]", GF_LOG_INFO, +                gf_msg ("[core]", GF_LOG_INFO, 0, +                        LG_MSG_LATENCY_MEASUREMENT_STATE,                          "Latency measurement turned %s",                          ctx->measure_latency ? "on" : "off");          } diff --git a/libglusterfs/src/logging.c b/libglusterfs/src/logging.c index 90eebee2ab5..9a4e7b65fe8 100644 --- a/libglusterfs/src/logging.c +++ b/libglusterfs/src/logging.c @@ -39,6 +39,7 @@  #include "defaults.h"  #include "glusterfs.h"  #include "timer.h" +#include "libglusterfs-messages.h"  /* Do not replace gf_log in TEST_LOG with gf_msg, as there is a slight chance   * that it could lead to an infinite recursion.*/ @@ -376,17 +377,18 @@ gf_log_rotate(glusterfs_ctx_t *ctx)                  fd = open (ctx->log.filename,                             O_CREAT | O_RDONLY, S_IRUSR | S_IWUSR);                  if (fd < 0) { -                        gf_log ("logrotate", GF_LOG_ERROR, -                                "%s", strerror (errno)); +                        gf_msg ("logrotate", GF_LOG_ERROR, errno, +                                LG_MSG_FILE_OP_FAILED, "failed to open " +                                "logfile");                          return;                  }                  close (fd);                  new_logfile = fopen (ctx->log.filename, "a");                  if (!new_logfile) { -                        gf_log ("logrotate", GF_LOG_CRITICAL, -                                "failed to open logfile %s (%s)", -                                ctx->log.filename, strerror (errno)); +                        gf_msg ("logrotate", GF_LOG_CRITICAL, errno, +                                LG_MSG_FILE_OP_FAILED, "failed to open logfile" +                                " %s", ctx->log.filename);                          return;                  } @@ -2185,17 +2187,19 @@ _gf_log (const char *domain, const char *file, const char *function, int line,                  fd = open (ctx->log.filename,                             O_CREAT | O_RDONLY, S_IRUSR | S_IWUSR);                  if (fd < 0) { -                        gf_log ("logrotate", GF_LOG_ERROR, -                                "%s", strerror (errno)); +                        gf_msg ("logrotate", GF_LOG_ERROR, errno, +                                LG_MSG_FILE_OP_FAILED, +                                "failed to open logfile");                          return -1;                  }                  close (fd);                  new_logfile = fopen (ctx->log.filename, "a");                  if (!new_logfile) { -                        gf_log ("logrotate", GF_LOG_CRITICAL, -                                "failed to open logfile %s (%s)", -                                ctx->log.filename, strerror (errno)); +                        gf_msg ("logrotate", GF_LOG_CRITICAL, errno, +                                LG_MSG_FILE_OP_FAILED, +                                "failed to open logfile %s", +                                ctx->log.filename);                          goto log;                  } @@ -2340,15 +2344,13 @@ gf_cmd_log_init (const char *filename)                  return -1;          if (!filename){ -                gf_log (this->name, GF_LOG_CRITICAL, "gf_cmd_log_init: no " -                        "filename specified\n"); +                gf_msg (this->name, GF_LOG_CRITICAL, 0, LG_MSG_INVALID_ENTRY, +                        "gf_cmd_log_init: no filename specified\n");                  return -1;          }          ctx->log.cmd_log_filename = gf_strdup (filename);          if (!ctx->log.cmd_log_filename) { -                gf_log (this->name, GF_LOG_CRITICAL, -                        "gf_cmd_log_init: strdup error\n");                  return -1;          }          /* close and reopen cmdlogfile for log rotate*/ @@ -2360,17 +2362,18 @@ gf_cmd_log_init (const char *filename)          fd = open (ctx->log.cmd_log_filename,                     O_CREAT | O_RDONLY, S_IRUSR | S_IWUSR);          if (fd < 0) { -                gf_log (this->name, GF_LOG_CRITICAL, -                        "%s", strerror (errno)); +                gf_msg (this->name, GF_LOG_CRITICAL, errno, +                        LG_MSG_FILE_OP_FAILED, "failed to open cmd_log_file");                  return -1;          }          close (fd);          ctx->log.cmdlogfile = fopen (ctx->log.cmd_log_filename, "a");          if (!ctx->log.cmdlogfile){ -                gf_log (this->name, GF_LOG_CRITICAL, +                gf_msg (this->name, GF_LOG_CRITICAL, errno, +                        LG_MSG_FILE_OP_FAILED,                          "gf_cmd_log_init: failed to open logfile \"%s\" " -                        "(%s)\n", ctx->log.cmd_log_filename, strerror (errno)); +                        "\n", ctx->log.cmd_log_filename);                  return -1;          }          return 0; @@ -2399,7 +2402,7 @@ gf_cmd_log (const char *domain, const char *fmt, ...)          if (!domain || !fmt) { -                gf_log ("glusterd", GF_LOG_TRACE, +                gf_msg_trace ("glusterd", 0,                          "logging: invalid argument\n");                  return -1;          } diff --git a/libglusterfs/src/options.c b/libglusterfs/src/options.c index 33d81879917..de5a745449e 100644 --- a/libglusterfs/src/options.c +++ b/libglusterfs/src/options.c @@ -12,6 +12,7 @@  #include "xlator.h"  #include "defaults.h" +#include "libglusterfs-messages.h"  #define GF_OPTION_LIST_EMPTY(_opt) (_opt->value[0] == NULL) @@ -27,7 +28,8 @@ xlator_option_validate_path (xlator_t *xl, const char *key, const char *value,                  snprintf (errstr, 256,                            "invalid path given '%s'",                            value); -                gf_log (xl->name, GF_LOG_ERROR, "%s", errstr); +                gf_msg (xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s", +                        errstr);                  goto out;          } @@ -37,7 +39,8 @@ xlator_option_validate_path (xlator_t *xl, const char *key, const char *value,                            "option %s %s: '%s' is not an "                            "absolute path name",                            key, value, value); -                gf_log (xl->name, GF_LOG_ERROR, "%s", errstr); +                gf_msg (xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s", +                        errstr);                  goto out;          } @@ -62,7 +65,8 @@ xlator_option_validate_int (xlator_t *xl, const char *key, const char *value,                  snprintf (errstr, 256,                            "invalid number format \"%s\" in option \"%s\"",                            value, key); -                gf_log (xl->name, GF_LOG_ERROR, "%s", errstr); +                gf_msg (xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s", +                        errstr);                  goto out;          } @@ -71,15 +75,15 @@ xlator_option_validate_int (xlator_t *xl, const char *key, const char *value,                  snprintf (errstr, 256,                            "invalid number format \"%s\" in option \"%s\"",                            value, key); -                gf_log (xl->name, GF_LOG_ERROR, "%s", errstr); +                gf_msg (xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s", +                        errstr);                  goto out;          }          if ((opt->min == 0) && (opt->max == 0) &&              (opt->validate == GF_OPT_VALIDATE_BOTH)) { -                gf_log (xl->name, GF_LOG_TRACE, -                        "no range check required for 'option %s %s'", -                        key, value); +                gf_msg_trace (xl->name, 0, "no range check required for " +                              "'option %s %s'", key, value);                  ret = 0;                  goto out;          } @@ -90,7 +94,8 @@ xlator_option_validate_int (xlator_t *xl, const char *key, const char *value,                                    "'%lld' in 'option %s %s' is smaller than "                                    "minimum value '%.0f'", inputll, key,                                    value, opt->min); -                        gf_log (xl->name, GF_LOG_ERROR, "%s", errstr); +                        gf_msg (xl->name, GF_LOG_ERROR, 0, +                                LG_MSG_INVALID_ENTRY, "%s", errstr);                          goto out;                  }          } else if (opt->validate == GF_OPT_VALIDATE_MAX) { @@ -99,7 +104,8 @@ xlator_option_validate_int (xlator_t *xl, const char *key, const char *value,                                    "'%lld' in 'option %s %s' is greater than "                                    "maximum value '%.0f'", inputll, key,                                    value, opt->max); -                        gf_log (xl->name, GF_LOG_ERROR, "%s", errstr); +                        gf_msg (xl->name, GF_LOG_ERROR, 0, +                                LG_MSG_INVALID_ENTRY, "%s", errstr);                          goto out;                  }          } else if ((inputll < opt->min) || (inputll > opt->max)) { @@ -107,7 +113,8 @@ xlator_option_validate_int (xlator_t *xl, const char *key, const char *value,                            "'%lld' in 'option %s %s' is out of range "                            "[%.0f - %.0f]",                            inputll, key, value, opt->min, opt->max); -                gf_log (xl->name, GF_LOG_ERROR, "%s", errstr); +                gf_msg (xl->name, GF_LOG_ERROR, 0, LG_MSG_OUT_OF_RANGE, "%s", +                        errstr);                  goto out;          } @@ -132,15 +139,15 @@ xlator_option_validate_sizet (xlator_t *xl, const char *key, const char *value,                  snprintf (errstr, 256,                            "invalid number format \"%s\" in option \"%s\"",                            value, key); -                gf_log (xl->name, GF_LOG_ERROR, "%s", errstr); +                gf_msg (xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s", +                        errstr);                  ret = -1;                  goto out;          }          if ((opt->min == 0) && (opt->max == 0)) { -                gf_log (xl->name, GF_LOG_TRACE, -                        "no range check required for 'option %s %s'", -                        key, value); +                gf_msg_trace (xl->name, 0, "no range check required for " +                              "'option %s %s'", key, value);                  goto out;          } @@ -150,13 +157,15 @@ xlator_option_validate_sizet (xlator_t *xl, const char *key, const char *value,                         snprintf (errstr, 256, "Cache size %" GF_PRI_SIZET " is out of "                                   "range [%.0f - %.0f]",                                   size, opt->min, opt->max); -                       gf_log (xl->name, GF_LOG_WARNING, "%s", errstr); +                       gf_msg (xl->name, GF_LOG_WARNING, 0, +                               LG_MSG_OUT_OF_RANGE, "%s", errstr);                  } else {                          snprintf (errstr, 256,                                    "'%" GF_PRI_SIZET "' in 'option %s %s' "                                    "is out of range [%.0f - %.0f]",                                    size, key, value, opt->min, opt->max); -                        gf_log (xl->name, GF_LOG_ERROR, "%s", errstr); +                        gf_msg (xl->name, GF_LOG_ERROR, 0, +                                LG_MSG_OUT_OF_RANGE, "%s", errstr);                          ret = -1;                  }          } @@ -184,7 +193,8 @@ xlator_option_validate_bool (xlator_t *xl, const char *key, const char *value,                  snprintf (errstr, 256,                            "option %s %s: '%s' is not a valid boolean value",                            key, value, value); -                gf_log (xl->name, GF_LOG_ERROR, "%s", errstr); +                gf_msg (xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s", +                        errstr);                  goto out;          } @@ -222,7 +232,8 @@ xlator_option_validate_xlator (xlator_t *xl, const char *key, const char *value,                  snprintf (errstr, 256,                            "option %s %s: '%s' is not a valid volume name",                            key, value, value); -                gf_log (xl->name, GF_LOG_ERROR, "%s", errstr); +                gf_msg (xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s", +                        errstr);                  goto out;          } @@ -321,7 +332,8 @@ xlator_option_validate_str (xlator_t *xl, const char *key, const char *value,  out:          if (ret) {                  set_error_str (errstr, sizeof (errstr), opt, key, value); -                gf_log (xl->name, GF_LOG_ERROR, "%s", errstr); +                gf_msg (xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s", +                        errstr);                  if (op_errstr)                          *op_errstr = gf_strdup (errstr);          } @@ -342,7 +354,8 @@ xlator_option_validate_percent (xlator_t *xl, const char *key, const char *value                  snprintf (errstr, 256,                            "invalid percent format \"%s\" in \"option %s\"",                            value, key); -                gf_log (xl->name, GF_LOG_ERROR, "%s", errstr); +                gf_msg (xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s", +                        errstr);                  goto out;          } @@ -350,7 +363,8 @@ xlator_option_validate_percent (xlator_t *xl, const char *key, const char *value                  snprintf (errstr, 256,                            "'%lf' in 'option %s %s' is out of range [0 - 100]",                            percent, key, value); -                gf_log (xl->name, GF_LOG_ERROR, "%s", errstr); +                gf_msg (xl->name, GF_LOG_ERROR, 0, LG_MSG_OUT_OF_RANGE, "%s", +                        errstr);                  goto out;          } @@ -396,7 +410,8 @@ xlator_option_validate_percent_or_sizet (xlator_t *xl, const char *key,                                            "'%lf' in 'option %s %s' is out"                                            " of range [0 - 100]", size, key,                                            value); -                                gf_log (xl->name, GF_LOG_ERROR, "%s", errstr); +                                gf_msg (xl->name, GF_LOG_ERROR, 0, +                                        LG_MSG_OUT_OF_RANGE, "%s", errstr);                                  goto out;                          }  			ret = 0; @@ -410,16 +425,15 @@ xlator_option_validate_percent_or_sizet (xlator_t *xl, const char *key,                                    " %s' should not be fractional value. Use "                                    "valid unsigned integer value.", size, key,                                    value); -                        gf_log (xl->name, GF_LOG_ERROR, "%s", errstr); +                        gf_msg (xl->name, GF_LOG_ERROR, 0, +                                LG_MSG_INVALID_ENTRY, "%s", errstr);                          goto out;                  }  		/* Check the range */  		if ((opt->min == 0) && (opt->max == 0)) { -			gf_log (xl->name, GF_LOG_TRACE, -				"no range check required for " -				"'option %s %s'", -				key, value); +			gf_msg_trace (xl->name, 0, "no range check required " +                                      "for 'option %s %s'", key, value);  			ret = 0;  			goto out;  		} @@ -428,7 +442,8 @@ xlator_option_validate_percent_or_sizet (xlator_t *xl, const char *key,  				  "'%lf' in 'option %s %s'"  				  " is out of range [%.0f - %.0f]",  				  size, key, value, opt->min, opt->max); -			gf_log (xl->name, GF_LOG_ERROR, "%s", errstr); +			gf_msg (xl->name, GF_LOG_ERROR, 0, LG_MSG_OUT_OF_RANGE, +                                "%s", errstr);  			goto out;  		}  		ret = 0; @@ -440,7 +455,7 @@ xlator_option_validate_percent_or_sizet (xlator_t *xl, const char *key,  	snprintf (errstr, 256,  		  "invalid number format \"%s\" in \"option %s\"",  		  value, key); -	gf_log (xl->name, GF_LOG_ERROR, "%s", errstr); +	gf_msg (xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s", errstr);  out: @@ -464,15 +479,14 @@ xlator_option_validate_time (xlator_t *xl, const char *key, const char *value,                            "invalid time format \"%s\" in "                            "\"option %s\"",                            value, key); -                gf_log (xl->name, GF_LOG_ERROR, "%s", errstr); +                gf_msg (xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s", +                        errstr);                  goto out;          }          if ((opt->min == 0) && (opt->max == 0)) { -                gf_log (xl->name, GF_LOG_TRACE, -                        "no range check required for " -                        "'option %s %s'", -                        key, value); +                gf_msg_trace (xl->name, 0, "no range check required for " +                              "'option %s %s'", key, value);                  ret = 0;                  goto out;          } @@ -483,7 +497,8 @@ xlator_option_validate_time (xlator_t *xl, const char *key, const char *value,                            "out of range [%.0f - %.0f]",                            input_time, key, value,                            opt->min, opt->max); -                gf_log (xl->name, GF_LOG_ERROR, "%s", errstr); +                gf_msg (xl->name, GF_LOG_ERROR, 0, LG_MSG_OUT_OF_RANGE, "%s", +                        errstr);                  goto out;          } @@ -508,15 +523,15 @@ xlator_option_validate_double (xlator_t *xl, const char *key, const char *value,                  snprintf (errstr, 256,                            "invalid number format \"%s\" in option \"%s\"",                            value, key); -                gf_log (xl->name, GF_LOG_ERROR, "%s", errstr); +                gf_msg (xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s", +                        errstr);                  goto out;          }          if ((opt->min == 0) && (opt->max == 0) &&              (opt->validate == GF_OPT_VALIDATE_BOTH)) { -                gf_log (xl->name, GF_LOG_TRACE, -                        "no range check required for 'option %s %s'", -                        key, value); +                gf_msg_trace (xl->name, 0, "no range check required for " +                              "'option %s %s'", key, value);                  ret = 0;                  goto out;          } @@ -527,7 +542,8 @@ xlator_option_validate_double (xlator_t *xl, const char *key, const char *value,                                    "'%f' in 'option %s %s' is smaller than "                                    "minimum value '%f'", input, key,                                    value, opt->min); -                        gf_log (xl->name, GF_LOG_ERROR, "%s", errstr); +                        gf_msg (xl->name, GF_LOG_ERROR, 0, +                                LG_MSG_INVALID_ENTRY, "%s", errstr);                          goto out;                  }          } else if (opt->validate == GF_OPT_VALIDATE_MAX) { @@ -536,7 +552,8 @@ xlator_option_validate_double (xlator_t *xl, const char *key, const char *value,                                    "'%f' in 'option %s %s' is greater than "                                    "maximum value '%f'", input, key,                                    value, opt->max); -                        gf_log (xl->name, GF_LOG_ERROR, "%s", errstr); +                        gf_msg (xl->name, GF_LOG_ERROR, 0, +                                LG_MSG_INVALID_ENTRY, "%s", errstr);                          goto out;                  }          } else if ((input < opt->min) || (input > opt->max)) { @@ -544,7 +561,8 @@ xlator_option_validate_double (xlator_t *xl, const char *key, const char *value,                            "'%f' in 'option %s %s' is out of range "                            "[%f - %f]",                            input, key, value, opt->min, opt->max); -                gf_log (xl->name, GF_LOG_ERROR, "%s", errstr); +                gf_msg (xl->name, GF_LOG_ERROR, 0, LG_MSG_OUT_OF_RANGE, "%s", +                        errstr);                  goto out;          } @@ -568,7 +586,8 @@ xlator_option_validate_addr (xlator_t *xl, const char *key, const char *value,                            "option %s %s: '%s'  is not a valid internet-address,"                            " it does not conform to standards.",                            key, value, value); -                gf_log (xl->name, GF_LOG_ERROR, "%s", errstr); +                gf_msg (xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s", +                        errstr);                  if (op_errstr)                          *op_errstr = gf_strdup (errstr);          } @@ -608,7 +627,8 @@ out:          if (ret) {                  snprintf (errstr, sizeof (errstr), "option %s %s: '%s' is not "                  "a valid internet-address-list", key, value, value); -                gf_log (xl->name, GF_LOG_ERROR, "%s", errstr); +                gf_msg (xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s", +                        errstr);                  if (op_errstr)                          *op_errstr = gf_strdup (errstr);          } @@ -647,7 +667,8 @@ out:          if (ret) {                  snprintf (errstr, sizeof (errstr), "option %s %s: '%s' is not "                  "a valid mount-auth-address", key, value, value); -                gf_log (xl->name, GF_LOG_ERROR, "%s", errstr); +                gf_msg (xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s", +                        errstr);                  if (op_errstr)                          *op_errstr = gf_strdup (errstr);          } @@ -673,7 +694,7 @@ gf_validate_size (const char *sizestr, volume_option_t *opt)          }   out: -        gf_log (THIS->name, GF_LOG_DEBUG, "Returning %d", ret); +        gf_msg_debug (THIS->name, 0, "Returning %d", ret);          return ret;  } @@ -717,9 +738,9 @@ validate_list_elements (const char *string, volume_option_t *opt,                  if (!key ||                      (key_validator && key_validator(key))) {                          ret = -1; -                        gf_log (THIS->name, GF_LOG_WARNING, -                                "invalid list '%s', key '%s' not valid.", -                                string, key); +                        gf_msg (THIS->name, GF_LOG_WARNING, 0, +                                LG_MSG_INVALID_ENTRY, "invalid list '%s', key " +                                "'%s' not valid.", string, key);                          goto out;                  } @@ -727,9 +748,9 @@ validate_list_elements (const char *string, volume_option_t *opt,                  if (!value ||                      (value_validator && value_validator(value, opt))) {                          ret = -1; -                        gf_log (THIS->name, GF_LOG_WARNING, -                                "invalid list '%s', value '%s' not valid.", -                                string, key); +                        gf_msg (THIS->name, GF_LOG_WARNING, 0, +                                LG_MSG_INVALID_ENTRY, "invalid list '%s', " +                                "value '%s' not valid.", string, key);                          goto out;                  } @@ -739,7 +760,7 @@ validate_list_elements (const char *string, volume_option_t *opt,   out:          GF_FREE (dup_string); -        gf_log (THIS->name, GF_LOG_DEBUG, "Returning %d", ret); +        gf_msg_debug (THIS->name, 0, "Returning %d", ret);          return ret;  } @@ -831,7 +852,7 @@ xlator_option_validate (xlator_t *xl, char *key, char *value,          };          if (opt->type > GF_OPTION_TYPE_MAX) { -                gf_log (xl->name, GF_LOG_ERROR, +                gf_msg (xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY,                          "unknown option type '%d'", opt->type);                  goto out;          } @@ -918,17 +939,17 @@ xl_opt_validate (dict_t *dict, char *key, data_t *value, void *data)          ret = xlator_option_validate (xl, key, value->data, opt, &errstr);          if (ret) -                gf_log (xl->name, GF_LOG_WARNING, "validate of %s returned %d", -                        key, ret); +                gf_msg (xl->name, GF_LOG_WARNING, 0, LG_MSG_VALIDATE_RETURNS, +                        "validate of %s returned %d", key, ret);          if (errstr)                  /* possible small leak of previously set stub->errstr */                  stub->errstr = errstr;          if (fnmatch (opt->key[0], key, FNM_NOESCAPE) != 0) { -                gf_log (xl->name, GF_LOG_WARNING, "option '%s' is deprecated, " -                        "preferred is '%s', continuing with correction", -                        key, opt->key[0]); +                gf_msg (xl->name, GF_LOG_WARNING, 0, LG_MSG_INVALID_ENTRY, +                        "option '%s' is deprecated, preferred is '%s', " +                        "continuing with correction", key, opt->key[0]);                  dict_set (dict, opt->key[0], value);                  dict_del (dict, key);          } @@ -970,7 +991,7 @@ xlator_options_validate (xlator_t *xl, dict_t *options, char **op_errstr)          if (!xl) { -                gf_log (THIS->name, GF_LOG_DEBUG, "'this' not a valid ptr"); +                gf_msg_debug (THIS->name, 0, "'this' not a valid ptr");                  ret = -1;                  goto out;          } @@ -1000,7 +1021,9 @@ xlator_validate_rec (xlator_t *xlator, char **op_errstr)          while (trav) {                  if (xlator_validate_rec (trav->xlator, op_errstr)) { -                        gf_log ("xlator", GF_LOG_WARNING, "validate_rec failed"); +                        gf_msg ("xlator", GF_LOG_WARNING, 0, +                                LG_MSG_VALIDATE_REC_FAILED, "validate_rec " +                                "failed");                          goto out;                  } @@ -1008,7 +1031,7 @@ xlator_validate_rec (xlator_t *xlator, char **op_errstr)          }          if (xlator_dynload (xlator)) -                gf_log (xlator->name, GF_LOG_DEBUG, "Did not load the symbols"); +                gf_msg_debug (xlator->name, 0, "Did not load the symbols");          old_THIS = THIS;          THIS = xlator; @@ -1024,11 +1047,12 @@ xlator_validate_rec (xlator_t *xlator, char **op_errstr)          THIS = old_THIS;          if (ret) { -                gf_log (xlator->name, GF_LOG_INFO, "%s", *op_errstr); +                gf_msg (xlator->name, GF_LOG_INFO, 0, LG_MSG_INVALID_ENTRY, +                        "%s", *op_errstr);                  goto out;          } -        gf_log (xlator->name, GF_LOG_DEBUG, "Validated options"); +        gf_msg_debug (xlator->name, 0, "Validated options");          ret = 0;  out: @@ -1071,7 +1095,7 @@ xlator_reconfigure_rec (xlator_t *old_xl, xlator_t *new_xl)                  if (ret)                          goto out; -                gf_log (trav1->xlator->name, GF_LOG_DEBUG, "reconfigured"); +                gf_msg_debug (trav1->xlator->name, 0, "reconfigured");                  trav1 = trav1->next;                  trav2 = trav2->next; @@ -1088,7 +1112,7 @@ xlator_reconfigure_rec (xlator_t *old_xl, xlator_t *new_xl)                  if (ret)                          goto out;          } else { -                gf_log (old_xl->name, GF_LOG_DEBUG, "No reconfigure() found"); +                gf_msg_debug (old_xl->name, 0, "No reconfigure() found");          }          ret = 0; diff --git a/libglusterfs/src/options.h b/libglusterfs/src/options.h index 83b545850c8..3154dcefc02 100644 --- a/libglusterfs/src/options.h +++ b/libglusterfs/src/options.h @@ -16,6 +16,7 @@  #include <inttypes.h>  #include "xlator.h" +#include "libglusterfs-messages.h"  /* Add possible new type of option you may need */  typedef enum {          GF_OPTION_TYPE_ANY = 0, @@ -128,7 +129,8 @@ xlator_option_init_##type (xlator_t *this, dict_t *options, char *key,  \                                                                          \          opt = xlator_volume_option_get (this, key);                     \          if (!opt) {                                                     \ -                gf_log (this->name, GF_LOG_WARNING,                     \ +                gf_msg (this->name, GF_LOG_WARNING, EINVAL,             \ +                        LG_MSG_INVALID_ENTRY,                           \                          "unknown option: %s", key);                     \                  ret = -1;                                               \                  return ret;                                             \ @@ -141,27 +143,26 @@ xlator_option_init_##type (xlator_t *this, dict_t *options, char *key,  \          if (set_value)                                                  \                  value = set_value;                                      \          if (!value) {                                                   \ -                gf_log (this->name, GF_LOG_TRACE, "option %s not set",  \ +                gf_msg_trace (this->name, 0, "option %s not set",       \                          key);                                           \                  *val_p = (type_t)0;                                     \                  return 0;                                               \          }                                                               \          if (value == def_value) {                                       \ -                gf_log (this->name, GF_LOG_TRACE,                       \ -                        "option %s using default value %s",             \ -                        key, value);                                    \ +                gf_msg_trace (this->name, 0, "option %s using default"  \ +                              " value %s", key, value);                 \          } else {                                                        \ -                gf_log (this->name, GF_LOG_DEBUG,                       \ -                        "option %s using set value %s",                 \ -                        key, value);                                    \ +                gf_msg_debug (this->name, 0, "option %s using set"      \ +                              " value %s", key, value);                 \          }                                                               \          old_THIS = THIS;                                                \          THIS = this;                                                    \          ret = conv (value, val_p);                                      \          THIS = old_THIS;                                                \          if (ret) {							\ -                gf_log (this->name, GF_LOG_INFO,                        \ -                        "option %s convertion failed value %s",         \ +                gf_msg (this->name, GF_LOG_INFO, 0,                     \ +                        LG_MSG_CONVERSION_FAILED,                       \ +                        "option %s conversion failed value %s",         \                          key, value);                                    \                  return ret;                                             \  	}                                                               \ @@ -214,7 +215,8 @@ xlator_option_reconf_##type (xlator_t *this, dict_t *options, char *key, \                                                                          \          opt = xlator_volume_option_get (this, key);                     \          if (!opt) {                                                     \ -                gf_log (this->name, GF_LOG_WARNING,                     \ +                gf_msg (this->name, GF_LOG_WARNING, EINVAL,             \ +                        LG_MSG_INVALID_ENTRY,                           \                          "unknown option: %s", key);                     \                  ret = -1;                                               \                  return ret;                                             \ @@ -227,17 +229,16 @@ xlator_option_reconf_##type (xlator_t *this, dict_t *options, char *key, \          if (set_value)                                                  \                  value = set_value;                                      \          if (!value) {                                                   \ -                gf_log (this->name, GF_LOG_TRACE, "option %s not set",  \ -                        key);                                           \ +                gf_msg_trace (this->name, 0, "option %s not set", key); \                  *val_p = (type_t)0;                                     \                  return 0;                                               \          }                                                               \          if (value == def_value) {                                       \ -                gf_log (this->name, GF_LOG_TRACE,                       \ +                gf_msg_trace (this->name, 0,                            \                          "option %s using default value %s",             \                          key, value);                                    \          } else {                                                        \ -                gf_log (this->name, GF_LOG_DEBUG,                       \ +                gf_msg_debug (this->name, 0,                            \                          "option %s using set value %s",                 \                          key, value);                                    \          }                                                               \ diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c index 117454092cb..76077c7a360 100644 --- a/libglusterfs/src/xlator.c +++ b/libglusterfs/src/xlator.c @@ -13,6 +13,7 @@  #include <netdb.h>  #include <fnmatch.h>  #include "defaults.h" +#include "libglusterfs-messages.h"  #define SET_DEFAULT_FOP(fn) do {			\                  if (!xl->fops->fn)			\ @@ -29,7 +30,8 @@ static void  fill_defaults (xlator_t *xl)  {          if (xl == NULL)	{ -                gf_log_callingfn ("xlator", GF_LOG_WARNING, "invalid argument"); +                gf_msg_callingfn ("xlator", GF_LOG_WARNING, EINVAL, +                                  LG_MSG_INVALID_ARG, "invalid argument");                  return;          } @@ -123,23 +125,23 @@ xlator_volopt_dynload (char *xlator_type, void **dl_handle,          ret = gf_asprintf (&name, "%s/%s.so", XLATORDIR, xlator_type);          if (-1 == ret) { -                gf_log ("xlator", GF_LOG_ERROR, "asprintf failed");                  goto out;          }          ret = -1; -        gf_log ("xlator", GF_LOG_TRACE, "attempt to load file %s", name); +        gf_msg_trace ("xlator", 0, "attempt to load file %s", name);          handle = dlopen (name, RTLD_NOW|RTLD_GLOBAL);          if (!handle) { -                gf_log ("xlator", GF_LOG_WARNING, "%s", dlerror ()); +                gf_msg ("xlator", GF_LOG_WARNING, 0, LG_MSG_DLOPEN_FAILED, +                        "%s", dlerror ());                  goto out;          }          if (!(opt_list->given_opt = dlsym (handle, "options"))) {                  dlerror (); -                gf_log ("xlator", GF_LOG_ERROR, +                gf_msg ("xlator", GF_LOG_ERROR, 0, LG_MSG_LOAD_FAILED,                          "Failed to load xlator opt table");                  goto out;          } @@ -153,7 +155,7 @@ xlator_volopt_dynload (char *xlator_type, void **dl_handle,          if (handle)                  dlclose (handle); -        gf_log ("xlator", GF_LOG_DEBUG, "Returning %d", ret); +        gf_msg_debug ("xlator", 0, "Returning %d", ret);          return ret;  } @@ -174,30 +176,30 @@ xlator_dynload (xlator_t *xl)          ret = gf_asprintf (&name, "%s/%s.so", XLATORDIR, xl->type);          if (-1 == ret) { -                gf_log ("xlator", GF_LOG_ERROR, "asprintf failed");                  goto out;          }          ret = -1; -        gf_log ("xlator", GF_LOG_TRACE, "attempt to load file %s", name); +        gf_msg_trace ("xlator", 0, "attempt to load file %s", name);          handle = dlopen (name, RTLD_NOW|RTLD_GLOBAL);          if (!handle) { -                gf_log ("xlator", GF_LOG_WARNING, "%s", dlerror ()); +                gf_msg ("xlator", GF_LOG_WARNING, 0, LG_MSG_DLOPEN_FAILED, +                        "%s", dlerror ());                  goto out;          }          xl->dlhandle = handle;          if (!(xl->fops = dlsym (handle, "fops"))) { -                gf_log ("xlator", GF_LOG_WARNING, "dlsym(fops) on %s", -                        dlerror ()); +                gf_msg ("xlator", GF_LOG_WARNING, 0, LG_MSG_DLSYM_ERROR, +                        "dlsym(fops) on %s", dlerror ());                  goto out;          }          if (!(xl->cbks = dlsym (handle, "cbks"))) { -                gf_log ("xlator", GF_LOG_WARNING, "dlsym(cbks) on %s", -                        dlerror ()); +                gf_msg ("xlator", GF_LOG_WARNING, 0, LG_MSG_DLSYM_ERROR, +                        "dlsym(cbks) on %s", dlerror ());                  goto out;          } @@ -215,39 +217,38 @@ xlator_dynload (xlator_t *xl)          }          else {                  if (!(*VOID(&xl->init) = dlsym (handle, "init"))) { -                        gf_log ("xlator", GF_LOG_WARNING, "dlsym(init) on %s", +                        gf_msg ("xlator", GF_LOG_WARNING, 0, +                                LG_MSG_DLSYM_ERROR, "dlsym(init) on %s",                                  dlerror ());                          goto out;                  }                  if (!(*VOID(&(xl->fini)) = dlsym (handle, "fini"))) { -                        gf_log ("xlator", GF_LOG_WARNING, "dlsym(fini) on %s", +                        gf_msg ("xlator", GF_LOG_WARNING, 0, +                                LG_MSG_DLSYM_ERROR, "dlsym(fini) on %s",                                  dlerror ());                          goto out;                  }                  if (!(*VOID(&(xl->reconfigure)) = dlsym (handle,                                                           "reconfigure"))) { -                        gf_log ("xlator", GF_LOG_TRACE, -                                "dlsym(reconfigure) on %s -- neglecting", -                                dlerror()); +                        gf_msg_trace ("xlator", 0, "dlsym(reconfigure) on %s " +                                      "-- neglecting", dlerror());                  }                  if (!(*VOID(&(xl->notify)) = dlsym (handle, "notify"))) { -                        gf_log ("xlator", GF_LOG_TRACE, -                                "dlsym(notify) on %s -- neglecting", -                                dlerror ()); +                        gf_msg_trace ("xlator", 0, "dlsym(notify) on %s -- " +                                      "neglecting", dlerror ());                  }          }          if (!(xl->dumpops = dlsym (handle, "dumpops"))) { -                gf_log ("xlator", GF_LOG_TRACE, -                        "dlsym(dumpops) on %s -- neglecting", dlerror ()); +                gf_msg_trace ("xlator", 0, "dlsym(dumpops) on %s -- " +                              "neglecting", dlerror ());          }          if (!(*VOID(&(xl->mem_acct_init)) = dlsym (handle, "mem_acct_init"))) { -                gf_log (xl->name, GF_LOG_TRACE, -                        "dlsym(mem_acct_init) on %s -- neglecting", -                        dlerror ()); +                gf_msg_trace (xl->name, 0, "dlsym(mem_acct_init) on %s -- " +                              "neglecting", dlerror ());          }          vol_opt = GF_CALLOC (1, sizeof (volume_opt_list_t), @@ -259,8 +260,8 @@ xlator_dynload (xlator_t *xl)          if (!(vol_opt->given_opt = dlsym (handle, "options"))) {                  dlerror (); -                gf_log (xl->name, GF_LOG_TRACE, -                        "Strict option validation not enforced -- neglecting"); +                gf_msg_trace (xl->name, 0, "Strict option validation not " +                              "enforced -- neglecting");          }          INIT_LIST_HEAD (&vol_opt->list);          list_add_tail (&vol_opt->list, &xl->volume_options); @@ -294,8 +295,9 @@ xlator_set_inode_lru_limit (xlator_t *this, void *data)          if (this->itable) {                  if (!data) { -                        gf_log (this->name, GF_LOG_WARNING, "input data is " -                                "NULL. Cannot update the lru limit of the inode" +                        gf_msg (this->name, GF_LOG_WARNING, 0, +                                LG_MSG_INVALID_ENTRY, "input data is NULL. " +                                "Cannot update the lru limit of the inode"                                  " table. Continuing with older value");                          goto out;                  } @@ -408,17 +410,17 @@ xlator_init (xlator_t *xl)                  xl->mem_acct_init (xl);          if (!xl->init) { -                gf_log (xl->name, GF_LOG_WARNING, "No init() found"); +                gf_msg (xl->name, GF_LOG_WARNING, 0, LG_MSG_INIT_FAILED, +                        "No init() found");                  goto out;          }          ret = __xlator_init (xl);          if (ret) { -                gf_log (xl->name, GF_LOG_ERROR, +                gf_msg (xl->name, GF_LOG_ERROR, 0, LG_MSG_VOLUME_ERROR,                          "Initialization of volume '%s' failed," -                        " review your volfile again", -                        xl->name); +                        " review your volfile again", xl->name);                  goto out;          } @@ -446,7 +448,7 @@ xlator_fini_rec (xlator_t *xl)                  }                  xlator_fini_rec (trav->xlator); -                gf_log (trav->xlator->name, GF_LOG_DEBUG, "fini done"); +                gf_msg_debug (trav->xlator->name, 0, "fini done");                  trav = trav->next;          } @@ -462,7 +464,7 @@ xlator_fini_rec (xlator_t *xl)                          THIS = old_THIS;                  } else { -                        gf_log (xl->name, GF_LOG_DEBUG, "No fini() found"); +                        gf_msg_debug (xl->name, 0, "No fini() found");                  }                  xl->init_succeeded = 0;          } @@ -641,7 +643,8 @@ xlator_tree_free_members (xlator_t *tree)          xlator_t *prev = tree;          if (!tree) { -                gf_log ("parser", GF_LOG_ERROR, "Translator tree not found"); +                gf_msg ("parser", GF_LOG_ERROR, 0, LG_MSG_TREE_NOT_FOUND, +                        "Translator tree not found");                  return -1;          } @@ -661,7 +664,8 @@ xlator_tree_free_memacct (xlator_t *tree)          xlator_t *prev = tree;          if (!tree) { -                gf_log ("parser", GF_LOG_ERROR, "Translator tree not found"); +                gf_msg ("parser", GF_LOG_ERROR, 0, LG_MSG_TREE_NOT_FOUND, +                        "Translator tree not found");                  return -1;          } @@ -1037,8 +1041,9 @@ glusterd_check_log_level (const char *value)          }          if (log_level == -1) -                gf_log (THIS->name, GF_LOG_ERROR, "Invalid log-level. possible values " -                        "are DEBUG|WARNING|ERROR|CRITICAL|NONE|TRACE"); +                gf_msg (THIS->name, GF_LOG_ERROR, 0, LG_MSG_INIT_FAILED, +                        "Invalid log-level. possible values are " +                        "DEBUG|WARNING|ERROR|CRITICAL|NONE|TRACE");          return log_level;  }  | 
