git.droids-corp.org
/
dpdk.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
net/dpaa2: add logging of flow extracts and rules
[dpdk.git]
/
app
/
test
/
commands.c
diff --git
a/app/test/commands.c
b/app/test/commands.c
index
94fbc31
..
d48dd51
100644
(file)
--- a/
app/test/commands.c
+++ b/
app/test/commands.c
@@
-10,11
+10,6
@@
#include <stdlib.h>
#include <netinet/in.h>
#include <termios.h>
#include <stdlib.h>
#include <netinet/in.h>
#include <termios.h>
-#ifndef __linux__
-#ifndef __FreeBSD__
-#include <net/socket.h>
-#endif
-#endif
#include <inttypes.h>
#include <errno.h>
#include <sys/queue.h>
#include <inttypes.h>
#include <errno.h>
#include <sys/queue.h>
@@
-44,6
+39,7
@@
#include <cmdline_parse_num.h>
#include <cmdline_parse_string.h>
#include <cmdline.h>
#include <cmdline_parse_num.h>
#include <cmdline_parse_string.h>
#include <cmdline.h>
+#include <rte_string_fns.h>
#include "test.h"
#include "test.h"
@@
-63,8
+59,8
@@
struct cmd_autotest_result {
};
static void cmd_autotest_parsed(void *parsed_result,
};
static void cmd_autotest_parsed(void *parsed_result,
- __
attribute__((unused))
struct cmdline *cl,
- __
attribute__((unused))
void *data)
+ __
rte_unused
struct cmdline *cl,
+ __
rte_unused
void *data)
{
struct test_command *t;
struct cmd_autotest_result *res = parsed_result;
{
struct test_command *t;
struct cmd_autotest_result *res = parsed_result;
@@
-116,8
+112,8
@@
dump_struct_sizes(void)
}
static void cmd_dump_parsed(void *parsed_result,
}
static void cmd_dump_parsed(void *parsed_result,
- __
attribute__((unused))
struct cmdline *cl,
- __
attribute__((unused))
void *data)
+ __
rte_unused
struct cmdline *cl,
+ __
rte_unused
void *data)
{
struct cmd_dump_result *res = parsed_result;
{
struct cmd_dump_result *res = parsed_result;
@@
-171,7
+167,7
@@
struct cmd_dump_one_result {
};
static void cmd_dump_one_parsed(void *parsed_result, struct cmdline *cl,
};
static void cmd_dump_one_parsed(void *parsed_result, struct cmdline *cl,
- __
attribute__((unused))
void *data)
+ __
rte_unused
void *data)
{
struct cmd_dump_one_result *res = parsed_result;
{
struct cmd_dump_one_result *res = parsed_result;
@@
-220,9
+216,9
@@
struct cmd_quit_result {
};
static void
};
static void
-cmd_quit_parsed(__
attribute__((unused))
void *parsed_result,
+cmd_quit_parsed(__
rte_unused
void *parsed_result,
struct cmdline *cl,
struct cmdline *cl,
- __
attribute__((unused))
void *data)
+ __
rte_unused
void *data)
{
cmdline_quit(cl);
}
{
cmdline_quit(cl);
}
@@
-249,7
+245,7
@@
struct cmd_set_rxtx_result {
};
static void cmd_set_rxtx_parsed(void *parsed_result, struct cmdline *cl,
};
static void cmd_set_rxtx_parsed(void *parsed_result, struct cmdline *cl,
- __
attribute__((unused))
void *data)
+ __
rte_unused
void *data)
{
struct cmd_set_rxtx_result *res = parsed_result;
if (test_set_rxtx_conf(res->mode) < 0)
{
struct cmd_set_rxtx_result *res = parsed_result;
if (test_set_rxtx_conf(res->mode) < 0)
@@
-285,7
+281,7
@@
struct cmd_set_rxtx_anchor {
static void
cmd_set_rxtx_anchor_parsed(void *parsed_result,
struct cmdline *cl,
static void
cmd_set_rxtx_anchor_parsed(void *parsed_result,
struct cmdline *cl,
- __
attribute__((unused))
void *data)
+ __
rte_unused
void *data)
{
struct cmd_set_rxtx_anchor *res = parsed_result;
if (test_set_rxtx_anchor(res->type) < 0)
{
struct cmd_set_rxtx_anchor *res = parsed_result;
if (test_set_rxtx_anchor(res->type) < 0)
@@
-322,7
+318,7
@@
struct cmd_set_rxtx_sc {
static void
cmd_set_rxtx_sc_parsed(void *parsed_result,
struct cmdline *cl,
static void
cmd_set_rxtx_sc_parsed(void *parsed_result,
struct cmdline *cl,
- __
attribute__((unused))
void *data)
+ __
rte_unused
void *data)
{
struct cmd_set_rxtx_sc *res = parsed_result;
if (test_set_rxtx_sc(res->type) < 0)
{
struct cmd_set_rxtx_sc *res = parsed_result;
if (test_set_rxtx_sc(res->type) < 0)
@@
-365,23
+361,22
@@
cmdline_parse_ctx_t main_ctx[] = {
int commands_init(void)
{
struct test_command *t;
int commands_init(void)
{
struct test_command *t;
- char *commands
, *ptr
;
+ char *commands;
int commands_len = 0;
TAILQ_FOREACH(t, &commands_list, next) {
commands_len += strlen(t->command) + 1;
}
int commands_len = 0;
TAILQ_FOREACH(t, &commands_list, next) {
commands_len += strlen(t->command) + 1;
}
- commands =
malloc(commands_len + 1
);
+ commands =
(char *)calloc(commands_len, sizeof(char)
);
if (!commands)
return -1;
if (!commands)
return -1;
- ptr = commands;
TAILQ_FOREACH(t, &commands_list, next) {
TAILQ_FOREACH(t, &commands_list, next) {
- ptr += sprintf(ptr, "%s#", t->command);
+ strlcat(commands, t->command, commands_len);
+ if (TAILQ_NEXT(t, next) != NULL)
+ strlcat(commands, "#", commands_len);
}
}
- ptr--;
- ptr[0] = '\0';
cmd_autotest_autotest.string_data.str = commands;
return 0;
cmd_autotest_autotest.string_data.str = commands;
return 0;