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 1414da90731..b617c43b1e2 100644 --- a/libglusterfs/src/defaults.c +++ b/libglusterfs/src/defaults.c @@ -27,6 +27,7 @@ #include "xlator.h" #include "defaults.h" +#include "libglusterfs-messages.h" /* FAILURE_CBK function section */ @@ -2196,7 +2197,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; } @@ -2205,7 +2207,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; } @@ -2213,7 +2216,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 bd1165ec50c..8943637ef62 100644 --- a/libglusterfs/src/globals.c +++ b/libglusterfs/src/globals.c @@ -20,6 +20,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", @@ -113,7 +114,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; } @@ -338,43 +341,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); } } @@ -389,8 +392,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 e8fca2db916..44f5cd2cff5 100644 --- a/libglusterfs/src/logging.c +++ b/libglusterfs/src/logging.c @@ -44,6 +44,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.*/ @@ -381,17 +382,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; } @@ -2190,17 +2192,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; } @@ -2345,15 +2349,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*/ @@ -2365,17 +2367,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; @@ -2404,7 +2407,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 75dce0ea3b6..4786a2789ca 100644 --- a/libglusterfs/src/options.c +++ b/libglusterfs/src/options.c @@ -17,6 +17,7 @@ #include "xlator.h" #include "defaults.h" +#include "libglusterfs-messages.h" #define GF_OPTION_LIST_EMPTY(_opt) (_opt->value[0] == NULL) @@ -32,7 +33,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; } @@ -42,7 +44,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; } @@ -67,7 +70,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; } @@ -76,15 +80,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; } @@ -95,7 +99,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) { @@ -104,7 +109,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)) { @@ -112,7 +118,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; } @@ -137,15 +144,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; } @@ -155,13 +162,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; } } @@ -189,7 +198,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; } @@ -227,7 +237,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; } @@ -326,7 +337,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); } @@ -347,7 +359,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; } @@ -355,7 +368,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; } @@ -401,7 +415,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; @@ -415,16 +430,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; } @@ -433,7 +447,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; @@ -445,7 +460,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: @@ -469,15 +484,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; } @@ -488,7 +502,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; } @@ -513,15 +528,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; } @@ -532,7 +547,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) { @@ -541,7 +557,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)) { @@ -549,7 +566,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; } @@ -573,7 +591,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); } @@ -613,7 +632,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); } @@ -652,7 +672,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); } @@ -678,7 +699,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; } @@ -722,9 +743,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; } @@ -732,9 +753,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; } @@ -744,7 +765,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; } @@ -836,7 +857,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; } @@ -923,17 +944,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); } @@ -975,7 +996,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; } @@ -1005,7 +1026,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; } @@ -1013,7 +1036,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; @@ -1029,11 +1052,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: @@ -1076,7 +1100,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; @@ -1093,7 +1117,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 05a3d4332cf..fa798db05ed 100644 --- a/libglusterfs/src/options.h +++ b/libglusterfs/src/options.h @@ -21,6 +21,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, @@ -133,7 +134,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; \ @@ -146,27 +148,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; \ } \ @@ -219,7 +220,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; \ @@ -232,17 +234,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 628f3499956..52f96c94a50 100644 --- a/libglusterfs/src/xlator.c +++ b/libglusterfs/src/xlator.c @@ -18,6 +18,7 @@ #include <netdb.h> #include <fnmatch.h> #include "defaults.h" +#include "libglusterfs-messages.h" #define SET_DEFAULT_FOP(fn) do { \ if (!xl->fops->fn) \ @@ -34,7 +35,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; } @@ -128,23 +130,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; } @@ -158,7 +160,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; } @@ -179,30 +181,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; } @@ -220,39 +222,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), @@ -264,8 +265,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); @@ -299,8 +300,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; } @@ -413,17 +415,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; } @@ -451,7 +453,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; } @@ -467,7 +469,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; } @@ -646,7 +648,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; } @@ -666,7 +669,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; } @@ -1042,8 +1046,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; } |