From 0461de9e246c9c6ed4514897d191142dd3af9d1a Mon Sep 17 00:00:00 2001 From: Daniel Madej Date: Tue, 19 Nov 2024 09:07:34 +0100 Subject: [PATCH 1/2] Fix typos Signed-off-by: Daniel Madej --- casadm/cas_lib.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/casadm/cas_lib.c b/casadm/cas_lib.c index a0f7b2b..1686aeb 100644 --- a/casadm/cas_lib.c +++ b/casadm/cas_lib.c @@ -70,7 +70,7 @@ static const char *core_states_name[] = { #define STANDBY_DETACHED_STATE "Standby detached" -#define CACHE_STATE_LENGHT 20 +#define CACHE_STATE_LENGTH 20 #define CAS_LOG_FILE "/var/log/opencas.log" #define CAS_LOG_LEVEL LOG_INFO @@ -2202,7 +2202,7 @@ int partition_list(unsigned int cache_id, unsigned int output_format) fclose(intermediate_file[1]); if (!result && stat_format_output(intermediate_file[0], stdout, use_csv?RAW_CSV:TEXT)) { - cas_printf(LOG_ERR, "An error occured during statistics formatting.\n"); + cas_printf(LOG_ERR, "An error occurred during statistics formatting.\n"); result = FAILURE; } fclose(intermediate_file[0]); @@ -2414,7 +2414,7 @@ int partition_get_config(CSVFILE *csv, struct kcas_io_classes *cnfg, return FAILURE; } else { cas_printf(LOG_ERR, - "I/O error occured while reading" + "I/O error occurred while reading" " IO Classes configuration file" " supplied.\n"); return FAILURE; @@ -2661,7 +2661,7 @@ void *list_printout(void *ctx) struct list_printout_ctx *spc = ctx; if (stat_format_output(spc->intermediate, spc->out, spc->type)) { - cas_printf(LOG_ERR, "An error occured during statistics formatting.\n"); + cas_printf(LOG_ERR, "An error occurred during statistics formatting.\n"); spc->result = FAILURE; } else { spc->result = SUCCESS; @@ -2800,7 +2800,7 @@ int list_caches(unsigned int list_format, bool by_id_path) for (i = 0; i < caches_count; ++i) { curr_cache = caches[i]; - char status_buf[CACHE_STATE_LENGHT]; + char status_buf[CACHE_STATE_LENGTH]; const char *tmp_status; char mode_string[12]; char exp_obj[32]; @@ -2867,7 +2867,7 @@ int list_caches(unsigned int list_format, bool by_id_path) } if (core_flush_prog || cache_flush_prog) { - snprintf(status_buf, CACHE_STATE_LENGHT, + snprintf(status_buf, CACHE_STATE_LENGTH, "%s (%3.1f %%)", "Flushing", core_flush_prog); tmp_status = status_buf; } else { @@ -2895,7 +2895,7 @@ int list_caches(unsigned int list_format, bool by_id_path) pthread_join(thread, 0); if (printout_ctx.result) { result = 1; - cas_printf(LOG_ERR, "An error occured during list formatting.\n"); + cas_printf(LOG_ERR, "An error occurred during list formatting.\n"); } fclose(intermediate_file[0]); @@ -3029,7 +3029,7 @@ int zero_md(const char *cache_device, bool force) } close(fd); - cas_printf(LOG_INFO, "OpenCAS's metadata wiped succesfully from device '%s'.\n", cache_device); + cas_printf(LOG_INFO, "OpenCAS's metadata wiped successfully from device '%s'.\n", cache_device); return SUCCESS; } From f15d3238ad0fa171a7a6568b01071628bce7ef4f Mon Sep 17 00:00:00 2001 From: Daniel Madej Date: Tue, 19 Nov 2024 09:48:16 +0100 Subject: [PATCH 2/2] Informative error for incorrect IO class 0 name Instead of generic 'Invalid input parameter' Signed-off-by: Daniel Madej --- casadm/cas_lib.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/casadm/cas_lib.c b/casadm/cas_lib.c index 1686aeb..dbdb83a 100644 --- a/casadm/cas_lib.c +++ b/casadm/cas_lib.c @@ -2327,6 +2327,10 @@ static inline int partition_get_line(CSVFILE *csv, } strncpy_s(cnfg->info[part_id].name, sizeof(cnfg->info[part_id].name), name, strnlen_s(name, sizeof(cnfg->info[part_id].name))); + if (0 == part_id && strcmp(name, "unclassified")) { + cas_printf(LOG_ERR, "IO class 0 must have the default name 'unclassified'\n"); + return FAILURE; + } /* Validate Priority*/ *error_col = part_csv_coll_prio;