Add a usage string field in rte_option, allowing to display
help to the user and describe which options are currently available.
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
" --"OPT_NO_HPET" Disable HPET\n"
" --"OPT_NO_SHCONF" No shared config (mmap'd files)\n"
"\n", RTE_MAX_LCORE);
+ rte_option_usage();
}
void
rte_option_init(void);
+/**
+ * Iterate through the registered options and show the associated
+ * usage string.
+ */
+void
+rte_option_usage(void);
+
#endif /* _EAL_PRIVATE_H_ */
struct rte_option {
TAILQ_ENTRY(rte_option) next; /**< Next entry in the list. */
char *opt_str; /**< The option name. */
+ const char *usage; /**< Option summary string. */
rte_option_cb cb; /**< Function called when option is used. */
int enabled; /**< Set when the option is used. */
};
option->cb();
}
}
+
+void
+rte_option_usage(void)
+{
+ struct rte_option *option;
+ int opt_count = 0;
+
+ TAILQ_FOREACH(option, &rte_option_list, next)
+ opt_count += 1;
+ if (opt_count == 0)
+ return;
+
+ printf("EAL dynamic options:\n");
+ TAILQ_FOREACH(option, &rte_option_list, next)
+ printf(" --%-*s %s\n", 17, option->opt_str, option->usage);
+ printf("\n");
+}
static struct rte_option option = {
.opt_str = "telemetry",
+ .usage = "Enable telemetry backend",
.cb = &rte_telemetry_init,
.enabled = 0
};