Change cache/core printing style

This commit is contained in:
Wojciech Olszewski 2018-12-07 14:14:30 +01:00
parent c0079e4d77
commit 7973dbbf41
4 changed files with 9 additions and 9 deletions

View File

@ -420,7 +420,7 @@ static int _ocf_mngt_init_instance_add_cores(
if (!cache->core_obj[i].obj.type)
goto _cache_mng_init_instance_add_cores_ERROR;
ret = snprintf(core_name, sizeof(core_name), "%d", i);
ret = snprintf(core_name, sizeof(core_name), "core%d", i);
if (ret < 0 || ret >= sizeof(core_name))
goto _cache_mng_init_instance_add_cores_ERROR;
@ -716,7 +716,7 @@ static int _ocf_mngt_init_prepare_cache(struct ocf_cachemng_init_params *param,
goto out;
} else {
ret = snprintf(cache_name, sizeof(cache_name),
"%hu", param->id);
"cache%hu", param->id);
if (ret < 0)
goto out;
}

View File

@ -351,7 +351,7 @@ int ocf_mngt_cache_add_core_nolock(ocf_cache_t cache, ocf_core_t *core,
if (result)
return result;
} else {
result = snprintf(core_name, sizeof(core_name), "%hu",
result = snprintf(core_name, sizeof(core_name), "core%hu",
cfg->core_id);
if (result < 0)
return result;

View File

@ -211,11 +211,11 @@ struct ocf_cache {
};
#define ocf_cache_log_prefix(cache, lvl, prefix, fmt, ...) \
ocf_log_prefix(ocf_cache_get_ctx(cache), lvl, "[Cache %s] ", \
prefix fmt, ocf_cache_get_name(cache), ##__VA_ARGS__)
ocf_log_prefix(ocf_cache_get_ctx(cache), lvl, "%s" prefix, \
fmt, ocf_cache_get_name(cache), ##__VA_ARGS__)
#define ocf_cache_log(cache, lvl, fmt, ...) \
ocf_cache_log_prefix(cache, lvl, "", fmt, ##__VA_ARGS__)
ocf_cache_log_prefix(cache, lvl, ": ", fmt, ##__VA_ARGS__)
#define ocf_cache_log_rl(cache) \
ocf_log_rl(ocf_cache_get_ctx(cache))

View File

@ -47,10 +47,10 @@ bool ocf_core_is_valid(ocf_cache_t cache, ocf_core_id_t id);
int ocf_core_set_user_metadata_raw(ocf_core_t core, void *data, size_t size);
#define ocf_core_log_prefix(core, lvl, prefix, fmt, ...) \
ocf_cache_log_prefix(ocf_core_get_cache(core), lvl, "[Core %s] ", \
prefix fmt, ocf_core_get_name(core), ##__VA_ARGS__)
ocf_cache_log_prefix(ocf_core_get_cache(core), lvl, ".%s" prefix, \
fmt, ocf_core_get_name(core), ##__VA_ARGS__)
#define ocf_core_log(core, lvl, fmt, ...) \
ocf_core_log_prefix(core, lvl, "", fmt, ##__VA_ARGS__)
ocf_core_log_prefix(core, lvl, ": ", fmt, ##__VA_ARGS__)
#endif /* __OCF_CORE_PRIV_H__ */