Duplicate cache name in struct ocf_cache
Cache name is needed for logging in passive mode, when config metadata is still not accessible. Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
parent
85e8b414c4
commit
ee42d9aaaf
@ -1012,7 +1012,7 @@ static void _ocf_mngt_load_read_properties_end(void *priv, int error,
|
|||||||
/*
|
/*
|
||||||
* Check if name loaded from disk is the same as present one.
|
* Check if name loaded from disk is the same as present one.
|
||||||
*/
|
*/
|
||||||
if (env_strncmp(cache->conf_meta->name, OCF_CACHE_NAME_SIZE,
|
if (env_strncmp(cache->name, OCF_CACHE_NAME_SIZE,
|
||||||
properties->cache_name, OCF_CACHE_NAME_SIZE)) {
|
properties->cache_name, OCF_CACHE_NAME_SIZE)) {
|
||||||
OCF_PL_FINISH_RET(context->pipeline, -OCF_ERR_CACHE_NAME_MISMATCH);
|
OCF_PL_FINISH_RET(context->pipeline, -OCF_ERR_CACHE_NAME_MISMATCH);
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,14 @@ ocf_volume_t ocf_cache_get_volume(ocf_cache_t cache)
|
|||||||
|
|
||||||
int ocf_cache_set_name(ocf_cache_t cache, const char *src, size_t src_size)
|
int ocf_cache_set_name(ocf_cache_t cache, const char *src, size_t src_size)
|
||||||
{
|
{
|
||||||
|
int result;
|
||||||
|
|
||||||
OCF_CHECK_NULL(cache);
|
OCF_CHECK_NULL(cache);
|
||||||
|
|
||||||
|
result = env_strncpy(cache->name, OCF_CACHE_NAME_SIZE, src, src_size);
|
||||||
|
if (result)
|
||||||
|
return result;
|
||||||
|
|
||||||
return env_strncpy(cache->conf_meta->name, OCF_CACHE_NAME_SIZE,
|
return env_strncpy(cache->conf_meta->name, OCF_CACHE_NAME_SIZE,
|
||||||
src, src_size);
|
src, src_size);
|
||||||
}
|
}
|
||||||
@ -29,7 +36,7 @@ int ocf_cache_set_name(ocf_cache_t cache, const char *src, size_t src_size)
|
|||||||
const char *ocf_cache_get_name(ocf_cache_t cache)
|
const char *ocf_cache_get_name(ocf_cache_t cache)
|
||||||
{
|
{
|
||||||
OCF_CHECK_NULL(cache);
|
OCF_CHECK_NULL(cache);
|
||||||
return cache->conf_meta->name;
|
return cache->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ocf_cache_is_incomplete(ocf_cache_t cache)
|
bool ocf_cache_is_incomplete(ocf_cache_t cache)
|
||||||
|
@ -51,6 +51,8 @@ struct ocf_cache_device {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct ocf_cache {
|
struct ocf_cache {
|
||||||
|
char name[OCF_CACHE_NAME_SIZE];
|
||||||
|
|
||||||
ocf_ctx_t owner;
|
ocf_ctx_t owner;
|
||||||
|
|
||||||
struct list_head list;
|
struct list_head list;
|
||||||
|
Loading…
Reference in New Issue
Block a user