From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 85AFC41DB5; Thu, 2 Mar 2023 08:56:49 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 16F7A42D10; Thu, 2 Mar 2023 08:56:37 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 3BDA141156 for ; Thu, 2 Mar 2023 08:56:32 +0100 (CET) Received: from dggpeml500024.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4PS3KL4D6Xz9tJF; Thu, 2 Mar 2023 15:54:30 +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:56:30 +0800 From: Chengwen Feng To: , , Olivier Matz CC: Subject: [PATCH 1/9] kvargs: detailed definition of callback prototype Date: Thu, 2 Mar 2023 07:50:04 +0000 Message-ID: <20230302075012.32423-2-fengchengwen@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230302075012.32423-1-fengchengwen@huawei.com> References: <20230302075012.32423-1-fengchengwen@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.50.163.32] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) 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 */ -- 2.17.1