Introduce cache bind operation
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
@@ -198,6 +198,8 @@ int start_cache_command_handle_option(char *opt, const char **arg)
|
||||
command_args_values.cache_id = atoi(arg[0]);
|
||||
} else if (!strcmp(opt, "load")) {
|
||||
command_args_values.state = CACHE_INIT_LOAD;
|
||||
} else if (!strcmp(opt, "bind")) {
|
||||
command_args_values.state = CACHE_INIT_BIND;
|
||||
} else if (!strcmp(opt, "cache-device")) {
|
||||
if(validate_device_name(arg[0]) == FAILURE)
|
||||
return FAILURE;
|
||||
@@ -243,6 +245,7 @@ static cli_option start_options[] = {
|
||||
{'d', "cache-device", CACHE_DEVICE_DESC, 1, "DEVICE", CLI_OPTION_REQUIRED},
|
||||
{'i', "cache-id", CACHE_ID_DESC_LONG, 1, "ID", 0},
|
||||
{'l', "load", "Load cache metadata from caching device (DANGEROUS - see manual or Admin Guide for details)"},
|
||||
{'b', "bind", "Bind caching device (DANGEROUS - see manual or Admin Guide for details)"},
|
||||
{'f', "force", "Force the creation of cache instance"},
|
||||
{'c', "cache-mode", "Set cache mode from available: {"CAS_CLI_HELP_START_CACHE_MODES"} "CAS_CLI_HELP_START_CACHE_MODES_FULL"; without this parameter Write-Through will be set by default", 1, "NAME"},
|
||||
{'x', "cache-line-size", "Set cache line size in kibibytes: {4,8,16,32,64}[KiB] (default: %d)", 1, "NUMBER", CLI_OPTION_DEFAULT_INT, 0, 0, ocf_cache_line_size_default / KiB},
|
||||
@@ -293,6 +296,11 @@ int handle_start()
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (command_args_values.state == CACHE_INIT_BIND && command_args_values.force) {
|
||||
cas_printf(LOG_ERR, "Use of 'bind' and 'force' simultaneously is forbidden.\n");
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
cache_device = open(command_args_values.cache_device, O_RDONLY);
|
||||
|
||||
if (cache_device < 0) {
|
||||
|
Reference in New Issue
Block a user