From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>
Subject: [24.03 RFC 2/3] eal: allow export of the cmdline argument parsing options
Date: Thu, 2 Nov 2023 17:28:48 +0000 [thread overview]
Message-ID: <20231102172849.7400-3-bruce.richardson@intel.com> (raw)
In-Reply-To: <20231102172849.7400-1-bruce.richardson@intel.com>
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@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
next prev parent reply other threads:[~2023-11-02 17:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-02 17:28 [24.03 RFC 0/3] Add argument manipulation library Bruce Richardson
2023-11-02 17:28 ` [24.03 RFC 1/3] args: new library to allow easier manipulation of cmdline args Bruce Richardson
2024-01-24 12:03 ` Thomas Monjalon
2024-01-24 13:57 ` Honnappa Nagarahalli
2023-11-02 17:28 ` Bruce Richardson [this message]
2023-11-02 17:28 ` [24.03 RFC 3/3] args: add functions to check parameter validity Bruce Richardson
2024-01-24 11:53 ` Thomas Monjalon
2023-11-02 17:50 ` [24.03 RFC 0/3] Add argument manipulation library Stephen Hemminger
2023-11-02 18:12 ` Bruce Richardson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231102172849.7400-3-bruce.richardson@intel.com \
--to=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.