From patchwork Thu Nov 2 17:28:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bruce Richardson X-Patchwork-Id: 133788 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 30DB843270; Thu, 2 Nov 2023 18:33:08 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0140242D35; Thu, 2 Nov 2023 18:32:57 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by mails.dpdk.org (Postfix) with ESMTP id 7409642D78 for ; Thu, 2 Nov 2023 18:32:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698946376; x=1730482376; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MPUtgZ9ZahngBU8EdpLn+V8ammi2KYwVQKaOmX9LF7A=; b=gFOoj225HCp53Zg7uKzXwBbaj4TLCGHMK/5dYiNtrL7K7ou3FmgLK+Y6 xrLNFIDKeOR0vP8cPJYRpEFRtakRRvOylntCjPaRSTq552ScjBvv9pOYC +jjrPVxkJ2Woa2zb8v4EZo/5Gz77TIRnAVkPCzvyaaX63GHm5gzBKLdXc ttywNTirirkaGwrB42vE74J7TekFSlapthNX+hxml4rGOVyXllkChkvpn IBwqfcVWlWi4BgqdvTwn/iaSgZLmQeJUkMRWn2hB+d7mbrLuUaSlTxIYV AA4Mkb464J+mn7jGvunMEZ9foKU9fqbnKGMdBhleMROwk/KcyUA0Hr1ql g==; X-IronPort-AV: E=McAfee;i="6600,9927,10882"; a="1645212" X-IronPort-AV: E=Sophos;i="6.03,272,1694761200"; d="scan'208";a="1645212" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Nov 2023 10:29:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10882"; a="878330507" X-IronPort-AV: E=Sophos;i="6.03,272,1694761200"; d="scan'208";a="878330507" Received: from silpixa00401385.ir.intel.com ([10.237.214.164]) by fmsmga002.fm.intel.com with ESMTP; 02 Nov 2023 10:29:05 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Subject: [24.03 RFC 2/3] eal: allow export of the cmdline argument parsing options Date: Thu, 2 Nov 2023 17:28:48 +0000 Message-Id: <20231102172849.7400-3-bruce.richardson@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231102172849.7400-1-bruce.richardson@intel.com> References: <20231102172849.7400-1-bruce.richardson@intel.com> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- 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;