1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2018 Intel Corporation.
10 #include <rte_option.h>
12 #include "eal_private.h"
13 #include "eal_internal_cfg.h" /* Necessary for eal_options.h */
14 #include "eal_options.h"
16 TAILQ_HEAD(rte_option_list, rte_option);
18 struct rte_option_list rte_option_list =
19 TAILQ_HEAD_INITIALIZER(rte_option_list);
22 rte_option_parse(const char *opt)
24 struct rte_option *option;
26 if (strlen(opt) <= 2 ||
27 strncmp(opt, "--", 2))
30 /* Check if the option is registered */
31 TAILQ_FOREACH(option, &rte_option_list, next) {
32 if (strcmp(&opt[2], option->name) == 0) {
41 void __rte_experimental
42 rte_option_register(struct rte_option *opt)
44 struct rte_option *option;
45 const struct option *gopt;
47 gopt = &eal_long_options[0];
48 while (gopt->name != NULL) {
49 if (strcmp(gopt->name, opt->name) == 0) {
50 RTE_LOG(ERR, EAL, "Option %s is already a common EAL option.\n",
57 TAILQ_FOREACH(option, &rte_option_list, next) {
58 if (strcmp(opt->name, option->name) == 0) {
59 RTE_LOG(ERR, EAL, "Option %s has already been registered.\n",
65 TAILQ_INSERT_HEAD(&rte_option_list, opt, next);
71 struct rte_option *option;
73 TAILQ_FOREACH(option, &rte_option_list, next) {
80 rte_option_usage(void)
82 struct rte_option *option;
85 TAILQ_FOREACH(option, &rte_option_list, next)
90 printf("EAL dynamic options:\n");
91 TAILQ_FOREACH(option, &rte_option_list, next)
92 printf(" --%-*s %s\n", 17, option->name, option->usage);