From 6f41fe75e2dd8dd38f7bea7b9501edd4f9b72fa5 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 24 Jun 2014 11:15:28 -0700 Subject: [PATCH] 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 Acked-by: Thomas Monjalon --- app/test-pipeline/init.c | 4 +- app/test-pmd/cmdline.c | 4 +- app/test-pmd/config.c | 2 +- app/test-pmd/parameters.c | 6 +-- app/test-pmd/testpmd.h | 2 +- app/test/Makefile | 7 +++ app/test/process.h | 2 +- app/test/test_cmdline_cirbuf.c | 2 +- app/test/test_cmdline_etheraddr.c | 2 +- app/test/test_cmdline_ipaddr.c | 2 +- app/test/test_cmdline_num.c | 2 +- app/test/test_cmdline_string.c | 2 +- app/test/test_eal_flags.c | 50 +++++++++---------- app/test/test_eal_fs.c | 2 +- app/test/test_errno.c | 4 +- app/test/test_func_reentrancy.c | 26 +++++----- app/test/test_hash_perf.c | 4 +- app/test/test_ivshmem.c | 16 +++--- app/test/test_kni.c | 4 +- app/test/test_malloc.c | 2 +- app/test/test_mp_secondary.c | 10 ++-- app/test/test_power.c | 2 +- app/test/test_table.c | 4 +- app/test/test_table_acl.c | 8 +-- examples/cmdline/commands.c | 10 ++-- examples/cmdline/parse_obj_list.c | 4 +- examples/dpdk_qat/crypto.c | 2 +- examples/dpdk_qat/main.c | 4 +- examples/exception_path/main.c | 8 +-- examples/ip_fragmentation/main.c | 8 +-- examples/ip_pipeline/config.c | 2 +- examples/ip_pipeline/init.c | 2 +- examples/ip_reassembly/main.c | 6 +-- examples/kni/main.c | 6 +-- examples/l2fwd-ivshmem/host/host.c | 6 +-- examples/l3fwd-acl/main.c | 6 +-- examples/l3fwd-power/main.c | 10 ++-- examples/l3fwd-vf/main.c | 8 +-- examples/l3fwd/main.c | 12 ++--- examples/load_balancer/config.c | 2 +- examples/load_balancer/init.c | 8 +-- .../client_server_mp/mp_server/main.c | 2 +- .../client_server_mp/shared/common.h | 2 +- .../multi_process/simple_mp/mp_commands.c | 2 +- examples/multi_process/symmetric_mp/main.c | 4 +- examples/netmap_compat/bridge/bridge.c | 4 +- examples/netmap_compat/lib/compat_netmap.c | 2 +- examples/qos_sched/args.c | 2 +- examples/qos_sched/cfg_file.c | 22 ++++---- examples/qos_sched/init.c | 8 +-- examples/quota_watermark/qw/init.c | 2 +- examples/vhost/main.c | 20 ++++---- examples/vhost/vhost-net-cdev.c | 8 +-- examples/vhost/virtio-net.c | 6 +-- examples/vhost_xen/main.c | 10 ++-- examples/vhost_xen/vhost_monitor.c | 4 +- examples/vhost_xen/xenstore_parse.c | 12 ++--- lib/librte_acl/rte_acl.c | 4 +- lib/librte_acl/rte_acl_osdep_alone.h | 2 +- lib/librte_cfgfile/rte_cfgfile.c | 8 +-- lib/librte_cmdline/cmdline.c | 2 +- lib/librte_cmdline/cmdline_parse.c | 18 +++---- lib/librte_cmdline/cmdline_parse_etheraddr.c | 4 +- lib/librte_cmdline/cmdline_parse_ipaddr.c | 16 +++--- lib/librte_cmdline/cmdline_parse_num.c | 2 +- lib/librte_cmdline/cmdline_parse_portlist.c | 4 +- lib/librte_cmdline/cmdline_parse_string.c | 8 +-- lib/librte_distributor/rte_distributor.c | 4 +- lib/librte_eal/bsdapp/eal/eal_memory.c | 2 +- lib/librte_eal/bsdapp/eal/eal_pci.c | 4 +- .../bsdapp/eal/include/eal_filesystem.h | 8 +-- lib/librte_eal/common/eal_common_errno.c | 2 +- lib/librte_eal/common/eal_common_hexdump.c | 10 ++-- lib/librte_eal/common/eal_common_memzone.c | 2 +- .../common/include/rte_string_fns.h | 11 ++-- .../linuxapp/eal/eal_hugepage_info.c | 4 +- lib/librte_eal/linuxapp/eal/eal_ivshmem.c | 10 ++-- lib/librte_eal/linuxapp/eal/eal_lcore.c | 8 +-- lib/librte_eal/linuxapp/eal/eal_memory.c | 4 +- lib/librte_eal/linuxapp/eal/eal_pci.c | 28 +++++------ lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 24 ++++----- lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 6 +-- .../linuxapp/eal/eal_pci_vfio_mp_sync.c | 2 +- lib/librte_eal/linuxapp/eal/eal_xen_memory.c | 6 +-- .../linuxapp/eal/include/eal_filesystem.h | 8 +-- lib/librte_hash/rte_fbk_hash.c | 4 +- lib/librte_hash/rte_hash.c | 4 +- lib/librte_ivshmem/rte_ivshmem.c | 16 +++--- lib/librte_kni/rte_kni.c | 32 ++++++------ lib/librte_lpm/rte_lpm.c | 4 +- lib/librte_lpm/rte_lpm6.c | 4 +- lib/librte_malloc/malloc_heap.c | 2 +- lib/librte_mempool/rte_dom0_mempool.c | 2 +- lib/librte_mempool/rte_mempool.c | 6 +-- lib/librte_pipeline/rte_pipeline.c | 2 +- lib/librte_pmd_e1000/em_rxtx.c | 2 +- lib/librte_pmd_e1000/igb_rxtx.c | 2 +- lib/librte_pmd_i40e/i40e_ethdev.c | 2 +- lib/librte_pmd_i40e/i40e_rxtx.c | 2 +- lib/librte_pmd_ixgbe/ixgbe_rxtx.c | 2 +- lib/librte_pmd_ring/rte_eth_ring.c | 8 +-- lib/librte_pmd_virtio/virtio_ethdev.c | 22 ++++---- lib/librte_pmd_virtio/virtio_rxtx.c | 2 +- lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c | 2 +- lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c | 4 +- lib/librte_pmd_xenvirt/rte_eth_xenvirt.c | 20 ++++---- lib/librte_pmd_xenvirt/rte_xen_lib.c | 20 ++++---- lib/librte_power/rte_power.c | 10 ++-- lib/librte_ring/rte_ring.c | 4 +- lib/librte_table/rte_table_acl.c | 4 +- 110 files changed, 390 insertions(+), 386 deletions(-) diff --git a/app/test-pipeline/init.c b/app/test-pipeline/init.c index 12b104ae96..a4337d0dbc 100644 --- a/app/test-pipeline/init.c +++ b/app/test-pipeline/init.c @@ -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, diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 3298360bdb..45ce343faa 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -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; diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 255f82d43d..32f2134d5f 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -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) diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 3ff4f818d1..4bca0b0c23 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -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++) { diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 6a9eab8227..e263616c3f 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -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 * diff --git a/app/test/Makefile b/app/test/Makefile index 9c524602e4..45d0cf29ba 100644 --- a/app/test/Makefile +++ b/app/test/Makefile @@ -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 diff --git a/app/test/process.h b/app/test/process.h index ee9fda6147..cb8973efb4 100644 --- a/app/test/process.h +++ b/app/test/process.h @@ -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); } diff --git a/app/test/test_cmdline_cirbuf.c b/app/test/test_cmdline_cirbuf.c index bf5d68ad1d..87f83cc6d9 100644 --- a/app/test/test_cmdline_cirbuf.c +++ b/app/test/test_cmdline_cirbuf.c @@ -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 diff --git a/app/test/test_cmdline_etheraddr.c b/app/test/test_cmdline_etheraddr.c index 739f2498dd..21f5863734 100644 --- a/app/test/test_cmdline_etheraddr.c +++ b/app/test/test_cmdline_etheraddr.c @@ -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); diff --git a/app/test/test_cmdline_ipaddr.c b/app/test/test_cmdline_ipaddr.c index 0fd61e852a..4ce928d75f 100644 --- a/app/test/test_cmdline_ipaddr.c +++ b/app/test/test_cmdline_ipaddr.c @@ -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 */ diff --git a/app/test/test_cmdline_num.c b/app/test/test_cmdline_num.c index 35f01a8057..e865428f84 100644 --- a/app/test/test_cmdline_num.c +++ b/app/test/test_cmdline_num.c @@ -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 */ diff --git a/app/test/test_cmdline_string.c b/app/test/test_cmdline_string.c index 4f3d63e0f2..3ec0ce1221 100644 --- a/app/test/test_cmdline_string.c +++ b/app/test/test_cmdline_string.c @@ -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( diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c index 2401556a4e..a862654c8d 100644 --- a/app/test/test_eal_flags.c +++ b/app/test/test_eal_flags.c @@ -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); } } diff --git a/app/test/test_eal_fs.c b/app/test/test_eal_fs.c index cc0afdf549..b28ca6c478 100644 --- a/app/test/test_eal_fs.c +++ b/app/test/test_eal_fs.c @@ -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; diff --git a/app/test/test_errno.c b/app/test/test_errno.c index 6533e53562..93ad0b5a23 100644 --- a/app/test/test_errno.c +++ b/app/test/test_errno.c @@ -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); diff --git a/app/test/test_func_reentrancy.c b/app/test/test_func_reentrancy.c index 501b2375e9..0955b0a27c 100644 --- a/app/test/test_func_reentrancy.c +++ b/app/test/test_func_reentrancy.c @@ -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; } diff --git a/app/test/test_hash_perf.c b/app/test/test_hash_perf.c index 17d3795b97..1e9c16e92a 100644 --- a/app/test/test_hash_perf.c +++ b/app/test/test_hash_perf.c @@ -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, diff --git a/app/test/test_ivshmem.c b/app/test/test_ivshmem.c index bafd48790d..1404ada0b8 100644 --- a/app/test/test_ivshmem.c +++ b/app/test/test_ivshmem.c @@ -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 }; diff --git a/app/test/test_kni.c b/app/test/test_kni.c index a870dd5736..962bfad18c 100644 --- a/app/test/test_kni.c +++ b/app/test/test_kni.c @@ -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; diff --git a/app/test/test_malloc.c b/app/test/test_malloc.c index bf27effed9..081715192e 100644 --- a/app/test/test_malloc.c +++ b/app/test/test_malloc.c @@ -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); diff --git a/app/test/test_mp_secondary.c b/app/test/test_mp_secondary.c index 5ec99a2b10..e739765ab4 100644 --- a/app/test/test_mp_secondary.c +++ b/app/test/test_mp_secondary.c @@ -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); diff --git a/app/test/test_power.c b/app/test/test_power.c index ee9011f398..94c1cac004 100644 --- a/app/test/test_power.c +++ b/app/test/test_power.c @@ -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; } diff --git a/app/test/test_table.c b/app/test/test_table.c index 7e2e781d5c..970d15cdc6 100644 --- a/app/test/test_table.c +++ b/app/test/test_table.c @@ -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( diff --git a/app/test/test_table_acl.c b/app/test/test_table_acl.c index ad0e6f1410..5bcc8b83c7 100644 --- a/app/test/test_table_acl.c +++ b/app/test/test_table_acl.c @@ -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); diff --git a/examples/cmdline/commands.c b/examples/cmdline/commands.c index fe82be53f5..8c6c11be1f 100644 --- a/examples/cmdline/commands.c +++ b/examples/cmdline/commands.c @@ -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", diff --git a/examples/cmdline/parse_obj_list.c b/examples/cmdline/parse_obj_list.c index 45a26ef7a6..2625ca3e11 100644 --- a/examples/cmdline/parse_obj_list.c +++ b/examples/cmdline/parse_obj_list.c @@ -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; } diff --git a/examples/dpdk_qat/crypto.c b/examples/dpdk_qat/crypto.c index 2f8ba3da96..577ab32683 100644 --- a/examples/dpdk_qat/crypto.c +++ b/examples/dpdk_qat/crypto.c @@ -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); diff --git a/examples/dpdk_qat/main.c b/examples/dpdk_qat/main.c index 71c03969ff..d61db4c3de 100644 --- a/examples/dpdk_qat/main.c +++ b/examples/dpdk_qat/main.c @@ -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), diff --git a/examples/exception_path/main.c b/examples/exception_path/main.c index 3ece2ac295..020411619d 100644 --- a/examples/exception_path/main.c +++ b/examples/exception_path/main.c @@ -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)", diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c index 3172ad5a45..72cd2b2e1c 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -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) { diff --git a/examples/ip_pipeline/config.c b/examples/ip_pipeline/config.c index 86be3a82d4..2af0b00a18 100644 --- a/examples/ip_pipeline/config.c +++ b/examples/ip_pipeline/config.c @@ -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); diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c index 947e152a1b..d00027fef9 100644 --- a/examples/ip_pipeline/init.c +++ b/examples/ip_pipeline/init.c @@ -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, diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c index 1b60e410ac..3bb6afdbf1 100644 --- a/examples/ip_reassembly/main.c +++ b/examples/ip_reassembly/main.c @@ -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) { diff --git a/examples/kni/main.c b/examples/kni/main.c index bc1f961373..7df1b36468 100644 --- a/examples/kni/main.c +++ b/examples/kni/main.c @@ -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; diff --git a/examples/l2fwd-ivshmem/host/host.c b/examples/l2fwd-ivshmem/host/host.c index 712f1ea511..02e65b979e 100644 --- a/examples/l2fwd-ivshmem/host/host.c +++ b/examples/l2fwd-ivshmem/host/host.c @@ -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) diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c index 5d1053f1e8..9b2c21bec8 100644 --- a/examples/l3fwd-acl/main.c +++ b/examples/l3fwd-acl/main.c @@ -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, diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index ae9d3e5d26..57fc3716b2 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -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, diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index c199f0c126..2ca5c21dab 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -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, diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index e1754a94c8..73a039eb22 100755 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -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), diff --git a/examples/load_balancer/config.c b/examples/load_balancer/config.c index 62990e49f5..6e2fad06c7 100644 --- a/examples/load_balancer/config.c +++ b/examples/load_balancer/config.c @@ -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; diff --git a/examples/load_balancer/init.c b/examples/load_balancer/init.c index 09ba3ff8f1..2f00a7085c 100644 --- a/examples/load_balancer/init.c +++ b/examples/load_balancer/init.c @@ -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, diff --git a/examples/multi_process/client_server_mp/mp_server/main.c b/examples/multi_process/client_server_mp/mp_server/main.c index 1eaf76152a..b3887b1f61 100644 --- a/examples/multi_process/client_server_mp/mp_server/main.c +++ b/examples/multi_process/client_server_mp/mp_server/main.c @@ -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]); diff --git a/examples/multi_process/client_server_mp/shared/common.h b/examples/multi_process/client_server_mp/shared/common.h index 16efd2e08d..631c463250 100644 --- a/examples/multi_process/client_server_mp/shared/common.h +++ b/examples/multi_process/client_server_mp/shared/common.h @@ -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; } diff --git a/examples/multi_process/simple_mp/mp_commands.c b/examples/multi_process/simple_mp/mp_commands.c index c64ebddc55..bf882c990b 100644 --- a/examples/multi_process/simple_mp/mp_commands.c +++ b/examples/multi_process/simple_mp/mp_commands.c @@ -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); diff --git a/examples/multi_process/symmetric_mp/main.c b/examples/multi_process/symmetric_mp/main.c index d40223e4d3..b8f31b31a2 100644 --- a/examples/multi_process/symmetric_mp/main.c +++ b/examples/multi_process/symmetric_mp/main.c @@ -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); diff --git a/examples/netmap_compat/bridge/bridge.c b/examples/netmap_compat/bridge/bridge.c index d9c892cc51..898277e532 100644 --- a/examples/netmap_compat/bridge/bridge.c +++ b/examples/netmap_compat/bridge/bridge.c @@ -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; diff --git a/examples/netmap_compat/lib/compat_netmap.c b/examples/netmap_compat/lib/compat_netmap.c index 190151ed56..44b3f8e3b6 100644 --- a/examples/netmap_compat/lib/compat_netmap.c +++ b/examples/netmap_compat/lib/compat_netmap.c @@ -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 */ diff --git a/examples/qos_sched/args.c b/examples/qos_sched/args.c index 42ef5f9115..ddf9ba465f 100755 --- a/examples/qos_sched/args.c +++ b/examples/qos_sched/args.c @@ -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; diff --git a/examples/qos_sched/cfg_file.c b/examples/qos_sched/cfg_file.c index f72645878e..05a8cafb12 100755 --- a/examples/qos_sched/cfg_file.c +++ b/examples/qos_sched/cfg_file.c @@ -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; diff --git a/examples/qos_sched/init.c b/examples/qos_sched/init.c index cc4c2c9e48..cbfd63f0c3 100755 --- a/examples/qos_sched/init.c +++ b/examples/qos_sched/init.c @@ -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), diff --git a/examples/quota_watermark/qw/init.c b/examples/quota_watermark/qw/init.c index d163d7fce7..a7f8c8504e 100644 --- a/examples/quota_watermark/qw/init.c +++ b/examples/quota_watermark/qw/init.c @@ -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); diff --git a/examples/vhost/main.c b/examples/vhost/main.c index e0fc2c98c2..193aa2551c 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -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), diff --git a/examples/vhost/vhost-net-cdev.c b/examples/vhost/vhost-net-cdev.c index ef42e8808e..8cf806ac4c 100644 --- a/examples/vhost/vhost-net-cdev.c +++ b/examples/vhost/vhost-net-cdev.c @@ -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. */ diff --git a/examples/vhost/virtio-net.c b/examples/vhost/virtio-net.c index 9be959f817..801607ace2 100644 --- a/examples/vhost/virtio-net.c +++ b/examples/vhost/virtio-net.c @@ -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); diff --git a/examples/vhost_xen/main.c b/examples/vhost_xen/main.c index 94c69ee918..b2757473a1 100644 --- a/examples/vhost_xen/main.c +++ b/examples/vhost_xen/main.c @@ -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) diff --git a/examples/vhost_xen/vhost_monitor.c b/examples/vhost_xen/vhost_monitor.c index b9c1cb5ac2..6994c9c78d 100644 --- a/examples/vhost_xen/vhost_monitor.c +++ b/examples/vhost_xen/vhost_monitor.c @@ -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); diff --git a/examples/vhost_xen/xenstore_parse.c b/examples/vhost_xen/xenstore_parse.c index b8acd3ec6e..fdd69b2971 100644 --- a/examples/vhost_xen/xenstore_parse.c +++ b/examples/vhost_xen/xenstore_parse.c @@ -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); diff --git a/lib/librte_acl/rte_acl.c b/lib/librte_acl/rte_acl.c index 129a41f9b9..ea3ce3a32e 100644 --- a/lib/librte_acl/rte_acl.c +++ b/lib/librte_acl/rte_acl.c @@ -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); diff --git a/lib/librte_acl/rte_acl_osdep_alone.h b/lib/librte_acl/rte_acl_osdep_alone.h index a46d71e20b..a7b7424d68 100644 --- a/lib/librte_acl/rte_acl_osdep_alone.h +++ b/lib/librte_acl/rte_acl_osdep_alone.h @@ -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 diff --git a/lib/librte_cfgfile/rte_cfgfile.c b/lib/librte_cfgfile/rte_cfgfile.c index 26052d0c2f..f2bc2cc102 100644 --- a/lib/librte_cfgfile/rte_cfgfile.c +++ b/lib/librte_cfgfile/rte_cfgfile.c @@ -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; diff --git a/lib/librte_cmdline/cmdline.c b/lib/librte_cmdline/cmdline.c index 78572f4b98..e61c4f2c7e 100755 --- a/lib/librte_cmdline/cmdline.c +++ b/lib/librte_cmdline/cmdline.c @@ -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 * diff --git a/lib/librte_cmdline/cmdline_parse.c b/lib/librte_cmdline/cmdline_parse.c index 40969eff22..940480dec6 100644 --- a/lib/librte_cmdline/cmdline_parse.c +++ b/lib/librte_cmdline/cmdline_parse.c @@ -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); } diff --git a/lib/librte_cmdline/cmdline_parse_etheraddr.c b/lib/librte_cmdline/cmdline_parse_etheraddr.c index 5e11631282..5285c4096c 100644 --- a/lib/librte_cmdline/cmdline_parse_etheraddr.c +++ b/lib/librte_cmdline/cmdline_parse_etheraddr.c @@ -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; diff --git a/lib/librte_cmdline/cmdline_parse_ipaddr.c b/lib/librte_cmdline/cmdline_parse_ipaddr.c index 501f35ba72..ac835149e0 100644 --- a/lib/librte_cmdline/cmdline_parse_ipaddr.c +++ b/lib/librte_cmdline/cmdline_parse_ipaddr.c @@ -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; diff --git a/lib/librte_cmdline/cmdline_parse_num.c b/lib/librte_cmdline/cmdline_parse_num.c index 832310d68e..0b9e4d0dc3 100644 --- a/lib/librte_cmdline/cmdline_parse_num.c +++ b/lib/librte_cmdline/cmdline_parse_num.c @@ -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'; diff --git a/lib/librte_cmdline/cmdline_parse_portlist.c b/lib/librte_cmdline/cmdline_parse_portlist.c index d7a93ccb9e..7eac05c4be 100644 --- a/lib/librte_cmdline/cmdline_parse_portlist.c +++ b/lib/librte_cmdline/cmdline_parse_portlist.c @@ -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; diff --git a/lib/librte_cmdline/cmdline_parse_string.c b/lib/librte_cmdline/cmdline_parse_string.c index cbad6fb456..b1bfe918b3 100644 --- a/lib/librte_cmdline/cmdline_parse_string.c +++ b/lib/librte_cmdline/cmdline_parse_string.c @@ -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; } diff --git a/lib/librte_distributor/rte_distributor.c b/lib/librte_distributor/rte_distributor.c index ec6094f705..2d92e45471 100644 --- a/lib/librte_distributor/rte_distributor.c +++ b/lib/librte_distributor/rte_distributor.c @@ -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); diff --git a/lib/librte_eal/bsdapp/eal/eal_memory.c b/lib/librte_eal/bsdapp/eal/eal_memory.c index 736b3bf40e..65ee87d87b 100644 --- a/lib/librte_eal/bsdapp/eal/eal_memory.c +++ b/lib/librte_eal/bsdapp/eal/eal_memory.c @@ -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); diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c index dad5418507..2bbbeb03fd 100644 --- a/lib/librte_eal/bsdapp/eal/eal_pci.c +++ b/lib/librte_eal/bsdapp/eal/eal_pci.c @@ -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)); diff --git a/lib/librte_eal/bsdapp/eal/include/eal_filesystem.h b/lib/librte_eal/bsdapp/eal/include/eal_filesystem.h index 6609e08a41..ce442c9e12 100644 --- a/lib/librte_eal/bsdapp/eal/include/eal_filesystem.h +++ b/lib/librte_eal/bsdapp/eal/include/eal_filesystem.h @@ -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; diff --git a/lib/librte_eal/common/eal_common_errno.c b/lib/librte_eal/common/eal_common_errno.c index cd8144a391..259f89587f 100644 --- a/lib/librte_eal/common/eal_common_errno.c +++ b/lib/librte_eal/common/eal_common_errno.c @@ -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 diff --git a/lib/librte_eal/common/eal_common_hexdump.c b/lib/librte_eal/common/eal_common_hexdump.c index ddcb791414..6135133fae 100755 --- a/lib/librte_eal/common/eal_common_hexdump.c +++ b/lib/librte_eal/common/eal_common_hexdump.c @@ -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 ) diff --git a/lib/librte_eal/common/eal_common_memzone.c b/lib/librte_eal/common/eal_common_memzone.c index 524a61c813..5acd9ce491 100644 --- a/lib/librte_eal/common/eal_common_memzone.c +++ b/lib/librte_eal/common/eal_common_memzone.c @@ -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; diff --git a/lib/librte_eal/common/include/rte_string_fns.h b/lib/librte_eal/common/include/rte_string_fns.h index bbb8c5ba55..cf96b2c7dc 100644 --- a/lib/librte_eal/common/include/rte_string_fns.h +++ b/lib/librte_eal/common/include/rte_string_fns.h @@ -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" diff --git a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c index 902cc58283..b72a205b5a 100644 --- a/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c +++ b/lib/librte_eal/linuxapp/eal/eal_hugepage_info.c @@ -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) diff --git a/lib/librte_eal/linuxapp/eal/eal_ivshmem.c b/lib/librte_eal/linuxapp/eal/eal_ivshmem.c index b130e668b9..4e59df5e05 100644 --- a/lib/librte_eal/linuxapp/eal/eal_ivshmem.c +++ b/lib/librte_eal/linuxapp/eal/eal_ivshmem.c @@ -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); diff --git a/lib/librte_eal/linuxapp/eal/eal_lcore.c b/lib/librte_eal/linuxapp/eal/eal_lcore.c index cc9b900d82..baf16598ae 100644 --- a/lib/librte_eal/linuxapp/eal/eal_lcore.c +++ b/lib/librte_eal/linuxapp/eal/eal_lcore.c @@ -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) diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c index ae43f9eadb..f2454f4051 100644 --- a/lib/librte_eal/linuxapp/eal/eal_memory.c +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c @@ -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 */ diff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c index b20c510c3e..5fe3961ef8 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci.c @@ -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) { diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c index 96aa24d63c..7e62266429 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci_uio.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci_uio.c @@ -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 */ diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c index bf765b5f45..c776ddc442 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c @@ -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 */ diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c b/lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c index add2c3e5e8..6588fb1f91 100644 --- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c +++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c @@ -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); } diff --git a/lib/librte_eal/linuxapp/eal/eal_xen_memory.c b/lib/librte_eal/linuxapp/eal/eal_xen_memory.c index 4c66bf3af2..ee5cc2da99 100644 --- a/lib/librte_eal/linuxapp/eal/eal_xen_memory.c +++ b/lib/librte_eal/linuxapp/eal/eal_xen_memory.c @@ -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); diff --git a/lib/librte_eal/linuxapp/eal/include/eal_filesystem.h b/lib/librte_eal/linuxapp/eal/include/eal_filesystem.h index 6609e08a41..ce442c9e12 100644 --- a/lib/librte_eal/linuxapp/eal/include/eal_filesystem.h +++ b/lib/librte_eal/linuxapp/eal/include/eal_filesystem.h @@ -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; diff --git a/lib/librte_hash/rte_fbk_hash.c b/lib/librte_hash/rte_fbk_hash.c index 4d6755485e..d1caabce62 100644 --- a/lib/librte_hash/rte_fbk_hash.c +++ b/lib/librte_hash/rte_fbk_hash.c @@ -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; diff --git a/lib/librte_hash/rte_hash.c b/lib/librte_hash/rte_hash.c index d4221a8cca..b7d882b411 100644 --- a/lib/librte_hash/rte_hash.c +++ b/lib/librte_hash/rte_hash.c @@ -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; diff --git a/lib/librte_ivshmem/rte_ivshmem.c b/lib/librte_ivshmem/rte_ivshmem.c index ae63bb9c37..7ca55edb91 100644 --- a/lib/librte_ivshmem/rte_ivshmem.c +++ b/lib/librte_ivshmem/rte_ivshmem.c @@ -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); diff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c index 2416e95534..76feef47fb 100644 --- a/lib/librte_kni/rte_kni.c +++ b/lib/librte_kni/rte_kni.c @@ -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); } diff --git a/lib/librte_lpm/rte_lpm.c b/lib/librte_lpm/rte_lpm.c index 35209c3301..c8dd3649ed 100644 --- a/lib/librte_lpm/rte_lpm.c +++ b/lib/librte_lpm/rte_lpm.c @@ -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); diff --git a/lib/librte_lpm/rte_lpm6.c b/lib/librte_lpm/rte_lpm6.c index 32690cbbcf..5610ebc4c7 100644 --- a/lib/librte_lpm/rte_lpm6.c +++ b/lib/librte_lpm/rte_lpm6.c @@ -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); diff --git a/lib/librte_malloc/malloc_heap.c b/lib/librte_malloc/malloc_heap.c index a36cd925e5..94be0afe13 100644 --- a/lib/librte_malloc/malloc_heap.c +++ b/lib/librte_malloc/malloc_heap.c @@ -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 diff --git a/lib/librte_mempool/rte_dom0_mempool.c b/lib/librte_mempool/rte_dom0_mempool.c index 8152b01cc8..9ec68fb3c4 100644 --- a/lib/librte_mempool/rte_dom0_mempool.c +++ b/lib/librte_mempool/rte_dom0_mempool.c @@ -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); diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c index 7eebf7fe38..dbb4104369 100644 --- a/lib/librte_mempool/rte_mempool.c +++ b/lib/librte_mempool/rte_mempool.c @@ -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; diff --git a/lib/librte_pipeline/rte_pipeline.c b/lib/librte_pipeline/rte_pipeline.c index 1de4c09b2d..f0349e32b9 100644 --- a/lib/librte_pipeline/rte_pipeline.c +++ b/lib/librte_pipeline/rte_pipeline.c @@ -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; diff --git a/lib/librte_pmd_e1000/em_rxtx.c b/lib/librte_pmd_e1000/em_rxtx.c index e5f1933f53..f2548587d5 100644 --- a/lib/librte_pmd_e1000/em_rxtx.c +++ b/lib/librte_pmd_e1000/em_rxtx.c @@ -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); diff --git a/lib/librte_pmd_e1000/igb_rxtx.c b/lib/librte_pmd_e1000/igb_rxtx.c index aea898c139..977c4a26b2 100644 --- a/lib/librte_pmd_e1000/igb_rxtx.c +++ b/lib/librte_pmd_e1000/igb_rxtx.c @@ -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); diff --git a/lib/librte_pmd_i40e/i40e_ethdev.c b/lib/librte_pmd_i40e/i40e_ethdev.c index ade92ecb6d..068b847572 100644 --- a/lib/librte_pmd_i40e/i40e_ethdev.c +++ b/lib/librte_pmd_i40e/i40e_ethdev.c @@ -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; diff --git a/lib/librte_pmd_i40e/i40e_rxtx.c b/lib/librte_pmd_i40e/i40e_rxtx.c index 3a6a2d8106..83b9462732 100644 --- a/lib/librte_pmd_i40e/i40e_rxtx.c +++ b/lib/librte_pmd_i40e/i40e_rxtx.c @@ -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); diff --git a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c index a5c8228943..dfc2076065 100644 --- a/lib/librte_pmd_ixgbe/ixgbe_rxtx.c +++ b/lib/librte_pmd_ixgbe/ixgbe_rxtx.c @@ -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); diff --git a/lib/librte_pmd_ring/rte_eth_ring.c b/lib/librte_pmd_ring/rte_eth_ring.c index 10d4e247fe..ce7ad71d16 100644 --- a/lib/librte_pmd_ring/rte_eth_ring.c +++ b/lib/librte_pmd_ring/rte_eth_ring.c @@ -326,7 +326,7 @@ eth_dev_ring_create(const char *name, const unsigned numa_node, RTE_PMD_RING_MAX_TX_RINGS); for (i = 0; i < num_rings; i++) { - rte_snprintf(rng_name, sizeof(rng_name), "ETH_RXTX%u_%s", i, name); + snprintf(rng_name, sizeof(rng_name), "ETH_RXTX%u_%s", i, name); rxtx[i] = (action == DEV_CREATE) ? rte_ring_create(rng_name, 1024, numa_node, RING_F_SP_ENQ|RING_F_SC_DEQ) : @@ -357,14 +357,14 @@ eth_dev_ring_pair_create(const char *name, const unsigned numa_node, RTE_PMD_RING_MAX_TX_RINGS); for (i = 0; i < num_rings; i++) { - rte_snprintf(rng_name, sizeof(rng_name), "ETH_RX%u_%s", i, name); + snprintf(rng_name, sizeof(rng_name), "ETH_RX%u_%s", i, name); rx[i] = (action == DEV_CREATE) ? rte_ring_create(rng_name, 1024, numa_node, RING_F_SP_ENQ|RING_F_SC_DEQ) : rte_ring_lookup(rng_name); if (rx[i] == NULL) return -1; - rte_snprintf(rng_name, sizeof(rng_name), "ETH_TX%u_%s", i, name); + snprintf(rng_name, sizeof(rng_name), "ETH_TX%u_%s", i, name); tx[i] = (action == DEV_CREATE) ? rte_ring_create(rng_name, 1024, numa_node, RING_F_SP_ENQ|RING_F_SC_DEQ): @@ -461,7 +461,7 @@ static int parse_kvlist (const char *key __rte_unused, const char *value, void * goto out; } - rte_snprintf(info->list[info->count].name, sizeof(info->list[info->count].name), "%s", name); + snprintf(info->list[info->count].name, sizeof(info->list[info->count].name), "%s", name); info->count++; diff --git a/lib/librte_pmd_virtio/virtio_ethdev.c b/lib/librte_pmd_virtio/virtio_ethdev.c index 96613581b2..d4730f907a 100644 --- a/lib/librte_pmd_virtio/virtio_ethdev.c +++ b/lib/librte_pmd_virtio/virtio_ethdev.c @@ -267,19 +267,19 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev, } if (queue_type == VTNET_RQ) { - rte_snprintf(vq_name, sizeof(vq_name), "port%d_rvq%d", + snprintf(vq_name, sizeof(vq_name), "port%d_rvq%d", dev->data->port_id, queue_idx); vq = rte_zmalloc(vq_name, sizeof(struct virtqueue) + vq_size * sizeof(struct vq_desc_extra), CACHE_LINE_SIZE); memcpy(vq->vq_name, vq_name, sizeof(vq->vq_name)); } else if (queue_type == VTNET_TQ) { - rte_snprintf(vq_name, sizeof(vq_name), "port%d_tvq%d", + snprintf(vq_name, sizeof(vq_name), "port%d_tvq%d", dev->data->port_id, queue_idx); vq = rte_zmalloc(vq_name, sizeof(struct virtqueue) + vq_size * sizeof(struct vq_desc_extra), CACHE_LINE_SIZE); memcpy(vq->vq_name, vq_name, sizeof(vq->vq_name)); } else if (queue_type == VTNET_CQ) { - rte_snprintf(vq_name, sizeof(vq_name), "port%d_cvq", + snprintf(vq_name, sizeof(vq_name), "port%d_cvq", dev->data->port_id); vq = rte_zmalloc(vq_name, sizeof(struct virtqueue) + vq_size * sizeof(struct vq_desc_extra), @@ -337,7 +337,7 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev, /* * For each xmit packet, allocate a virtio_net_hdr */ - rte_snprintf(vq_name, sizeof(vq_name), "port%d_tvq%d_hdrzone", + snprintf(vq_name, sizeof(vq_name), "port%d_tvq%d_hdrzone", dev->data->port_id, queue_idx); vq->virtio_net_hdr_mz = rte_memzone_reserve_aligned(vq_name, vq_size * sizeof(struct virtio_net_hdr), @@ -352,7 +352,7 @@ int virtio_dev_queue_setup(struct rte_eth_dev *dev, vq_size * sizeof(struct virtio_net_hdr)); } else if (queue_type == VTNET_CQ) { /* Allocate a page for control vq command, data and status */ - rte_snprintf(vq_name, sizeof(vq_name), "port%d_cvq_hdrzone", + snprintf(vq_name, sizeof(vq_name), "port%d_cvq_hdrzone", dev->data->port_id); vq->virtio_net_hdr_mz = rte_memzone_reserve_aligned(vq_name, PAGE_SIZE, socket_id, 0, CACHE_LINE_SIZE); @@ -592,13 +592,13 @@ static int get_uio_dev(struct rte_pci_addr *loc, char *buf, unsigned int buflen) /* 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); @@ -624,7 +624,7 @@ static int get_uio_dev(struct rte_pci_addr *loc, char *buf, unsigned int buflen) errno = 0; uio_num = strtoull(e->d_name + shortprefix_len, &endptr, 10); if (errno == 0 && endptr != (e->d_name + shortprefix_len)) { - rte_snprintf(buf, buflen, "%s/uio%u", dirname, uio_num); + snprintf(buf, buflen, "%s/uio%u", dirname, uio_num); break; } @@ -632,7 +632,7 @@ static int get_uio_dev(struct rte_pci_addr *loc, char *buf, unsigned int buflen) errno = 0; uio_num = strtoull(e->d_name + longprefix_len, &endptr, 10); if (errno == 0 && endptr != (e->d_name + longprefix_len)) { - rte_snprintf(buf, buflen, "%s/uio:uio%u", dirname, + snprintf(buf, buflen, "%s/uio:uio%u", dirname, uio_num); break; } @@ -697,7 +697,7 @@ eth_virtio_dev_init(__rte_unused struct eth_driver *eth_drv, return -1; /* get portio size */ - rte_snprintf(filename, sizeof(filename), + snprintf(filename, sizeof(filename), "%s/portio/port0/size", dirname); if (parse_sysfs_value(filename, &size) < 0) { PMD_INIT_LOG(ERR, "%s(): cannot parse size\n", @@ -706,7 +706,7 @@ eth_virtio_dev_init(__rte_unused struct eth_driver *eth_drv, } /* get portio start */ - rte_snprintf(filename, sizeof(filename), + snprintf(filename, sizeof(filename), "%s/portio/port0/start", dirname); if (parse_sysfs_value(filename, &start) < 0) { PMD_INIT_LOG(ERR, "%s(): cannot parse portio start\n", diff --git a/lib/librte_pmd_virtio/virtio_rxtx.c b/lib/librte_pmd_virtio/virtio_rxtx.c index ab5b091b5b..6d203312a7 100644 --- a/lib/librte_pmd_virtio/virtio_rxtx.c +++ b/lib/librte_pmd_virtio/virtio_rxtx.c @@ -103,7 +103,7 @@ virtio_dev_vring_start(struct rte_eth_dev *dev, struct virtqueue *vq, int queue_ */ virtqueue_disable_intr(vq); - rte_snprintf(vq_name, sizeof(vq_name), "port_%d_rx_vq", + snprintf(vq_name, sizeof(vq_name), "port_%d_rx_vq", dev->data->port_id); PMD_INIT_LOG(DEBUG, "vq name: %s\n", vq->vq_name); diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c index 2411d26929..90e9b29033 100644 --- a/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c +++ b/lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c @@ -126,7 +126,7 @@ gpa_zone_reserve(struct rte_eth_dev *dev, uint32_t size, char z_name[RTE_MEMZONE_NAMESIZE]; const struct rte_memzone *mz; - rte_snprintf(z_name, sizeof(z_name), "%s_%d_%s", + snprintf(z_name, sizeof(z_name), "%s_%d_%s", dev->driver->pci_drv.name, dev->data->port_id, post_string); mz = rte_memzone_lookup(z_name); diff --git a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c index 319bc113c6..c6aa9638bb 100644 --- a/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c +++ b/lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c @@ -594,7 +594,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); @@ -812,7 +812,7 @@ vmxnet3_dev_rx_queue_setup(struct rte_eth_dev *dev, ring = &rxq->cmd_ring[i]; ring->rid = i; - rte_snprintf(mem_name, sizeof(mem_name), "rx_ring_%d_buf_info", i); + snprintf(mem_name, sizeof(mem_name), "rx_ring_%d_buf_info", i); ring->buf_info = rte_zmalloc(mem_name, ring->size * sizeof(vmxnet3_buf_info_t), CACHE_LINE_SIZE); if (ring->buf_info == NULL) { diff --git a/lib/librte_pmd_xenvirt/rte_eth_xenvirt.c b/lib/librte_pmd_xenvirt/rte_eth_xenvirt.c index 7c4d3fe82b..18c44f5797 100644 --- a/lib/librte_pmd_xenvirt/rte_eth_xenvirt.c +++ b/lib/librte_pmd_xenvirt/rte_eth_xenvirt.c @@ -211,8 +211,8 @@ gntalloc_vring_flag(int vtidx) } *(uint8_t *)ptr = MAP_FLAG; - rte_snprintf(val_str, sizeof(val_str), "%u", gref_tmp); - rte_snprintf(key_str, sizeof(key_str), + snprintf(val_str, sizeof(val_str), "%u", gref_tmp); + snprintf(key_str, sizeof(key_str), DPDK_XENSTORE_PATH"%d"VRING_FLAG_STR, vtidx); xenstore_write(key_str, val_str); } @@ -230,10 +230,10 @@ dev_start_notify(int vtidx) RTE_LOG(INFO, PMD, "%s: virtio %d is started\n", __func__, vtidx); gntalloc_vring_flag(vtidx); - rte_snprintf(key_str, sizeof(key_str), "%s%s%d", + snprintf(key_str, sizeof(key_str), "%s%s%d", DPDK_XENSTORE_PATH, EVENT_TYPE_START_STR, vtidx); - rte_snprintf(val_str, sizeof(val_str), "1"); + snprintf(val_str, sizeof(val_str), "1"); xenstore_write(key_str, val_str); } @@ -259,11 +259,11 @@ update_mac_address(struct ether_addr *mac_addrs, int vtidx) RTE_LOG(ERR, PMD, "%s: NULL pointer mac specified\n", __func__); return -1; } - rv = rte_snprintf(key_str, sizeof(key_str), + rv = snprintf(key_str, sizeof(key_str), DPDK_XENSTORE_PATH"%d_ether_addr", vtidx); if (rv == -1) return rv; - rv = rte_snprintf(val_str, sizeof(val_str), "%02x:%02x:%02x:%02x:%02x:%02x", + rv = snprintf(val_str, sizeof(val_str), "%02x:%02x:%02x:%02x:%02x:%02x", mac_addrs->addr_bytes[0], mac_addrs->addr_bytes[1], mac_addrs->addr_bytes[2], @@ -419,9 +419,9 @@ gntalloc_vring_create(int queue_type, uint32_t size, int vtidx) } if (queue_type == VTNET_RQ) - rv = rte_snprintf(key_str, sizeof(key_str), DPDK_XENSTORE_PATH"%d"RXVRING_XENSTORE_STR, vtidx); + rv = snprintf(key_str, sizeof(key_str), DPDK_XENSTORE_PATH"%d"RXVRING_XENSTORE_STR, vtidx); else - rv = rte_snprintf(key_str, sizeof(key_str), DPDK_XENSTORE_PATH"%d"TXVRING_XENSTORE_STR, vtidx); + rv = snprintf(key_str, sizeof(key_str), DPDK_XENSTORE_PATH"%d"TXVRING_XENSTORE_STR, vtidx); if (rv == -1 || xenstore_write(key_str, val_str) == -1) { gntfree(va, size, start_index); va = NULL; @@ -449,7 +449,7 @@ virtio_queue_setup(struct rte_eth_dev *dev, int queue_type) /* Allocate memory for virtqueue. */ if (queue_type == VTNET_RQ) { - rte_snprintf(vq_name, sizeof(vq_name), "port%d_rvq", + snprintf(vq_name, sizeof(vq_name), "port%d_rvq", dev->data->port_id); vq = rte_zmalloc(vq_name, sizeof(struct virtqueue) + vq_size * sizeof(struct vq_desc_extra), CACHE_LINE_SIZE); @@ -459,7 +459,7 @@ virtio_queue_setup(struct rte_eth_dev *dev, int queue_type) } memcpy(vq->vq_name, vq_name, sizeof(vq->vq_name)); } else if(queue_type == VTNET_TQ) { - rte_snprintf(vq_name, sizeof(vq_name), "port%d_tvq", + snprintf(vq_name, sizeof(vq_name), "port%d_tvq", dev->data->port_id); vq = rte_zmalloc(vq_name, sizeof(struct virtqueue) + vq_size * sizeof(struct vq_desc_extra), CACHE_LINE_SIZE); diff --git a/lib/librte_pmd_xenvirt/rte_xen_lib.c b/lib/librte_pmd_xenvirt/rte_xen_lib.c index 493908af60..85a1ed91bd 100644 --- a/lib/librte_pmd_xenvirt/rte_xen_lib.c +++ b/lib/librte_pmd_xenvirt/rte_xen_lib.c @@ -258,7 +258,7 @@ xenstore_cleanup(void) { char store_path[PATH_MAX] = {0}; - if (rte_snprintf(store_path, sizeof(store_path), + if (snprintf(store_path, sizeof(store_path), "%s%s", dompath, DPDK_XENSTORE_NODE) == -1) return -1; @@ -320,9 +320,9 @@ xenstore_write(const char *key_str, const char *val_str) RTE_LOG(ERR, PMD, "%s: xenstore init failed\n", __func__); return -1; } - rv = rte_snprintf(grant_path, sizeof(grant_path), "%s%s", dompath, key_str); + rv = snprintf(grant_path, sizeof(grant_path), "%s%s", dompath, key_str); if (rv == -1) { - RTE_LOG(ERR, PMD, "%s: rte_snprintf %s %s failed\n", + RTE_LOG(ERR, PMD, "%s: snprintf %s %s failed\n", __func__, dompath, key_str); return -1; } @@ -374,11 +374,11 @@ grant_node_create(uint32_t pg_num, uint32_t *gref_arr, phys_addr_t *pa_arr, char while (j < pg_num) { if (first) { - rv = rte_snprintf(val_str, str_size, "%u", gref_tmp[k]); + rv = snprintf(val_str, str_size, "%u", gref_tmp[k]); first = 0; } else { - rte_snprintf(tmp_str, PATH_MAX, "%s", val_str); - rv = rte_snprintf(val_str, str_size, "%s,%u", tmp_str, gref_tmp[k]); + snprintf(tmp_str, PATH_MAX, "%s", val_str); + rv = snprintf(val_str, str_size, "%s,%u", tmp_str, gref_tmp[k]); } k++; if (rv == -1) @@ -406,22 +406,22 @@ grant_gntalloc_mbuf_pool(struct rte_mempool *mpool, uint32_t pg_num, uint32_t *g char key_str[PATH_MAX] = {0}; char val_str[PATH_MAX] = {0}; - rte_snprintf(val_str, sizeof(val_str), ""); + snprintf(val_str, sizeof(val_str), ""); if (grant_node_create(pg_num, gref_arr, pa_arr, val_str, sizeof(val_str))) { return -1; } - if (rte_snprintf(key_str, sizeof(key_str), + if (snprintf(key_str, sizeof(key_str), DPDK_XENSTORE_PATH"%d"MEMPOOL_XENSTORE_STR, mempool_idx) == -1) return -1; if (xenstore_write(key_str, val_str) == -1) return -1; - if (rte_snprintf(key_str, sizeof(key_str), + if (snprintf(key_str, sizeof(key_str), DPDK_XENSTORE_PATH"%d"MEMPOOL_VA_XENSTORE_STR, mempool_idx) == -1) return -1; - if (rte_snprintf(val_str, sizeof(val_str), "%p", (uintptr_t)mpool->elt_va_start) == -1) + if (snprintf(val_str, sizeof(val_str), "%p", (uintptr_t)mpool->elt_va_start) == -1) return -1; if (xenstore_write(key_str, val_str) == -1) return -1; diff --git a/lib/librte_power/rte_power.c b/lib/librte_power/rte_power.c index a2d9e0c309..856da9ae4e 100644 --- a/lib/librte_power/rte_power.c +++ b/lib/librte_power/rte_power.c @@ -158,7 +158,7 @@ power_set_governor_userspace(struct rte_power_info *pi) char *s; int val; - rte_snprintf(fullpath, sizeof(fullpath), POWER_SYSFILE_GOVERNOR, + snprintf(fullpath, sizeof(fullpath), POWER_SYSFILE_GOVERNOR, pi->lcore_id); f = fopen(fullpath, "rw+"); FOPEN_OR_ERR_RET(f, ret); @@ -175,7 +175,7 @@ power_set_governor_userspace(struct rte_power_info *pi) goto out; } /* Save the original governor */ - rte_snprintf(pi->governor_ori, sizeof(pi->governor_ori), "%s", buf); + snprintf(pi->governor_ori, sizeof(pi->governor_ori), "%s", buf); /* Write 'userspace' to the governor */ val = fseek(f, 0, SEEK_SET); @@ -208,7 +208,7 @@ power_get_available_freqs(struct rte_power_info *pi) char *freqs[RTE_MAX_LCORE_FREQS]; char *s; - rte_snprintf(fullpath, sizeof(fullpath), POWER_SYSFILE_AVAIL_FREQ, + snprintf(fullpath, sizeof(fullpath), POWER_SYSFILE_AVAIL_FREQ, pi->lcore_id); f = fopen(fullpath, "r"); FOPEN_OR_ERR_RET(f, ret); @@ -264,7 +264,7 @@ power_init_for_setting_freq(struct rte_power_info *pi) uint32_t i, freq; char *s; - rte_snprintf(fullpath, sizeof(fullpath), POWER_SYSFILE_SETSPEED, + snprintf(fullpath, sizeof(fullpath), POWER_SYSFILE_SETSPEED, pi->lcore_id); f = fopen(fullpath, "rw+"); FOPEN_OR_ERR_RET(f, -1); @@ -361,7 +361,7 @@ power_set_governor_original(struct rte_power_info *pi) char *s; int val; - rte_snprintf(fullpath, sizeof(fullpath), POWER_SYSFILE_GOVERNOR, + snprintf(fullpath, sizeof(fullpath), POWER_SYSFILE_GOVERNOR, pi->lcore_id); f = fopen(fullpath, "rw+"); FOPEN_OR_ERR_RET(f, ret); diff --git a/lib/librte_ring/rte_ring.c b/lib/librte_ring/rte_ring.c index 2fe4024602..c62065db38 100644 --- a/lib/librte_ring/rte_ring.c +++ b/lib/librte_ring/rte_ring.c @@ -135,7 +135,7 @@ rte_ring_init(struct rte_ring *r, const char *name, unsigned count, /* init the ring structure */ memset(r, 0, sizeof(*r)); - rte_snprintf(r->name, sizeof(r->name), "%s", name); + snprintf(r->name, sizeof(r->name), "%s", name); r->flags = flags; r->prod.watermark = count; r->prod.sp_enqueue = !!(flags & RING_F_SP_ENQ); @@ -173,7 +173,7 @@ rte_ring_create(const char *name, unsigned count, int socket_id, return NULL; } - rte_snprintf(mz_name, sizeof(mz_name), "%s%s", RTE_RING_MZ_PREFIX, name); + snprintf(mz_name, sizeof(mz_name), "%s%s", RTE_RING_MZ_PREFIX, name); rte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK); diff --git a/lib/librte_table/rte_table_acl.c b/lib/librte_table/rte_table_acl.c index f74f22a685..c6d389eea4 100644 --- a/lib/librte_table/rte_table_acl.c +++ b/lib/librte_table/rte_table_acl.c @@ -126,8 +126,8 @@ rte_table_acl_create( &acl->memory[action_table_size + acl_rule_list_size]; /* Initialization of internal fields */ - rte_snprintf(acl->name[0], RTE_ACL_NAMESIZE, "%s_a", p->name); - rte_snprintf(acl->name[1], RTE_ACL_NAMESIZE, "%s_b", p->name); + snprintf(acl->name[0], RTE_ACL_NAMESIZE, "%s_a", p->name); + snprintf(acl->name[1], RTE_ACL_NAMESIZE, "%s_b", p->name); acl->name_id = 1; acl->acl_params.name = acl->name[acl->name_id]; -- 2.20.1