20 Star 0 Fork 76

openEuler-RISC-V/dpdk

forked from src-openEuler/dpdk 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0189-telemetry-make-help-command-more-helpful.patch 1.83 KB
一键复制 编辑 原始数据 按行查看 历史
From 2674bf9f28b9dd7724d72096a8e54b19400239bd Mon Sep 17 00:00:00 2001
From: Bruce Richardson <[email protected]>
Date: Fri, 21 Oct 2022 15:37:05 +0800
Subject: [PATCH 189/189] telemetry: make help command more helpful
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The /help telemetry command prints out the help text for the given
command passed in as parameter. However, entering /help without any
parameters does not give any useful information as to the fact that you
need to pass in a command to get help on. Update the command so it
prints its own help text when called without any parameters.
Signed-off-by: Bruce Richardson <[email protected]>
Acked-by: Ciara Power <[email protected]>
Acked-by: Morten Brørup <[email protected]>
Acked-by: Chengwen Feng <[email protected]>
---
lib/telemetry/telemetry.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c
index 25ab6ed877..52048de55c 100644
--- a/lib/telemetry/telemetry.c
+++ b/lib/telemetry/telemetry.c
@@ -141,15 +141,17 @@ command_help(const char *cmd __rte_unused, const char *params,
struct rte_tel_data *d)
{
int i;
+ /* if no parameters return our own help text */
+ const char *to_lookup = (params == NULL ? cmd : params);
- if (!params)
- return -1;
rte_tel_data_start_dict(d);
rte_spinlock_lock(&callback_sl);
for (i = 0; i < num_callbacks; i++)
- if (strcmp(params, callbacks[i].cmd) == 0) {
- rte_tel_data_add_dict_string(d, params,
- callbacks[i].help);
+ if (strcmp(to_lookup, callbacks[i].cmd) == 0) {
+ if (params == NULL)
+ rte_tel_data_string(d, callbacks[i].help);
+ else
+ rte_tel_data_add_dict_string(d, params, callbacks[i].help);
break;
}
rte_spinlock_unlock(&callback_sl);
--
2.23.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/openeuler-risc-v/dpdk.git
[email protected]:openeuler-risc-v/dpdk.git
openeuler-risc-v
dpdk
dpdk
master

搜索帮助