casadm: use constans for parsing seq cutoff params

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
Michal Mielewczyk 2021-03-12 09:12:45 +01:00
parent a70a862c6d
commit 66f30dcf12

View File

@ -744,8 +744,9 @@ static cli_namespace set_param_namespace = {
int set_param_seq_cutoff_handle_option(char *opt, const char **arg) int set_param_seq_cutoff_handle_option(char *opt, const char **arg)
{ {
if (!strcmp(opt, "threshold")) { if (!strcmp(opt, "threshold")) {
if (validate_str_num(arg[0], "sequential cutoff threshold", 1, if (validate_str_num(arg[0], "sequential cutoff threshold",
4194181) == FAILURE) OCF_SEQ_CUTOFF_MIN_THRESHOLD,
OCF_SEQ_CUTOFF_MAX_THRESHOLD) == FAILURE)
return FAILURE; return FAILURE;
SET_CORE_PARAM(core_param_seq_cutoff_threshold, atoi(arg[0]) * KiB); SET_CORE_PARAM(core_param_seq_cutoff_threshold, atoi(arg[0]) * KiB);
@ -764,8 +765,9 @@ int set_param_seq_cutoff_handle_option(char *opt, const char **arg)
return FAILURE; return FAILURE;
} }
} else if (!strcmp(opt, "promotion-count")) { } else if (!strcmp(opt, "promotion-count")) {
if (validate_str_num(arg[0], "sequential cutoff promotion request count", 1, if (validate_str_num(arg[0], "sequential cutoff promotion request count",
65535) == FAILURE) OCF_SEQ_CUTOFF_MIN_PROMOTION_COUNT,
OCF_SEQ_CUTOFF_MAX_PROMOTION_COUNT) == FAILURE)
return FAILURE; return FAILURE;
SET_CORE_PARAM(core_param_seq_cutoff_promotion_count, atoi(arg[0])); SET_CORE_PARAM(core_param_seq_cutoff_promotion_count, atoi(arg[0]));