* [spp] [PATCH 1/2] shared/sec: change name of struct cmd_response
2019-06-24 7:10 [spp] [PATCH 0/2] Rename struct cmd_response yasufum.o
@ 2019-06-24 7:10 ` yasufum.o
2019-06-24 7:10 ` [spp] [PATCH 2/2] spp_pcap: " yasufum.o
1 sibling, 0 replies; 3+ messages in thread
From: yasufum.o @ 2019-06-24 7:10 UTC (permalink / raw)
To: spp, ferruh.yigit, yasufum.o
From: Yasufumi Ogawa <yasufum.o@gmail.com>
This update is to rename struct `cmd_response` to
`cmd_res_formatter_ops` because it is a set of tag and operation
function for parsing command.
Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
.../secondary/spp_worker_th/cmd_res_formatter.c | 13 ++++++-------
.../secondary/spp_worker_th/cmd_res_formatter.h | 11 +++++------
2 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/src/shared/secondary/spp_worker_th/cmd_res_formatter.c b/src/shared/secondary/spp_worker_th/cmd_res_formatter.c
index e4912d6..8d64c21 100644
--- a/src/shared/secondary/spp_worker_th/cmd_res_formatter.c
+++ b/src/shared/secondary/spp_worker_th/cmd_res_formatter.c
@@ -49,7 +49,7 @@ const char *PORT_ABILITY_STAT_LIST[] = {
};
/* command response result string list */
-struct cmd_response response_result_list[] = {
+struct cmd_res_formatter_ops response_result_list[] = {
{ "result", append_result_value },
{ "error_details", append_error_details_value },
{ "", NULL }
@@ -67,7 +67,7 @@ struct cmd_response response_result_list[] = {
* "core": 2,
* ...
*/
-struct cmd_response response_info_list[] = {
+struct cmd_res_formatter_ops response_info_list[] = {
{ "client-id", add_client_id },
{ "phy", add_interface },
{ "vhost", add_interface },
@@ -392,8 +392,8 @@ append_core_element_value(
/* append string of command response list for JSON format */
int
-append_response_list_value(char **output, struct cmd_response *responses,
- void *tmp)
+append_response_list_value(char **output,
+ struct cmd_res_formatter_ops *responses, void *tmp)
{
int ret = SPP_RET_NG;
int i;
@@ -559,8 +559,8 @@ wk_get_client_id(void)
/**
* Operator functions start with prefix `add_` defined in `response_info_list`
- * of struct `cmd_response` which are for making each of parts of command
- * response.
+ * of struct `cmd_res_formatter_ops` which are for making each of parts of
+ * command response.
*/
/* Add entry of client ID such as `"client-id": 1` to a response in JSON. */
@@ -614,4 +614,3 @@ add_master_lcore(const char *name, char **output,
ret = append_json_int_value(output, name, rte_get_master_lcore());
return ret;
}
-
diff --git a/src/shared/secondary/spp_worker_th/cmd_res_formatter.h b/src/shared/secondary/spp_worker_th/cmd_res_formatter.h
index 6ae2c5d..b1de209 100644
--- a/src/shared/secondary/spp_worker_th/cmd_res_formatter.h
+++ b/src/shared/secondary/spp_worker_th/cmd_res_formatter.h
@@ -26,8 +26,7 @@ struct cmd_result {
* Contains command response and operator func for. It is used as an array of
* this struct.
*/
-/* TODO(yasufum) add comment describes the purpose of this struct is used. */
-struct cmd_response {
+struct cmd_res_formatter_ops {
char tag_name[CMD_RES_TAG_LEN];
int (*func)(const char *name, char **output, void *tmp);
};
@@ -56,8 +55,8 @@ int append_core_element_value(struct spp_iterate_core_params *params,
const int num_rx, const struct sppwk_port_idx *rx_ports,
const int num_tx, const struct sppwk_port_idx *tx_ports);
-int append_response_list_value(char **output, struct cmd_response *responses,
- void *tmp);
+int append_response_list_value(char **output,
+ struct cmd_res_formatter_ops *responses, void *tmp);
int append_command_results_value(const char *name, char **output,
int num, struct cmd_result *results);
@@ -66,8 +65,8 @@ int append_info_value(const char *name, char **output);
/**
* Operator functions start with prefix `add_` defined in `response_info_list`
- * of struct `cmd_response` which are for making each of parts of command
- * response.
+ * of struct `cmd_res_formatter_ops` which are for making each of parts of
+ * command response.
*/
int add_client_id(const char *name, char **output,
void *tmp __attribute__ ((unused)));
--
2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [spp] [PATCH 2/2] spp_pcap: change name of struct cmd_response
2019-06-24 7:10 [spp] [PATCH 0/2] Rename struct cmd_response yasufum.o
2019-06-24 7:10 ` [spp] [PATCH 1/2] shared/sec: change name of " yasufum.o
@ 2019-06-24 7:10 ` yasufum.o
1 sibling, 0 replies; 3+ messages in thread
From: yasufum.o @ 2019-06-24 7:10 UTC (permalink / raw)
To: spp, ferruh.yigit, yasufum.o
From: Yasufumi Ogawa <yasufum.o@gmail.com>
This update is to rename struct `cmd_response` to
`cmd_res_formatter_ops` because it is a set of tag and operation
function for parsing command.
Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
src/pcap/cmd_runner.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/pcap/cmd_runner.c b/src/pcap/cmd_runner.c
index 55f15bf..4a74af2 100644
--- a/src/pcap/cmd_runner.c
+++ b/src/pcap/cmd_runner.c
@@ -47,7 +47,7 @@ struct cmd_result {
/* command response list control structure */
/* TODO(yasufum) merge it to the same definition in shared/.../cmd_runner.c */
-struct cmd_response {
+struct cmd_res_formatter_ops {
char tag_name[SPPWK_NAME_BUFSZ]; /* JSON Tag name */
int (*func)(const char *name, char **output, void *tmp);
};
@@ -548,7 +548,7 @@ append_core_value(const char *name, char **output,
/* append string of command response list for JSON format */
static int
append_response_list_value(char **output,
- struct cmd_response *list,
+ struct cmd_res_formatter_ops *list,
void *tmp)
{
int ret = SPPWK_RET_NG;
@@ -607,14 +607,14 @@ append_response_list_value(char **output,
#define COMMAND_RESP_TAG_LIST_EMPTY { "", NULL }
/* command response result string list */
-struct cmd_response response_result_list[] = {
+struct cmd_res_formatter_ops response_result_list[] = {
{ "result", append_result_value },
{ "error_details", append_error_details_value },
COMMAND_RESP_TAG_LIST_EMPTY
};
/* command response status information string list */
-struct cmd_response response_info_list[] = {
+struct cmd_res_formatter_ops response_info_list[] = {
{ "client-id", append_client_id_value },
{ "status", append_capture_status_value },
{ "master-lcore", append_master_lcore_value },
--
2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread