@@ -1640,9 +1640,20 @@ eal_parse_huge_unlink(const char *arg, struct hugepage_file_discipline *out)
return -1;
}
-/* Parse the arguments for --log-level only */
+bool
+eal_option_is_log(int opt)
+{
+ switch (opt) {
+ case OPT_LOG_LEVEL_NUM:
+ return true;
+ default:
+ return false;
+ }
+}
+
+/* Parse all arguments looking for log related ones */
int
-eal_log_level_parse(int argc, char * const argv[])
+eal_parse_log_options(int argc, char * const argv[])
{
struct internal_config *internal_conf = eal_get_internal_configuration();
int option_index, opt;
@@ -1661,12 +1672,11 @@ eal_log_level_parse(int argc, char * const argv[])
while ((opt = getopt_long(argc, argv, eal_short_options,
eal_long_options, &option_index)) != EOF) {
- switch (opt) {
- case OPT_LOG_LEVEL_NUM:
- if (eal_parse_common_option(opt, optarg, internal_conf) < 0)
- return -1;
- break;
- }
+ if (!eal_option_is_log(opt))
+ continue;
+
+ if (eal_parse_common_option(opt, optarg, internal_conf) < 0)
+ return -1;
}
/* restore getopt lib */
@@ -96,7 +96,8 @@ enum {
extern const char eal_short_options[];
extern const struct option eal_long_options[];
-int eal_log_level_parse(int argc, char * const argv[]);
+bool eal_option_is_log(int opt);
+int eal_parse_log_options(int argc, char * const argv[]);
int eal_parse_common_option(int opt, const char *argv,
struct internal_config *conf);
int eal_option_device_parse(void);
@@ -392,8 +392,8 @@ eal_parse_args(int argc, char **argv)
goto out;
}
- /* eal_log_level_parse() already handled this option */
- if (opt == OPT_LOG_LEVEL_NUM)
+ /* eal_parse_log_options() already handled this option */
+ if (eal_option_is_log(opt))
continue;
ret = eal_parse_common_option(opt, optarg, internal_conf);
@@ -574,8 +574,8 @@ rte_eal_init(int argc, char **argv)
/* clone argv to report out later in telemetry */
eal_save_args(argc, argv);
- /* set log level as early as possible */
- eal_log_level_parse(argc, argv);
+ /* parse log options as early as possible */
+ eal_parse_log_options(argc, argv);
if (rte_eal_cpu_init() < 0) {
rte_eal_init_alert("Cannot detect lcores.");
@@ -610,8 +610,8 @@ eal_parse_args(int argc, char **argv)
goto out;
}
- /* eal_log_level_parse() already handled this option */
- if (opt == OPT_LOG_LEVEL_NUM)
+ /* eal_parse_log_options() already handled this option */
+ if (eal_option_is_log(opt))
continue;
ret = eal_parse_common_option(opt, optarg, internal_conf);
@@ -950,8 +950,8 @@ rte_eal_init(int argc, char **argv)
eal_reset_internal_config(internal_conf);
- /* set log level as early as possible */
- eal_log_level_parse(argc, argv);
+ /* parse log options as early as possible */
+ eal_parse_log_options(argc, argv);
/* clone argv to report out later in telemetry */
eal_save_args(argc, argv);
@@ -120,8 +120,8 @@ eal_parse_args(int argc, char **argv)
return -1;
}
- /* eal_log_level_parse() already handled this option */
- if (opt == OPT_LOG_LEVEL_NUM)
+ /* eal_parse_log_options() already handled this option */
+ if (eal_option_is_log(opt))
continue;
ret = eal_parse_common_option(opt, optarg, internal_conf);
@@ -252,7 +252,8 @@ rte_eal_init(int argc, char **argv)
eal_log_init(NULL, 0);
- eal_log_level_parse(argc, argv);
+ /* parse log options as early as possible */
+ eal_parse_log_options(argc, argv);
if (eal_create_cpu_map() < 0) {
rte_eal_init_alert("Cannot discover CPU and NUMA.");