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) {
43 rte_option_register(struct rte_option *opt)
45 struct rte_option *option;
46 const struct option *gopt;
48 gopt = &eal_long_options[0];
49 while (gopt->name != NULL) {
50 if (strcmp(gopt->name, opt->name) == 0) {
51 RTE_LOG(ERR, EAL, "Option %s is already a common EAL option.\n",
58 TAILQ_FOREACH(option, &rte_option_list, next) {
59 if (strcmp(opt->name, option->name) == 0) {
60 RTE_LOG(ERR, EAL, "Option %s has already been registered.\n",
66 TAILQ_INSERT_HEAD(&rte_option_list, opt, next);
73 struct rte_option *option;
75 TAILQ_FOREACH(option, &rte_option_list, next) {
82 rte_option_usage(void)
84 struct rte_option *option;
87 TAILQ_FOREACH(option, &rte_option_list, next)
92 printf("EAL dynamic options:\n");
93 TAILQ_FOREACH(option, &rte_option_list, next)
94 printf(" --%-*s %s\n", 17, option->name, option->usage);