eal: rename option name field
[dpdk.git] / lib / librte_eal / common / include / rte_option.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2018 Intel Corporation.
3  */
4
5 #ifndef __INCLUDE_RTE_OPTION_H__
6 #define __INCLUDE_RTE_OPTION_H__
7
8 /**
9  * @file
10  *
11  * This API offers the ability to register options to the EAL command line and
12  * map those options to functions that will be executed at the end of EAL
13  * initialization. These options will be available as part of the EAL command
14  * line of applications and are dynamically managed.
15  *
16  * This is used primarily by DPDK libraries offering command line options.
17  * Currently, this API is limited to registering options without argument.
18  *
19  * The register API can be used to resolve circular dependency issues
20  * between EAL and the library. The library uses EAL, but is also initialized
21  * by EAL. Hence, EAL depends on the init function of the library. The API
22  * introduced in rte_option allows us to register the library init with EAL
23  * (passing a function pointer) and avoid the circular dependency.
24  */
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 typedef int (*rte_option_cb)(void);
31
32 /*
33  * Structure describing the EAL command line option being registered.
34  */
35 struct rte_option {
36         TAILQ_ENTRY(rte_option) next; /**< Next entry in the list. */
37         const char *name; /**< The option name. */
38         const char *usage; /**< Option summary string. */
39         rte_option_cb cb;          /**< Function called when option is used. */
40         int enabled;               /**< Set when the option is used. */
41 };
42
43 /**
44  * @warning
45  * @b EXPERIMENTAL: this API may change without prior notice
46  *
47  * Register an option to the EAL command line.
48  * When recognized, the associated function will be executed at the end of EAL
49  * initialization.
50  *
51  * The associated structure must be available the whole time this option is
52  * registered (i.e. not stack memory).
53  *
54  * @param opt
55  *  Structure describing the option to parse.
56  */
57 void __rte_experimental
58 rte_option_register(struct rte_option *opt);
59
60 #ifdef __cplusplus
61 }
62 #endif
63
64 #endif