eal: deprecate rte_snprintf
The function rte_snprintf serves no useful purpose. It is the same as snprintf() for all valid inputs. Deprecate it and replace all uses in current code. Leave the tests for the deprecated function in place. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
This commit is contained in:
parent
e8ed6c7817
commit
6f41fe75e2
@ -167,7 +167,7 @@ app_init_rings(void)
|
||||
for (i = 0; i < app.n_ports; i++) {
|
||||
char name[32];
|
||||
|
||||
rte_snprintf(name, sizeof(name), "app_ring_rx_%u", i);
|
||||
snprintf(name, sizeof(name), "app_ring_rx_%u", i);
|
||||
|
||||
app.rings_rx[i] = rte_ring_create(
|
||||
name,
|
||||
@ -182,7 +182,7 @@ app_init_rings(void)
|
||||
for (i = 0; i < app.n_ports; i++) {
|
||||
char name[32];
|
||||
|
||||
rte_snprintf(name, sizeof(name), "app_ring_tx_%u", i);
|
||||
snprintf(name, sizeof(name), "app_ring_tx_%u", i);
|
||||
|
||||
app.rings_tx[i] = rte_ring_create(
|
||||
name,
|
||||
|
@ -1426,7 +1426,7 @@ parse_reta_config(const char *str, struct rte_eth_rss_reta *reta_conf)
|
||||
if(size >= sizeof(s))
|
||||
return -1;
|
||||
|
||||
rte_snprintf(s, sizeof(s), "%.*s", size, p);
|
||||
snprintf(s, sizeof(s), "%.*s", size, p);
|
||||
if (rte_strsplit(s, sizeof(s), str_fld, _NUM_FLD, ',') != _NUM_FLD)
|
||||
return -1;
|
||||
for (i = 0; i < _NUM_FLD; i++) {
|
||||
@ -3075,7 +3075,7 @@ static void cmd_set_fwd_mode_init(void)
|
||||
cmdline_parse_token_string_t *token_struct;
|
||||
|
||||
modes = list_pkt_forwarding_modes();
|
||||
rte_snprintf(help, sizeof help, "set fwd %s - "
|
||||
snprintf(help, sizeof help, "set fwd %s - "
|
||||
"set packet forwarding mode", modes);
|
||||
cmd_set_fwd_mode.help_str = help;
|
||||
|
||||
|
@ -563,7 +563,7 @@ ring_dma_zone_lookup(const char *ring_name, uint8_t port_id, uint16_t q_id)
|
||||
char mz_name[RTE_MEMZONE_NAMESIZE];
|
||||
const struct rte_memzone *mz;
|
||||
|
||||
rte_snprintf(mz_name, sizeof(mz_name), "%s_%s_%d_%d",
|
||||
snprintf(mz_name, sizeof(mz_name), "%s_%s_%d_%d",
|
||||
ports[port_id].dev_info.driver_name, ring_name, port_id, q_id);
|
||||
mz = rte_memzone_lookup(mz_name);
|
||||
if (mz == NULL)
|
||||
|
@ -300,7 +300,7 @@ parse_queue_stats_mapping_config(const char *q_arg, int is_rx)
|
||||
if(size >= sizeof(s))
|
||||
return -1;
|
||||
|
||||
rte_snprintf(s, sizeof(s), "%.*s", size, p);
|
||||
snprintf(s, sizeof(s), "%.*s", size, p);
|
||||
if (rte_strsplit(s, sizeof(s), str_fld, _NUM_FLD, ',') != _NUM_FLD)
|
||||
return -1;
|
||||
for (i = 0; i < _NUM_FLD; i++){
|
||||
@ -383,7 +383,7 @@ parse_portnuma_config(const char *q_arg)
|
||||
if(size >= sizeof(s))
|
||||
return -1;
|
||||
|
||||
rte_snprintf(s, sizeof(s), "%.*s", size, p);
|
||||
snprintf(s, sizeof(s), "%.*s", size, p);
|
||||
if (rte_strsplit(s, sizeof(s), str_fld, _NUM_FLD, ',') != _NUM_FLD)
|
||||
return -1;
|
||||
for (i = 0; i < _NUM_FLD; i++) {
|
||||
@ -439,7 +439,7 @@ parse_ringnuma_config(const char *q_arg)
|
||||
if(size >= sizeof(s))
|
||||
return -1;
|
||||
|
||||
rte_snprintf(s, sizeof(s), "%.*s", size, p);
|
||||
snprintf(s, sizeof(s), "%.*s", size, p);
|
||||
if (rte_strsplit(s, sizeof(s), str_fld, _NUM_FLD, ',') != _NUM_FLD)
|
||||
return -1;
|
||||
for (i = 0; i < _NUM_FLD; i++) {
|
||||
|
@ -397,7 +397,7 @@ current_fwd_lcore(void)
|
||||
static inline void
|
||||
mbuf_poolname_build(unsigned int sock_id, char* mp_name, int name_size)
|
||||
{
|
||||
rte_snprintf(mp_name, name_size, "mbuf_pool_socket_%u", sock_id);
|
||||
snprintf(mp_name, name_size, "mbuf_pool_socket_%u", sock_id);
|
||||
}
|
||||
|
||||
static inline struct rte_mempool *
|
||||
|
@ -112,6 +112,13 @@ endif
|
||||
CFLAGS += -O3
|
||||
CFLAGS += $(WERROR_FLAGS)
|
||||
|
||||
# Allow use of deprecated rte_snprintf in test_string_fns.c
|
||||
ifeq ($(CC), icc)
|
||||
CFLAGS_test_string_fns.o += -Wd1478
|
||||
else
|
||||
CFLAGS_test_string_fns.o += -Wno-deprecated-declarations
|
||||
endif
|
||||
|
||||
# Disable warnings of deprecated-declarations in test_kni.c
|
||||
ifeq ($(CC), icc)
|
||||
CFLAGS_test_kni.o += -wd1478
|
||||
|
@ -81,7 +81,7 @@ process_dup(const char *const argv[], int numargs, const char *env_value)
|
||||
/* close all open file descriptors, check /proc/self/fd to only
|
||||
* call close on open fds. Exclude fds 0, 1 and 2*/
|
||||
for (fd = getdtablesize(); fd > 2; fd-- ) {
|
||||
rte_snprintf(path, sizeof(path), "/proc/" exe "/fd/%d", fd);
|
||||
snprintf(path, sizeof(path), "/proc/" exe "/fd/%d", fd);
|
||||
if (access(path, F_OK) == 0)
|
||||
close(fd);
|
||||
}
|
||||
|
@ -512,7 +512,7 @@ test_cirbuf_string_get_del_partial(void)
|
||||
memset(tmp, 0, sizeof(tmp));
|
||||
memset(tmp2, 0, sizeof(tmp));
|
||||
|
||||
rte_snprintf(tmp2, sizeof(tmp2), "%s", CIRBUF_STR_HEAD);
|
||||
snprintf(tmp2, sizeof(tmp2), "%s", CIRBUF_STR_HEAD);
|
||||
|
||||
/*
|
||||
* initialize circular buffer
|
||||
|
@ -146,7 +146,7 @@ test_parse_etheraddr_invalid_param(void)
|
||||
/* try null result */
|
||||
|
||||
/* copy string to buffer */
|
||||
rte_snprintf(buf, sizeof(buf), "%s",
|
||||
snprintf(buf, sizeof(buf), "%s",
|
||||
ether_addr_valid_strs[0].str);
|
||||
|
||||
ret = cmdline_parse_etheraddr(NULL, buf, NULL);
|
||||
|
@ -673,7 +673,7 @@ test_parse_ipaddr_invalid_param(void)
|
||||
char buf[CMDLINE_TEST_BUFSIZE];
|
||||
cmdline_ipaddr_t result;
|
||||
|
||||
rte_snprintf(buf, sizeof(buf), "1.2.3.4");
|
||||
snprintf(buf, sizeof(buf), "1.2.3.4");
|
||||
token.ipaddr_data.flags = CMDLINE_IPADDR_V4;
|
||||
|
||||
/* null token */
|
||||
|
@ -346,7 +346,7 @@ test_parse_num_invalid_param(void)
|
||||
token.num_data.type = UINT32;
|
||||
|
||||
/* copy string to buffer */
|
||||
rte_snprintf(buf, sizeof(buf), "%s",
|
||||
snprintf(buf, sizeof(buf), "%s",
|
||||
num_valid_positive_strs[0].str);
|
||||
|
||||
/* try all null */
|
||||
|
@ -161,7 +161,7 @@ test_parse_string_invalid_param(void)
|
||||
|
||||
memset(&token, 0, sizeof(token));
|
||||
|
||||
rte_snprintf(buf, sizeof(buf), "buffer");
|
||||
snprintf(buf, sizeof(buf), "buffer");
|
||||
|
||||
/* test null token */
|
||||
if (cmdline_get_help_string(
|
||||
|
@ -85,7 +85,7 @@ get_hugepage_path(char * src, int src_len, char * dst, int dst_len)
|
||||
return 0;
|
||||
|
||||
if (strncmp(tokens[2], "hugetlbfs", sizeof("hugetlbfs")) == 0) {
|
||||
rte_snprintf(dst, dst_len, "%s", tokens[1]);
|
||||
snprintf(dst, dst_len, "%s", tokens[1]);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
@ -114,7 +114,7 @@ process_hugefiles(const char * prefix, enum hugepage_action action)
|
||||
|
||||
int fd, lck_result, result = 0;
|
||||
|
||||
const int prefix_len = rte_snprintf(hugefile_prefix,
|
||||
const int prefix_len = snprintf(hugefile_prefix,
|
||||
sizeof(hugefile_prefix), "%smap_", prefix);
|
||||
if (prefix_len <= 0 || prefix_len >= (int)sizeof(hugefile_prefix)
|
||||
|| prefix_len >= (int)sizeof(dirent->d_name)) {
|
||||
@ -160,7 +160,7 @@ process_hugefiles(const char * prefix, enum hugepage_action action)
|
||||
{
|
||||
char file_path[PATH_MAX] = {0};
|
||||
|
||||
rte_snprintf(file_path, sizeof(file_path),
|
||||
snprintf(file_path, sizeof(file_path),
|
||||
"%s/%s", hugedir, dirent->d_name);
|
||||
|
||||
/* remove file */
|
||||
@ -257,17 +257,17 @@ get_current_prefix(char * prefix, int size)
|
||||
char buf[PATH_MAX] = {0};
|
||||
|
||||
/* get file for config (fd is always 3) */
|
||||
rte_snprintf(path, sizeof(path), "/proc/self/fd/%d", 3);
|
||||
snprintf(path, sizeof(path), "/proc/self/fd/%d", 3);
|
||||
|
||||
/* return NULL on error */
|
||||
if (readlink(path, buf, sizeof(buf)) == -1)
|
||||
return NULL;
|
||||
|
||||
/* get the basename */
|
||||
rte_snprintf(buf, sizeof(buf), "%s", basename(buf));
|
||||
snprintf(buf, sizeof(buf), "%s", basename(buf));
|
||||
|
||||
/* copy string all the way from second char up to start of _config */
|
||||
rte_snprintf(prefix, size, "%.*s",
|
||||
snprintf(prefix, size, "%.*s",
|
||||
(int)(strnlen(buf, sizeof(buf)) - sizeof("_config")),
|
||||
&buf[1]);
|
||||
|
||||
@ -292,7 +292,7 @@ test_whitelist_flag(void)
|
||||
printf("Error - unable to get current prefix!\n");
|
||||
return -1;
|
||||
}
|
||||
rte_snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp);
|
||||
snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp);
|
||||
#endif
|
||||
|
||||
const char *wlinval[][11] = {
|
||||
@ -361,7 +361,7 @@ test_invalid_b_flag(void)
|
||||
printf("Error - unable to get current prefix!\n");
|
||||
return -1;
|
||||
}
|
||||
rte_snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp);
|
||||
snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp);
|
||||
#endif
|
||||
|
||||
const char *blinval[][9] = {
|
||||
@ -407,7 +407,7 @@ test_invalid_r_flag(void)
|
||||
printf("Error - unable to get current prefix!\n");
|
||||
return -1;
|
||||
}
|
||||
rte_snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp);
|
||||
snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp);
|
||||
#endif
|
||||
|
||||
const char *rinval[][9] = {
|
||||
@ -451,7 +451,7 @@ test_missing_c_flag(void)
|
||||
printf("Error - unable to get current prefix!\n");
|
||||
return -1;
|
||||
}
|
||||
rte_snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp);
|
||||
snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp);
|
||||
#endif
|
||||
|
||||
/* -c flag but no coremask value */
|
||||
@ -494,7 +494,7 @@ test_missing_n_flag(void)
|
||||
printf("Error - unable to get current prefix!\n");
|
||||
return -1;
|
||||
}
|
||||
rte_snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp);
|
||||
snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp);
|
||||
#endif
|
||||
|
||||
/* -n flag but no value */
|
||||
@ -537,7 +537,7 @@ test_no_hpet_flag(void)
|
||||
printf("Error - unable to get current prefix!\n");
|
||||
return -1;
|
||||
}
|
||||
rte_snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp);
|
||||
snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp);
|
||||
|
||||
/* With --no-hpet */
|
||||
const char *argv1[] = {prgname, prefix, mp_flag, no_hpet, "-c", "1", "-n", "2"};
|
||||
@ -617,7 +617,7 @@ test_dom0_misc_flags(void)
|
||||
printf("Error - unable to get current prefix!\n");
|
||||
return -1;
|
||||
}
|
||||
rte_snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp);
|
||||
snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp);
|
||||
|
||||
/* check that some general flags don't prevent things from working.
|
||||
* All cases, apart from the first, app should run.
|
||||
@ -691,7 +691,7 @@ test_misc_flags(void)
|
||||
printf("Error - unable to get current prefix!\n");
|
||||
return -1;
|
||||
}
|
||||
rte_snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp);
|
||||
snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp);
|
||||
|
||||
/*
|
||||
* get first valid hugepage path
|
||||
@ -992,7 +992,7 @@ test_memory_flags(void)
|
||||
printf("Error - unable to get current prefix!\n");
|
||||
return -1;
|
||||
}
|
||||
rte_snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp);
|
||||
snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp);
|
||||
#endif
|
||||
#ifdef RTE_LIBRTE_XEN_DOM0
|
||||
mem_size = "30";
|
||||
@ -1053,32 +1053,32 @@ test_memory_flags(void)
|
||||
return -1;
|
||||
}
|
||||
|
||||
rte_snprintf(invalid_socket_mem, sizeof(invalid_socket_mem), "--socket-mem=");
|
||||
snprintf(invalid_socket_mem, sizeof(invalid_socket_mem), "--socket-mem=");
|
||||
|
||||
/* add one extra socket */
|
||||
for (i = 0; i < num_sockets + 1; i++) {
|
||||
rte_snprintf(buf, sizeof(buf), "%s2", invalid_socket_mem);
|
||||
rte_snprintf(invalid_socket_mem, sizeof(invalid_socket_mem), "%s", buf);
|
||||
snprintf(buf, sizeof(buf), "%s2", invalid_socket_mem);
|
||||
snprintf(invalid_socket_mem, sizeof(invalid_socket_mem), "%s", buf);
|
||||
|
||||
if (num_sockets + 1 - i > 1) {
|
||||
rte_snprintf(buf, sizeof(buf), "%s,", invalid_socket_mem);
|
||||
rte_snprintf(invalid_socket_mem, sizeof(invalid_socket_mem), "%s", buf);
|
||||
snprintf(buf, sizeof(buf), "%s,", invalid_socket_mem);
|
||||
snprintf(invalid_socket_mem, sizeof(invalid_socket_mem), "%s", buf);
|
||||
}
|
||||
}
|
||||
|
||||
/* construct a valid socket mask with 2 megs on each existing socket */
|
||||
char valid_socket_mem[SOCKET_MEM_STRLEN];
|
||||
|
||||
rte_snprintf(valid_socket_mem, sizeof(valid_socket_mem), "--socket-mem=");
|
||||
snprintf(valid_socket_mem, sizeof(valid_socket_mem), "--socket-mem=");
|
||||
|
||||
/* add one extra socket */
|
||||
for (i = 0; i < num_sockets; i++) {
|
||||
rte_snprintf(buf, sizeof(buf), "%s2", valid_socket_mem);
|
||||
rte_snprintf(valid_socket_mem, sizeof(valid_socket_mem), "%s", buf);
|
||||
snprintf(buf, sizeof(buf), "%s2", valid_socket_mem);
|
||||
snprintf(valid_socket_mem, sizeof(valid_socket_mem), "%s", buf);
|
||||
|
||||
if (num_sockets - i > 1) {
|
||||
rte_snprintf(buf, sizeof(buf), "%s,", valid_socket_mem);
|
||||
rte_snprintf(valid_socket_mem, sizeof(valid_socket_mem), "%s", buf);
|
||||
snprintf(buf, sizeof(buf), "%s,", valid_socket_mem);
|
||||
snprintf(valid_socket_mem, sizeof(valid_socket_mem), "%s", buf);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ test_parse_sysfs_value(void)
|
||||
perror("mkstemp() failure");
|
||||
goto error;
|
||||
}
|
||||
rte_snprintf(proc_path, sizeof(proc_path), "/proc/self/fd/%d", tmp_file_handle);
|
||||
snprintf(proc_path, sizeof(proc_path), "/proc/self/fd/%d", tmp_file_handle);
|
||||
if (readlink(proc_path, filename, sizeof(filename)) < 0) {
|
||||
perror("readlink() failure");
|
||||
goto error;
|
||||
|
@ -86,7 +86,7 @@ test_errno(void)
|
||||
/* generate appropriate error string for unknown error number
|
||||
* and then check that this is what we got back. If not, we have
|
||||
* a duplicate error number that conflicts with errno.h */
|
||||
rte_snprintf(expected_libc_retval, sizeof(expected_libc_retval),
|
||||
snprintf(expected_libc_retval, sizeof(expected_libc_retval),
|
||||
unknown_code_result, rte_errs[i]);
|
||||
if ((strcmp(expected_libc_retval, libc_retval) != 0) &&
|
||||
(strcmp("", libc_retval) != 0)){
|
||||
@ -98,7 +98,7 @@ test_errno(void)
|
||||
/* ensure that beyond RTE_MAX_ERRNO, we always get an unknown code */
|
||||
rte_retval = rte_strerror(RTE_MAX_ERRNO + 1);
|
||||
libc_retval = strerror(RTE_MAX_ERRNO + 1);
|
||||
rte_snprintf(expected_libc_retval, sizeof(expected_libc_retval),
|
||||
snprintf(expected_libc_retval, sizeof(expected_libc_retval),
|
||||
unknown_code_result, RTE_MAX_ERRNO + 1);
|
||||
printf("rte_strerror: '%s', strerror: '%s'\n",
|
||||
rte_retval, libc_retval);
|
||||
|
@ -129,7 +129,7 @@ ring_create_lookup(__attribute__((unused)) void *arg)
|
||||
|
||||
/* create/lookup new ring several times */
|
||||
for (i = 0; i < MAX_ITER_TIMES; i++) {
|
||||
rte_snprintf(ring_name, sizeof(ring_name), "fr_test_%d_%d", lcore_self, i);
|
||||
snprintf(ring_name, sizeof(ring_name), "fr_test_%d_%d", lcore_self, i);
|
||||
rp = rte_ring_create(ring_name, 4096, SOCKET_ID_ANY, 0);
|
||||
if (NULL == rp)
|
||||
return -1;
|
||||
@ -139,7 +139,7 @@ ring_create_lookup(__attribute__((unused)) void *arg)
|
||||
|
||||
/* verify all ring created sucessful */
|
||||
for (i = 0; i < MAX_ITER_TIMES; i++) {
|
||||
rte_snprintf(ring_name, sizeof(ring_name), "fr_test_%d_%d", lcore_self, i);
|
||||
snprintf(ring_name, sizeof(ring_name), "fr_test_%d_%d", lcore_self, i);
|
||||
if (rte_ring_lookup(ring_name) == NULL)
|
||||
return -1;
|
||||
}
|
||||
@ -179,7 +179,7 @@ mempool_create_lookup(__attribute__((unused)) void *arg)
|
||||
|
||||
/* create/lookup new ring several times */
|
||||
for (i = 0; i < MAX_ITER_TIMES; i++) {
|
||||
rte_snprintf(mempool_name, sizeof(mempool_name), "fr_test_%d_%d", lcore_self, i);
|
||||
snprintf(mempool_name, sizeof(mempool_name), "fr_test_%d_%d", lcore_self, i);
|
||||
mp = rte_mempool_create(mempool_name, MEMPOOL_SIZE,
|
||||
MEMPOOL_ELT_SIZE, 0, 0,
|
||||
NULL, NULL,
|
||||
@ -193,7 +193,7 @@ mempool_create_lookup(__attribute__((unused)) void *arg)
|
||||
|
||||
/* verify all ring created sucessful */
|
||||
for (i = 0; i < MAX_ITER_TIMES; i++) {
|
||||
rte_snprintf(mempool_name, sizeof(mempool_name), "fr_test_%d_%d", lcore_self, i);
|
||||
snprintf(mempool_name, sizeof(mempool_name), "fr_test_%d_%d", lcore_self, i);
|
||||
if (rte_mempool_lookup(mempool_name) == NULL)
|
||||
return -1;
|
||||
}
|
||||
@ -210,7 +210,7 @@ hash_clean(unsigned lcore_id)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_ITER_TIMES; i++) {
|
||||
rte_snprintf(hash_name, sizeof(hash_name), "fr_test_%d_%d", lcore_id, i);
|
||||
snprintf(hash_name, sizeof(hash_name), "fr_test_%d_%d", lcore_id, i);
|
||||
|
||||
if ((handle = rte_hash_find_existing(hash_name)) != NULL)
|
||||
rte_hash_free(handle);
|
||||
@ -246,7 +246,7 @@ hash_create_free(__attribute__((unused)) void *arg)
|
||||
|
||||
/* create mutiple times simultaneously */
|
||||
for (i = 0; i < MAX_ITER_TIMES; i++) {
|
||||
rte_snprintf(hash_name, sizeof(hash_name), "fr_test_%d_%d", lcore_self, i);
|
||||
snprintf(hash_name, sizeof(hash_name), "fr_test_%d_%d", lcore_self, i);
|
||||
hash_params.name = hash_name;
|
||||
|
||||
handle = rte_hash_create(&hash_params);
|
||||
@ -262,7 +262,7 @@ hash_create_free(__attribute__((unused)) void *arg)
|
||||
|
||||
/* verify free correct */
|
||||
for (i = 0; i < MAX_ITER_TIMES; i++) {
|
||||
rte_snprintf(hash_name, sizeof(hash_name), "fr_test_%d_%d", lcore_self, i);
|
||||
snprintf(hash_name, sizeof(hash_name), "fr_test_%d_%d", lcore_self, i);
|
||||
|
||||
if (NULL != rte_hash_find_existing(hash_name))
|
||||
return -1;
|
||||
@ -279,7 +279,7 @@ fbk_clean(unsigned lcore_id)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_ITER_TIMES; i++) {
|
||||
rte_snprintf(fbk_name, sizeof(fbk_name), "fr_test_%d_%d", lcore_id, i);
|
||||
snprintf(fbk_name, sizeof(fbk_name), "fr_test_%d_%d", lcore_id, i);
|
||||
|
||||
if ((handle = rte_fbk_hash_find_existing(fbk_name)) != NULL)
|
||||
rte_fbk_hash_free(handle);
|
||||
@ -314,7 +314,7 @@ fbk_create_free(__attribute__((unused)) void *arg)
|
||||
|
||||
/* create mutiple fbk tables simultaneously */
|
||||
for (i = 0; i < MAX_ITER_TIMES; i++) {
|
||||
rte_snprintf(fbk_name, sizeof(fbk_name), "fr_test_%d_%d", lcore_self, i);
|
||||
snprintf(fbk_name, sizeof(fbk_name), "fr_test_%d_%d", lcore_self, i);
|
||||
fbk_params.name = fbk_name;
|
||||
|
||||
handle = rte_fbk_hash_create(&fbk_params);
|
||||
@ -330,7 +330,7 @@ fbk_create_free(__attribute__((unused)) void *arg)
|
||||
|
||||
/* verify free correct */
|
||||
for (i = 0; i < MAX_ITER_TIMES; i++) {
|
||||
rte_snprintf(fbk_name, sizeof(fbk_name), "fr_test_%d_%d", lcore_self, i);
|
||||
snprintf(fbk_name, sizeof(fbk_name), "fr_test_%d_%d", lcore_self, i);
|
||||
|
||||
if (NULL != rte_fbk_hash_find_existing(fbk_name))
|
||||
return -1;
|
||||
@ -349,7 +349,7 @@ lpm_clean(unsigned lcore_id)
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_LPM_ITER_TIMES; i++) {
|
||||
rte_snprintf(lpm_name, sizeof(lpm_name), "fr_test_%d_%d", lcore_id, i);
|
||||
snprintf(lpm_name, sizeof(lpm_name), "fr_test_%d_%d", lcore_id, i);
|
||||
|
||||
if ((lpm = rte_lpm_find_existing(lpm_name)) != NULL)
|
||||
rte_lpm_free(lpm);
|
||||
@ -375,7 +375,7 @@ lpm_create_free(__attribute__((unused)) void *arg)
|
||||
|
||||
/* create mutiple fbk tables simultaneously */
|
||||
for (i = 0; i < MAX_LPM_ITER_TIMES; i++) {
|
||||
rte_snprintf(lpm_name, sizeof(lpm_name), "fr_test_%d_%d", lcore_self, i);
|
||||
snprintf(lpm_name, sizeof(lpm_name), "fr_test_%d_%d", lcore_self, i);
|
||||
lpm = rte_lpm_create(lpm_name, SOCKET_ID_ANY, 4, RTE_LPM_HEAP);
|
||||
if (NULL == lpm)
|
||||
return -1;
|
||||
@ -389,7 +389,7 @@ lpm_create_free(__attribute__((unused)) void *arg)
|
||||
|
||||
/* verify free correct */
|
||||
for (i = 0; i < MAX_LPM_ITER_TIMES; i++) {
|
||||
rte_snprintf(lpm_name, sizeof(lpm_name), "fr_test_%d_%d", lcore_self, i);
|
||||
snprintf(lpm_name, sizeof(lpm_name), "fr_test_%d_%d", lcore_self, i);
|
||||
if (NULL != rte_lpm_find_existing(lpm_name))
|
||||
return -1;
|
||||
}
|
||||
|
@ -538,7 +538,7 @@ run_tbl_perf_test(struct tbl_perf_test_params *params)
|
||||
char name[RTE_HASH_NAMESIZE];
|
||||
char hashname[RTE_HASH_NAMESIZE];
|
||||
|
||||
rte_snprintf(name, 32, "test%u", calledCount++);
|
||||
snprintf(name, 32, "test%u", calledCount++);
|
||||
hash_params.name = name;
|
||||
|
||||
handle = rte_hash_create(&hash_params);
|
||||
@ -589,7 +589,7 @@ run_tbl_perf_test(struct tbl_perf_test_params *params)
|
||||
default: return -1;
|
||||
}
|
||||
|
||||
rte_snprintf(hashname, RTE_HASH_NAMESIZE, "%s", get_hash_name(params->hash_func));
|
||||
snprintf(hashname, RTE_HASH_NAMESIZE, "%s", get_hash_name(params->hash_func));
|
||||
|
||||
printf("%-12s, %-15s, %-16u, %-7u, %-18u, %-8u, %-19.2f, %.2f\n",
|
||||
hashname,
|
||||
|
@ -73,17 +73,17 @@ get_current_prefix(char * prefix, int size)
|
||||
char buf[PATH_MAX] = {0};
|
||||
|
||||
/* get file for config (fd is always 3) */
|
||||
rte_snprintf(path, sizeof(path), "/proc/self/fd/%d", 3);
|
||||
snprintf(path, sizeof(path), "/proc/self/fd/%d", 3);
|
||||
|
||||
/* return NULL on error */
|
||||
if (readlink(path, buf, sizeof(buf)) == -1)
|
||||
return NULL;
|
||||
|
||||
/* get the basename */
|
||||
rte_snprintf(buf, sizeof(buf), "%s", basename(buf));
|
||||
snprintf(buf, sizeof(buf), "%s", basename(buf));
|
||||
|
||||
/* copy string all the way from second char up to start of _config */
|
||||
rte_snprintf(prefix, size, "%.*s",
|
||||
snprintf(prefix, size, "%.*s",
|
||||
(int)(strnlen(buf, sizeof(buf)) - sizeof("_config")),
|
||||
&buf[1]);
|
||||
|
||||
@ -97,7 +97,7 @@ mmap_metadata(const char *name)
|
||||
char pathname[PATH_MAX];
|
||||
struct rte_ivshmem_metadata *metadata;
|
||||
|
||||
rte_snprintf(pathname, sizeof(pathname),
|
||||
snprintf(pathname, sizeof(pathname),
|
||||
"/var/run/.dpdk_ivshmem_metadata_%s", name);
|
||||
|
||||
fd = open(pathname, O_RDWR, 0660);
|
||||
@ -136,7 +136,7 @@ test_ivshmem_create_lots_of_memzones(void)
|
||||
"Failed to create metadata");
|
||||
|
||||
for (i = 0; i < RTE_LIBRTE_IVSHMEM_MAX_ENTRIES; i++) {
|
||||
rte_snprintf(name, sizeof(name), "mz_%i", i);
|
||||
snprintf(name, sizeof(name), "mz_%i", i);
|
||||
|
||||
mz = rte_memzone_reserve(name, CACHE_LINE_SIZE, SOCKET_ID_ANY, 0);
|
||||
ASSERT(mz != NULL, "Failed to reserve memzone");
|
||||
@ -313,7 +313,7 @@ test_ivshmem_create_multiple_metadata_configs(void)
|
||||
struct rte_ivshmem_metadata *metadata;
|
||||
|
||||
for (i = 0; i < RTE_LIBRTE_IVSHMEM_MAX_METADATA_FILES / 2; i++) {
|
||||
rte_snprintf(name, sizeof(name), "test_%d", i);
|
||||
snprintf(name, sizeof(name), "test_%d", i);
|
||||
rte_ivshmem_metadata_create(name);
|
||||
metadata = mmap_metadata(name);
|
||||
|
||||
@ -334,7 +334,7 @@ test_ivshmem_create_too_many_metadata_configs(void)
|
||||
char name[IVSHMEM_NAME_LEN];
|
||||
|
||||
for (i = 0; i < RTE_LIBRTE_IVSHMEM_MAX_METADATA_FILES; i++) {
|
||||
rte_snprintf(name, sizeof(name), "test_%d", i);
|
||||
snprintf(name, sizeof(name), "test_%d", i);
|
||||
ASSERT(rte_ivshmem_metadata_create(name) == 0,
|
||||
"Create config file failed");
|
||||
}
|
||||
@ -369,7 +369,7 @@ launch_all_tests_on_secondary_processes(void)
|
||||
|
||||
get_current_prefix(tmp, sizeof(tmp));
|
||||
|
||||
rte_snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp);
|
||||
snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp);
|
||||
|
||||
const char *argv[] = { prgname, "-c", "1", "-n", "3",
|
||||
"--proc-type=secondary", prefix };
|
||||
|
@ -390,7 +390,7 @@ test_kni_processing(uint8_t port_id, struct rte_mempool *mp)
|
||||
rte_eth_dev_info_get(port_id, &info);
|
||||
conf.addr = info.pci_dev->addr;
|
||||
conf.id = info.pci_dev->id;
|
||||
rte_snprintf(conf.name, sizeof(conf.name), TEST_KNI_PORT);
|
||||
snprintf(conf.name, sizeof(conf.name), TEST_KNI_PORT);
|
||||
|
||||
/* core id 1 configured for kernel thread */
|
||||
conf.core_id = 1;
|
||||
@ -647,7 +647,7 @@ test_kni(void)
|
||||
|
||||
/* test of getting KNI device with an invalid string name */
|
||||
memset(&conf, 0, sizeof(conf));
|
||||
rte_snprintf(conf.name, sizeof(conf.name), "testing");
|
||||
snprintf(conf.name, sizeof(conf.name), "testing");
|
||||
kni = rte_kni_get(conf.name);
|
||||
if (kni) {
|
||||
ret = -1;
|
||||
|
@ -486,7 +486,7 @@ test_realloc(void)
|
||||
printf("NULL pointer returned from rte_zmalloc\n");
|
||||
return -1;
|
||||
}
|
||||
rte_snprintf(ptr1, size1, "%s" ,hello_str);
|
||||
snprintf(ptr1, size1, "%s" ,hello_str);
|
||||
char *ptr2 = rte_realloc(ptr1, size2, CACHE_LINE_SIZE);
|
||||
if (!ptr2){
|
||||
rte_free(ptr1);
|
||||
|
@ -92,17 +92,17 @@ get_current_prefix(char * prefix, int size)
|
||||
char buf[PATH_MAX] = {0};
|
||||
|
||||
/* get file for config (fd is always 3) */
|
||||
rte_snprintf(path, sizeof(path), "/proc/self/fd/%d", 3);
|
||||
snprintf(path, sizeof(path), "/proc/self/fd/%d", 3);
|
||||
|
||||
/* return NULL on error */
|
||||
if (readlink(path, buf, sizeof(buf)) == -1)
|
||||
return NULL;
|
||||
|
||||
/* get the basename */
|
||||
rte_snprintf(buf, sizeof(buf), "%s", basename(buf));
|
||||
snprintf(buf, sizeof(buf), "%s", basename(buf));
|
||||
|
||||
/* copy string all the way from second char up to start of _config */
|
||||
rte_snprintf(prefix, size, "%.*s",
|
||||
snprintf(prefix, size, "%.*s",
|
||||
(int)(strnlen(buf, sizeof(buf)) - sizeof("_config")),
|
||||
&buf[1]);
|
||||
|
||||
@ -124,7 +124,7 @@ run_secondary_instances(void)
|
||||
|
||||
get_current_prefix(tmp, sizeof(tmp));
|
||||
|
||||
rte_snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp);
|
||||
snprintf(prefix, sizeof(prefix), "--file-prefix=%s", tmp);
|
||||
|
||||
/* good case, using secondary */
|
||||
const char *argv1[] = {
|
||||
@ -147,7 +147,7 @@ run_secondary_instances(void)
|
||||
"--file-prefix=ERROR"
|
||||
};
|
||||
|
||||
rte_snprintf(coremask, sizeof(coremask), "%x", \
|
||||
snprintf(coremask, sizeof(coremask), "%x", \
|
||||
(1 << rte_get_master_lcore()));
|
||||
|
||||
ret |= launch_proc(argv1);
|
||||
|
@ -63,7 +63,7 @@ check_cur_freq(unsigned lcore_id, uint32_t idx)
|
||||
uint32_t cur_freq;
|
||||
int ret = -1;
|
||||
|
||||
if (rte_snprintf(fullpath, sizeof(fullpath),
|
||||
if (snprintf(fullpath, sizeof(fullpath),
|
||||
TEST_POWER_SYSFILE_CUR_FREQ, lcore_id) < 0) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ app_init_rings(void)
|
||||
for (i = 0; i < N_PORTS; i++) {
|
||||
char name[32];
|
||||
|
||||
rte_snprintf(name, sizeof(name), "app_ring_rx_%u", i);
|
||||
snprintf(name, sizeof(name), "app_ring_rx_%u", i);
|
||||
rings_rx[i] = rte_ring_lookup(name);
|
||||
if (rings_rx[i] == NULL) {
|
||||
rings_rx[i] = rte_ring_create(
|
||||
@ -141,7 +141,7 @@ app_init_rings(void)
|
||||
for (i = 0; i < N_PORTS; i++) {
|
||||
char name[32];
|
||||
|
||||
rte_snprintf(name, sizeof(name), "app_ring_tx_%u", i);
|
||||
snprintf(name, sizeof(name), "app_ring_tx_%u", i);
|
||||
rings_tx[i] = rte_ring_lookup(name);
|
||||
if (rings_tx[i] == NULL) {
|
||||
rings_tx[i] = rte_ring_create(
|
||||
|
@ -364,7 +364,7 @@ setup_acl_pipeline(void)
|
||||
|
||||
acl_params.n_rules = 1 << 5;
|
||||
acl_params.n_rule_fields = DIM(ipv4_defs);
|
||||
rte_snprintf(acl_name, sizeof(acl_name), "ACL%d", i);
|
||||
snprintf(acl_name, sizeof(acl_name), "ACL%d", i);
|
||||
acl_params.name = acl_name;
|
||||
memcpy(acl_params.field_format, ipv4_defs, sizeof(ipv4_defs));
|
||||
|
||||
@ -408,7 +408,7 @@ setup_acl_pipeline(void)
|
||||
parser = parse_cb_ipv4_rule;
|
||||
|
||||
for (n = 1; n <= 5; n++) {
|
||||
rte_snprintf(line, sizeof(line), "%s", lines[n-1]);
|
||||
snprintf(line, sizeof(line), "%s", lines[n-1]);
|
||||
printf("PARSING [%s]\n", line);
|
||||
|
||||
ret = parser(line, &rule_params);
|
||||
@ -434,7 +434,7 @@ setup_acl_pipeline(void)
|
||||
|
||||
/* delete a few rules */
|
||||
for (n = 2; n <= 3; n++) {
|
||||
rte_snprintf(line, sizeof(line), "%s", lines[n-1]);
|
||||
snprintf(line, sizeof(line), "%s", lines[n-1]);
|
||||
printf("PARSING [%s]\n", line);
|
||||
|
||||
ret = parser(line, &rule_params);
|
||||
@ -461,7 +461,7 @@ setup_acl_pipeline(void)
|
||||
|
||||
/* Try to add duplicates */
|
||||
for (n = 1; n <= 5; n++) {
|
||||
rte_snprintf(line, sizeof(line), "%s", lines[n-1]);
|
||||
snprintf(line, sizeof(line), "%s", lines[n-1]);
|
||||
printf("PARSING [%s]\n", line);
|
||||
|
||||
ret = parser(line, &rule_params);
|
||||
|
@ -134,10 +134,10 @@ static void cmd_obj_del_show_parsed(void *parsed_result,
|
||||
char ip_str[INET6_ADDRSTRLEN];
|
||||
|
||||
if (res->obj->ip.family == AF_INET)
|
||||
rte_snprintf(ip_str, sizeof(ip_str), NIPQUAD_FMT,
|
||||
snprintf(ip_str, sizeof(ip_str), NIPQUAD_FMT,
|
||||
NIPQUAD(res->obj->ip.addr.ipv4));
|
||||
else
|
||||
rte_snprintf(ip_str, sizeof(ip_str), NIP6_FMT,
|
||||
snprintf(ip_str, sizeof(ip_str), NIP6_FMT,
|
||||
NIP6(res->obj->ip.addr.ipv6));
|
||||
|
||||
if (strcmp(res->action, "del") == 0) {
|
||||
@ -199,15 +199,15 @@ static void cmd_obj_add_parsed(void *parsed_result,
|
||||
cmdline_printf(cl, "mem error\n");
|
||||
return;
|
||||
}
|
||||
rte_snprintf(o->name, sizeof(o->name), "%s", res->name);
|
||||
snprintf(o->name, sizeof(o->name), "%s", res->name);
|
||||
o->ip = res->ip;
|
||||
SLIST_INSERT_HEAD(&global_obj_list, o, next);
|
||||
|
||||
if (o->ip.family == AF_INET)
|
||||
rte_snprintf(ip_str, sizeof(ip_str), NIPQUAD_FMT,
|
||||
snprintf(ip_str, sizeof(ip_str), NIPQUAD_FMT,
|
||||
NIPQUAD(o->ip.addr.ipv4));
|
||||
else
|
||||
rte_snprintf(ip_str, sizeof(ip_str), NIP6_FMT,
|
||||
snprintf(ip_str, sizeof(ip_str), NIP6_FMT,
|
||||
NIP6(o->ip.addr.ipv6));
|
||||
|
||||
cmdline_printf(cl, "Object %s added, ip=%s\n",
|
||||
|
@ -148,7 +148,7 @@ int complete_get_elt_obj_list(cmdline_parse_token_hdr_t *tk,
|
||||
return -1;
|
||||
|
||||
if (dstbuf)
|
||||
rte_snprintf(dstbuf, size, "%s", o->name);
|
||||
snprintf(dstbuf, size, "%s", o->name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -157,6 +157,6 @@ int complete_get_elt_obj_list(cmdline_parse_token_hdr_t *tk,
|
||||
int get_help_obj_list(__attribute__((unused)) cmdline_parse_token_hdr_t *tk,
|
||||
char *dstbuf, unsigned int size)
|
||||
{
|
||||
rte_snprintf(dstbuf, size, "Obj-List");
|
||||
snprintf(dstbuf, size, "Obj-List");
|
||||
return 0;
|
||||
}
|
||||
|
@ -665,7 +665,7 @@ per_core_crypto_init(uint32_t lcore_id)
|
||||
qaCoreConf[lcore_id].numResponseAttempts = 0;
|
||||
|
||||
/* Initialise and reserve lcore memzone for virt2phys translation */
|
||||
rte_snprintf(memzone_name,
|
||||
snprintf(memzone_name,
|
||||
RTE_MEMZONE_NAMESIZE,
|
||||
"lcore_%u",
|
||||
lcore_id);
|
||||
|
@ -543,7 +543,7 @@ parse_config(const char *q_arg)
|
||||
if(size >= sizeof(s))
|
||||
return -1;
|
||||
|
||||
rte_snprintf(s, sizeof(s), "%.*s", size, p);
|
||||
snprintf(s, sizeof(s), "%.*s", size, p);
|
||||
if (rte_strsplit(s, sizeof(s), str_fld, _NUM_FLD, ',') != _NUM_FLD)
|
||||
return -1;
|
||||
for (i = 0; i < _NUM_FLD; i++) {
|
||||
@ -654,7 +654,7 @@ init_mem(void)
|
||||
return -1;
|
||||
}
|
||||
if (pktmbuf_pool[socketid] == NULL) {
|
||||
rte_snprintf(s, sizeof(s), "mbuf_pool_%d", socketid);
|
||||
snprintf(s, sizeof(s), "mbuf_pool_%d", socketid);
|
||||
pktmbuf_pool[socketid] =
|
||||
rte_mempool_create(s, NB_MBUF, MBUF_SIZE, 32,
|
||||
sizeof(struct rte_pktmbuf_pool_private),
|
||||
|
@ -229,7 +229,7 @@ static int tap_create(char *name)
|
||||
ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
|
||||
|
||||
if (name && *name)
|
||||
rte_snprintf(ifr.ifr_name, IFNAMSIZ, "%s", name);
|
||||
snprintf(ifr.ifr_name, IFNAMSIZ, "%s", name);
|
||||
|
||||
ret = ioctl(fd, TUNSETIFF, (void *) &ifr);
|
||||
if (ret < 0) {
|
||||
@ -238,7 +238,7 @@ static int tap_create(char *name)
|
||||
}
|
||||
|
||||
if (name)
|
||||
rte_snprintf(name, IFNAMSIZ, "%s", ifr.ifr_name);
|
||||
snprintf(name, IFNAMSIZ, "%s", ifr.ifr_name);
|
||||
|
||||
return fd;
|
||||
}
|
||||
@ -253,7 +253,7 @@ main_loop(__attribute__((unused)) void *arg)
|
||||
|
||||
if ((1ULL << lcore_id) & input_cores_mask) {
|
||||
/* Create new tap interface */
|
||||
rte_snprintf(tap_name, IFNAMSIZ, "tap_dpdk_%.2u", lcore_id);
|
||||
snprintf(tap_name, IFNAMSIZ, "tap_dpdk_%.2u", lcore_id);
|
||||
tap_fd = tap_create(tap_name);
|
||||
if (tap_fd < 0)
|
||||
FATAL_ERROR("Could not create tap interface \"%s\" (%d)",
|
||||
@ -286,7 +286,7 @@ main_loop(__attribute__((unused)) void *arg)
|
||||
}
|
||||
else if ((1ULL << lcore_id) & output_cores_mask) {
|
||||
/* Create new tap interface */
|
||||
rte_snprintf(tap_name, IFNAMSIZ, "tap_dpdk_%.2u", lcore_id);
|
||||
snprintf(tap_name, IFNAMSIZ, "tap_dpdk_%.2u", lcore_id);
|
||||
tap_fd = tap_create(tap_name);
|
||||
if (tap_fd < 0)
|
||||
FATAL_ERROR("Could not create tap interface \"%s\" (%d)",
|
||||
|
@ -786,7 +786,7 @@ init_mem(void)
|
||||
if (socket_direct_pool[socket] == NULL) {
|
||||
RTE_LOG(INFO, IP_FRAG, "Creating direct mempool on socket %i\n",
|
||||
socket);
|
||||
rte_snprintf(buf, sizeof(buf), "pool_direct_%i", socket);
|
||||
snprintf(buf, sizeof(buf), "pool_direct_%i", socket);
|
||||
|
||||
mp = rte_mempool_create(buf, NB_MBUF,
|
||||
MBUF_SIZE, 32,
|
||||
@ -804,7 +804,7 @@ init_mem(void)
|
||||
if (socket_indirect_pool[socket] == NULL) {
|
||||
RTE_LOG(INFO, IP_FRAG, "Creating indirect mempool on socket %i\n",
|
||||
socket);
|
||||
rte_snprintf(buf, sizeof(buf), "pool_indirect_%i", socket);
|
||||
snprintf(buf, sizeof(buf), "pool_indirect_%i", socket);
|
||||
|
||||
mp = rte_mempool_create(buf, NB_MBUF,
|
||||
sizeof(struct rte_mbuf), 32,
|
||||
@ -821,7 +821,7 @@ init_mem(void)
|
||||
|
||||
if (socket_lpm[socket] == NULL) {
|
||||
RTE_LOG(INFO, IP_FRAG, "Creating LPM table on socket %i\n", socket);
|
||||
rte_snprintf(buf, sizeof(buf), "IP_FRAG_LPM_%i", socket);
|
||||
snprintf(buf, sizeof(buf), "IP_FRAG_LPM_%i", socket);
|
||||
|
||||
lpm = rte_lpm_create(buf, socket, LPM_MAX_RULES, 0);
|
||||
if (lpm == NULL) {
|
||||
@ -833,7 +833,7 @@ init_mem(void)
|
||||
|
||||
if (socket_lpm6[socket] == NULL) {
|
||||
RTE_LOG(INFO, IP_FRAG, "Creating LPM6 table on socket %i\n", socket);
|
||||
rte_snprintf(buf, sizeof(buf), "IP_FRAG_LPM_%i", socket);
|
||||
snprintf(buf, sizeof(buf), "IP_FRAG_LPM_%i", socket);
|
||||
|
||||
lpm6 = rte_lpm6_create("IP_FRAG_LPM6", socket, &lpm6_config);
|
||||
if (lpm6 == NULL) {
|
||||
|
@ -239,7 +239,7 @@ app_install_cfgfile(const char *file_name)
|
||||
uint32_t j;
|
||||
|
||||
/* [core X] */
|
||||
rte_snprintf(section_name, sizeof(section_name), "core %u", i);
|
||||
snprintf(section_name, sizeof(section_name), "core %u", i);
|
||||
if (!rte_cfgfile_has_section(file, section_name)) {
|
||||
rte_panic("Config file parse error: core IDs are not "
|
||||
"sequential (core %u missing)\n", i);
|
||||
|
@ -427,7 +427,7 @@ app_init_rings(void)
|
||||
struct rte_ring *ring;
|
||||
char name[32];
|
||||
|
||||
rte_snprintf(name, sizeof(name), "app_ring_%u", i);
|
||||
snprintf(name, sizeof(name), "app_ring_%u", i);
|
||||
|
||||
ring = rte_ring_create(
|
||||
name,
|
||||
|
@ -954,7 +954,7 @@ setup_queue_tbl(struct rx_queue *rxq, uint32_t lcore, uint32_t queue)
|
||||
|
||||
nb_mbuf = RTE_MAX(nb_mbuf, (uint32_t)NB_MBUF);
|
||||
|
||||
rte_snprintf(buf, sizeof(buf), "mbuf_pool_%u_%u", lcore, queue);
|
||||
snprintf(buf, sizeof(buf), "mbuf_pool_%u_%u", lcore, queue);
|
||||
|
||||
if ((rxq->pool = rte_mempool_create(buf, nb_mbuf, MBUF_SIZE, 0,
|
||||
sizeof(struct rte_pktmbuf_pool_private),
|
||||
@ -990,7 +990,7 @@ init_mem(void)
|
||||
|
||||
if (socket_lpm[socket] == NULL) {
|
||||
RTE_LOG(INFO, IP_RSMBL, "Creating LPM table on socket %i\n", socket);
|
||||
rte_snprintf(buf, sizeof(buf), "IP_RSMBL_LPM_%i", socket);
|
||||
snprintf(buf, sizeof(buf), "IP_RSMBL_LPM_%i", socket);
|
||||
|
||||
lpm = rte_lpm_create(buf, socket, LPM_MAX_RULES, 0);
|
||||
if (lpm == NULL) {
|
||||
@ -1002,7 +1002,7 @@ init_mem(void)
|
||||
|
||||
if (socket_lpm6[socket] == NULL) {
|
||||
RTE_LOG(INFO, IP_RSMBL, "Creating LPM6 table on socket %i\n", socket);
|
||||
rte_snprintf(buf, sizeof(buf), "IP_RSMBL_LPM_%i", socket);
|
||||
snprintf(buf, sizeof(buf), "IP_RSMBL_LPM_%i", socket);
|
||||
|
||||
lpm6 = rte_lpm6_create("IP_RSMBL_LPM6", socket, &lpm6_config);
|
||||
if (lpm6 == NULL) {
|
||||
|
@ -465,7 +465,7 @@ parse_config(const char *arg)
|
||||
printf("Invalid config parameters\n");
|
||||
goto fail;
|
||||
}
|
||||
rte_snprintf(s, sizeof(s), "%.*s", size, p);
|
||||
snprintf(s, sizeof(s), "%.*s", size, p);
|
||||
nb_token = rte_strsplit(s, sizeof(s), str_fld, _NUM_FLD, ',');
|
||||
if (nb_token <= FLD_LCORE_TX) {
|
||||
printf("Invalid config parameters\n");
|
||||
@ -793,12 +793,12 @@ kni_alloc(uint8_t port_id)
|
||||
/* Clear conf at first */
|
||||
memset(&conf, 0, sizeof(conf));
|
||||
if (params[port_id]->nb_lcore_k) {
|
||||
rte_snprintf(conf.name, RTE_KNI_NAMESIZE,
|
||||
snprintf(conf.name, RTE_KNI_NAMESIZE,
|
||||
"vEth%u_%u", port_id, i);
|
||||
conf.core_id = params[port_id]->lcore_k[i];
|
||||
conf.force_bind = 1;
|
||||
} else
|
||||
rte_snprintf(conf.name, RTE_KNI_NAMESIZE,
|
||||
snprintf(conf.name, RTE_KNI_NAMESIZE,
|
||||
"vEth%u", port_id);
|
||||
conf.group_id = (uint16_t)port_id;
|
||||
conf.mbuf_size = MAX_PACKET_SZ;
|
||||
|
@ -217,7 +217,7 @@ print_to_file(const char *cmdline, const char *config_name)
|
||||
FILE *file;
|
||||
char path[PATH_MAX];
|
||||
|
||||
rte_snprintf(path, sizeof(path), QEMU_CMD_FMT, config_name);
|
||||
snprintf(path, sizeof(path), QEMU_CMD_FMT, config_name);
|
||||
file = fopen(path, "w");
|
||||
if (file == NULL) {
|
||||
RTE_LOG(ERR, L2FWD_IVSHMEM, "Could not open '%s' \n", path);
|
||||
@ -871,7 +871,7 @@ int main(int argc, char **argv)
|
||||
for (portid = 0; portid < nb_ports_available; portid++) {
|
||||
|
||||
/* RX ring. SP/SC because it's only used by host and a single VM */
|
||||
rte_snprintf(name, sizeof(name), "%s%i", RX_RING_PREFIX, portid);
|
||||
snprintf(name, sizeof(name), "%s%i", RX_RING_PREFIX, portid);
|
||||
r = rte_ring_create(name, NB_MBUF,
|
||||
SOCKET_ID_ANY, RING_F_SP_ENQ | RING_F_SC_DEQ);
|
||||
if (r == NULL)
|
||||
@ -880,7 +880,7 @@ int main(int argc, char **argv)
|
||||
ctrl->vm_ports[portid].rx_ring = r;
|
||||
|
||||
/* TX ring. SP/SC because it's only used by host and a single VM */
|
||||
rte_snprintf(name, sizeof(name), "%s%i", TX_RING_PREFIX, portid);
|
||||
snprintf(name, sizeof(name), "%s%i", TX_RING_PREFIX, portid);
|
||||
r = rte_ring_create(name, NB_MBUF,
|
||||
SOCKET_ID_ANY, RING_F_SP_ENQ | RING_F_SC_DEQ);
|
||||
if (r == NULL)
|
||||
|
@ -1204,7 +1204,7 @@ setup_acl(struct rte_acl_rule *route_base,
|
||||
int dim = ipv6 ? RTE_DIM(ipv6_defs) : RTE_DIM(ipv4_defs);
|
||||
|
||||
/* Create ACL contexts */
|
||||
rte_snprintf(name, sizeof(name), "%s%d",
|
||||
snprintf(name, sizeof(name), "%s%d",
|
||||
ipv6 ? L3FWD_ACL_IPV6_NAME : L3FWD_ACL_IPV4_NAME,
|
||||
socketid);
|
||||
|
||||
@ -1709,7 +1709,7 @@ parse_config(const char *q_arg)
|
||||
if (size >= sizeof(s))
|
||||
return -1;
|
||||
|
||||
rte_snprintf(s, sizeof(s), "%.*s", size, p);
|
||||
snprintf(s, sizeof(s), "%.*s", size, p);
|
||||
if (rte_strsplit(s, sizeof(s), str_fld, _NUM_FLD, ',') !=
|
||||
_NUM_FLD)
|
||||
return -1;
|
||||
@ -1894,7 +1894,7 @@ init_mem(unsigned nb_mbuf)
|
||||
socketid, lcore_id, NB_SOCKETS);
|
||||
}
|
||||
if (pktmbuf_pool[socketid] == NULL) {
|
||||
rte_snprintf(s, sizeof(s), "mbuf_pool_%d", socketid);
|
||||
snprintf(s, sizeof(s), "mbuf_pool_%d", socketid);
|
||||
pktmbuf_pool[socketid] =
|
||||
rte_mempool_create(s, nb_mbuf, MBUF_SIZE,
|
||||
MEMPOOL_CACHE_SIZE,
|
||||
|
@ -1149,7 +1149,7 @@ parse_config(const char *q_arg)
|
||||
if(size >= sizeof(s))
|
||||
return -1;
|
||||
|
||||
rte_snprintf(s, sizeof(s), "%.*s", size, p);
|
||||
snprintf(s, sizeof(s), "%.*s", size, p);
|
||||
if (rte_strsplit(s, sizeof(s), str_fld, _NUM_FLD, ',') !=
|
||||
_NUM_FLD)
|
||||
return -1;
|
||||
@ -1315,7 +1315,7 @@ setup_hash(int socketid)
|
||||
char s[64];
|
||||
|
||||
/* create ipv4 hash */
|
||||
rte_snprintf(s, sizeof(s), "ipv4_l3fwd_hash_%d", socketid);
|
||||
snprintf(s, sizeof(s), "ipv4_l3fwd_hash_%d", socketid);
|
||||
ipv4_l3fwd_hash_params.name = s;
|
||||
ipv4_l3fwd_hash_params.socket_id = socketid;
|
||||
ipv4_l3fwd_lookup_struct[socketid] =
|
||||
@ -1325,7 +1325,7 @@ setup_hash(int socketid)
|
||||
"socket %d\n", socketid);
|
||||
|
||||
/* create ipv6 hash */
|
||||
rte_snprintf(s, sizeof(s), "ipv6_l3fwd_hash_%d", socketid);
|
||||
snprintf(s, sizeof(s), "ipv6_l3fwd_hash_%d", socketid);
|
||||
ipv6_l3fwd_hash_params.name = s;
|
||||
ipv6_l3fwd_hash_params.socket_id = socketid;
|
||||
ipv6_l3fwd_lookup_struct[socketid] =
|
||||
@ -1372,7 +1372,7 @@ setup_lpm(int socketid)
|
||||
char s[64];
|
||||
|
||||
/* create the LPM table */
|
||||
rte_snprintf(s, sizeof(s), "IPV4_L3FWD_LPM_%d", socketid);
|
||||
snprintf(s, sizeof(s), "IPV4_L3FWD_LPM_%d", socketid);
|
||||
ipv4_l3fwd_lookup_struct[socketid] = rte_lpm_create(s, socketid,
|
||||
IPV4_L3FWD_LPM_MAX_RULES, 0);
|
||||
if (ipv4_l3fwd_lookup_struct[socketid] == NULL)
|
||||
@ -1423,7 +1423,7 @@ init_mem(unsigned nb_mbuf)
|
||||
lcore_id, NB_SOCKETS);
|
||||
}
|
||||
if (pktmbuf_pool[socketid] == NULL) {
|
||||
rte_snprintf(s, sizeof(s), "mbuf_pool_%d", socketid);
|
||||
snprintf(s, sizeof(s), "mbuf_pool_%d", socketid);
|
||||
pktmbuf_pool[socketid] =
|
||||
rte_mempool_create(s, nb_mbuf,
|
||||
MBUF_SIZE, MEMPOOL_CACHE_SIZE,
|
||||
|
@ -763,7 +763,7 @@ parse_config(const char *q_arg)
|
||||
if(size >= sizeof(s))
|
||||
return -1;
|
||||
|
||||
rte_snprintf(s, sizeof(s), "%.*s", size, p);
|
||||
snprintf(s, sizeof(s), "%.*s", size, p);
|
||||
if (rte_strsplit(s, sizeof(s), str_fld, _NUM_FLD, ',') != _NUM_FLD)
|
||||
return -1;
|
||||
for (i = 0; i < _NUM_FLD; i++){
|
||||
@ -868,7 +868,7 @@ setup_hash(int socketid)
|
||||
char s[64];
|
||||
|
||||
/* create hashes */
|
||||
rte_snprintf(s, sizeof(s), "l3fwd_hash_%d", socketid);
|
||||
snprintf(s, sizeof(s), "l3fwd_hash_%d", socketid);
|
||||
l3fwd_hash_params.name = s;
|
||||
l3fwd_hash_params.socket_id = socketid;
|
||||
l3fwd_lookup_struct[socketid] = rte_hash_create(&l3fwd_hash_params);
|
||||
@ -900,7 +900,7 @@ setup_lpm(int socketid)
|
||||
char s[64];
|
||||
|
||||
/* create the LPM table */
|
||||
rte_snprintf(s, sizeof(s), "L3FWD_LPM_%d", socketid);
|
||||
snprintf(s, sizeof(s), "L3FWD_LPM_%d", socketid);
|
||||
l3fwd_lookup_struct[socketid] = rte_lpm_create(s, socketid,
|
||||
L3FWD_LPM_MAX_RULES, 0);
|
||||
if (l3fwd_lookup_struct[socketid] == NULL)
|
||||
@ -950,7 +950,7 @@ init_mem(unsigned nb_mbuf)
|
||||
socketid, lcore_id, NB_SOCKETS);
|
||||
}
|
||||
if (pktmbuf_pool[socketid] == NULL) {
|
||||
rte_snprintf(s, sizeof(s), "mbuf_pool_%d", socketid);
|
||||
snprintf(s, sizeof(s), "mbuf_pool_%d", socketid);
|
||||
pktmbuf_pool[socketid] =
|
||||
rte_mempool_create(s, nb_mbuf, MBUF_SIZE,
|
||||
MEMPOOL_CACHE_SIZE,
|
||||
|
@ -1657,7 +1657,7 @@ parse_config(const char *q_arg)
|
||||
if(size >= sizeof(s))
|
||||
return -1;
|
||||
|
||||
rte_snprintf(s, sizeof(s), "%.*s", size, p);
|
||||
snprintf(s, sizeof(s), "%.*s", size, p);
|
||||
if (rte_strsplit(s, sizeof(s), str_fld, _NUM_FLD, ',') != _NUM_FLD)
|
||||
return -1;
|
||||
for (i = 0; i < _NUM_FLD; i++){
|
||||
@ -1998,7 +1998,7 @@ setup_hash(int socketid)
|
||||
char s[64];
|
||||
|
||||
/* create ipv4 hash */
|
||||
rte_snprintf(s, sizeof(s), "ipv4_l3fwd_hash_%d", socketid);
|
||||
snprintf(s, sizeof(s), "ipv4_l3fwd_hash_%d", socketid);
|
||||
ipv4_l3fwd_hash_params.name = s;
|
||||
ipv4_l3fwd_hash_params.socket_id = socketid;
|
||||
ipv4_l3fwd_lookup_struct[socketid] = rte_hash_create(&ipv4_l3fwd_hash_params);
|
||||
@ -2007,7 +2007,7 @@ setup_hash(int socketid)
|
||||
"socket %d\n", socketid);
|
||||
|
||||
/* create ipv6 hash */
|
||||
rte_snprintf(s, sizeof(s), "ipv6_l3fwd_hash_%d", socketid);
|
||||
snprintf(s, sizeof(s), "ipv6_l3fwd_hash_%d", socketid);
|
||||
ipv6_l3fwd_hash_params.name = s;
|
||||
ipv6_l3fwd_hash_params.socket_id = socketid;
|
||||
ipv6_l3fwd_lookup_struct[socketid] = rte_hash_create(&ipv6_l3fwd_hash_params);
|
||||
@ -2051,7 +2051,7 @@ setup_lpm(int socketid)
|
||||
char s[64];
|
||||
|
||||
/* create the LPM table */
|
||||
rte_snprintf(s, sizeof(s), "IPV4_L3FWD_LPM_%d", socketid);
|
||||
snprintf(s, sizeof(s), "IPV4_L3FWD_LPM_%d", socketid);
|
||||
ipv4_l3fwd_lookup_struct[socketid] = rte_lpm_create(s, socketid,
|
||||
IPV4_L3FWD_LPM_MAX_RULES, 0);
|
||||
if (ipv4_l3fwd_lookup_struct[socketid] == NULL)
|
||||
@ -2084,7 +2084,7 @@ setup_lpm(int socketid)
|
||||
}
|
||||
|
||||
/* create the LPM6 table */
|
||||
rte_snprintf(s, sizeof(s), "IPV6_L3FWD_LPM_%d", socketid);
|
||||
snprintf(s, sizeof(s), "IPV6_L3FWD_LPM_%d", socketid);
|
||||
|
||||
config.max_rules = IPV6_L3FWD_LPM_MAX_RULES;
|
||||
config.number_tbl8s = IPV6_L3FWD_LPM_NUMBER_TBL8S;
|
||||
@ -2144,7 +2144,7 @@ init_mem(unsigned nb_mbuf)
|
||||
socketid, lcore_id, NB_SOCKETS);
|
||||
}
|
||||
if (pktmbuf_pool[socketid] == NULL) {
|
||||
rte_snprintf(s, sizeof(s), "mbuf_pool_%d", socketid);
|
||||
snprintf(s, sizeof(s), "mbuf_pool_%d", socketid);
|
||||
pktmbuf_pool[socketid] =
|
||||
rte_mempool_create(s, nb_mbuf, MBUF_SIZE, MEMPOOL_CACHE_SIZE,
|
||||
sizeof(struct rte_pktmbuf_pool_private),
|
||||
|
@ -155,7 +155,7 @@ str_to_unsigned_array(
|
||||
int i, num_splits = 0;
|
||||
|
||||
/* copy s so we don't modify original string */
|
||||
rte_snprintf(str, sizeof(str), "%s", s);
|
||||
snprintf(str, sizeof(str), "%s", s);
|
||||
num_splits = rte_strsplit(str, sizeof(str), splits, num_vals, separator);
|
||||
|
||||
errno = 0;
|
||||
|
@ -146,7 +146,7 @@ app_init_mbuf_pools(void)
|
||||
continue;
|
||||
}
|
||||
|
||||
rte_snprintf(name, sizeof(name), "mbuf_pool_%u", socket);
|
||||
snprintf(name, sizeof(name), "mbuf_pool_%u", socket);
|
||||
printf("Creating the mbuf pool for socket %u ...\n", socket);
|
||||
app.pools[socket] = rte_mempool_create(
|
||||
name,
|
||||
@ -187,7 +187,7 @@ app_init_lpm_tables(void)
|
||||
continue;
|
||||
}
|
||||
|
||||
rte_snprintf(name, sizeof(name), "lpm_table_%u", socket);
|
||||
snprintf(name, sizeof(name), "lpm_table_%u", socket);
|
||||
printf("Creating the LPM table for socket %u ...\n", socket);
|
||||
app.lpm_tables[socket] = rte_lpm_create(
|
||||
name,
|
||||
@ -259,7 +259,7 @@ app_init_rings_rx(void)
|
||||
lcore,
|
||||
socket_io,
|
||||
lcore_worker);
|
||||
rte_snprintf(name, sizeof(name), "app_ring_rx_s%u_io%u_w%u",
|
||||
snprintf(name, sizeof(name), "app_ring_rx_s%u_io%u_w%u",
|
||||
socket_io,
|
||||
lcore,
|
||||
lcore_worker);
|
||||
@ -342,7 +342,7 @@ app_init_rings_tx(void)
|
||||
|
||||
printf("Creating ring to connect worker lcore %u with TX port %u (through I/O lcore %u) (socket %u) ...\n",
|
||||
lcore, port, (unsigned)lcore_io, (unsigned)socket_io);
|
||||
rte_snprintf(name, sizeof(name), "app_ring_tx_s%u_w%u_p%u", socket_io, lcore, port);
|
||||
snprintf(name, sizeof(name), "app_ring_tx_s%u_w%u_p%u", socket_io, lcore, port);
|
||||
ring = rte_ring_create(
|
||||
name,
|
||||
app.ring_tx_size,
|
||||
|
@ -103,7 +103,7 @@ get_printable_mac_addr(uint8_t port)
|
||||
if (unlikely(addresses[port][0]=='\0')){
|
||||
struct ether_addr mac;
|
||||
rte_eth_macaddr_get(port, &mac);
|
||||
rte_snprintf(addresses[port], sizeof(addresses[port]),
|
||||
snprintf(addresses[port], sizeof(addresses[port]),
|
||||
"%02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||
mac.addr_bytes[0], mac.addr_bytes[1], mac.addr_bytes[2],
|
||||
mac.addr_bytes[3], mac.addr_bytes[4], mac.addr_bytes[5]);
|
||||
|
@ -78,7 +78,7 @@ get_rx_queue_name(unsigned id)
|
||||
* by maximum 3 digits (plus an extra byte for safety) */
|
||||
static char buffer[sizeof(MP_CLIENT_RXQ_NAME) + 2];
|
||||
|
||||
rte_snprintf(buffer, sizeof(buffer) - 1, MP_CLIENT_RXQ_NAME, id);
|
||||
snprintf(buffer, sizeof(buffer) - 1, MP_CLIENT_RXQ_NAME, id);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ static void cmd_send_parsed(void *parsed_result,
|
||||
|
||||
if (rte_mempool_get(message_pool, &msg) < 0)
|
||||
rte_panic("Failed to get message buffer\n");
|
||||
rte_snprintf((char *)msg, string_size, "%s", res->message);
|
||||
snprintf((char *)msg, string_size, "%s", res->message);
|
||||
if (rte_ring_enqueue(send_ring, msg) < 0) {
|
||||
printf("Failed to send message - message discarded\n");
|
||||
rte_mempool_put(message_pool, msg);
|
||||
|
@ -347,10 +347,10 @@ lcore_main(void *arg __rte_unused)
|
||||
/* build up message in msgbuf before printing to decrease likelihood
|
||||
* of multi-core message interleaving.
|
||||
*/
|
||||
msgbufpos += rte_snprintf(msgbuf, sizeof(msgbuf) - msgbufpos,
|
||||
msgbufpos += snprintf(msgbuf, sizeof(msgbuf) - msgbufpos,
|
||||
"Lcore %u using ports ", id);
|
||||
for (p = start_port; p < end_port; p++){
|
||||
msgbufpos += rte_snprintf(msgbuf + msgbufpos, sizeof(msgbuf) - msgbufpos,
|
||||
msgbufpos += snprintf(msgbuf + msgbufpos, sizeof(msgbuf) - msgbufpos,
|
||||
"%u ", (unsigned)ports[p]);
|
||||
}
|
||||
printf("%s\n", msgbuf);
|
||||
|
@ -234,7 +234,7 @@ netmap_port_open(uint32_t idx)
|
||||
|
||||
port->fd = rte_netmap_open("/dev/netmap", O_RDWR);
|
||||
|
||||
rte_snprintf(req.nr_name, sizeof(req.nr_name), "%s", port->str);
|
||||
snprintf(req.nr_name, sizeof(req.nr_name), "%s", port->str);
|
||||
req.nr_version = NETMAP_API;
|
||||
req.nr_ringid = 0;
|
||||
|
||||
@ -244,7 +244,7 @@ netmap_port_open(uint32_t idx)
|
||||
return (err);
|
||||
}
|
||||
|
||||
rte_snprintf(req.nr_name, sizeof(req.nr_name), "%s", port->str);
|
||||
snprintf(req.nr_name, sizeof(req.nr_name), "%s", port->str);
|
||||
req.nr_version = NETMAP_API;
|
||||
req.nr_ringid = 0;
|
||||
|
||||
|
@ -324,7 +324,7 @@ netmap_regif(struct nmreq *req, uint32_t idx, uint8_t port)
|
||||
if (req->nr_ringid != 0)
|
||||
return (-EINVAL);
|
||||
|
||||
rte_snprintf(nmif->ni_name, sizeof(nmif->ni_name), "%s", req->nr_name);
|
||||
snprintf(nmif->ni_name, sizeof(nmif->ni_name), "%s", req->nr_name);
|
||||
nmif->ni_version = req->nr_version;
|
||||
|
||||
/* Netmap uses ni_(r|t)x_rings + 1 */
|
||||
|
@ -143,7 +143,7 @@ app_cpu_core_count(void)
|
||||
uint32_t ncores = 0;
|
||||
|
||||
for(i = 0; i < RTE_MAX_LCORE; i++) {
|
||||
len = rte_snprintf(path, sizeof(path), SYS_CPU_DIR, i);
|
||||
len = snprintf(path, sizeof(path), SYS_CPU_DIR, i);
|
||||
if (len <= 0 || (unsigned)len >= sizeof(path))
|
||||
continue;
|
||||
|
||||
|
@ -152,7 +152,7 @@ cfg_load(const char *filename, int flags)
|
||||
goto error1;
|
||||
}
|
||||
|
||||
rte_snprintf(cfg->sections[curr_section]->name,
|
||||
snprintf(cfg->sections[curr_section]->name,
|
||||
sizeof(cfg->sections[0]->name),
|
||||
"%s", &buffer[1]);
|
||||
}
|
||||
@ -189,8 +189,8 @@ cfg_load(const char *filename, int flags)
|
||||
}
|
||||
|
||||
struct cfg_entry *entry = sect->entries[curr_entry];
|
||||
rte_snprintf(entry->name, sizeof(entry->name), "%s", split[0]);
|
||||
rte_snprintf(entry->value, sizeof(entry->value), "%s", split[1]);
|
||||
snprintf(entry->name, sizeof(entry->name), "%s", split[0]);
|
||||
snprintf(entry->value, sizeof(entry->value), "%s", split[1]);
|
||||
_strip(entry->name, strnlen(entry->name, sizeof(entry->name)));
|
||||
_strip(entry->value, strnlen(entry->value, sizeof(entry->value)));
|
||||
}
|
||||
@ -249,7 +249,7 @@ cfg_sections(struct cfg_file *cfg, char *sections[], int max_sections)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < cfg->num_sections && i < max_sections; i++) {
|
||||
rte_snprintf(sections[i], CFG_NAME_LEN, "%s", cfg->sections[i]->name);
|
||||
snprintf(sections[i], CFG_NAME_LEN, "%s", cfg->sections[i]->name);
|
||||
}
|
||||
return i;
|
||||
}
|
||||
@ -355,7 +355,7 @@ cfg_load_port(struct cfg_file *cfg, struct rte_sched_port_params *port_params)
|
||||
char str[32];
|
||||
|
||||
/* Parse WRED min thresholds */
|
||||
rte_snprintf(str, sizeof(str), "tc %d wred min", j);
|
||||
snprintf(str, sizeof(str), "tc %d wred min", j);
|
||||
entry = cfg_get_entry(cfg, "red", str);
|
||||
if (entry) {
|
||||
char *next;
|
||||
@ -371,7 +371,7 @@ cfg_load_port(struct cfg_file *cfg, struct rte_sched_port_params *port_params)
|
||||
}
|
||||
|
||||
/* Parse WRED max thresholds */
|
||||
rte_snprintf(str, sizeof(str), "tc %d wred max", j);
|
||||
snprintf(str, sizeof(str), "tc %d wred max", j);
|
||||
entry = cfg_get_entry(cfg, "red", str);
|
||||
if (entry) {
|
||||
char *next;
|
||||
@ -387,7 +387,7 @@ cfg_load_port(struct cfg_file *cfg, struct rte_sched_port_params *port_params)
|
||||
}
|
||||
|
||||
/* Parse WRED inverse mark probabilities */
|
||||
rte_snprintf(str, sizeof(str), "tc %d wred inv prob", j);
|
||||
snprintf(str, sizeof(str), "tc %d wred inv prob", j);
|
||||
entry = cfg_get_entry(cfg, "red", str);
|
||||
if (entry) {
|
||||
char *next;
|
||||
@ -404,7 +404,7 @@ cfg_load_port(struct cfg_file *cfg, struct rte_sched_port_params *port_params)
|
||||
}
|
||||
|
||||
/* Parse WRED EWMA filter weights */
|
||||
rte_snprintf(str, sizeof(str), "tc %d wred weight", j);
|
||||
snprintf(str, sizeof(str), "tc %d wred weight", j);
|
||||
entry = cfg_get_entry(cfg, "red", str);
|
||||
if (entry) {
|
||||
char *next;
|
||||
@ -440,7 +440,7 @@ cfg_load_pipe(struct cfg_file *cfg, struct rte_sched_pipe_params *pipe_params)
|
||||
|
||||
for (j = 0; j < profiles; j++) {
|
||||
char pipe_name[32];
|
||||
rte_snprintf(pipe_name, sizeof(pipe_name), "pipe profile %d", j);
|
||||
snprintf(pipe_name, sizeof(pipe_name), "pipe profile %d", j);
|
||||
|
||||
entry = cfg_get_entry(cfg, pipe_name, "tb rate");
|
||||
if (entry)
|
||||
@ -533,7 +533,7 @@ cfg_load_subport(struct cfg_file *cfg, struct rte_sched_subport_params *subport_
|
||||
|
||||
for (i = 0; i < MAX_SCHED_SUBPORTS; i++) {
|
||||
char sec_name[CFG_NAME_LEN];
|
||||
rte_snprintf(sec_name, sizeof(sec_name), "subport %d", i);
|
||||
snprintf(sec_name, sizeof(sec_name), "subport %d", i);
|
||||
|
||||
if (cfg_has_section(cfg, sec_name)) {
|
||||
entry = cfg_get_entry(cfg, sec_name, "tb rate");
|
||||
@ -592,7 +592,7 @@ cfg_load_subport(struct cfg_file *cfg, struct rte_sched_subport_params *subport_
|
||||
for (k = begin; k <= end; k++) {
|
||||
char profile_name[CFG_NAME_LEN];
|
||||
|
||||
rte_snprintf(profile_name, sizeof(profile_name),
|
||||
snprintf(profile_name, sizeof(profile_name),
|
||||
"pipe profile %d", profile);
|
||||
if (cfg_has_section(cfg, profile_name))
|
||||
app_pipe_to_profile[i][k] = profile;
|
||||
|
@ -248,7 +248,7 @@ app_init_sched_port(uint32_t portid, uint32_t socketid)
|
||||
|
||||
port_params.socket = socketid;
|
||||
port_params.rate = (uint64_t) link.link_speed * 1000 * 1000 / 8;
|
||||
rte_snprintf(port_name, sizeof(port_name), "port_%d", portid);
|
||||
snprintf(port_name, sizeof(port_name), "port_%d", portid);
|
||||
port_params.name = port_name;
|
||||
|
||||
port = rte_sched_port_config(&port_params);
|
||||
@ -319,7 +319,7 @@ int app_init(void)
|
||||
uint32_t socket = rte_lcore_to_socket_id(qos_conf[i].rx_core);
|
||||
struct rte_ring *ring;
|
||||
|
||||
rte_snprintf(ring_name, MAX_NAME_LEN, "ring-%u-%u", i, qos_conf[i].rx_core);
|
||||
snprintf(ring_name, MAX_NAME_LEN, "ring-%u-%u", i, qos_conf[i].rx_core);
|
||||
ring = rte_ring_lookup(ring_name);
|
||||
if (ring == NULL)
|
||||
qos_conf[i].rx_ring = rte_ring_create(ring_name, ring_conf.ring_size,
|
||||
@ -327,7 +327,7 @@ int app_init(void)
|
||||
else
|
||||
qos_conf[i].rx_ring = ring;
|
||||
|
||||
rte_snprintf(ring_name, MAX_NAME_LEN, "ring-%u-%u", i, qos_conf[i].tx_core);
|
||||
snprintf(ring_name, MAX_NAME_LEN, "ring-%u-%u", i, qos_conf[i].tx_core);
|
||||
ring = rte_ring_lookup(ring_name);
|
||||
if (ring == NULL)
|
||||
qos_conf[i].tx_ring = rte_ring_create(ring_name, ring_conf.ring_size,
|
||||
@ -337,7 +337,7 @@ int app_init(void)
|
||||
|
||||
|
||||
/* create the mbuf pools for each RX Port */
|
||||
rte_snprintf(pool_name, MAX_NAME_LEN, "mbuf_pool%u", i);
|
||||
snprintf(pool_name, MAX_NAME_LEN, "mbuf_pool%u", i);
|
||||
qos_conf[i].mbuf_pool = rte_mempool_create(pool_name, mp_size, MBUF_SIZE,
|
||||
burst_conf.rx_burst * 4,
|
||||
sizeof(struct rte_pktmbuf_pool_private),
|
||||
|
@ -152,7 +152,7 @@ void init_ring(int lcore_id, uint8_t port_id)
|
||||
struct rte_ring *ring;
|
||||
char ring_name[RTE_RING_NAMESIZE];
|
||||
|
||||
rte_snprintf(ring_name, RTE_RING_NAMESIZE,
|
||||
snprintf(ring_name, RTE_RING_NAMESIZE,
|
||||
"core%d_port%d", lcore_id, port_id);
|
||||
ring = rte_ring_create(ring_name, RING_SIZE, rte_socket_id(),
|
||||
RING_F_SP_ENQ | RING_F_SC_DEQ);
|
||||
|
@ -143,7 +143,7 @@
|
||||
/* Max number of devices. Limited by vmdq. */
|
||||
#define MAX_DEVICES 64
|
||||
|
||||
/* Size of buffers used for rte_snprintfs. */
|
||||
/* Size of buffers used for snprintfs. */
|
||||
#define MAX_PRINT_BUFF 6072
|
||||
|
||||
/* Maximum character device basename size. */
|
||||
@ -498,7 +498,7 @@ us_vhost_parse_basename(const char *q_arg)
|
||||
if (strnlen(q_arg, MAX_BASENAME_SZ) > MAX_BASENAME_SZ)
|
||||
return -1;
|
||||
else
|
||||
rte_snprintf((char*)&dev_basename, MAX_BASENAME_SZ, "%s", q_arg);
|
||||
snprintf((char*)&dev_basename, MAX_BASENAME_SZ, "%s", q_arg);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -837,14 +837,14 @@ static unsigned check_ports_num(unsigned nb_ports)
|
||||
char packet[MAX_PRINT_BUFF]; \
|
||||
\
|
||||
if ((header)) \
|
||||
rte_snprintf(packet, MAX_PRINT_BUFF, "(%"PRIu64") Header size %d: ", (device->device_fh), (size)); \
|
||||
snprintf(packet, MAX_PRINT_BUFF, "(%"PRIu64") Header size %d: ", (device->device_fh), (size)); \
|
||||
else \
|
||||
rte_snprintf(packet, MAX_PRINT_BUFF, "(%"PRIu64") Packet size %d: ", (device->device_fh), (size)); \
|
||||
snprintf(packet, MAX_PRINT_BUFF, "(%"PRIu64") Packet size %d: ", (device->device_fh), (size)); \
|
||||
for (index = 0; index < (size); index++) { \
|
||||
rte_snprintf(packet + strnlen(packet, MAX_PRINT_BUFF), MAX_PRINT_BUFF - strnlen(packet, MAX_PRINT_BUFF), \
|
||||
snprintf(packet + strnlen(packet, MAX_PRINT_BUFF), MAX_PRINT_BUFF - strnlen(packet, MAX_PRINT_BUFF), \
|
||||
"%02hhx ", pkt_addr[index]); \
|
||||
} \
|
||||
rte_snprintf(packet + strnlen(packet, MAX_PRINT_BUFF), MAX_PRINT_BUFF - strnlen(packet, MAX_PRINT_BUFF), "\n"); \
|
||||
snprintf(packet + strnlen(packet, MAX_PRINT_BUFF), MAX_PRINT_BUFF - strnlen(packet, MAX_PRINT_BUFF), "\n"); \
|
||||
\
|
||||
LOG_DEBUG(VHOST_DATA, "%s", packet); \
|
||||
} while(0)
|
||||
@ -2992,9 +2992,9 @@ MAIN(int argc, char *argv[])
|
||||
+ num_switching_cores * MAX_PKT_BURST;
|
||||
|
||||
for (queue_id = 0; queue_id < MAX_QUEUES; queue_id++) {
|
||||
rte_snprintf(pool_name, sizeof(pool_name),
|
||||
snprintf(pool_name, sizeof(pool_name),
|
||||
"rxmbuf_pool_%u", queue_id);
|
||||
rte_snprintf(ring_name, sizeof(ring_name),
|
||||
snprintf(ring_name, sizeof(ring_name),
|
||||
"rxmbuf_ring_%u", queue_id);
|
||||
setup_mempool_tbl(rte_socket_id(), queue_id,
|
||||
pool_name, ring_name, nb_mbuf);
|
||||
@ -3005,9 +3005,9 @@ MAIN(int argc, char *argv[])
|
||||
+ num_switching_cores * MAX_PKT_BURST;
|
||||
|
||||
for (queue_id = 0; queue_id < MAX_QUEUES; queue_id++) {
|
||||
rte_snprintf(pool_name, sizeof(pool_name),
|
||||
snprintf(pool_name, sizeof(pool_name),
|
||||
"txmbuf_pool_%u", queue_id);
|
||||
rte_snprintf(ring_name, sizeof(ring_name),
|
||||
snprintf(ring_name, sizeof(ring_name),
|
||||
"txmbuf_ring_%u", queue_id);
|
||||
setup_mempool_tbl(rte_socket_id(),
|
||||
(queue_id + MAX_QUEUES),
|
||||
|
@ -325,11 +325,11 @@ register_cuse_device(const char *base_name, int index, struct vhost_net_device_o
|
||||
* of userspace vhost which we can then add devices to separately.
|
||||
*/
|
||||
if (strncmp(base_name, default_cdev, PATH_MAX)!=0) {
|
||||
rte_snprintf(device_name, PATH_MAX, "DEVNAME=%s-%d", base_name, index);
|
||||
rte_snprintf(char_device_name, PATH_MAX, "/dev/%s-%d", base_name, index);
|
||||
snprintf(device_name, PATH_MAX, "DEVNAME=%s-%d", base_name, index);
|
||||
snprintf(char_device_name, PATH_MAX, "/dev/%s-%d", base_name, index);
|
||||
} else {
|
||||
rte_snprintf(device_name, PATH_MAX, "DEVNAME=%s", base_name);
|
||||
rte_snprintf(char_device_name, PATH_MAX, "/dev/%s", base_name);
|
||||
snprintf(device_name, PATH_MAX, "DEVNAME=%s", base_name);
|
||||
snprintf(char_device_name, PATH_MAX, "/dev/%s", base_name);
|
||||
}
|
||||
|
||||
/* Check if device already exists. */
|
||||
|
@ -136,9 +136,9 @@ host_memory_map (struct virtio_net *dev, struct virtio_memory *mem, pid_t pid, u
|
||||
char *end = NULL;
|
||||
|
||||
/* Path where mem files are located. */
|
||||
rte_snprintf (procdir, PATH_MAX, "/proc/%u/fd/", pid);
|
||||
snprintf (procdir, PATH_MAX, "/proc/%u/fd/", pid);
|
||||
/* Maps file used to locate mem file. */
|
||||
rte_snprintf (mapfile, PATH_MAX, "/proc/%u/maps", pid);
|
||||
snprintf (mapfile, PATH_MAX, "/proc/%u/maps", pid);
|
||||
|
||||
fmap = fopen(mapfile, "r");
|
||||
if (fmap == NULL) {
|
||||
@ -224,7 +224,7 @@ host_memory_map (struct virtio_net *dev, struct virtio_memory *mem, pid_t pid, u
|
||||
|
||||
/* Read the fd directory contents. */
|
||||
while (NULL != (dptr = readdir(dp))) {
|
||||
rte_snprintf (memfile, PATH_MAX, "/proc/%u/fd/%s", pid, dptr->d_name);
|
||||
snprintf (memfile, PATH_MAX, "/proc/%u/fd/%s", pid, dptr->d_name);
|
||||
realpath(memfile, resolved_path);
|
||||
if (resolved_path == NULL) {
|
||||
RTE_LOG(ERR, VHOST_CONFIG, "(%"PRIu64") Failed to resolve fd directory\n", dev->device_fh);
|
||||
|
@ -110,7 +110,7 @@
|
||||
/* Max number of devices. Limited by vmdq. */
|
||||
#define MAX_DEVICES 64
|
||||
|
||||
/* Size of buffers used for rte_snprintfs. */
|
||||
/* Size of buffers used for snprintfs. */
|
||||
#define MAX_PRINT_BUFF 6072
|
||||
|
||||
|
||||
@ -538,14 +538,14 @@ static unsigned check_ports_num(unsigned nb_ports)
|
||||
char packet[MAX_PRINT_BUFF]; \
|
||||
\
|
||||
if ((header)) \
|
||||
rte_snprintf(packet, MAX_PRINT_BUFF, "(%"PRIu64") Header size %d: ", (device->device_fh), (size)); \
|
||||
snprintf(packet, MAX_PRINT_BUFF, "(%"PRIu64") Header size %d: ", (device->device_fh), (size)); \
|
||||
else \
|
||||
rte_snprintf(packet, MAX_PRINT_BUFF, "(%"PRIu64") Packet size %d: ", (device->device_fh), (size)); \
|
||||
snprintf(packet, MAX_PRINT_BUFF, "(%"PRIu64") Packet size %d: ", (device->device_fh), (size)); \
|
||||
for (index = 0; index < (size); index++) { \
|
||||
rte_snprintf(packet + strnlen(packet, MAX_PRINT_BUFF), MAX_PRINT_BUFF - strnlen(packet, MAX_PRINT_BUFF), \
|
||||
snprintf(packet + strnlen(packet, MAX_PRINT_BUFF), MAX_PRINT_BUFF - strnlen(packet, MAX_PRINT_BUFF), \
|
||||
"%02hhx ", pkt_addr[index]); \
|
||||
} \
|
||||
rte_snprintf(packet + strnlen(packet, MAX_PRINT_BUFF), MAX_PRINT_BUFF - strnlen(packet, MAX_PRINT_BUFF), "\n"); \
|
||||
snprintf(packet + strnlen(packet, MAX_PRINT_BUFF), MAX_PRINT_BUFF - strnlen(packet, MAX_PRINT_BUFF), "\n"); \
|
||||
\
|
||||
LOG_DEBUG(VHOST_DATA, "%s", packet); \
|
||||
} while(0)
|
||||
|
@ -434,8 +434,8 @@ static void virtio_init(void)
|
||||
continue;
|
||||
|
||||
for (j = 0; j < RTE_MAX_ETHPORTS; j++) {
|
||||
rte_snprintf(node, PATH_MAX, "%s%d", VIRTIO_START, j);
|
||||
rte_snprintf(path, PATH_MAX, XEN_VM_NODE_FMT,
|
||||
snprintf(node, PATH_MAX, "%s%d", VIRTIO_START, j);
|
||||
snprintf(path, PATH_MAX, XEN_VM_NODE_FMT,
|
||||
dom_id, node);
|
||||
|
||||
th = xs_transaction_start(watch.xs);
|
||||
|
@ -400,7 +400,7 @@ parse_mpool_va(struct xen_mempool *mempool)
|
||||
int ret = -1;
|
||||
|
||||
errno = 0;
|
||||
rte_snprintf(path, sizeof(path),
|
||||
snprintf(path, sizeof(path),
|
||||
XEN_VM_ROOTNODE_FMT"/%d_"XEN_GVA_SUFFIX,
|
||||
mempool->dom_id, mempool->pool_idx);
|
||||
|
||||
@ -484,7 +484,7 @@ parse_mempoolnode(struct xen_guest *guest)
|
||||
|
||||
while (1) {
|
||||
/* check if null terminated */
|
||||
rte_snprintf(path, sizeof(path),
|
||||
snprintf(path, sizeof(path),
|
||||
XEN_VM_ROOTNODE_FMT"/%d_"XEN_MEMPOOL_SUFFIX,
|
||||
guest->dom_id,
|
||||
guest->pool_num);
|
||||
@ -541,7 +541,7 @@ xen_map_vringflag(struct xen_vring *vring)
|
||||
int pg_sz = getpagesize();
|
||||
char *end;
|
||||
|
||||
rte_snprintf(path, sizeof(path),
|
||||
snprintf(path, sizeof(path),
|
||||
XEN_VM_ROOTNODE_FMT"/%d_"XEN_VRINGFLAG_SUFFIX,
|
||||
vring->dom_id, vring->virtio_idx);
|
||||
|
||||
@ -669,7 +669,7 @@ xen_parse_etheraddr(struct xen_vring *vring)
|
||||
uint32_t len;
|
||||
int ret = -1;
|
||||
|
||||
rte_snprintf(path, sizeof(path),
|
||||
snprintf(path, sizeof(path),
|
||||
XEN_VM_ROOTNODE_FMT"/%d_"XEN_ADDR_SUFFIX,
|
||||
vring->dom_id, vring->virtio_idx);
|
||||
|
||||
@ -695,7 +695,7 @@ parse_vringnode(struct xen_guest *guest, uint32_t virtio_idx)
|
||||
struct xen_vring *vring = NULL;
|
||||
|
||||
/*check if null terminated */
|
||||
rte_snprintf(path, sizeof(path),
|
||||
snprintf(path, sizeof(path),
|
||||
XEN_VM_ROOTNODE_FMT"/%d_"XEN_RXVRING_SUFFIX,
|
||||
guest->dom_id,
|
||||
virtio_idx);
|
||||
@ -706,7 +706,7 @@ parse_vringnode(struct xen_guest *guest, uint32_t virtio_idx)
|
||||
goto err;
|
||||
|
||||
/*check if null terminated */
|
||||
rte_snprintf(path, sizeof(path),
|
||||
snprintf(path, sizeof(path),
|
||||
XEN_VM_ROOTNODE_FMT"/%d_"XEN_TXVRING_SUFFIX,
|
||||
guest->dom_id,
|
||||
virtio_idx);
|
||||
|
@ -96,7 +96,7 @@ rte_acl_create(const struct rte_acl_param *param)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rte_snprintf(name, sizeof(name), "ACL_%s", param->name);
|
||||
snprintf(name, sizeof(name), "ACL_%s", param->name);
|
||||
|
||||
/* calculate amount of memory required for pattern set. */
|
||||
sz = sizeof(*ctx) + param->max_rule_num * param->rule_size;
|
||||
@ -119,7 +119,7 @@ rte_acl_create(const struct rte_acl_param *param)
|
||||
ctx->max_rules = param->max_rule_num;
|
||||
ctx->rule_sz = param->rule_size;
|
||||
ctx->socket_id = param->socket_id;
|
||||
rte_snprintf(ctx->name, sizeof(ctx->name), "%s", param->name);
|
||||
snprintf(ctx->name, sizeof(ctx->name), "%s", param->name);
|
||||
|
||||
TAILQ_INSERT_TAIL(acl_list, ctx, next);
|
||||
|
||||
|
@ -229,7 +229,7 @@ rte_dummy_tailq(void)
|
||||
/*
|
||||
* rte_string related
|
||||
*/
|
||||
#define rte_snprintf(str, len, frmt, args...) snprintf(str, len, frmt, ##args)
|
||||
#define snprintf(str, len, frmt, args...) snprintf(str, len, frmt, ##args)
|
||||
|
||||
/*
|
||||
* rte_log related
|
||||
|
@ -169,7 +169,7 @@ rte_cfgfile_load(const char *filename, int flags)
|
||||
goto error1;
|
||||
}
|
||||
|
||||
rte_snprintf(cfg->sections[curr_section]->name,
|
||||
snprintf(cfg->sections[curr_section]->name,
|
||||
sizeof(cfg->sections[0]->name),
|
||||
"%s", &buffer[1]);
|
||||
} else {
|
||||
@ -213,9 +213,9 @@ rte_cfgfile_load(const char *filename, int flags)
|
||||
|
||||
struct rte_cfgfile_entry *entry = sect->entries[
|
||||
curr_entry];
|
||||
rte_snprintf(entry->name, sizeof(entry->name), "%s",
|
||||
snprintf(entry->name, sizeof(entry->name), "%s",
|
||||
split[0]);
|
||||
rte_snprintf(entry->value, sizeof(entry->value), "%s",
|
||||
snprintf(entry->value, sizeof(entry->value), "%s",
|
||||
split[1]);
|
||||
_strip(entry->name, strnlen(entry->name,
|
||||
sizeof(entry->name)));
|
||||
@ -283,7 +283,7 @@ rte_cfgfile_sections(struct rte_cfgfile *cfg, char *sections[],
|
||||
int i;
|
||||
|
||||
for (i = 0; i < cfg->num_sections && i < max_sections; i++)
|
||||
rte_snprintf(sections[i], CFG_NAME_LEN, "%s",
|
||||
snprintf(sections[i], CFG_NAME_LEN, "%s",
|
||||
cfg->sections[i]->name);
|
||||
|
||||
return i;
|
||||
|
@ -122,7 +122,7 @@ cmdline_set_prompt(struct cmdline *cl, const char *prompt)
|
||||
{
|
||||
if (!cl || !prompt)
|
||||
return;
|
||||
rte_snprintf(cl->prompt, sizeof(cl->prompt), "%s", prompt);
|
||||
snprintf(cl->prompt, sizeof(cl->prompt), "%s", prompt);
|
||||
}
|
||||
|
||||
struct cmdline *
|
||||
|
@ -270,7 +270,7 @@ cmdline_parse(struct cmdline *cl, const char * buf)
|
||||
}
|
||||
|
||||
#ifdef RTE_LIBRTE_CMDLINE_DEBUG
|
||||
rte_snprintf(debug_buf, (linelen>64 ? 64 : linelen), "%s", buf);
|
||||
snprintf(debug_buf, (linelen>64 ? 64 : linelen), "%s", buf);
|
||||
debug_printf("Parse line : len=%d, <%s>\n", linelen, debug_buf);
|
||||
#endif
|
||||
|
||||
@ -415,7 +415,7 @@ cmdline_complete(struct cmdline *cl, const char *buf, int *state,
|
||||
if (!strncmp(partial_tok, tmpbuf,
|
||||
partial_tok_len)) {
|
||||
if (comp_len == -1) {
|
||||
rte_snprintf(comp_buf, sizeof(comp_buf),
|
||||
snprintf(comp_buf, sizeof(comp_buf),
|
||||
"%s", tmpbuf + partial_tok_len);
|
||||
comp_len =
|
||||
strnlen(tmpbuf + partial_tok_len,
|
||||
@ -452,7 +452,7 @@ cmdline_complete(struct cmdline *cl, const char *buf, int *state,
|
||||
if ((unsigned)(comp_len + 1) > size)
|
||||
return 0;
|
||||
|
||||
rte_snprintf(dst, size, "%s", comp_buf);
|
||||
snprintf(dst, size, "%s", comp_buf);
|
||||
dst[comp_len] = 0;
|
||||
return 2;
|
||||
}
|
||||
@ -493,14 +493,14 @@ cmdline_complete(struct cmdline *cl, const char *buf, int *state,
|
||||
sizeof(tmpbuf));
|
||||
help_str = inst->help_str;
|
||||
if (help_str)
|
||||
rte_snprintf(dst, size, "[%s]: %s", tmpbuf,
|
||||
snprintf(dst, size, "[%s]: %s", tmpbuf,
|
||||
help_str);
|
||||
else
|
||||
rte_snprintf(dst, size, "[%s]: No help",
|
||||
snprintf(dst, size, "[%s]: No help",
|
||||
tmpbuf);
|
||||
}
|
||||
else {
|
||||
rte_snprintf(dst, size, "[RETURN]");
|
||||
snprintf(dst, size, "[RETURN]");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@ -528,16 +528,16 @@ cmdline_complete(struct cmdline *cl, const char *buf, int *state,
|
||||
continue;
|
||||
}
|
||||
(*state)++;
|
||||
l=rte_snprintf(dst, size, "%s", tmpbuf);
|
||||
l=snprintf(dst, size, "%s", tmpbuf);
|
||||
if (l>=0 && token_hdr.ops->get_help) {
|
||||
token_hdr.ops->get_help(token_p, tmpbuf,
|
||||
sizeof(tmpbuf));
|
||||
help_str = inst->help_str;
|
||||
if (help_str)
|
||||
rte_snprintf(dst+l, size-l, "[%s]: %s",
|
||||
snprintf(dst+l, size-l, "[%s]: %s",
|
||||
tmpbuf, help_str);
|
||||
else
|
||||
rte_snprintf(dst+l, size-l,
|
||||
snprintf(dst+l, size-l,
|
||||
"[%s]: No help", tmpbuf);
|
||||
}
|
||||
|
||||
|
@ -154,7 +154,7 @@ cmdline_parse_etheraddr(__attribute__((unused)) cmdline_parse_token_hdr_t *tk,
|
||||
(token_len != ETHER_ADDRSTRLENSHORT - 1))
|
||||
return -1;
|
||||
|
||||
rte_snprintf(ether_str, token_len+1, "%s", buf);
|
||||
snprintf(ether_str, token_len+1, "%s", buf);
|
||||
|
||||
tmp = my_ether_aton(ether_str);
|
||||
if (tmp == NULL)
|
||||
@ -170,7 +170,7 @@ cmdline_get_help_etheraddr(__attribute__((unused)) cmdline_parse_token_hdr_t *tk
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = rte_snprintf(dstbuf, size, "Ethernet address");
|
||||
ret = snprintf(dstbuf, size, "Ethernet address");
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
return 0;
|
||||
|
@ -327,7 +327,7 @@ cmdline_parse_ipaddr(cmdline_parse_token_hdr_t *tk, const char *buf, void *res)
|
||||
if (token_len >= INET6_ADDRSTRLEN+4)
|
||||
return -1;
|
||||
|
||||
rte_snprintf(ip_str, token_len+1, "%s", buf);
|
||||
snprintf(ip_str, token_len+1, "%s", buf);
|
||||
|
||||
/* convert the network prefix */
|
||||
if (tk2->ipaddr_data.flags & CMDLINE_IPADDR_NETWORK) {
|
||||
@ -379,25 +379,25 @@ int cmdline_get_help_ipaddr(cmdline_parse_token_hdr_t *tk, char *dstbuf,
|
||||
|
||||
switch (tk2->ipaddr_data.flags) {
|
||||
case CMDLINE_IPADDR_V4:
|
||||
rte_snprintf(dstbuf, size, "IPv4");
|
||||
snprintf(dstbuf, size, "IPv4");
|
||||
break;
|
||||
case CMDLINE_IPADDR_V6:
|
||||
rte_snprintf(dstbuf, size, "IPv6");
|
||||
snprintf(dstbuf, size, "IPv6");
|
||||
break;
|
||||
case CMDLINE_IPADDR_V4|CMDLINE_IPADDR_V6:
|
||||
rte_snprintf(dstbuf, size, "IPv4/IPv6");
|
||||
snprintf(dstbuf, size, "IPv4/IPv6");
|
||||
break;
|
||||
case CMDLINE_IPADDR_NETWORK|CMDLINE_IPADDR_V4:
|
||||
rte_snprintf(dstbuf, size, "IPv4 network");
|
||||
snprintf(dstbuf, size, "IPv4 network");
|
||||
break;
|
||||
case CMDLINE_IPADDR_NETWORK|CMDLINE_IPADDR_V6:
|
||||
rte_snprintf(dstbuf, size, "IPv6 network");
|
||||
snprintf(dstbuf, size, "IPv6 network");
|
||||
break;
|
||||
case CMDLINE_IPADDR_NETWORK|CMDLINE_IPADDR_V4|CMDLINE_IPADDR_V6:
|
||||
rte_snprintf(dstbuf, size, "IPv4/IPv6 network");
|
||||
snprintf(dstbuf, size, "IPv4/IPv6 network");
|
||||
break;
|
||||
default:
|
||||
rte_snprintf(dstbuf, size, "IPaddr (bad flags)");
|
||||
snprintf(dstbuf, size, "IPaddr (bad flags)");
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
|
@ -358,7 +358,7 @@ cmdline_get_help_num(cmdline_parse_token_hdr_t *tk, char *dstbuf, unsigned int s
|
||||
/* if (nd.type >= (sizeof(num_help)/sizeof(const char *))) */
|
||||
/* return -1; */
|
||||
|
||||
ret = rte_snprintf(dstbuf, size, "%s", num_help[nd.type]);
|
||||
ret = snprintf(dstbuf, size, "%s", num_help[nd.type]);
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
dstbuf[size-1] = '\0';
|
||||
|
@ -145,7 +145,7 @@ cmdline_parse_portlist(__attribute__((unused)) cmdline_parse_token_hdr_t *tk,
|
||||
if (token_len >= PORTLIST_TOKEN_SIZE)
|
||||
return (-1);
|
||||
|
||||
rte_snprintf(portlist_str, token_len+1, "%s", buf);
|
||||
snprintf(portlist_str, token_len+1, "%s", buf);
|
||||
|
||||
if (pl) {
|
||||
pl->map = 0;
|
||||
@ -163,7 +163,7 @@ cmdline_get_help_portlist(__attribute__((unused)) cmdline_parse_token_hdr_t *tk,
|
||||
char *dstbuf, unsigned int size)
|
||||
{
|
||||
int ret;
|
||||
ret = rte_snprintf(dstbuf, size, "range of ports as 3,4-6,8-19,20");
|
||||
ret = snprintf(dstbuf, size, "range of ports as 3,4-6,8-19,20");
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
return 0;
|
||||
|
@ -159,7 +159,7 @@ cmdline_parse_string(cmdline_parse_token_hdr_t *tk, const char *buf, void *res)
|
||||
|
||||
if (res) {
|
||||
/* we are sure that token_len is < STR_TOKEN_SIZE-1 */
|
||||
rte_snprintf(res, STR_TOKEN_SIZE, "%s", buf);
|
||||
snprintf(res, STR_TOKEN_SIZE, "%s", buf);
|
||||
*((char *)res + token_len) = 0;
|
||||
}
|
||||
|
||||
@ -239,11 +239,11 @@ int cmdline_get_help_string(cmdline_parse_token_hdr_t *tk, char *dstbuf,
|
||||
|
||||
if (s) {
|
||||
if (get_next_token(s))
|
||||
rte_snprintf(dstbuf, size, MULTISTRING_HELP);
|
||||
snprintf(dstbuf, size, MULTISTRING_HELP);
|
||||
else
|
||||
rte_snprintf(dstbuf, size, FIXEDSTRING_HELP);
|
||||
snprintf(dstbuf, size, FIXEDSTRING_HELP);
|
||||
} else
|
||||
rte_snprintf(dstbuf, size, ANYSTRING_HELP);
|
||||
snprintf(dstbuf, size, ANYSTRING_HELP);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -425,7 +425,7 @@ rte_distributor_create(const char *name,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rte_snprintf(mz_name, sizeof(mz_name), RTE_DISTRIB_PREFIX"%s", name);
|
||||
snprintf(mz_name, sizeof(mz_name), RTE_DISTRIB_PREFIX"%s", name);
|
||||
mz = rte_memzone_reserve(mz_name, sizeof(*d), socket_id, NO_FLAGS);
|
||||
if (mz == NULL) {
|
||||
rte_errno = ENOMEM;
|
||||
@ -433,7 +433,7 @@ rte_distributor_create(const char *name,
|
||||
}
|
||||
|
||||
d = mz->addr;
|
||||
rte_snprintf(d->name, sizeof(d->name), "%s", name);
|
||||
snprintf(d->name, sizeof(d->name), "%s", name);
|
||||
d->num_workers = num_workers;
|
||||
|
||||
rte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK);
|
||||
|
@ -100,7 +100,7 @@ rte_eal_contigmem_init(void)
|
||||
return -1;
|
||||
}
|
||||
|
||||
rte_snprintf(physaddr_str, sizeof(physaddr_str), "hw.contigmem"
|
||||
snprintf(physaddr_str, sizeof(physaddr_str), "hw.contigmem"
|
||||
".physaddr.%d", j);
|
||||
error = sysctlbyname(physaddr_str, &physaddr, &sysctl_size,
|
||||
NULL, 0);
|
||||
|
@ -211,7 +211,7 @@ pci_uio_map_resource(struct rte_pci_device *dev)
|
||||
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
|
||||
return (pci_uio_map_secondary(dev));
|
||||
|
||||
rte_snprintf(devname, sizeof(devname), "/dev/uio@pci:%u:%u:%u",
|
||||
snprintf(devname, sizeof(devname), "/dev/uio@pci:%u:%u:%u",
|
||||
dev->addr.bus, dev->addr.devid, dev->addr.function);
|
||||
|
||||
if (access(devname, O_RDWR) < 0) {
|
||||
@ -236,7 +236,7 @@ pci_uio_map_resource(struct rte_pci_device *dev)
|
||||
return (-1);
|
||||
}
|
||||
|
||||
rte_snprintf(uio_res->path, sizeof(uio_res->path), "%s", devname);
|
||||
snprintf(uio_res->path, sizeof(uio_res->path), "%s", devname);
|
||||
memcpy(&uio_res->pci_addr, &dev->addr, sizeof(uio_res->pci_addr));
|
||||
|
||||
|
||||
|
@ -62,7 +62,7 @@ eal_runtime_config_path(void)
|
||||
|
||||
if (getuid() != 0 && home_dir != NULL)
|
||||
directory = home_dir;
|
||||
rte_snprintf(buffer, sizeof(buffer) - 1, RUNTIME_CONFIG_FMT, directory,
|
||||
snprintf(buffer, sizeof(buffer) - 1, RUNTIME_CONFIG_FMT, directory,
|
||||
internal_config.hugefile_prefix);
|
||||
return buffer;
|
||||
}
|
||||
@ -79,7 +79,7 @@ eal_hugepage_info_path(void)
|
||||
|
||||
if (getuid() != 0 && home_dir != NULL)
|
||||
directory = home_dir;
|
||||
rte_snprintf(buffer, sizeof(buffer) - 1, HUGEPAGE_INFO_FMT, directory,
|
||||
snprintf(buffer, sizeof(buffer) - 1, HUGEPAGE_INFO_FMT, directory,
|
||||
internal_config.hugefile_prefix);
|
||||
return buffer;
|
||||
}
|
||||
@ -91,7 +91,7 @@ eal_hugepage_info_path(void)
|
||||
static inline const char *
|
||||
eal_get_hugefile_path(char *buffer, size_t buflen, const char *hugedir, int f_id)
|
||||
{
|
||||
rte_snprintf(buffer, buflen, HUGEFILE_FMT, hugedir,
|
||||
snprintf(buffer, buflen, HUGEFILE_FMT, hugedir,
|
||||
internal_config.hugefile_prefix, f_id);
|
||||
buffer[buflen - 1] = '\0';
|
||||
return buffer;
|
||||
@ -101,7 +101,7 @@ eal_get_hugefile_path(char *buffer, size_t buflen, const char *hugedir, int f_id
|
||||
static inline const char *
|
||||
eal_get_hugefile_temp_path(char *buffer, size_t buflen, const char *hugedir, int f_id)
|
||||
{
|
||||
rte_snprintf(buffer, buflen, TEMP_HUGEFILE_FMT, hugedir,
|
||||
snprintf(buffer, buflen, TEMP_HUGEFILE_FMT, hugedir,
|
||||
internal_config.hugefile_prefix, f_id);
|
||||
buffer[buflen - 1] = '\0';
|
||||
return buffer;
|
||||
|
@ -52,7 +52,7 @@ rte_strerror(int errnum)
|
||||
/* since some implementations of strerror_r throw an error
|
||||
* themselves if errnum is too big, we handle that case here */
|
||||
if (errnum > RTE_MAX_ERRNO)
|
||||
rte_snprintf(RTE_PER_LCORE(retval), RETVAL_SZ,
|
||||
snprintf(RTE_PER_LCORE(retval), RETVAL_SZ,
|
||||
#ifdef RTE_EXEC_ENV_BSDAPP
|
||||
"Unknown error: %d", errnum);
|
||||
#else
|
||||
|
@ -63,16 +63,16 @@ rte_hexdump(FILE *f, const char * title, const void * buf, unsigned int len)
|
||||
ofs = 0;
|
||||
while (ofs < len) {
|
||||
/* format the line in the buffer, then use printf to output to screen */
|
||||
out = rte_snprintf(line, LINE_LEN, "%08X:", ofs);
|
||||
out = snprintf(line, LINE_LEN, "%08X:", ofs);
|
||||
for (i = 0; ((ofs + i) < len) && (i < 16); i++)
|
||||
out += rte_snprintf(line+out, LINE_LEN - out, " %02X", (data[ofs+i] & 0xff));
|
||||
out += snprintf(line+out, LINE_LEN - out, " %02X", (data[ofs+i] & 0xff));
|
||||
for(; i <= 16; i++)
|
||||
out += rte_snprintf(line+out, LINE_LEN - out, " | ");
|
||||
out += snprintf(line+out, LINE_LEN - out, " | ");
|
||||
for(i = 0; (ofs < len) && (i < 16); i++, ofs++) {
|
||||
unsigned char c = data[ofs];
|
||||
if ( (c < ' ') || (c > '~'))
|
||||
c = '.';
|
||||
out += rte_snprintf(line+out, LINE_LEN - out, "%c", c);
|
||||
out += snprintf(line+out, LINE_LEN - out, "%c", c);
|
||||
}
|
||||
fprintf(f, "%s\n", line);
|
||||
}
|
||||
@ -109,7 +109,7 @@ rte_memdump(FILE *f, const char * title, const void * buf, unsigned int len)
|
||||
out = 0;
|
||||
line[out] = '\0';
|
||||
}
|
||||
out += rte_snprintf(line+out, LINE_LEN - out, "%02x%s",
|
||||
out += snprintf(line+out, LINE_LEN - out, "%02x%s",
|
||||
(data[i] & 0xff), ((i+1) < len)? ":" : "");
|
||||
}
|
||||
if ( out > 0 )
|
||||
|
@ -289,7 +289,7 @@ memzone_reserve_aligned_thread_unsafe(const char *name, size_t len,
|
||||
|
||||
/* fill the zone in config */
|
||||
struct rte_memzone *mz = &mcfg->memzone[mcfg->memzone_idx++];
|
||||
rte_snprintf(mz->name, sizeof(mz->name), "%s", name);
|
||||
snprintf(mz->name, sizeof(mz->name), "%s", name);
|
||||
mz->phys_addr = memseg_physaddr;
|
||||
mz->addr = memseg_addr;
|
||||
mz->len = requested_len;
|
||||
|
@ -45,12 +45,8 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Safer version of snprintf that writes up to buflen characters to
|
||||
* the output buffer and ensures that the resultant string is null-terminated,
|
||||
* that is, it writes at most buflen-1 actual string characters to buffer. The
|
||||
* return value is the number of characters which should be written to the
|
||||
* buffer, so string truncation can be detected by the caller by checking if
|
||||
* the return value is greater than or equal to the buflen.
|
||||
* This functio is deprecated and just for backward compatibility.
|
||||
* It is just an alternate version of snprintf.
|
||||
*
|
||||
* @param buffer
|
||||
* The buffer into which the output is to be written
|
||||
@ -69,7 +65,8 @@ extern "C" {
|
||||
*/
|
||||
int
|
||||
rte_snprintf(char *buffer, int buflen, const char *format, ...)
|
||||
__attribute__((format(printf,3,4)));
|
||||
__attribute__((format(printf,3,4)))
|
||||
__attribute__((deprecated));
|
||||
|
||||
/**
|
||||
* Takes string "string" parameter and splits it at character "delim"
|
||||
|
@ -71,7 +71,7 @@ get_num_hugepages(const char *subdir)
|
||||
const char *nr_rsvd_file = "resv_hugepages";
|
||||
|
||||
/* first, check how many reserved pages kernel reports */
|
||||
rte_snprintf(path, sizeof(path), "%s/%s/%s",
|
||||
snprintf(path, sizeof(path), "%s/%s/%s",
|
||||
sys_dir_path, subdir, nr_rsvd_file);
|
||||
|
||||
if (eal_parse_sysfs_value(path, &resv_pages) < 0)
|
||||
@ -86,7 +86,7 @@ get_num_hugepages(const char *subdir)
|
||||
|
||||
memset(path, 0, sizeof(path));
|
||||
|
||||
rte_snprintf(path, sizeof(path), "%s/%s/%s",
|
||||
snprintf(path, sizeof(path), "%s/%s/%s",
|
||||
sys_dir_path, subdir, nr_hp_file);
|
||||
|
||||
if (eal_parse_sysfs_value(path, &num_pages) < 0)
|
||||
|
@ -364,7 +364,7 @@ read_metadata(char * path, int path_len, int fd, uint64_t flen)
|
||||
sizeof(struct rte_ivshmem_metadata_entry));
|
||||
|
||||
/* copy path */
|
||||
rte_snprintf(ivshmem_config->segment[idx].path, path_len, "%s", path);
|
||||
snprintf(ivshmem_config->segment[idx].path, path_len, "%s", path);
|
||||
|
||||
idx++;
|
||||
}
|
||||
@ -469,7 +469,7 @@ create_shared_config(void)
|
||||
int fd;
|
||||
|
||||
/* build ivshmem config file path */
|
||||
rte_snprintf(path, sizeof(path), IVSHMEM_CONFIG_PATH,
|
||||
snprintf(path, sizeof(path), IVSHMEM_CONFIG_PATH,
|
||||
internal_config.hugefile_prefix);
|
||||
|
||||
fd = open(path, O_CREAT | O_RDWR, 0600);
|
||||
@ -520,7 +520,7 @@ open_shared_config(void)
|
||||
int fd;
|
||||
|
||||
/* build ivshmem config file path */
|
||||
rte_snprintf(path, sizeof(path), IVSHMEM_CONFIG_PATH,
|
||||
snprintf(path, sizeof(path), IVSHMEM_CONFIG_PATH,
|
||||
internal_config.hugefile_prefix);
|
||||
|
||||
fd = open(path, O_RDONLY);
|
||||
@ -869,7 +869,7 @@ int rte_eal_ivshmem_init(void)
|
||||
continue;
|
||||
|
||||
/* construct pci device path */
|
||||
rte_snprintf(path, sizeof(path), IVSHMEM_RESOURCE_PATH,
|
||||
snprintf(path, sizeof(path), IVSHMEM_RESOURCE_PATH,
|
||||
dev->addr.domain, dev->addr.bus, dev->addr.devid,
|
||||
dev->addr.function);
|
||||
|
||||
@ -916,7 +916,7 @@ int rte_eal_ivshmem_init(void)
|
||||
dev->addr.bus, dev->addr.devid, dev->addr.function);
|
||||
|
||||
ivshmem_config->pci_devs[ivshmem_config->pci_devs_idx].ioremap_addr = res->phys_addr;
|
||||
rte_snprintf(ivshmem_config->pci_devs[ivshmem_config->pci_devs_idx].path,
|
||||
snprintf(ivshmem_config->pci_devs[ivshmem_config->pci_devs_idx].path,
|
||||
sizeof(ivshmem_config->pci_devs[ivshmem_config->pci_devs_idx].path),
|
||||
"%s", path);
|
||||
|
||||
|
@ -55,7 +55,7 @@ static int
|
||||
cpu_detected(unsigned lcore_id)
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
int len = rte_snprintf(path, sizeof(path), SYS_CPU_DIR
|
||||
int len = snprintf(path, sizeof(path), SYS_CPU_DIR
|
||||
"/"CORE_ID_FILE, lcore_id);
|
||||
if (len <= 0 || (unsigned)len >= sizeof(path))
|
||||
return 0;
|
||||
@ -82,7 +82,7 @@ cpu_socket_id(unsigned lcore_id)
|
||||
struct dirent *e;
|
||||
char *endptr = NULL;
|
||||
|
||||
int len = rte_snprintf(path, sizeof(path),
|
||||
int len = snprintf(path, sizeof(path),
|
||||
SYS_CPU_DIR, lcore_id);
|
||||
if (len <= 0 || (unsigned)len >= sizeof(path))
|
||||
goto err;
|
||||
@ -103,7 +103,7 @@ cpu_socket_id(unsigned lcore_id)
|
||||
"for lcore %u - using physical package id instead\n",
|
||||
lcore_id);
|
||||
|
||||
len = rte_snprintf(path, sizeof(path), SYS_CPU_DIR "/%s",
|
||||
len = snprintf(path, sizeof(path), SYS_CPU_DIR "/%s",
|
||||
lcore_id, PHYS_PKG_FILE);
|
||||
if (len <= 0 || (unsigned)len >= sizeof(path))
|
||||
goto err;
|
||||
@ -125,7 +125,7 @@ cpu_core_id(unsigned lcore_id)
|
||||
char path[PATH_MAX];
|
||||
unsigned long id;
|
||||
|
||||
int len = rte_snprintf(path, sizeof(path), SYS_CPU_DIR "/%s", lcore_id, CORE_ID_FILE);
|
||||
int len = snprintf(path, sizeof(path), SYS_CPU_DIR "/%s", lcore_id, CORE_ID_FILE);
|
||||
if (len <= 0 || (unsigned)len >= sizeof(path))
|
||||
goto err;
|
||||
if (eal_parse_sysfs_value(path, &id) != 0)
|
||||
|
@ -505,7 +505,7 @@ remap_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi)
|
||||
return -1;
|
||||
}
|
||||
|
||||
rte_snprintf(hugepg_tbl[page_idx].filepath, MAX_HUGEPAGE_PATH, "%s",
|
||||
snprintf(hugepg_tbl[page_idx].filepath, MAX_HUGEPAGE_PATH, "%s",
|
||||
filepath);
|
||||
|
||||
physaddr = rte_mem_virt2phy(vma_addr);
|
||||
@ -591,7 +591,7 @@ find_numasocket(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi)
|
||||
return 0;
|
||||
}
|
||||
|
||||
rte_snprintf(hugedir_str, sizeof(hugedir_str),
|
||||
snprintf(hugedir_str, sizeof(hugedir_str),
|
||||
"%s/", hpi->hugedir);
|
||||
|
||||
/* parse numa map */
|
||||
|
@ -69,7 +69,7 @@ pci_unbind_kernel_driver(struct rte_pci_device *dev)
|
||||
struct rte_pci_addr *loc = &dev->addr;
|
||||
|
||||
/* open /sys/bus/pci/devices/AAAA:BB:CC.D/driver */
|
||||
rte_snprintf(filename, sizeof(filename),
|
||||
snprintf(filename, sizeof(filename),
|
||||
SYSFS_PCI_DEVICES "/" PCI_PRI_FMT "/driver/unbind",
|
||||
loc->domain, loc->bus, loc->devid, loc->function);
|
||||
|
||||
@ -77,10 +77,10 @@ pci_unbind_kernel_driver(struct rte_pci_device *dev)
|
||||
if (f == NULL) /* device was not bound */
|
||||
return 0;
|
||||
|
||||
n = rte_snprintf(buf, sizeof(buf), PCI_PRI_FMT "\n",
|
||||
n = snprintf(buf, sizeof(buf), PCI_PRI_FMT "\n",
|
||||
loc->domain, loc->bus, loc->devid, loc->function);
|
||||
if ((n < 0) || (n >= (int)sizeof(buf))) {
|
||||
RTE_LOG(ERR, EAL, "%s(): rte_snprintf failed\n", __func__);
|
||||
RTE_LOG(ERR, EAL, "%s(): snprintf failed\n", __func__);
|
||||
goto error;
|
||||
}
|
||||
if (fwrite(buf, n, 1, f) == 0) {
|
||||
@ -221,7 +221,7 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
|
||||
dev->addr.function = function;
|
||||
|
||||
/* get vendor id */
|
||||
rte_snprintf(filename, sizeof(filename), "%s/vendor", dirname);
|
||||
snprintf(filename, sizeof(filename), "%s/vendor", dirname);
|
||||
if (eal_parse_sysfs_value(filename, &tmp) < 0) {
|
||||
free(dev);
|
||||
return -1;
|
||||
@ -229,7 +229,7 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
|
||||
dev->id.vendor_id = (uint16_t)tmp;
|
||||
|
||||
/* get device id */
|
||||
rte_snprintf(filename, sizeof(filename), "%s/device", dirname);
|
||||
snprintf(filename, sizeof(filename), "%s/device", dirname);
|
||||
if (eal_parse_sysfs_value(filename, &tmp) < 0) {
|
||||
free(dev);
|
||||
return -1;
|
||||
@ -237,7 +237,7 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
|
||||
dev->id.device_id = (uint16_t)tmp;
|
||||
|
||||
/* get subsystem_vendor id */
|
||||
rte_snprintf(filename, sizeof(filename), "%s/subsystem_vendor",
|
||||
snprintf(filename, sizeof(filename), "%s/subsystem_vendor",
|
||||
dirname);
|
||||
if (eal_parse_sysfs_value(filename, &tmp) < 0) {
|
||||
free(dev);
|
||||
@ -246,7 +246,7 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
|
||||
dev->id.subsystem_vendor_id = (uint16_t)tmp;
|
||||
|
||||
/* get subsystem_device id */
|
||||
rte_snprintf(filename, sizeof(filename), "%s/subsystem_device",
|
||||
snprintf(filename, sizeof(filename), "%s/subsystem_device",
|
||||
dirname);
|
||||
if (eal_parse_sysfs_value(filename, &tmp) < 0) {
|
||||
free(dev);
|
||||
@ -256,14 +256,14 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
|
||||
|
||||
/* get max_vfs */
|
||||
dev->max_vfs = 0;
|
||||
rte_snprintf(filename, sizeof(filename), "%s/max_vfs", dirname);
|
||||
snprintf(filename, sizeof(filename), "%s/max_vfs", dirname);
|
||||
if (!access(filename, F_OK) &&
|
||||
eal_parse_sysfs_value(filename, &tmp) == 0) {
|
||||
dev->max_vfs = (uint16_t)tmp;
|
||||
}
|
||||
|
||||
/* get numa node */
|
||||
rte_snprintf(filename, sizeof(filename), "%s/numa_node",
|
||||
snprintf(filename, sizeof(filename), "%s/numa_node",
|
||||
dirname);
|
||||
if (access(filename, R_OK) != 0) {
|
||||
/* if no NUMA support just set node to 0 */
|
||||
@ -277,7 +277,7 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
|
||||
}
|
||||
|
||||
/* parse resources */
|
||||
rte_snprintf(filename, sizeof(filename), "%s/resource", dirname);
|
||||
snprintf(filename, sizeof(filename), "%s/resource", dirname);
|
||||
if (pci_parse_sysfs_resource(filename, dev) < 0) {
|
||||
RTE_LOG(ERR, EAL, "%s(): cannot parse resource\n", __func__);
|
||||
free(dev);
|
||||
@ -380,7 +380,7 @@ pci_scan(void)
|
||||
&bus, &devid, &function) != 0)
|
||||
continue;
|
||||
|
||||
rte_snprintf(dirname, sizeof(dirname), "%s/%s", SYSFS_PCI_DEVICES,
|
||||
snprintf(dirname, sizeof(dirname), "%s/%s", SYSFS_PCI_DEVICES,
|
||||
e->d_name);
|
||||
if (pci_scan_one(dirname, domain, bus, devid, function) < 0)
|
||||
goto error;
|
||||
@ -407,7 +407,7 @@ pci_config_extended_tag(struct rte_pci_device *dev)
|
||||
strncmp(RTE_PCI_EXTENDED_TAG, "off", 3) != 0)
|
||||
return 0;
|
||||
|
||||
rte_snprintf(filename, sizeof(filename),
|
||||
snprintf(filename, sizeof(filename),
|
||||
SYSFS_PCI_DEVICES "/" PCI_PRI_FMT "/" "extended_tag",
|
||||
loc->domain, loc->bus, loc->devid, loc->function);
|
||||
f = fopen(filename, "rw+");
|
||||
@ -447,7 +447,7 @@ pci_config_max_read_request_size(struct rte_pci_device *dev)
|
||||
if (!max_size)
|
||||
return 0;
|
||||
|
||||
rte_snprintf(filename, sizeof(filename),
|
||||
snprintf(filename, sizeof(filename),
|
||||
SYSFS_PCI_DEVICES "/" PCI_PRI_FMT "/" "max_read_request_size",
|
||||
loc->domain, loc->bus, loc->devid, loc->function);
|
||||
f = fopen(filename, "rw+");
|
||||
@ -455,7 +455,7 @@ pci_config_max_read_request_size(struct rte_pci_device *dev)
|
||||
return -1;
|
||||
|
||||
fgets(buf, sizeof(buf), f);
|
||||
rte_snprintf(param, sizeof(param), "%d", max_size);
|
||||
snprintf(param, sizeof(param), "%d", max_size);
|
||||
|
||||
/* check if the size to be set is the same as current */
|
||||
if (strcmp(buf, param) == 0) {
|
||||
|
@ -61,14 +61,14 @@ pci_uio_get_mappings(const char *devname, struct pci_map maps[], int nb_maps)
|
||||
for (i = 0; i != nb_maps; i++) {
|
||||
|
||||
/* check if map directory exists */
|
||||
rte_snprintf(dirname, sizeof(dirname),
|
||||
snprintf(dirname, sizeof(dirname),
|
||||
"%s/maps/map%u", devname, i);
|
||||
|
||||
if (access(dirname, F_OK) != 0)
|
||||
break;
|
||||
|
||||
/* get mapping offset */
|
||||
rte_snprintf(filename, sizeof(filename),
|
||||
snprintf(filename, sizeof(filename),
|
||||
"%s/offset", dirname);
|
||||
if (pci_parse_sysfs_value(filename, &offset) < 0) {
|
||||
RTE_LOG(ERR, EAL,
|
||||
@ -78,7 +78,7 @@ pci_uio_get_mappings(const char *devname, struct pci_map maps[], int nb_maps)
|
||||
}
|
||||
|
||||
/* get mapping size */
|
||||
rte_snprintf(filename, sizeof(filename),
|
||||
snprintf(filename, sizeof(filename),
|
||||
"%s/size", dirname);
|
||||
if (pci_parse_sysfs_value(filename, &size) < 0) {
|
||||
RTE_LOG(ERR, EAL,
|
||||
@ -88,7 +88,7 @@ pci_uio_get_mappings(const char *devname, struct pci_map maps[], int nb_maps)
|
||||
}
|
||||
|
||||
/* get mapping physical address */
|
||||
rte_snprintf(filename, sizeof(filename),
|
||||
snprintf(filename, sizeof(filename),
|
||||
"%s/addr", dirname);
|
||||
if (pci_parse_sysfs_value(filename, &maps[i].phaddr) < 0) {
|
||||
RTE_LOG(ERR, EAL,
|
||||
@ -164,7 +164,7 @@ pci_mknod_uio_dev(const char *sysfs_uio_path, unsigned uio_num)
|
||||
|
||||
/* get the name of the sysfs file that contains the major and minor
|
||||
* of the uio device and read its content */
|
||||
rte_snprintf(filename, sizeof(filename), "%s/dev", sysfs_uio_path);
|
||||
snprintf(filename, sizeof(filename), "%s/dev", sysfs_uio_path);
|
||||
|
||||
f = fopen(filename, "r");
|
||||
if (f == NULL) {
|
||||
@ -183,7 +183,7 @@ pci_mknod_uio_dev(const char *sysfs_uio_path, unsigned uio_num)
|
||||
fclose(f);
|
||||
|
||||
/* create the char device "mknod /dev/uioX c major minor" */
|
||||
rte_snprintf(filename, sizeof(filename), "/dev/uio%u", uio_num);
|
||||
snprintf(filename, sizeof(filename), "/dev/uio%u", uio_num);
|
||||
dev = makedev(major, minor);
|
||||
ret = mknod(filename, S_IFCHR | S_IRUSR | S_IWUSR, dev);
|
||||
if (f == NULL) {
|
||||
@ -214,14 +214,14 @@ pci_get_uio_dev(struct rte_pci_device *dev, char *dstbuf,
|
||||
/* depending on kernel version, uio can be located in uio/uioX
|
||||
* or uio:uioX */
|
||||
|
||||
rte_snprintf(dirname, sizeof(dirname),
|
||||
snprintf(dirname, sizeof(dirname),
|
||||
SYSFS_PCI_DEVICES "/" PCI_PRI_FMT "/uio",
|
||||
loc->domain, loc->bus, loc->devid, loc->function);
|
||||
|
||||
dir = opendir(dirname);
|
||||
if (dir == NULL) {
|
||||
/* retry with the parent directory */
|
||||
rte_snprintf(dirname, sizeof(dirname),
|
||||
snprintf(dirname, sizeof(dirname),
|
||||
SYSFS_PCI_DEVICES "/" PCI_PRI_FMT,
|
||||
loc->domain, loc->bus, loc->devid, loc->function);
|
||||
dir = opendir(dirname);
|
||||
@ -247,7 +247,7 @@ pci_get_uio_dev(struct rte_pci_device *dev, char *dstbuf,
|
||||
errno = 0;
|
||||
uio_num = strtoull(e->d_name + shortprefix_len, &endptr, 10);
|
||||
if (errno == 0 && endptr != (e->d_name + shortprefix_len)) {
|
||||
rte_snprintf(dstbuf, buflen, "%s/uio%u", dirname, uio_num);
|
||||
snprintf(dstbuf, buflen, "%s/uio%u", dirname, uio_num);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -255,7 +255,7 @@ pci_get_uio_dev(struct rte_pci_device *dev, char *dstbuf,
|
||||
errno = 0;
|
||||
uio_num = strtoull(e->d_name + longprefix_len, &endptr, 10);
|
||||
if (errno == 0 && endptr != (e->d_name + longprefix_len)) {
|
||||
rte_snprintf(dstbuf, buflen, "%s/uio:uio%u", dirname, uio_num);
|
||||
snprintf(dstbuf, buflen, "%s/uio:uio%u", dirname, uio_num);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -304,7 +304,7 @@ pci_uio_map_resource(struct rte_pci_device *dev)
|
||||
"skipping\n", loc->domain, loc->bus, loc->devid, loc->function);
|
||||
return 1;
|
||||
}
|
||||
rte_snprintf(devname, sizeof(devname), "/dev/uio%u", uio_num);
|
||||
snprintf(devname, sizeof(devname), "/dev/uio%u", uio_num);
|
||||
|
||||
/* save fd if in primary process */
|
||||
dev->intr_handle.fd = open(devname, O_RDWR);
|
||||
@ -323,7 +323,7 @@ pci_uio_map_resource(struct rte_pci_device *dev)
|
||||
return -1;
|
||||
}
|
||||
|
||||
rte_snprintf(uio_res->path, sizeof(uio_res->path), "%s", devname);
|
||||
snprintf(uio_res->path, sizeof(uio_res->path), "%s", devname);
|
||||
memcpy(&uio_res->pci_addr, &dev->addr, sizeof(uio_res->pci_addr));
|
||||
|
||||
/* collect info about device mappings */
|
||||
|
@ -392,7 +392,7 @@ pci_vfio_get_group_fd(int iommu_group_no)
|
||||
|
||||
/* if primary, try to open the group */
|
||||
if (internal_config.process_type == RTE_PROC_PRIMARY) {
|
||||
rte_snprintf(filename, sizeof(filename),
|
||||
snprintf(filename, sizeof(filename),
|
||||
VFIO_GROUP_FMT, iommu_group_no);
|
||||
vfio_group_fd = open(filename, O_RDWR);
|
||||
if (vfio_group_fd < 0) {
|
||||
@ -472,7 +472,7 @@ pci_vfio_get_group_no(const char *pci_addr)
|
||||
memset(filename, 0, sizeof(filename));
|
||||
|
||||
/* try to find out IOMMU group for this device */
|
||||
rte_snprintf(linkname, sizeof(linkname),
|
||||
snprintf(linkname, sizeof(linkname),
|
||||
SYSFS_PCI_DEVICES "/%s/iommu_group", pci_addr);
|
||||
|
||||
ret = readlink(linkname, filename, sizeof(filename));
|
||||
@ -533,7 +533,7 @@ pci_vfio_map_resource(struct rte_pci_device *dev)
|
||||
dev->intr_handle.type = RTE_INTR_HANDLE_UNKNOWN;
|
||||
|
||||
/* store PCI address string */
|
||||
rte_snprintf(pci_addr, sizeof(pci_addr), PCI_PRI_FMT,
|
||||
snprintf(pci_addr, sizeof(pci_addr), PCI_PRI_FMT,
|
||||
loc->domain, loc->bus, loc->devid, loc->function);
|
||||
|
||||
/* get group number */
|
||||
|
@ -92,7 +92,7 @@ get_socket_path(char *buffer, int bufsz)
|
||||
dir = home_dir;
|
||||
|
||||
/* use current prefix as file path */
|
||||
rte_snprintf(buffer, bufsz, SOCKET_PATH_FMT, dir,
|
||||
snprintf(buffer, bufsz, SOCKET_PATH_FMT, dir,
|
||||
internal_config.hugefile_prefix);
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ get_xen_memory_size(void)
|
||||
static const char *file_name;
|
||||
|
||||
file_name = "memsize";
|
||||
rte_snprintf(path, sizeof(path), "%s/%s",
|
||||
snprintf(path, sizeof(path), "%s/%s",
|
||||
sys_dir_path, file_name);
|
||||
|
||||
if (eal_parse_sysfs_value(path, &mem_size) < 0)
|
||||
@ -213,7 +213,7 @@ rte_xen_dom0_memory_init(void)
|
||||
meminfo.size = mem_size;
|
||||
|
||||
/* construct memory mangement name for Dom0 */
|
||||
rte_snprintf(meminfo.name, DOM0_NAME_MAX, "%s-%s",
|
||||
snprintf(meminfo.name, DOM0_NAME_MAX, "%s-%s",
|
||||
internal_config.hugefile_prefix, DEFAUL_DOM0_NAME);
|
||||
|
||||
/* Notify kernel driver to allocate memory */
|
||||
@ -329,7 +329,7 @@ rte_xen_dom0_memory_attach(void)
|
||||
}
|
||||
|
||||
/* construct memory mangement name for Dom0 */
|
||||
rte_snprintf(name, DOM0_NAME_MAX, "%s-%s",
|
||||
snprintf(name, DOM0_NAME_MAX, "%s-%s",
|
||||
internal_config.hugefile_prefix, DEFAUL_DOM0_NAME);
|
||||
/* attach to memory segments of primary process */
|
||||
ret = ioctl(xen_fd, RTE_DOM0_IOCTL_ATTACH_TO_MEMSEG, name);
|
||||
|
@ -62,7 +62,7 @@ eal_runtime_config_path(void)
|
||||
|
||||
if (getuid() != 0 && home_dir != NULL)
|
||||
directory = home_dir;
|
||||
rte_snprintf(buffer, sizeof(buffer) - 1, RUNTIME_CONFIG_FMT, directory,
|
||||
snprintf(buffer, sizeof(buffer) - 1, RUNTIME_CONFIG_FMT, directory,
|
||||
internal_config.hugefile_prefix);
|
||||
return buffer;
|
||||
}
|
||||
@ -79,7 +79,7 @@ eal_hugepage_info_path(void)
|
||||
|
||||
if (getuid() != 0 && home_dir != NULL)
|
||||
directory = home_dir;
|
||||
rte_snprintf(buffer, sizeof(buffer) - 1, HUGEPAGE_INFO_FMT, directory,
|
||||
snprintf(buffer, sizeof(buffer) - 1, HUGEPAGE_INFO_FMT, directory,
|
||||
internal_config.hugefile_prefix);
|
||||
return buffer;
|
||||
}
|
||||
@ -91,7 +91,7 @@ eal_hugepage_info_path(void)
|
||||
static inline const char *
|
||||
eal_get_hugefile_path(char *buffer, size_t buflen, const char *hugedir, int f_id)
|
||||
{
|
||||
rte_snprintf(buffer, buflen, HUGEFILE_FMT, hugedir,
|
||||
snprintf(buffer, buflen, HUGEFILE_FMT, hugedir,
|
||||
internal_config.hugefile_prefix, f_id);
|
||||
buffer[buflen - 1] = '\0';
|
||||
return buffer;
|
||||
@ -101,7 +101,7 @@ eal_get_hugefile_path(char *buffer, size_t buflen, const char *hugedir, int f_id
|
||||
static inline const char *
|
||||
eal_get_hugefile_temp_path(char *buffer, size_t buflen, const char *hugedir, int f_id)
|
||||
{
|
||||
rte_snprintf(buffer, buflen, TEMP_HUGEFILE_FMT, hugedir,
|
||||
snprintf(buffer, buflen, TEMP_HUGEFILE_FMT, hugedir,
|
||||
internal_config.hugefile_prefix, f_id);
|
||||
buffer[buflen - 1] = '\0';
|
||||
return buffer;
|
||||
|
@ -129,7 +129,7 @@ rte_fbk_hash_create(const struct rte_fbk_hash_params *params)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rte_snprintf(hash_name, sizeof(hash_name), "FBK_%s", params->name);
|
||||
snprintf(hash_name, sizeof(hash_name), "FBK_%s", params->name);
|
||||
|
||||
rte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK);
|
||||
|
||||
@ -150,7 +150,7 @@ rte_fbk_hash_create(const struct rte_fbk_hash_params *params)
|
||||
memset(ht, 0, mem_size);
|
||||
|
||||
/* Set up hash table context. */
|
||||
rte_snprintf(ht->name, sizeof(ht->name), "%s", params->name);
|
||||
snprintf(ht->name, sizeof(ht->name), "%s", params->name);
|
||||
ht->entries = params->entries;
|
||||
ht->entries_per_bucket = params->entries_per_bucket;
|
||||
ht->used_entries = 0;
|
||||
|
@ -192,7 +192,7 @@ rte_hash_create(const struct rte_hash_parameters *params)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rte_snprintf(hash_name, sizeof(hash_name), "HT_%s", params->name);
|
||||
snprintf(hash_name, sizeof(hash_name), "HT_%s", params->name);
|
||||
|
||||
/* Calculate hash dimensions */
|
||||
num_buckets = params->entries / params->bucket_entries;
|
||||
@ -227,7 +227,7 @@ rte_hash_create(const struct rte_hash_parameters *params)
|
||||
}
|
||||
|
||||
/* Setup hash context */
|
||||
rte_snprintf(h->name, sizeof(h->name), "%s", params->name);
|
||||
snprintf(h->name, sizeof(h->name), "%s", params->name);
|
||||
h->entries = params->entries;
|
||||
h->bucket_entries = params->bucket_entries;
|
||||
h->key_len = params->key_len;
|
||||
|
@ -229,7 +229,7 @@ get_hugefile_by_virt_addr(uint64_t virt_addr, struct memseg_cache_entry * e)
|
||||
}
|
||||
|
||||
/* calculate offset and copy the file path */
|
||||
rte_snprintf(e->filepath, RTE_PTR_DIFF(path_end, start) + 1, "%s", start);
|
||||
snprintf(e->filepath, RTE_PTR_DIFF(path_end, start) + 1, "%s", start);
|
||||
|
||||
e->offset = virt_addr - start_addr;
|
||||
|
||||
@ -606,7 +606,7 @@ rte_ivshmem_metadata_add_mempool(const struct rte_mempool * mp, const char * nam
|
||||
static inline void
|
||||
ivshmem_config_path(char *buffer, size_t bufflen, const char *name)
|
||||
{
|
||||
rte_snprintf(buffer, bufflen, IVSHMEM_CONFIG_FILE_FMT, name);
|
||||
snprintf(buffer, bufflen, IVSHMEM_CONFIG_FILE_FMT, name);
|
||||
}
|
||||
|
||||
|
||||
@ -707,7 +707,7 @@ int rte_ivshmem_metadata_create(const char *name)
|
||||
/* Metadata setup */
|
||||
memset(ivshmem_config->metadata, 0, sizeof(struct rte_ivshmem_metadata));
|
||||
ivshmem_config->metadata->magic_number = IVSHMEM_MAGIC;
|
||||
rte_snprintf(ivshmem_config->metadata->name,
|
||||
snprintf(ivshmem_config->metadata->name,
|
||||
sizeof(ivshmem_config->metadata->name), "%s", name);
|
||||
|
||||
rte_spinlock_unlock(&global_cfg_sl);
|
||||
@ -738,7 +738,7 @@ rte_ivshmem_metadata_cmdline_generate(char *buffer, unsigned size, const char *n
|
||||
rte_spinlock_lock(&config->sl);
|
||||
|
||||
/* prepare metadata file path */
|
||||
rte_snprintf(cfg_file_path, sizeof(cfg_file_path), IVSHMEM_CONFIG_FILE_FMT,
|
||||
snprintf(cfg_file_path, sizeof(cfg_file_path), IVSHMEM_CONFIG_FILE_FMT,
|
||||
config->metadata->name);
|
||||
|
||||
ms_cache = config->memseg_cache;
|
||||
@ -754,7 +754,7 @@ rte_ivshmem_metadata_cmdline_generate(char *buffer, unsigned size, const char *n
|
||||
entry = &ms_cache[iter];
|
||||
|
||||
/* Offset and sizes within the current pathname */
|
||||
tmplen = rte_snprintf(cmdline_ptr, remaining_len, IVSHMEM_QEMU_CMD_FD_FMT,
|
||||
tmplen = snprintf(cmdline_ptr, remaining_len, IVSHMEM_QEMU_CMD_FD_FMT,
|
||||
entry->filepath, entry->offset, entry->len);
|
||||
|
||||
shared_mem_size += entry->len;
|
||||
@ -775,7 +775,7 @@ rte_ivshmem_metadata_cmdline_generate(char *buffer, unsigned size, const char *n
|
||||
zero_size = total_size - shared_mem_size - METADATA_SIZE_ALIGNED;
|
||||
|
||||
/* add /dev/zero to command-line to fill the space */
|
||||
tmplen = rte_snprintf(cmdline_ptr, remaining_len, IVSHMEM_QEMU_CMD_FD_FMT,
|
||||
tmplen = snprintf(cmdline_ptr, remaining_len, IVSHMEM_QEMU_CMD_FD_FMT,
|
||||
"/dev/zero",
|
||||
(uint64_t)0x0,
|
||||
zero_size);
|
||||
@ -790,7 +790,7 @@ rte_ivshmem_metadata_cmdline_generate(char *buffer, unsigned size, const char *n
|
||||
}
|
||||
|
||||
/* add metadata file to the end of command-line */
|
||||
tmplen = rte_snprintf(cmdline_ptr, remaining_len, IVSHMEM_QEMU_CMD_FD_FMT,
|
||||
tmplen = snprintf(cmdline_ptr, remaining_len, IVSHMEM_QEMU_CMD_FD_FMT,
|
||||
cfg_file_path,
|
||||
(uint64_t)0x0,
|
||||
METADATA_SIZE_ALIGNED);
|
||||
@ -812,7 +812,7 @@ rte_ivshmem_metadata_cmdline_generate(char *buffer, unsigned size, const char *n
|
||||
return -1;
|
||||
}
|
||||
/* complete the command-line */
|
||||
rte_snprintf(buffer, size,
|
||||
snprintf(buffer, size,
|
||||
IVSHMEM_QEMU_CMD_LINE_HEADER_FMT,
|
||||
total_size >> 20,
|
||||
cmdline);
|
||||
|
@ -119,7 +119,7 @@ rte_kni_create(uint8_t port_id,
|
||||
memset(&conf, 0, sizeof(conf));
|
||||
rte_eth_dev_info_get(port_id, &info);
|
||||
|
||||
rte_snprintf(conf.name, sizeof(conf.name), "vEth%u", port_id);
|
||||
snprintf(conf.name, sizeof(conf.name), "vEth%u", port_id);
|
||||
conf.addr = info.pci_dev->addr;
|
||||
conf.id = info.pci_dev->id;
|
||||
conf.group_id = (uint16_t)port_id;
|
||||
@ -158,8 +158,8 @@ rte_kni_alloc(struct rte_mempool *pktmbuf_pool,
|
||||
}
|
||||
}
|
||||
|
||||
rte_snprintf(intf_name, RTE_KNI_NAMESIZE, "%s", conf->name);
|
||||
rte_snprintf(mz_name, RTE_MEMZONE_NAMESIZE, "KNI_INFO_%s", intf_name);
|
||||
snprintf(intf_name, RTE_KNI_NAMESIZE, "%s", conf->name);
|
||||
snprintf(mz_name, RTE_MEMZONE_NAMESIZE, "KNI_INFO_%s", intf_name);
|
||||
mz = kni_memzone_reserve(mz_name, sizeof(struct rte_kni),
|
||||
SOCKET_ID_ANY, 0);
|
||||
KNI_MZ_CHECK(mz == NULL);
|
||||
@ -184,15 +184,15 @@ rte_kni_alloc(struct rte_mempool *pktmbuf_pool,
|
||||
dev_info.group_id = conf->group_id;
|
||||
dev_info.mbuf_size = conf->mbuf_size;
|
||||
|
||||
rte_snprintf(ctx->name, RTE_KNI_NAMESIZE, "%s", intf_name);
|
||||
rte_snprintf(dev_info.name, RTE_KNI_NAMESIZE, "%s", intf_name);
|
||||
snprintf(ctx->name, RTE_KNI_NAMESIZE, "%s", intf_name);
|
||||
snprintf(dev_info.name, RTE_KNI_NAMESIZE, "%s", intf_name);
|
||||
|
||||
RTE_LOG(INFO, KNI, "pci: %02x:%02x:%02x \t %02x:%02x\n",
|
||||
dev_info.bus, dev_info.devid, dev_info.function,
|
||||
dev_info.vendor_id, dev_info.device_id);
|
||||
|
||||
/* TX RING */
|
||||
rte_snprintf(obj_name, OBJNAMSIZ, "kni_tx_%s", intf_name);
|
||||
snprintf(obj_name, OBJNAMSIZ, "kni_tx_%s", intf_name);
|
||||
mz = kni_memzone_reserve(obj_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
|
||||
KNI_MZ_CHECK(mz == NULL);
|
||||
ctx->tx_q = mz->addr;
|
||||
@ -200,7 +200,7 @@ rte_kni_alloc(struct rte_mempool *pktmbuf_pool,
|
||||
dev_info.tx_phys = mz->phys_addr;
|
||||
|
||||
/* RX RING */
|
||||
rte_snprintf(obj_name, OBJNAMSIZ, "kni_rx_%s", intf_name);
|
||||
snprintf(obj_name, OBJNAMSIZ, "kni_rx_%s", intf_name);
|
||||
mz = kni_memzone_reserve(obj_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
|
||||
KNI_MZ_CHECK(mz == NULL);
|
||||
ctx->rx_q = mz->addr;
|
||||
@ -208,7 +208,7 @@ rte_kni_alloc(struct rte_mempool *pktmbuf_pool,
|
||||
dev_info.rx_phys = mz->phys_addr;
|
||||
|
||||
/* ALLOC RING */
|
||||
rte_snprintf(obj_name, OBJNAMSIZ, "kni_alloc_%s", intf_name);
|
||||
snprintf(obj_name, OBJNAMSIZ, "kni_alloc_%s", intf_name);
|
||||
mz = kni_memzone_reserve(obj_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
|
||||
KNI_MZ_CHECK(mz == NULL);
|
||||
ctx->alloc_q = mz->addr;
|
||||
@ -216,7 +216,7 @@ rte_kni_alloc(struct rte_mempool *pktmbuf_pool,
|
||||
dev_info.alloc_phys = mz->phys_addr;
|
||||
|
||||
/* FREE RING */
|
||||
rte_snprintf(obj_name, OBJNAMSIZ, "kni_free_%s", intf_name);
|
||||
snprintf(obj_name, OBJNAMSIZ, "kni_free_%s", intf_name);
|
||||
mz = kni_memzone_reserve(obj_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
|
||||
KNI_MZ_CHECK(mz == NULL);
|
||||
ctx->free_q = mz->addr;
|
||||
@ -224,7 +224,7 @@ rte_kni_alloc(struct rte_mempool *pktmbuf_pool,
|
||||
dev_info.free_phys = mz->phys_addr;
|
||||
|
||||
/* Request RING */
|
||||
rte_snprintf(obj_name, OBJNAMSIZ, "kni_req_%s", intf_name);
|
||||
snprintf(obj_name, OBJNAMSIZ, "kni_req_%s", intf_name);
|
||||
mz = kni_memzone_reserve(obj_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
|
||||
KNI_MZ_CHECK(mz == NULL);
|
||||
ctx->req_q = mz->addr;
|
||||
@ -232,7 +232,7 @@ rte_kni_alloc(struct rte_mempool *pktmbuf_pool,
|
||||
dev_info.req_phys = mz->phys_addr;
|
||||
|
||||
/* Response RING */
|
||||
rte_snprintf(obj_name, OBJNAMSIZ, "kni_resp_%s", intf_name);
|
||||
snprintf(obj_name, OBJNAMSIZ, "kni_resp_%s", intf_name);
|
||||
mz = kni_memzone_reserve(obj_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
|
||||
KNI_MZ_CHECK(mz == NULL);
|
||||
ctx->resp_q = mz->addr;
|
||||
@ -240,7 +240,7 @@ rte_kni_alloc(struct rte_mempool *pktmbuf_pool,
|
||||
dev_info.resp_phys = mz->phys_addr;
|
||||
|
||||
/* Req/Resp sync mem area */
|
||||
rte_snprintf(obj_name, OBJNAMSIZ, "kni_sync_%s", intf_name);
|
||||
snprintf(obj_name, OBJNAMSIZ, "kni_sync_%s", intf_name);
|
||||
mz = kni_memzone_reserve(obj_name, KNI_FIFO_SIZE, SOCKET_ID_ANY, 0);
|
||||
KNI_MZ_CHECK(mz == NULL);
|
||||
ctx->sync_addr = mz->addr;
|
||||
@ -248,7 +248,7 @@ rte_kni_alloc(struct rte_mempool *pktmbuf_pool,
|
||||
dev_info.sync_phys = mz->phys_addr;
|
||||
|
||||
/* MBUF mempool */
|
||||
rte_snprintf(mz_name, sizeof(mz_name), RTE_MEMPOOL_OBJ_NAME,
|
||||
snprintf(mz_name, sizeof(mz_name), RTE_MEMPOOL_OBJ_NAME,
|
||||
pktmbuf_pool->name);
|
||||
mz = rte_memzone_lookup(mz_name);
|
||||
KNI_MZ_CHECK(mz == NULL);
|
||||
@ -291,7 +291,7 @@ rte_kni_release(struct rte_kni *kni)
|
||||
if (!kni || !kni->in_use)
|
||||
return -1;
|
||||
|
||||
rte_snprintf(dev_info.name, sizeof(dev_info.name), "%s", kni->name);
|
||||
snprintf(dev_info.name, sizeof(dev_info.name), "%s", kni->name);
|
||||
if (ioctl(kni_fd, RTE_KNI_IOCTL_RELEASE, &dev_info) < 0) {
|
||||
RTE_LOG(ERR, KNI, "Fail to release kni device\n");
|
||||
return -1;
|
||||
@ -444,7 +444,7 @@ rte_kni_get(const char *name)
|
||||
if (!name || !name[0])
|
||||
return NULL;
|
||||
|
||||
rte_snprintf(mz_name, RTE_MEMZONE_NAMESIZE, "KNI_INFO_%s", name);
|
||||
snprintf(mz_name, RTE_MEMZONE_NAMESIZE, "KNI_INFO_%s", name);
|
||||
mz = rte_memzone_lookup(mz_name);
|
||||
if (!mz)
|
||||
return NULL;
|
||||
@ -467,7 +467,7 @@ rte_kni_info_get(uint8_t port_id)
|
||||
if (port_id >= RTE_MAX_ETHPORTS)
|
||||
return NULL;
|
||||
|
||||
rte_snprintf(name, RTE_MEMZONE_NAMESIZE, "vEth%u", port_id);
|
||||
snprintf(name, RTE_MEMZONE_NAMESIZE, "vEth%u", port_id);
|
||||
|
||||
return rte_kni_get(name);
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ rte_lpm_create(const char *name, int socket_id, int max_rules,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rte_snprintf(mem_name, sizeof(mem_name), "LPM_%s", name);
|
||||
snprintf(mem_name, sizeof(mem_name), "LPM_%s", name);
|
||||
|
||||
/* Determine the amount of memory to allocate. */
|
||||
mem_size = sizeof(*lpm) + (sizeof(lpm->rules_tbl[0]) * max_rules);
|
||||
@ -193,7 +193,7 @@ rte_lpm_create(const char *name, int socket_id, int max_rules,
|
||||
|
||||
/* Save user arguments. */
|
||||
lpm->max_rules = max_rules;
|
||||
rte_snprintf(lpm->name, sizeof(lpm->name), "%s", name);
|
||||
snprintf(lpm->name, sizeof(lpm->name), "%s", name);
|
||||
|
||||
TAILQ_INSERT_TAIL(lpm_list, lpm, next);
|
||||
|
||||
|
@ -169,7 +169,7 @@ rte_lpm6_create(const char *name, int socket_id,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rte_snprintf(mem_name, sizeof(mem_name), "LPM_%s", name);
|
||||
snprintf(mem_name, sizeof(mem_name), "LPM_%s", name);
|
||||
|
||||
/* Determine the amount of memory to allocate. */
|
||||
mem_size = sizeof(*lpm) + (sizeof(lpm->tbl8[0]) *
|
||||
@ -207,7 +207,7 @@ rte_lpm6_create(const char *name, int socket_id,
|
||||
/* Save user arguments. */
|
||||
lpm->max_rules = config->max_rules;
|
||||
lpm->number_tbl8s = config->number_tbl8s;
|
||||
rte_snprintf(lpm->name, sizeof(lpm->name), "%s", name);
|
||||
snprintf(lpm->name, sizeof(lpm->name), "%s", name);
|
||||
|
||||
TAILQ_INSERT_TAIL(lpm_list, lpm, next);
|
||||
|
||||
|
@ -90,7 +90,7 @@ malloc_heap_add_memzone(struct malloc_heap *heap, size_t size, unsigned align)
|
||||
mz_size = block_size;
|
||||
|
||||
char mz_name[RTE_MEMZONE_NAMESIZE];
|
||||
rte_snprintf(mz_name, sizeof(mz_name), "MALLOC_S%u_HEAP_%u",
|
||||
snprintf(mz_name, sizeof(mz_name), "MALLOC_S%u_HEAP_%u",
|
||||
numa_socket, heap->mz_count++);
|
||||
|
||||
/* try getting a block. if we fail and we don't need as big a block
|
||||
|
@ -111,7 +111,7 @@ rte_dom0_mempool_create(const char *name, unsigned elt_num, unsigned elt_size,
|
||||
if (pa == NULL)
|
||||
return mp;
|
||||
|
||||
rte_snprintf(mz_name, sizeof(mz_name), RTE_MEMPOOL_OBJ_NAME, name);
|
||||
snprintf(mz_name, sizeof(mz_name), RTE_MEMPOOL_OBJ_NAME, name);
|
||||
mz = rte_memzone_reserve(mz_name, sz, socket_id, mz_flags);
|
||||
if (mz == NULL) {
|
||||
free(pa);
|
||||
|
@ -477,7 +477,7 @@ rte_mempool_xmem_create(const char *name, unsigned n, unsigned elt_size,
|
||||
/* Ring functions will return appropriate errors if we are
|
||||
* running as a secondary process etc., so no checks made
|
||||
* in this function for that condition */
|
||||
rte_snprintf(rg_name, sizeof(rg_name), RTE_MEMPOOL_MZ_FORMAT, name);
|
||||
snprintf(rg_name, sizeof(rg_name), RTE_MEMPOOL_MZ_FORMAT, name);
|
||||
r = rte_ring_create(rg_name, rte_align32pow2(n+1), socket_id, rg_flags);
|
||||
if (r == NULL)
|
||||
goto exit;
|
||||
@ -519,7 +519,7 @@ rte_mempool_xmem_create(const char *name, unsigned n, unsigned elt_size,
|
||||
mempool_size += page_size;
|
||||
}
|
||||
|
||||
rte_snprintf(mz_name, sizeof(mz_name), RTE_MEMPOOL_MZ_FORMAT, name);
|
||||
snprintf(mz_name, sizeof(mz_name), RTE_MEMPOOL_MZ_FORMAT, name);
|
||||
|
||||
mz = rte_memzone_reserve(mz_name, mempool_size, socket_id, mz_flags);
|
||||
|
||||
@ -545,7 +545,7 @@ rte_mempool_xmem_create(const char *name, unsigned n, unsigned elt_size,
|
||||
/* init the mempool structure */
|
||||
mp = startaddr;
|
||||
memset(mp, 0, sizeof(*mp));
|
||||
rte_snprintf(mp->name, sizeof(mp->name), "%s", name);
|
||||
snprintf(mp->name, sizeof(mp->name), "%s", name);
|
||||
mp->phys_addr = mz->phys_addr;
|
||||
mp->ring = r;
|
||||
mp->size = n;
|
||||
|
@ -212,7 +212,7 @@ rte_pipeline_create(struct rte_pipeline_params *params)
|
||||
}
|
||||
|
||||
/* Save input parameters */
|
||||
rte_snprintf(p->name, RTE_PIPELINE_MAX_NAME_SZ, "%s", params->name);
|
||||
snprintf(p->name, RTE_PIPELINE_MAX_NAME_SZ, "%s", params->name);
|
||||
p->socket_id = params->socket_id;
|
||||
p->offset_port_id = params->offset_port_id;
|
||||
|
||||
|
@ -1093,7 +1093,7 @@ ring_dma_zone_reserve(struct rte_eth_dev *dev, const char *ring_name,
|
||||
const struct rte_memzone *mz;
|
||||
char z_name[RTE_MEMZONE_NAMESIZE];
|
||||
|
||||
rte_snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
|
||||
snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
|
||||
dev->driver->pci_drv.name, ring_name, dev->data->port_id,
|
||||
queue_id);
|
||||
|
||||
|
@ -1089,7 +1089,7 @@ ring_dma_zone_reserve(struct rte_eth_dev *dev, const char *ring_name,
|
||||
char z_name[RTE_MEMZONE_NAMESIZE];
|
||||
const struct rte_memzone *mz;
|
||||
|
||||
rte_snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
|
||||
snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
|
||||
dev->driver->pci_drv.name, ring_name,
|
||||
dev->data->port_id, queue_id);
|
||||
mz = rte_memzone_lookup(z_name);
|
||||
|
@ -1517,7 +1517,7 @@ i40e_allocate_dma_mem_d(__attribute__((unused)) struct i40e_hw *hw,
|
||||
return I40E_ERR_PARAM;
|
||||
|
||||
id++;
|
||||
rte_snprintf(z_name, sizeof(z_name), "i40e_dma_%"PRIu64, id);
|
||||
snprintf(z_name, sizeof(z_name), "i40e_dma_%"PRIu64, id);
|
||||
mz = rte_memzone_reserve_aligned(z_name, size, 0, 0, alignment);
|
||||
if (!mz)
|
||||
return I40E_ERR_NO_MEMORY;
|
||||
|
@ -1829,7 +1829,7 @@ i40e_ring_dma_zone_reserve(struct rte_eth_dev *dev,
|
||||
char z_name[RTE_MEMZONE_NAMESIZE];
|
||||
const struct rte_memzone *mz;
|
||||
|
||||
rte_snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
|
||||
snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
|
||||
dev->driver->pci_drv.name, ring_name,
|
||||
dev->data->port_id, queue_id);
|
||||
mz = rte_memzone_lookup(z_name);
|
||||
|
@ -1611,7 +1611,7 @@ ring_dma_zone_reserve(struct rte_eth_dev *dev, const char *ring_name,
|
||||
char z_name[RTE_MEMZONE_NAMESIZE];
|
||||
const struct rte_memzone *mz;
|
||||
|
||||
rte_snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
|
||||
snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
|
||||
dev->driver->pci_drv.name, ring_name,
|
||||
dev->data->port_id, queue_id);
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user