Soft Patch Panel
 help / color / Atom feed
From: ogawa.yasufumi@lab.ntt.co.jp
To: spp@dpdk.org, ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp
Subject: [spp] [PATCH 02/10] spp_pcap: rename struct spp_command
Date: Fri, 31 May 2019 17:52:34 +0900
Message-ID: <1559292762-27042-3-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> (raw)
In-Reply-To: <1559292762-27042-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp>

From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>

Rename struct `spp_command` to `pcap_cmd_attr` because it is not a
command, but a set of attributes actually.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
 src/pcap/cmd_parser.c | 7 ++++---
 src/pcap/cmd_parser.h | 7 +++----
 src/pcap/cmd_runner.c | 4 ++--
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/pcap/cmd_parser.c b/src/pcap/cmd_parser.c
index 946300e..1624347 100644
--- a/src/pcap/cmd_parser.c
+++ b/src/pcap/cmd_parser.c
@@ -13,7 +13,8 @@
 
 #define RTE_LOGTYPE_PCAP_PARSER RTE_LOGTYPE_USER2
 
-/* set parse error */
+/* Format error message object and return error code for an error case. */
+/* TODO(yasufum) merge it to the same definition in shared/.../cmd_parser.c */
 static inline int
 set_parse_error(struct sppwk_parse_err_msg *wk_err_msg,
 		const int err_code, const char *err_msg)
@@ -118,7 +119,7 @@ parse_command_in_list(struct spp_command_request *request,
 			continue;
 		}
 
-		request->commands[0].type = command_list_pcap[i].type;
+		request->cmd_attrs[0].type = command_list_pcap[i].type;
 		if (list->func != NULL)
 			return (*list->func)(request, argc, argv, wk_err_msg,
 							list->param_max);
@@ -163,7 +164,7 @@ spp_command_parse_request(
 
 	/* check getter command */
 	for (i = 0; i < request->num_valid_command; ++i) {
-		switch (request->commands[i].type) {
+		switch (request->cmd_attrs[i].type) {
 		case PCAP_CMDTYPE_CLIENT_ID:
 			request->is_requested_client_id = 1;
 			break;
diff --git a/src/pcap/cmd_parser.h b/src/pcap/cmd_parser.h
index fd110cb..706144d 100644
--- a/src/pcap/cmd_parser.h
+++ b/src/pcap/cmd_parser.h
@@ -51,16 +51,15 @@ enum pcap_cmd_type {
 	PCAP_CMDTYPE_STOP,  /**< port */
 };
 
-/** command parameters */
-struct spp_command {
-	enum pcap_cmd_type type; /**< Command type */
+struct pcap_cmd_attr {
+	enum pcap_cmd_type type;
 };
 
 /** request parameters */
 struct spp_command_request {
 	int num_command;                /**< Number of accepted commands */
 	int num_valid_command;          /**< Number of executed commands */
-	struct spp_command commands[SPPWK_MAX_CMDS];
+	struct pcap_cmd_attr cmd_attrs[SPPWK_MAX_CMDS];
 					/**<Information of executed commands */
 
 	int is_requested_client_id;     /**< Id for get_client_id command */
diff --git a/src/pcap/cmd_runner.c b/src/pcap/cmd_runner.c
index c83006f..9e4f4cf 100644
--- a/src/pcap/cmd_runner.c
+++ b/src/pcap/cmd_runner.c
@@ -236,7 +236,7 @@ append_json_block_brackets(const char *name, char **output, const char *str)
 /* TODO(yasufum) confirm why this function does nothing is needed. */
 /* execute one command */
 static int
-execute_command(const struct spp_command *command)
+execute_command(const struct pcap_cmd_attr *command)
 {
 	int ret = SPPWK_RET_OK;
 
@@ -892,7 +892,7 @@ process_request(int *sock, const char *request_str, size_t request_str_len)
 
 	/* execute commands */
 	for (i = 0; i < request.num_command ; ++i) {
-		ret = execute_command(request.commands + i);
+		ret = execute_command(request.cmd_attrs + i);
 		if (unlikely(ret != SPPWK_RET_OK)) {
 			set_command_results(&command_results[i], CMD_FAILURE,
 					"error occur");
-- 
2.17.1


  parent reply index

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-31  8:52 [spp] [PATCH 00/10] Refactor cmd parser in spp_pcap ogawa.yasufumi
2019-05-31  8:52 ` [spp] [PATCH 01/10] spp_pcap: rename enum spp_command_type ogawa.yasufumi
2019-05-31  8:52 ` ogawa.yasufumi [this message]
2019-05-31  8:52 ` [spp] [PATCH 03/10] spp_pcap: revise command response codes ogawa.yasufumi
2019-05-31  8:52 ` [spp] [PATCH 04/10] spp_pcap: revise parser functions ogawa.yasufumi
2019-05-31  8:52 ` [spp] [PATCH 05/10] spp_pcap: refactor func for splitting cmd tokens ogawa.yasufumi
2019-05-31  8:52 ` [spp] [PATCH 06/10] spp_pcap: revise log msgs in parser func ogawa.yasufumi
2019-05-31  8:52 ` [spp] [PATCH 07/10] spp_pcap: remove unused string list ogawa.yasufumi
2019-05-31  8:52 ` [spp] [PATCH 08/10] spp_pcap: refactor comments of spp_pcap ogawa.yasufumi
2019-05-31  8:52 ` [spp] [PATCH 09/10] spp_pcap: rename spp_get_core_status ogawa.yasufumi
2019-05-31  8:52 ` [spp] [PATCH 10/10] spp_pcap: revise name of vars for parser error ogawa.yasufumi

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1559292762-27042-3-git-send-email-ogawa.yasufumi@lab.ntt.co.jp \
    --to=ogawa.yasufumi@lab.ntt.co.jp \
    --cc=ferruh.yigit@intel.com \
    --cc=spp@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Soft Patch Panel

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/spp/0 spp/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 spp spp/ http://inbox.dpdk.org/spp \
		spp@dpdk.org
	public-inbox-index spp


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.spp


AGPL code for this site: git clone https://public-inbox.org/ public-inbox