Merge pull request #81 from mmichal10/cache-name-in-array

Cache name in array
This commit is contained in:
Michal Rakowski
2019-08-20 09:50:53 +02:00
committed by GitHub
4 changed files with 7 additions and 7 deletions

View File

@@ -64,7 +64,7 @@ struct command_args{
static struct command_args command_args_values = {
.force = 0,
.cache_id = 0,
.cache_id = OCF_CACHE_ID_INVALID,
.core_id = OCF_CORE_ID_INVALID,
.state = CACHE_INIT_NEW,
.cache_mode = ocf_cache_mode_default,

View File

@@ -167,7 +167,7 @@ static uint16_t find_free_cache_id(ocf_ctx_t ctx)
else if (result == -OCF_ERR_CACHE_NOT_EXIST)
break;
else
return OCF_CACHE_ID_MAX;
return OCF_CACHE_ID_INVALID;
}
return id;
@@ -1037,9 +1037,9 @@ int cache_mngt_prepare_cache_cfg(struct ocf_mngt_cache_config *cfg,
if (strnlen(cmd->cache_path_name, MAX_STR_LEN) >= MAX_STR_LEN)
return -OCF_ERR_INVAL;
if (cmd->cache_id == OCF_CACHE_ID_MAX) {
if (cmd->cache_id == OCF_CACHE_ID_INVALID) {
cache_id = find_free_cache_id(cas_ctx);
if (cache_id == OCF_CACHE_ID_MAX)
if (cache_id == OCF_CACHE_ID_INVALID)
return -OCF_ERR_INVAL;
cmd->cache_id = cache_id;
@@ -1051,7 +1051,7 @@ int cache_mngt_prepare_cache_cfg(struct ocf_mngt_cache_config *cfg,
memset(device_cfg, 0, sizeof(*device_cfg));
memset(atomic_params, 0, sizeof(*atomic_params));
cfg->name = cache_name;
strncpy(cfg->name, cache_name, OCF_CACHE_NAME_SIZE);
cfg->cache_mode = cmd->caching_mode;
cfg->cache_line_size = cmd->line_size;
cfg->eviction_policy = cmd->eviction_policy;

View File

@@ -861,7 +861,7 @@ static int _cas_upgrade_restore_conf_main(struct cas_properties *cache_props,
if (cache_mode >= ocf_cache_mode_max)
cache_mode = ocf_cache_mode_default;
cfg.name = cache_name;
strncpy(cfg.name, cache_name, OCF_CACHE_NAME_SIZE);
cfg.cache_mode = cache_mode;
/* cfg.eviction_policy = TODO */
cfg.cache_line_size = cache_line_size;

2
ocf

Submodule ocf updated: 8ed525ae7f...43e8905456