Soft Patch Panel
 help / color / Atom feed
* [spp] [PATCH 0/2] Rename functions for parsing error messages
@ 2019-05-31  3:35 ogawa.yasufumi
  2019-05-31  3:35 ` [spp] [PATCH 1/2] shared/sec: rename func for getting parse err msg ogawa.yasufumi
  2019-05-31  3:35 ` [spp] [PATCH 2/2] shared/sec: rename func for setup " ogawa.yasufumi
  0 siblings, 2 replies; 3+ messages in thread
From: ogawa.yasufumi @ 2019-05-31  3:35 UTC (permalink / raw)
  To: spp, ferruh.yigit, ogawa.yasufumi

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

* Rename for getting error message from its object is
  make_decode_error_message() to `get_parse_err_msg()` simply.

* Rename `set_decode_error_to_result()` for setting up an error message
  to `prepare_parse_err_msg()`.

Yasufumi Ogawa (2):
  shared/sec: rename func for getting parse err msg
  shared/sec: rename func for setup err msg

 .../secondary/spp_worker_th/command_proc.c    | 35 +++++++++----------
 1 file changed, 17 insertions(+), 18 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [spp] [PATCH 1/2] shared/sec: rename func for getting parse err msg
  2019-05-31  3:35 [spp] [PATCH 0/2] Rename functions for parsing error messages ogawa.yasufumi
@ 2019-05-31  3:35 ` ogawa.yasufumi
  2019-05-31  3:35 ` [spp] [PATCH 2/2] shared/sec: rename func for setup " ogawa.yasufumi
  1 sibling, 0 replies; 3+ messages in thread
From: ogawa.yasufumi @ 2019-05-31  3:35 UTC (permalink / raw)
  To: spp, ferruh.yigit, ogawa.yasufumi

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

The name of function for getting error message from its object is
`make_decode_error_message()`, but it is not describing this feature.
This update is to rename the function to `get_parse_err_msg()` simply.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
 .../secondary/spp_worker_th/command_proc.c    | 25 +++++++++----------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/src/shared/secondary/spp_worker_th/command_proc.c b/src/shared/secondary/spp_worker_th/command_proc.c
index 17d0645..fae9aab 100644
--- a/src/shared/secondary/spp_worker_th/command_proc.c
+++ b/src/shared/secondary/spp_worker_th/command_proc.c
@@ -801,34 +801,34 @@ execute_command(const struct spp_command *command)
 	return ret;
 }
 
-/* Fill err_msg obj with given error message. */
+/* Get error message of parsing from given wk_err_msg object. */
 static const char *
-make_decode_error_message(
-		const struct sppwk_parse_err_msg *err_msg,
+get_parse_err_msg(
+		const struct sppwk_parse_err_msg *wk_err_msg,
 		char *message)
 {
-	switch (err_msg->code) {
+	switch (wk_err_msg->code) {
 	case SPPWK_PARSE_WRONG_FORMAT:
 		sprintf(message, "Wrong message format");
 		break;
 
 	case SPPWK_PARSE_UNKNOWN_CMD:
 		/* TODO(yasufum) Fix compile err if space exists before "(" */
-		sprintf(message, "Unknown command(%s)", err_msg->details);
+		sprintf(message, "Unknown command(%s)", wk_err_msg->details);
 		break;
 
 	case SPPWK_PARSE_NO_PARAM:
 		sprintf(message, "No or insufficient number of params (%s)",
-				err_msg->msg);
+				wk_err_msg->msg);
 		break;
 
 	case SPPWK_PARSE_INVALID_TYPE:
 		sprintf(message, "Invalid value type (%s)",
-				err_msg->msg);
+				wk_err_msg->msg);
 		break;
 
 	case SPPWK_PARSE_INVALID_VALUE:
-		sprintf(message, "Invalid value (%s)", err_msg->msg);
+		sprintf(message, "Invalid value (%s)", wk_err_msg->msg);
 		break;
 
 	default:
@@ -866,22 +866,21 @@ set_command_results(struct command_result *result,
 static void
 set_decode_error_to_results(struct command_result *results,
 		const struct sppwk_cmd_req *request,
-		const struct sppwk_parse_err_msg *err_msg)
+		const struct sppwk_parse_err_msg *wk_err_msg)
 {
 	int i;
 	const char *tmp_buff;
 	char error_messege[CMD_RES_ERR_MSG_SIZE];
 
 	for (i = 0; i < request->num_command; i++) {
-		if (err_msg->code == 0)
+		if (wk_err_msg->code == 0)
 			set_command_results(&results[i], CRES_SUCCESS, "");
 		else
 			set_command_results(&results[i], CRES_INVALID, "");
 	}
 
-	if (err_msg->code != 0) {
-		tmp_buff = make_decode_error_message(err_msg,
-				error_messege);
+	if (wk_err_msg->code != 0) {
+		tmp_buff = get_parse_err_msg(wk_err_msg, error_messege);
 		set_command_results(&results[request->num_valid_command],
 				CRES_FAILURE, tmp_buff);
 	}
-- 
2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [spp] [PATCH 2/2] shared/sec: rename func for setup err msg
  2019-05-31  3:35 [spp] [PATCH 0/2] Rename functions for parsing error messages ogawa.yasufumi
  2019-05-31  3:35 ` [spp] [PATCH 1/2] shared/sec: rename func for getting parse err msg ogawa.yasufumi
@ 2019-05-31  3:35 ` " ogawa.yasufumi
  1 sibling, 0 replies; 3+ messages in thread
From: ogawa.yasufumi @ 2019-05-31  3:35 UTC (permalink / raw)
  To: spp, ferruh.yigit, ogawa.yasufumi

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

This update is to rename func `set_decode_error_to_result()` to
`prepare_parse_err_msg()`.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
 src/shared/secondary/spp_worker_th/command_proc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/shared/secondary/spp_worker_th/command_proc.c b/src/shared/secondary/spp_worker_th/command_proc.c
index fae9aab..151aaa6 100644
--- a/src/shared/secondary/spp_worker_th/command_proc.c
+++ b/src/shared/secondary/spp_worker_th/command_proc.c
@@ -862,9 +862,9 @@ set_command_results(struct command_result *result,
 	}
 }
 
-/* set decode error to command result */
+/* Setup error message of parsing for requested command. */
 static void
-set_decode_error_to_results(struct command_result *results,
+prepare_parse_err_msg(struct command_result *results,
 		const struct sppwk_cmd_req *request,
 		const struct sppwk_parse_err_msg *wk_err_msg)
 {
@@ -1657,12 +1657,12 @@ process_request(int *sock, const char *request_str, size_t request_str_len)
 			"request_str=\n%.*s\n",
 			(int)request_str_len, request_str);
 
-	/* decode request message */
+	/* Parse request message. */
 	ret = sppwk_parse_req(
 			&request, request_str, request_str_len, &wk_err_msg);
 	if (unlikely(ret != SPP_RET_OK)) {
-		/* send error response */
-		set_decode_error_to_results(command_results, &request,
+		/* Setup and send error response. */
+		prepare_parse_err_msg(command_results, &request,
 				&wk_err_msg);
 		send_decode_error_response(sock, &request, command_results);
 		RTE_LOG(DEBUG, SPP_COMMAND_PROC,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-31  3:35 [spp] [PATCH 0/2] Rename functions for parsing error messages ogawa.yasufumi
2019-05-31  3:35 ` [spp] [PATCH 1/2] shared/sec: rename func for getting parse err msg ogawa.yasufumi
2019-05-31  3:35 ` [spp] [PATCH 2/2] shared/sec: rename func for setup " ogawa.yasufumi

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