[24.03 RFC 2/3] eal: allow export of the cmdline argument parsing options
Bruce Richardson
bruce.richardson at intel.com
Thu Nov 2 18:28:48 CET 2023
Allow other libraries in DPDK to know about the options EAL takes, by
exporting the long and short getopt options via an internal-only
function.
Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
---
lib/eal/common/eal_common_options.c | 9 +++++++++
lib/eal/include/rte_eal.h | 14 ++++++++++++++
lib/eal/version.map | 1 +
3 files changed, 24 insertions(+)
diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c
index a6d21f1cba..e26f66ea07 100644
--- a/lib/eal/common/eal_common_options.c
+++ b/lib/eal/common/eal_common_options.c
@@ -175,6 +175,15 @@ rte_set_application_usage_hook(rte_usage_hook_t usage_func)
return old_func;
}
+__rte_internal
+int
+rte_eal_getopt_params(const char **shortopts, const struct option **longopts)
+{
+ *shortopts = eal_short_options;
+ *longopts = eal_long_options;
+ return 0;
+}
+
#ifndef RTE_EXEC_ENV_WINDOWS
static char **eal_args;
static char **eal_app_args;
diff --git a/lib/eal/include/rte_eal.h b/lib/eal/include/rte_eal.h
index cd318ee141..3bc5447abf 100644
--- a/lib/eal/include/rte_eal.h
+++ b/lib/eal/include/rte_eal.h
@@ -514,6 +514,20 @@ __rte_internal
int
rte_eal_parse_coremask(const char *coremask, int *cores);
+struct option;
+/**
+ * @internal
+ * Return the getopt parameters used by EAL when parsing cmdline arguments
+ *
+ * @shortopts
+ * Pointer for the short options for getopt
+ * @longopts
+ * Pointer for the longer options used by getopt_long
+ */
+__rte_internal
+int
+rte_eal_getopt_params(const char **shortopts, const struct option **longopts);
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/eal/version.map b/lib/eal/version.map
index e00a844805..6c0a7145ff 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -421,6 +421,7 @@ INTERNAL {
rte_bus_register;
rte_bus_unregister;
rte_eal_get_baseaddr;
+ rte_eal_getopt_params;
rte_eal_parse_coremask;
rte_firmware_read;
rte_intr_allow_others;
--
2.39.2
More information about the dev
mailing list