From 8c7a31317b0ec128d25b30cd56db94c144ceaaa2 Mon Sep 17 00:00:00 2001 From: Artur Trybula Date: Mon, 8 Jul 2019 20:16:19 +0200 Subject: [PATCH] app/compress-perf: remove magic numbers This patch fixes some minor problems like 'magic numbers', spelling mistakes, enumes naming. Signed-off-by: Artur Trybula Acked-by: Fiona Trahe Acked-by: Shally Verma --- app/test-compress-perf/comp_perf_options.h | 10 ++++------ app/test-compress-perf/comp_perf_options_parse.c | 6 +++--- app/test-compress-perf/comp_perf_test_common.c | 7 ++++--- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/app/test-compress-perf/comp_perf_options.h b/app/test-compress-perf/comp_perf_options.h index 532fb964e5..5a32ed3a6b 100644 --- a/app/test-compress-perf/comp_perf_options.h +++ b/app/test-compress-perf/comp_perf_options.h @@ -5,8 +5,6 @@ #ifndef _COMP_PERF_OPS_ #define _COMP_PERF_OPS_ -#define MAX_DRIVER_NAME 64 -#define MAX_INPUT_FILE_NAME 64 #define MAX_LIST 32 #define MIN_COMPRESSED_BUF_SIZE 8 #define EXPANSE_RATIO 1.05 @@ -25,7 +23,7 @@ enum cleanup_st { ST_DURING_TEST }; -enum cperf_perf_test_type { +enum cperf_test_type { CPERF_TEST_TYPE_BENCHMARK, CPERF_TEST_TYPE_VERIFY }; @@ -45,9 +43,9 @@ struct range_list { }; struct comp_test_data { - char driver_name[64]; - char input_file[64]; - enum cperf_perf_test_type test; + char driver_name[RTE_DEV_NAME_MAX_LEN]; + char input_file[PATH_MAX]; + enum cperf_test_type test; uint8_t *input_data; size_t input_data_sz; diff --git a/app/test-compress-perf/comp_perf_options_parse.c b/app/test-compress-perf/comp_perf_options_parse.c index 3d820197a0..01e19eafb0 100644 --- a/app/test-compress-perf/comp_perf_options_parse.c +++ b/app/test-compress-perf/comp_perf_options_parse.c @@ -99,7 +99,7 @@ parse_cperf_test_type(struct comp_test_data *test_data, const char *arg) return -1; } - test_data->test = (enum cperf_perf_test_type)id; + test_data->test = (enum cperf_test_type)id; return 0; } @@ -614,8 +614,8 @@ comp_perf_options_default(struct comp_test_data *test_data) test_data->huffman_enc = RTE_COMP_HUFFMAN_DYNAMIC; test_data->test_op = COMPRESS_DECOMPRESS; test_data->window_sz = -1; - test_data->level_lst.min = 1; - test_data->level_lst.max = 9; + test_data->level_lst.min = RTE_COMP_LEVEL_MIN; + test_data->level_lst.max = RTE_COMP_LEVEL_MAX; test_data->level_lst.inc = 1; test_data->test = CPERF_TEST_TYPE_BENCHMARK; } diff --git a/app/test-compress-perf/comp_perf_test_common.c b/app/test-compress-perf/comp_perf_test_common.c index dc9d0b0f49..472c766867 100644 --- a/app/test-compress-perf/comp_perf_test_common.c +++ b/app/test-compress-perf/comp_perf_test_common.c @@ -7,11 +7,12 @@ #include #include +#include "comp_perf.h" #include "comp_perf_options.h" -#include "comp_perf_test_verify.h" #include "comp_perf_test_benchmark.h" -#include "comp_perf.h" #include "comp_perf_test_common.h" +#include "comp_perf_test_verify.h" + #define DIV_CEIL(a, b) ((a) / (b) + ((a) % (b) != 0)) @@ -49,7 +50,7 @@ find_buf_size(uint32_t input_size) * power of 2 but also should be enough to store incompressible data */ - /* We're looking for nearest power of 2 buffer size, which is greather + /* We're looking for nearest power of 2 buffer size, which is greater * than input_size */ uint32_t size = -- 2.20.1