summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authoryatipadia <ypadia@redhat.com>2019-11-23 14:03:41 +0530
committerAmar Tumballi <amar@kadalu.io>2020-02-09 02:53:40 +0000
commitf1e62e1578ee07802827121722d90c1ec4b811a6 (patch)
tree1cdeeb5d6a9548a8d64127d22b9cd6cc7bdff892 /libglusterfs
parentc87817495b3c5c36dcca9d157e9313b7d3195eed (diff)
libglusterfs-options: structure logging
convert all gf_msg() to gf_smsg() Change-Id: I8f1ff462b9c8012ed676c51450930a65ac403bf3 Updates: #657 Signed-off-by: yatipadia <ypadia@redhat.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/glusterfs/libglusterfs-messages.h16
-rw-r--r--libglusterfs/src/iobuf.c43
-rw-r--r--libglusterfs/src/options.c123
3 files changed, 100 insertions, 82 deletions
diff --git a/libglusterfs/src/glusterfs/libglusterfs-messages.h b/libglusterfs/src/glusterfs/libglusterfs-messages.h
index 441f1bbafa3..71fc5f662af 100644
--- a/libglusterfs/src/glusterfs/libglusterfs-messages.h
+++ b/libglusterfs/src/glusterfs/libglusterfs-messages.h
@@ -117,7 +117,8 @@ GLFS_MSGID(
LG_MSG_THREAD_CREATE_FAILED, LG_MSG_FILE_DELETE_FAILED, LG_MSG_WRONG_VALUE,
LG_MSG_PATH_OPEN_FAILED, LG_MSG_DISPATCH_HANDLER_FAILED,
LG_MSG_READ_FILE_FAILED, LG_MSG_ENTRIES_NOT_PROVIDED,
- LG_MSG_ENTRIES_PROVIDED);
+ LG_MSG_ENTRIES_PROVIDED, LG_MSG_UNKNOWN_OPTION_TYPE,
+ LG_MSG_OPTION_DEPRECATED);
#define LG_MSG_EPOLL_FD_CREATE_FAILED_STR "epoll fd creation failed"
#define LG_MSG_INVALID_POLL_IN_STR "invalid poll_in value"
@@ -194,5 +195,18 @@ GLFS_MSGID(
"detected cyclic loop formation during inode linkage"
#define LG_MSG_CTX_NULL_STR "_ctx not found"
#define LG_MSG_DENTRY_NOT_FOUND_STR "dentry not found"
+#define LG_MSG_OUT_OF_RANGE_STR "out of range"
+#define LG_MSG_UNKNOWN_OPTION_TYPE_STR "unknown option type"
+#define LG_MSG_VALIDATE_RETURNS_STR "validate of returned"
+#define LG_MSG_OPTION_DEPRECATED_STR \
+ "option is deprecated, continuing with correction"
+#define LG_MSG_VALIDATE_REC_FAILED_STR "validate_rec failed"
+#define LG_MSG_MAPPING_FAILED_STR "mapping failed"
+#define LG_MSG_INIT_IOBUF_FAILED_STR "init failed"
+#define LG_MSG_ARENA_NOT_FOUND_STR "arena not found"
+#define LG_MSG_PAGE_SIZE_EXCEEDED_STR \
+ "page_size of iobufs in arena being added is greater than max available"
+#define LG_MSG_POOL_NOT_FOUND_STR "pool not found"
+#define LG_MSG_IOBUF_NOT_FOUND_STR "iobuf not found"
#endif /* !_LG_MESSAGES_H_ */
diff --git a/libglusterfs/src/iobuf.c b/libglusterfs/src/iobuf.c
index e0538f1f5b0..4e7d2958764 100644
--- a/libglusterfs/src/iobuf.c
+++ b/libglusterfs/src/iobuf.c
@@ -168,8 +168,7 @@ __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_msg(THIS->name, GF_LOG_WARNING, 0, LG_MSG_MAPPING_FAILED,
- "mapping failed");
+ gf_smsg(THIS->name, GF_LOG_WARNING, 0, LG_MSG_MAPPING_FAILED, NULL);
goto err;
}
@@ -181,8 +180,7 @@ __iobuf_arena_alloc(struct iobuf_pool *iobuf_pool, size_t page_size,
__iobuf_arena_init_iobufs(iobuf_arena);
if (!iobuf_arena->iobufs) {
- gf_msg(THIS->name, GF_LOG_ERROR, 0, LG_MSG_INIT_IOBUF_FAILED,
- "init failed");
+ gf_smsg(THIS->name, GF_LOG_ERROR, 0, LG_MSG_INIT_IOBUF_FAILED, NULL);
goto err;
}
@@ -227,8 +225,8 @@ __iobuf_pool_add_arena(struct iobuf_pool *iobuf_pool, const size_t page_size,
if (!iobuf_arena) {
iobuf_arena = __iobuf_arena_alloc(iobuf_pool, page_size, num_pages);
if (!iobuf_arena) {
- gf_msg(THIS->name, GF_LOG_WARNING, 0, LG_MSG_ARENA_NOT_FOUND,
- "arena not found");
+ gf_smsg(THIS->name, GF_LOG_WARNING, 0, LG_MSG_ARENA_NOT_FOUND,
+ NULL);
return NULL;
}
}
@@ -552,10 +550,8 @@ iobuf_get2(struct iobuf_pool *iobuf_pool, size_t page_size)
iobuf_pool->request_misses++;
return iobuf;
} else if (index == -1) {
- 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);
+ gf_smsg("iobuf", GF_LOG_ERROR, 0, LG_MSG_PAGE_SIZE_EXCEEDED,
+ "page_size=%zu", page_size, NULL);
return NULL;
}
@@ -564,8 +560,8 @@ iobuf_get2(struct iobuf_pool *iobuf_pool, size_t page_size)
iobuf = __iobuf_get(iobuf_pool, rounded_size, index);
if (!iobuf) {
pthread_mutex_unlock(&iobuf_pool->mutex);
- gf_msg(THIS->name, GF_LOG_WARNING, 0, LG_MSG_IOBUF_NOT_FOUND,
- "iobuf not found");
+ gf_smsg(THIS->name, GF_LOG_WARNING, 0, LG_MSG_IOBUF_NOT_FOUND,
+ NULL);
goto post_unlock;
}
@@ -618,10 +614,8 @@ iobuf_get(struct iobuf_pool *iobuf_pool)
index = gf_iobuf_get_arena_index(iobuf_pool->default_page_size);
if (index == -1) {
- 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",
- iobuf_pool->default_page_size);
+ gf_smsg("iobuf", GF_LOG_ERROR, 0, LG_MSG_PAGE_SIZE_EXCEEDED,
+ "page_size=%zu", iobuf_pool->default_page_size, NULL);
return NULL;
}
@@ -630,8 +624,8 @@ iobuf_get(struct iobuf_pool *iobuf_pool)
iobuf = __iobuf_get(iobuf_pool, iobuf_pool->default_page_size, index);
if (!iobuf) {
pthread_mutex_unlock(&iobuf_pool->mutex);
- gf_msg(THIS->name, GF_LOG_WARNING, 0, LG_MSG_IOBUF_NOT_FOUND,
- "iobuf not found");
+ gf_smsg(THIS->name, GF_LOG_WARNING, 0, LG_MSG_IOBUF_NOT_FOUND,
+ NULL);
goto out;
}
@@ -701,15 +695,14 @@ iobuf_put(struct iobuf *iobuf)
iobuf_arena = iobuf->iobuf_arena;
if (!iobuf_arena) {
- gf_msg(THIS->name, GF_LOG_WARNING, 0, LG_MSG_ARENA_NOT_FOUND,
- "arena not found");
+ gf_smsg(THIS->name, GF_LOG_WARNING, 0, LG_MSG_ARENA_NOT_FOUND, NULL);
return;
}
iobuf_pool = iobuf_arena->iobuf_pool;
if (!iobuf_pool) {
- gf_msg(THIS->name, GF_LOG_WARNING, 0, LG_MSG_POOL_NOT_FOUND,
- "iobuf pool not found");
+ gf_smsg(THIS->name, GF_LOG_WARNING, 0, LG_MSG_POOL_NOT_FOUND, "iobuf",
+ NULL);
return;
}
@@ -948,14 +941,12 @@ iobuf_size(struct iobuf *iobuf)
GF_VALIDATE_OR_GOTO("iobuf", iobuf, out);
if (!iobuf->iobuf_arena) {
- gf_msg(THIS->name, GF_LOG_WARNING, 0, LG_MSG_ARENA_NOT_FOUND,
- "arena not found");
+ gf_smsg(THIS->name, GF_LOG_WARNING, 0, LG_MSG_ARENA_NOT_FOUND, NULL);
goto out;
}
if (!iobuf->iobuf_arena->iobuf_pool) {
- gf_msg(THIS->name, GF_LOG_WARNING, 0, LG_MSG_POOL_NOT_FOUND,
- "pool not found");
+ gf_smsg(THIS->name, GF_LOG_WARNING, 0, LG_MSG_POOL_NOT_FOUND, NULL);
goto out;
}
diff --git a/libglusterfs/src/options.c b/libglusterfs/src/options.c
index 400a3901689..f6b5aa0ea23 100644
--- a/libglusterfs/src/options.c
+++ b/libglusterfs/src/options.c
@@ -25,7 +25,8 @@ xlator_option_validate_path(xlator_t *xl, const char *key, const char *value,
if (strstr(value, "../")) {
snprintf(errstr, 256, "invalid path given '%s'", value);
- gf_msg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s", errstr);
+ gf_smsg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "error=%s",
+ errstr, NULL);
goto out;
}
@@ -35,7 +36,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_msg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s", errstr);
+ gf_smsg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "error=%s",
+ errstr, NULL);
goto out;
}
@@ -59,7 +61,8 @@ xlator_option_validate_int(xlator_t *xl, const char *key, const char *value,
if (gf_string2longlong(value, &inputll) != 0) {
snprintf(errstr, 256, "invalid number format \"%s\" in option \"%s\"",
value, key);
- gf_msg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s", errstr);
+ gf_smsg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "error=%s",
+ errstr, NULL);
goto out;
}
@@ -67,7 +70,8 @@ xlator_option_validate_int(xlator_t *xl, const char *key, const char *value,
if ((inputll == 0) && (gf_string2ulonglong(value, &uinputll) != 0)) {
snprintf(errstr, 256, "invalid number format \"%s\" in option \"%s\"",
value, key);
- gf_msg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s", errstr);
+ gf_smsg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "error=%s",
+ errstr, NULL);
goto out;
}
@@ -87,8 +91,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_msg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s",
- errstr);
+ gf_smsg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "error=%s",
+ errstr, NULL);
goto out;
}
} else if (opt->validate == GF_OPT_VALIDATE_MAX) {
@@ -97,8 +101,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_msg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s",
- errstr);
+ gf_smsg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "error=%s",
+ errstr, NULL);
goto out;
}
} else if ((inputll < opt->min) || (inputll > opt->max)) {
@@ -106,7 +110,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_msg(xl->name, GF_LOG_ERROR, 0, LG_MSG_OUT_OF_RANGE, "%s", errstr);
+ gf_smsg(xl->name, GF_LOG_ERROR, 0, LG_MSG_OUT_OF_RANGE, "error=%s",
+ errstr, NULL);
goto out;
}
@@ -129,7 +134,8 @@ xlator_option_validate_sizet(xlator_t *xl, const char *key, const char *value,
if (gf_string2bytesize_uint64(value, &size) != 0) {
snprintf(errstr, 256, "invalid number format \"%s\" in option \"%s\"",
value, key);
- gf_msg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s", errstr);
+ gf_smsg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "error=%s",
+ errstr, NULL);
ret = -1;
goto out;
}
@@ -147,7 +153,8 @@ xlator_option_validate_sizet(xlator_t *xl, const char *key, const char *value,
"'%" PRIu64
"' in 'option %s %s' is out of range [%.0f - %.0f]",
size, key, value, opt->min, opt->max);
- gf_msg(xl->name, GF_LOG_ERROR, 0, LG_MSG_OUT_OF_RANGE, "%s", errstr);
+ gf_smsg(xl->name, GF_LOG_ERROR, 0, LG_MSG_OUT_OF_RANGE, "error=%s",
+ errstr, NULL);
ret = -1;
}
@@ -171,7 +178,8 @@ xlator_option_validate_bool(xlator_t *xl, const char *key, const char *value,
if (gf_string2boolean(value, &is_valid) != 0) {
snprintf(errstr, 256, "option %s %s: '%s' is not a valid boolean value",
key, value, value);
- gf_msg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s", errstr);
+ gf_smsg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "error=%s",
+ errstr, NULL);
goto out;
}
@@ -206,7 +214,8 @@ xlator_option_validate_xlator(xlator_t *xl, const char *key, const char *value,
if (!xlopt) {
snprintf(errstr, 256, "option %s %s: '%s' is not a valid volume name",
key, value, value);
- gf_msg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s", errstr);
+ gf_smsg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "error=%s",
+ errstr, NULL);
goto out;
}
@@ -305,7 +314,8 @@ out:
char errstr[4096];
set_error_str(errstr, sizeof(errstr), opt, key, value);
- gf_msg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s", errstr);
+ gf_smsg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "error=%s",
+ errstr, NULL);
if (op_errstr)
*op_errstr = gf_strdup(errstr);
}
@@ -324,7 +334,8 @@ xlator_option_validate_percent(xlator_t *xl, const char *key, const char *value,
if (gf_string2percent(value, &percent) != 0) {
snprintf(errstr, 256, "invalid percent format \"%s\" in \"option %s\"",
value, key);
- gf_msg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s", errstr);
+ gf_smsg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "error=%s",
+ errstr, NULL);
goto out;
}
@@ -332,7 +343,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_msg(xl->name, GF_LOG_ERROR, 0, LG_MSG_OUT_OF_RANGE, "%s", errstr);
+ gf_smsg(xl->name, GF_LOG_ERROR, 0, LG_MSG_OUT_OF_RANGE, "error=%s",
+ errstr, NULL);
goto out;
}
@@ -378,8 +390,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_msg(xl->name, GF_LOG_ERROR, 0, LG_MSG_OUT_OF_RANGE, "%s",
- errstr);
+ gf_smsg(xl->name, GF_LOG_ERROR, 0, LG_MSG_OUT_OF_RANGE,
+ "error=%s", errstr, NULL);
goto out;
}
ret = 0;
@@ -394,8 +406,8 @@ 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_msg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s",
- errstr);
+ gf_smsg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "error=%s",
+ errstr, NULL);
goto out;
}
@@ -413,8 +425,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_msg(xl->name, GF_LOG_ERROR, 0, LG_MSG_OUT_OF_RANGE, "%s",
- errstr);
+ gf_smsg(xl->name, GF_LOG_ERROR, 0, LG_MSG_OUT_OF_RANGE, "error=%s",
+ errstr, NULL);
goto out;
}
ret = 0;
@@ -425,7 +437,8 @@ 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_msg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s", errstr);
+ gf_smsg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "error=%s", errstr,
+ NULL);
out:
if (ret && op_errstr)
@@ -447,7 +460,8 @@ xlator_option_validate_time(xlator_t *xl, const char *key, const char *value,
"invalid time format \"%s\" in "
"\"option %s\"",
value, key);
- gf_msg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s", errstr);
+ gf_smsg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "error=%s",
+ errstr, NULL);
goto out;
}
@@ -466,7 +480,8 @@ xlator_option_validate_time(xlator_t *xl, const char *key, const char *value,
"' in 'option %s %s' is "
"out of range [%.0f - %.0f]",
input_time, key, value, opt->min, opt->max);
- gf_msg(xl->name, GF_LOG_ERROR, 0, LG_MSG_OUT_OF_RANGE, "%s", errstr);
+ gf_smsg(xl->name, GF_LOG_ERROR, 0, LG_MSG_OUT_OF_RANGE, "error=%s",
+ errstr, NULL);
goto out;
}
@@ -489,7 +504,8 @@ xlator_option_validate_double(xlator_t *xl, const char *key, const char *value,
if (gf_string2double(value, &input) != 0) {
snprintf(errstr, 256, "invalid number format \"%s\" in option \"%s\"",
value, key);
- gf_msg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s", errstr);
+ gf_smsg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "error=%s",
+ errstr, NULL);
goto out;
}
@@ -509,8 +525,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_msg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s",
- errstr);
+ gf_smsg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "error=%s",
+ errstr, NULL);
goto out;
}
} else if (opt->validate == GF_OPT_VALIDATE_MAX) {
@@ -519,8 +535,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_msg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s",
- errstr);
+ gf_smsg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "error=%s",
+ errstr, NULL);
goto out;
}
} else if ((input < opt->min) || (input > opt->max)) {
@@ -528,7 +544,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_msg(xl->name, GF_LOG_ERROR, 0, LG_MSG_OUT_OF_RANGE, "%s", errstr);
+ gf_smsg(xl->name, GF_LOG_ERROR, 0, LG_MSG_OUT_OF_RANGE, "error=%s",
+ errstr, NULL);
goto out;
}
@@ -549,7 +566,8 @@ xlator_option_validate_addr(xlator_t *xl, const char *key, const char *value,
if (!valid_internet_address((char *)value, _gf_false, _gf_false)) {
snprintf(errstr, 256, "option %s %s: Can not parse %s address", key,
value, value);
- gf_msg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s", errstr);
+ gf_smsg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "error=%s",
+ errstr, NULL);
if (op_errstr)
*op_errstr = gf_strdup(errstr);
}
@@ -640,7 +658,8 @@ out:
"option %s %s: '%s' is not "
"a valid internet-address-list",
key, value, value);
- gf_msg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s", errstr);
+ gf_smsg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "error=%s",
+ errstr, NULL);
if (op_errstr)
*op_errstr = gf_strdup(errstr);
}
@@ -681,7 +700,8 @@ out:
"option %s %s: '%s' is not "
"a valid mount-auth-address",
key, value, value);
- gf_msg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "%s", errstr);
+ gf_smsg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY, "error=%s",
+ errstr, NULL);
if (op_errstr)
*op_errstr = gf_strdup(errstr);
}
@@ -747,20 +767,16 @@ validate_list_elements(const char *string, volume_option_t *opt,
key = strtok_r(str_ptr, ":", &substr_sav);
if (!key || (key_validator && key_validator(key))) {
ret = -1;
- gf_msg(THIS->name, GF_LOG_WARNING, 0, LG_MSG_INVALID_ENTRY,
- "invalid list '%s', key "
- "'%s' not valid.",
- string, key ? key : "");
+ gf_smsg(THIS->name, GF_LOG_WARNING, 0, LG_MSG_INVALID_ENTRY,
+ "list=%s", string, "key=%s", key ? key : "", NULL);
goto out;
}
value = strtok_r(NULL, ":", &substr_sav);
if (!value || (value_validator && value_validator(value, opt))) {
ret = -1;
- gf_msg(THIS->name, GF_LOG_WARNING, 0, LG_MSG_INVALID_ENTRY,
- "invalid list '%s', "
- "value '%s' not valid.",
- string, key);
+ gf_smsg(THIS->name, GF_LOG_WARNING, 0, LG_MSG_INVALID_ENTRY,
+ "list=%s", string, "value=%s", key, NULL);
goto out;
}
@@ -865,8 +881,8 @@ xlator_option_validate(xlator_t *xl, char *key, char *value,
};
if (opt->type > GF_OPTION_TYPE_MAX) {
- gf_msg(xl->name, GF_LOG_ERROR, 0, LG_MSG_INVALID_ENTRY,
- "unknown option type '%d'", opt->type);
+ gf_smsg(xl->name, GF_LOG_ERROR, 0, LG_MSG_UNKNOWN_OPTION_TYPE,
+ "type=%d", opt->type, NULL);
goto out;
}
@@ -947,18 +963,16 @@ 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_msg(xl->name, GF_LOG_WARNING, 0, LG_MSG_VALIDATE_RETURNS,
- "validate of %s returned %d", key, ret);
+ gf_smsg(xl->name, GF_LOG_WARNING, 0, LG_MSG_VALIDATE_RETURNS, "key=%s",
+ key, "ret=%d", ret, NULL);
if (errstr)
/* possible small leak of previously set stub->errstr */
stub->errstr = errstr;
if (fnmatch(opt->key[0], key, FNM_NOESCAPE) != 0) {
- gf_msg(xl->name, GF_LOG_DEBUG, 0, LG_MSG_INVALID_ENTRY,
- "option '%s' is deprecated, preferred is '%s', "
- "continuing with correction",
- key, opt->key[0]);
+ gf_smsg(xl->name, GF_LOG_DEBUG, 0, LG_MSG_OPTION_DEPRECATED, "key=%s",
+ key, "preferred=%s", opt->key[0], NULL);
dict_set(dict, opt->key[0], value);
dict_del(dict, key);
}
@@ -1026,9 +1040,8 @@ xlator_validate_rec(xlator_t *xlator, char **op_errstr)
while (trav) {
if (xlator_validate_rec(trav->xlator, op_errstr)) {
- gf_msg("xlator", GF_LOG_WARNING, 0, LG_MSG_VALIDATE_REC_FAILED,
- "validate_rec "
- "failed");
+ gf_smsg("xlator", GF_LOG_WARNING, 0, LG_MSG_VALIDATE_REC_FAILED,
+ NULL);
goto out;
}
@@ -1052,8 +1065,8 @@ xlator_validate_rec(xlator_t *xlator, char **op_errstr)
THIS = old_THIS;
if (ret) {
- gf_msg(xlator->name, GF_LOG_INFO, 0, LG_MSG_INVALID_ENTRY, "%s",
- *op_errstr);
+ gf_smsg(xlator->name, GF_LOG_INFO, 0, LG_MSG_INVALID_ENTRY, "%s",
+ *op_errstr, NULL);
goto out;
}