[spp] [PATCH 06/17] shared/sec: rename define of buffer size for cmds

ogawa.yasufumi at lab.ntt.co.jp ogawa.yasufumi at lab.ntt.co.jp
Wed May 8 04:01:24 CEST 2019


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

For refactoring, rename SPP_CMD_NAME_BUFSZ and SPP_CMD_NAME_VALUE_BUFSZ
to SPPWK_NAME_BUFSZ and SPPWK_VAL_BUFSZ to be more simple and specific.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi at lab.ntt.co.jp>
---
 src/shared/secondary/spp_worker_th/cmd_parser.h   | 14 +++++++-------
 src/shared/secondary/spp_worker_th/command_dec.c  |  4 ++--
 src/shared/secondary/spp_worker_th/command_proc.c |  4 ++--
 3 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/shared/secondary/spp_worker_th/cmd_parser.h b/src/shared/secondary/spp_worker_th/cmd_parser.h
index 2a0e580..99346cb 100644
--- a/src/shared/secondary/spp_worker_th/cmd_parser.h
+++ b/src/shared/secondary/spp_worker_th/cmd_parser.h
@@ -19,10 +19,10 @@
 #define SPPWK_MAX_PARAMS 8
 
 /* Size of string buffer of message including null char. */
-#define SPP_CMD_NAME_BUFSZ  32
+#define SPPWK_NAME_BUFSZ  32
 
 /* Size of string buffer of detailed message including null char. */
-#define SPP_CMD_VALUE_BUFSZ 111
+#define SPPWK_VAL_BUFSZ 111
 
 /* Fix value for 'unused' status. */
 #define SPP_CMD_UNUSE "unuse"
@@ -76,7 +76,7 @@ struct spp_command_classifier_table {
 	enum sppwk_action wk_action;  /**< add or del */
 	enum spp_classifier_type type;  /**< currently only for mac */
 	int vid;  /**< VLAN ID  */
-	char mac[SPP_CMD_VALUE_BUFSZ];  /**< MAC address  */
+	char mac[SPPWK_VAL_BUFSZ];  /**< MAC address  */
 	struct spp_port_index port;/**< Destination port type and number */
 };
 
@@ -88,7 +88,7 @@ struct spp_command_flush {
 /* `component` command parameters. */
 struct spp_command_component {
 	enum sppwk_action wk_action;  /**< start or stop */
-	char name[SPP_CMD_NAME_BUFSZ];  /**< component name */
+	char name[SPPWK_NAME_BUFSZ];  /**< component name */
 	unsigned int core;  /**< logical core number */
 	enum spp_component_type type;  /**< component type */
 };
@@ -98,7 +98,7 @@ struct spp_command_port {
 	enum sppwk_action wk_action;  /**< add or del */
 	struct spp_port_index port;  /**< port type and number */
 	enum spp_port_rxtx rxtx;  /**< rx or tx identifier */
-	char name[SPP_CMD_NAME_BUFSZ];  /**<  component name */
+	char name[SPPWK_NAME_BUFSZ];  /**<  component name */
 	struct spp_port_ability ability;  /**< port ability */
 };
 
@@ -127,8 +127,8 @@ struct spp_command_request {
 /* Error message if parse failed. */
 struct sppwk_parse_err_msg {
 	int code;  /**< Code in enu sppwk_parse_error_code */
-	char msg[SPP_CMD_NAME_BUFSZ];   /**< Message in short */
-	char details[SPP_CMD_VALUE_BUFSZ];  /**< Detailed message */
+	char msg[SPPWK_NAME_BUFSZ];   /**< Message in short */
+	char details[SPPWK_VAL_BUFSZ];  /**< Detailed message */
 };
 
 /**
diff --git a/src/shared/secondary/spp_worker_th/command_dec.c b/src/shared/secondary/spp_worker_th/command_dec.c
index 1dbd510..519ce3a 100644
--- a/src/shared/secondary/spp_worker_th/command_dec.c
+++ b/src/shared/secondary/spp_worker_th/command_dec.c
@@ -302,7 +302,7 @@ get_uint_value(
 static int
 decode_str_value(char *output, const char *arg_val)
 {
-	if (strlen(arg_val) >= SPP_CMD_VALUE_BUFSZ)
+	if (strlen(arg_val) >= SPPWK_VAL_BUFSZ)
 		return SPP_RET_NG;
 
 	strcpy(output, arg_val);
@@ -1035,7 +1035,7 @@ decode_command_in_list(struct spp_command_request *request,
 	int i = 0;
 	int argc = 0;
 	char *argv[SPPWK_MAX_PARAMS];
-	char tmp_str[SPPWK_MAX_PARAMS*SPP_CMD_VALUE_BUFSZ];
+	char tmp_str[SPPWK_MAX_PARAMS*SPPWK_VAL_BUFSZ];
 	memset(argv, 0x00, sizeof(argv));
 	memset(tmp_str, 0x00, sizeof(tmp_str));
 
diff --git a/src/shared/secondary/spp_worker_th/command_proc.c b/src/shared/secondary/spp_worker_th/command_proc.c
index 1ab8111..7fd5fcd 100644
--- a/src/shared/secondary/spp_worker_th/command_proc.c
+++ b/src/shared/secondary/spp_worker_th/command_proc.c
@@ -48,7 +48,7 @@ struct command_result {
 	int code;
 
 	/* Response message */
-	char result[SPP_CMD_NAME_BUFSZ];
+	char result[SPPWK_NAME_BUFSZ];
 
 	/* Detailed response message */
 	char error_message[CMD_RES_ERR_MSG_SIZE];
@@ -57,7 +57,7 @@ struct command_result {
 /* command response list control structure */
 struct command_response_list {
 	/* Tag name */
-	char tag_name[SPP_CMD_NAME_BUFSZ];
+	char tag_name[SPPWK_NAME_BUFSZ];
 
 	/* Pointer to handling function */
 	int (*func)(const char *name, char **output, void *tmp);
-- 
2.17.1



More information about the spp mailing list