From patchwork Thu Mar 2 07:48:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fengchengwen X-Patchwork-Id: 124665 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 F0C2F41DB5; Thu, 2 Mar 2023 08:54:48 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 928CE40E09; Thu, 2 Mar 2023 08:54:48 +0100 (CET) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id 32BB340DFB for ; Thu, 2 Mar 2023 08:54:46 +0100 (CET) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4PS3GW60Htz16P4F; Thu, 2 Mar 2023 15:52:03 +0800 (CST) Received: from localhost.localdomain (10.50.163.32) by dggpeml500024.china.huawei.com (7.185.36.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Thu, 2 Mar 2023 15:54:43 +0800 From: Chengwen Feng To: , CC: Subject: [PATCH 1/9] kvargs: detailed definition of callback prototype Date: Thu, 2 Mar 2023 07:48:17 +0000 Message-ID: <20230302074825.31947-2-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230302074825.31947-1-fengchengwen@huawei.com> References: <20230302074825.31947-1-fengchengwen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.50.163.32] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml500024.china.huawei.com (7.185.36.10) X-CFilter-Loop: Reflected 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 The rte_kvargs_process() was used to parse KV pairs, it also supports to parse 'only keys' (e.g. socket_id) type. And the callback function (which prototype is arg_handler_t) parameter 'value' is NULL when parsed 'only keys'. But where there is no detailed definition of 'value' maybe NULL, so this patch adds it. Cc: stable@dpdk.org Signed-off-by: Chengwen Feng --- lib/kvargs/rte_kvargs.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/kvargs/rte_kvargs.h b/lib/kvargs/rte_kvargs.h index 359a9f5b09..4900b750bc 100644 --- a/lib/kvargs/rte_kvargs.h +++ b/lib/kvargs/rte_kvargs.h @@ -36,7 +36,19 @@ extern "C" { /** separator character used between key and value */ #define RTE_KVARGS_KV_DELIM "=" -/** Type of callback function used by rte_kvargs_process() */ +/** + * Callback prototype used by rte_kvargs_process(). + * + * @param key + * The key to consider, it will not be NULL. + * @param value + * The value corresponding to the key, it may be NULL (e.g. only with key) + * @param opaque + * An opaque pointer coming from the caller. + * @return + * - >=0 handle key success. + * - <0 on error. + */ typedef int (*arg_handler_t)(const char *key, const char *value, void *opaque); /** A key/value association */