stringfns: remove rte_snprintf
PATCH 1/3 stringfns: remove rte_snprintf
The function rte_snprintf serves no useful purpose. It is the same as snprintf() for all valid inputs. Just remove it and replace all uses in current code.
app/test-pipeline/init.c +2 -2
@@ -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,
app/test-pmd/cmdline.c +2 -2
@@ -1426,7 +1426,7 @@ parse_reta_config(const char *str, strucif (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;
app/test-pmd/config.c +1 -1
@@ -563,7 +563,7 @@ ring_dma_zone_lookup(const char *ring_nachar 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 )
app/test-pmd/parameters.c +3 -3
@@ -300,7 +300,7 @@ parse_queue_stats_mapping_config(const cif (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++) {
app/test-pmd/testpmd.h +1 -1
@@ -395,7 +395,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 *
app/test/process.h +1 -1
@@ -81,7 +81,7 @@ process_dup(const char *const argv[], in/* 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); }
app/test/test_cmdline_cirbuf.c +1 -1
@@ -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
app/test/test_cmdline_etheraddr.c +1 -1
@@ -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 ]); ret =cmdline_parse_etheraddr (NULL , buf,NULL );
app/test/test_cmdline_ipaddr.c +1 -1
@@ -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 */
app/test/test_cmdline_num.c +1 -1
@@ -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 */
app/test/test_cmdline_string.c +1 -1
@@ -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(
app/test/test_eal_flags.c +25 -25
158 lines not on this page · raw message
app/test/test_eal_fs.c +1 -1
@@ -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;
app/test/test_errno.c +2 -2
@@ -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);
app/test/test_func_reentrancy.c +13 -13
@@ -129,7 +129,7 @@ ring_create_lookup(__attribute__((unused/* 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/* 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__((unu/* 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__((unu/* 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))/* 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))/* 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))/* 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))/* 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))/* 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))/* 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 ; }
app/test/test_hash_perf.c +2 -2
@@ -538,7 +538,7 @@ run_tbl_perf_test(struct tbl_perf_test_pchar 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_pdefault :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,
app/test/test_ivshmem.c +8 -8
@@ -73,17 +73,17 @@ get_current_prefix(char * prefix, int sichar 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" ,strnlen (buf,sizeof (buf)) -sizeof ("_config" ), &buf[1 ]);return prefix;
@@ -96,7 +96,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 );
@@ -135,7 +135,7 @@ test_ivshmem_create_lots_of_memzones(voi "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" );
@@ -312,7 +312,7 @@ test_ivshmem_create_multiple_metadata_costruct 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);
@@ -333,7 +333,7 @@ test_ivshmem_create_too_many_metadata_cochar 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" ); }
@@ -368,7 +368,7 @@ launch_all_tests_on_secondary_processes(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 };
app/test/test_kni.c +2 -2
@@ -390,7 +390,7 @@ test_kni_processing(uint8_t port_id, strrte_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 ;
app/test/test_malloc.c +1 -1
@@ -485,7 +485,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);
app/test/test_mp_secondary.c +5 -5
@@ -92,17 +92,17 @@ get_current_prefix(char * prefix, int sichar 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" ,strnlen (buf,sizeof (buf)) -sizeof ("_config" ), &buf[1 ]);return prefix;
@@ -123,7 +123,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[] = {
@@ -146,7 +146,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);
app/test/test_power.c +1 -1
@@ -63,7 +63,7 @@ check_cur_freq(unsigned lcore_id, uint32uint32_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 ; }
app/test/test_string_fns.c +11 -11
@@ -49,7 +49,7 @@#define DATA_BYTE 'a'static int -test_rte_snprintf (void ) +test_snprintf (void ) {/* ================================================= * First test with a string that will fit in buffer
@@ -62,8 +62,8 @@ test_rte_snprintf(void)/* initialise buffer with characters so it can contain no nulls */ memset (buf,DATA_BYTE ,sizeof (buf)); -/* run rte_snprintf and check results */ - retval =rte_snprintf (buf,sizeof (buf),"%s" , source); +/* run snprintf and check results */ + retval =snprintf (buf,sizeof (buf),"%s" , source);if (retval !=sizeof (source) -1 ) {LOG ("Error, retval = %d, expected = %u\n" , retval, (unsigned )sizeof (source));
@@ -90,8 +90,8 @@ test_rte_snprintf(void)/* initialise buffer with characters so it can contain no nulls */ memset (buf,DATA_BYTE ,sizeof (buf)); -/* run rte_snprintf and check results */ - retval =rte_snprintf (buf,sizeof (buf),"%s" , source); +/* run snprintf and check results */ + retval =snprintf (buf,sizeof (buf),"%s" , source);if (retval !=sizeof (source) -1 ) {LOG ("Error, retval = %d, expected = %u\n" , retval, (unsigned )sizeof (source));
@@ -117,7 +117,7 @@ test_rte_snprintf(void)/* call with a zero-sized non-NULL buffer, should tell how big a buffer * we need */ - retval =rte_snprintf (buf,0 ,"%s" , source); + retval =snprintf (buf,0 ,"%s" , source);if (retval !=sizeof (source) -1 ) {LOG ("Call with 0-length buffer does not return correct size." "Expected: %zu, got: %d\n" ,sizeof (source), retval);
@@ -126,7 +126,7 @@ test_rte_snprintf(void)/* call with a zero-sized NULL buffer, should tell how big a buffer * we need */ - retval =rte_snprintf (NULL ,0 ,"%s" , source); + retval =snprintf (NULL ,0 ,"%s" , source);if (retval !=sizeof (source) -1 ) {LOG ("Call with 0-length buffer does not return correct size." "Expected: %zu, got: %d\n" ,sizeof (source), retval);
@@ -143,7 +143,7 @@ test_rte_snprintf(void)char buf[10 ];/* call with buffer value set to NULL is EINVAL */ -if (rte_snprintf (NULL ,sizeof (buf),"%s\n" , source) !=-1 || +if (snprintf (NULL ,sizeof (buf),"%s\n" , source) !=-1 || errno !=EINVAL ) {LOG ("Failed to get suitable error when passing NULL buffer\n" );return -1 ;
@@ -152,7 +152,7 @@ test_rte_snprintf(void)memset (buf,DATA_BYTE ,sizeof (buf));/* call with a NULL format and zero-size should return error * without affecting the buffer */ -if (rte_snprintf (buf,0 ,NULL ) !=-1 || +if (snprintf (buf,0 ,NULL ) !=-1 || errno !=EINVAL ) {LOG ("Failed to get suitable error when passing NULL buffer\n" );return -1 ;
@@ -165,7 +165,7 @@ test_rte_snprintf(void)/* call with a NULL format should return error but also null-terminate * the buffer */ -if (rte_snprintf (buf,sizeof (buf),NULL ) !=-1 || +if (snprintf (buf,sizeof (buf),NULL ) !=-1 || errno !=EINVAL ) {LOG ("Failed to get suitable error when passing NULL buffer\n" );return -1 ;
@@ -294,7 +294,7 @@ test_rte_strsplit(void)int test_string_fns (void ) { -if (test_rte_snprintf () <0 || +if (test_snprintf () <0 ||test_rte_strsplit () <0 )return -1 ;return 0 ;
app/test/test_table.c +2 -2
@@ -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(
app/test/test_table_acl.c +4 -4
@@ -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);
examples/cmdline/commands.c +5 -5
@@ -134,10 +134,10 @@ static void cmd_obj_del_show_parsed(voidchar 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 *parcmdline_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",
examples/cmdline/parse_obj_list.c +2 -2
@@ -148,7 +148,7 @@ int complete_get_elt_obj_list(cmdline_pareturn -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_paint 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 ; }
examples/dpdk_qat/crypto.c +1 -1
@@ -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);
examples/dpdk_qat/main.c +2 -2
@@ -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),
examples/exception_path/main.c +4 -4
@@ -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 , name); +snprintf (ifr.ifr_name,IFNAMSIZ , 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 , ifr.ifr_name); +snprintf (name,IFNAMSIZ , ifr.ifr_name);return fd; }
@@ -253,7 +253,7 @@ main_loop(__attribute__((unused)) void *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 * }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)",
examples/ip_fragmentation/main.c +4 -4
@@ -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 ) {
examples/ip_pipeline/config.c +1 -1
@@ -239,7 +239,7 @@ app_install_cfgfile(const char *file_namuint32_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);
examples/ip_pipeline/init.c +1 -1
@@ -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,
examples/ip_reassembly/main.c +3 -3
@@ -954,7 +954,7 @@ setup_queue_tbl(struct rx_queue *rxq, ui 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 ) {
examples/kni/main.c +3 -3
@@ -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 ;
examples/l2fwd-ivshmem/host/host.c +3 -3
@@ -217,7 +217,7 @@ print_to_file(const char *cmdline, constFILE *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 )
examples/l3fwd-acl/main.c +3 -3
@@ -1204,7 +1204,7 @@ setup_acl(struct rte_acl_rule *route_basint 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,
examples/l3fwd-power/main.c +5 -5
@@ -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,
examples/l3fwd-vf/main.c +4 -4
@@ -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,
examples/l3fwd/main.c +6 -6
@@ -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),
examples/load_balancer/config.c +1 -1
@@ -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 ;
examples/load_balancer/init.c +4 -4
@@ -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,
examples/multi_process/client_server_mp/mp_server/main.c +1 -1
@@ -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 ]);
examples/multi_process/client_server_mp/shared/common.h +1 -1
@@ -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; }
examples/multi_process/simple_mp/mp_commands.c +1 -1
@@ -79,7 +79,7 @@ static void cmd_send_parsed(void *parsedif (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);
examples/multi_process/symmetric_mp/main.c +2 -2
@@ -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);
examples/netmap_compat/bridge/bridge.c +2 -2
@@ -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 ;
examples/netmap_compat/lib/compat_netmap.c +1 -1
@@ -324,7 +324,7 @@ netmap_regif(struct nmreq *req, uint32_tif (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 */
examples/qos_sched/args.c +1 -1
@@ -143,7 +143,7 @@ app_cpu_core_count(void)uint32_t ncores =0 ;for (i =0 ; i <RTE_MAX_LCORE ; i++) { - len =rte_snprintf (path,sizeof (path),SYS_CPU_DIR , i); + len =snprintf (path,sizeof (path),SYS_CPU_DIR , i);if (len <=0 || (unsigned )len >=sizeof (path))continue ;
examples/qos_sched/cfg_file.c +11 -11
@@ -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 {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, struchar 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, stru }/* 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, stru }/* 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, stru }/* 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, strufor (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, sfor (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, sfor (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;
examples/qos_sched/init.c +4 -4
@@ -249,7 +249,7 @@ app_init_sched_port(uint32_t portid, uin 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);
@@ -320,7 +320,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,
@@ -328,7 +328,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,
@@ -338,7 +338,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),
examples/quota_watermark/qw/init.c +1 -1
@@ -152,7 +152,7 @@ void init_ring(int lcore_id, uint8_t porstruct 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 );
examples/vhost/main.c +10 -10
@@ -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_arif (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(unsignedchar 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),
examples/vhost/vhost-net-cdev.c +4 -4
@@ -325,11 +325,11 @@ register_cuse_device(const char *base_na* 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. */
examples/vhost/virtio-net.c +3 -3
@@ -136,9 +136,9 @@ host_memory_map (struct virtio_net *dev,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,/* 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);
examples/vhost_xen/main.c +5 -5
@@ -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(unsignedchar 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 )
examples/vhost_xen/vhost_monitor.c +2 -2
@@ -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);
examples/vhost_xen/xenstore_parse.c +6 -6
@@ -400,7 +400,7 @@ parse_mpool_va(struct xen_mempool *mempoint 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 *gueswhile (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 *vrinint 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 *vruint32_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,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, 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);
lib/librte_acl/rte_acl.c +2 -2
@@ -96,7 +96,7 @@ rte_acl_create(const struct rte_acl_parareturn 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_para 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);
lib/librte_acl/rte_acl_osdep_alone.h +1 -1
@@ -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
lib/librte_cfgfile/rte_cfgfile.c +4 -4
@@ -169,7 +169,7 @@ rte_cfgfile_load(const char *filename, i 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, istruct 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_cfgfileint 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;
lib/librte_cmdline/cmdline.c +1 -1
@@ -122,7 +122,7 @@ cmdline_set_prompt(struct cmdline *cl, c {if (!cl || !prompt)return ; -rte_snprintf (cl->prompt,sizeof (cl->prompt),"%s" , prompt); +snprintf (cl->prompt,sizeof (cl->prompt),"%s" , prompt); } struct cmdline *
lib/librte_cmdline/cmdline_parse.c +9 -9
@@ -270,7 +270,7 @@ cmdline_parse(struct cmdline *cl, const }#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, conif (!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, conif ((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, con 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, concontinue ; } (*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); }
lib/librte_cmdline/cmdline_parse_etheraddr.c +2 -2
@@ -154,7 +154,7 @@ cmdline_parse_etheraddr(__attribute__((u (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__ {int ret; - ret =rte_snprintf (dstbuf, size,"Ethernet address" ); + ret =snprintf (dstbuf, size,"Ethernet address" );if (ret <0 )return -1 ;return 0 ;
lib/librte_cmdline/cmdline_parse_ipaddr.c +8 -8
@@ -327,7 +327,7 @@ cmdline_parse_ipaddr(cmdline_parse_tokenif (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_parsswitch (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 ;
lib/librte_cmdline/cmdline_parse_num.c +1 -1
@@ -358,7 +358,7 @@ cmdline_get_help_num(cmdline_parse_token/* 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' ;
lib/librte_cmdline/cmdline_parse_portlist.c +2 -2
@@ -145,7 +145,7 @@ cmdline_parse_portlist(__attribute__((unif (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__( 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 ;
lib/librte_cmdline/cmdline_parse_string.c +4 -4
@@ -159,7 +159,7 @@ cmdline_parse_string(cmdline_parse_tokenif (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_parsif (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 ; }
lib/librte_distributor/rte_distributor.c +2 -2
@@ -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 );
lib/librte_eal/bsdapp/eal/eal_memory.c +1 -1
@@ -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 );
lib/librte_eal/bsdapp/eal/eal_pci.c +2 -2
@@ -211,7 +211,7 @@ pci_uio_map_resource(struct rte_pci_deviif (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_devireturn (-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));
lib/librte_eal/bsdapp/eal/include/eal_filesystem.h +4 -4
@@ -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, sizestatic 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;
lib/librte_eal/common/eal_common_errno.c +1 -1
@@ -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
lib/librte_eal/common/eal_common_hexdump.c +5 -5
@@ -63,16 +63,16 @@ rte_hexdump(FILE *f, const char * title, 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, 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 )
lib/librte_eal/common/eal_common_memzone.c +1 -1
@@ -289,7 +289,7 @@ memzone_reserve_aligned_thread_unsafe(co/* 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;
lib/librte_eal/common/eal_common_string_fns.c +0 -28
@@ -38,34 +38,6 @@#include <rte_string_fns.h> -/* safe version os snprintf */ -int -rte_snprintf (char *buffer,int buflen,const char *format, ...) -{ -int len; -va_list ap; - -if (buffer ==NULL && buflen !=0 ) - goto einval_error; -if (format ==NULL ) { -if (buflen >0 ) - buffer[0 ] ='\0' ; - goto einval_error; - } - -va_start (ap, format); - len =vsnprintf (buffer, buflen, format, ap); -va_end (ap); -if (len >= buflen && buflen >0 ) - buffer[buflen -1 ] ='\0' ; - -return len; - -einval_error: - errno =EINVAL ; -return -1 ; -} -/* split string into tokens */ int rte_strsplit(char *string, int stringlen,
lib/librte_eal/common/include/rte_string_fns.h +0 -26
@@ -45,32 +45,6 @@ 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. -* -* @param buffer -* The buffer into which the output is to be written -* -* @param buflen -* The size of the output buffer -* -* @param format -* The format string to be printed to the buffer -* -* @return -* The number of characters written to the buffer, or if the string has been -* truncated, the number of characters which would have been written had the -* buffer been sufficiently big. -* -*/ -int -rte_snprintf (char *buffer,int buflen,const char *format, ...); - -/** * Takes string "string" parameter and splits it at character "delim" * up to maxtokens-1 times - to give "maxtokens" resulting tokens. Like * strtok or strsep functions, this modifies its input string, by replacing
lib/librte_eal/common/include/rte_warnings.h +1 -1
@@ -54,7 +54,7 @@#include <dirent.h> #endif -/* rte_snprintf uses snprintf, so include its definition before we poison the +/* snprintf uses snprintf, so include its definition before we poison the * functions, otherwise we'll get an error in it. */ #include <rte_string_fns.h>
lib/librte_eal/linuxapp/eal/eal_hugepage_info.c +2 -2
@@ -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 )
lib/librte_eal/linuxapp/eal/eal_ivshmem.c +5 -5
@@ -364,7 +364,7 @@ read_metadata(char * path, int path_len, 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), path);
lib/librte_eal/linuxapp/eal/eal_lcore.c +4 -4
@@ -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 )
lib/librte_eal/linuxapp/eal/eal_memory.c +2 -2
@@ -505,7 +505,7 @@ remap_all_hugepages(struct hugepage_filereturn -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 *hureturn 0 ; } -rte_snprintf (hugedir_str,sizeof (hugedir_str), +snprintf (hugedir_str,sizeof (hugedir_str),"%s/" , hpi->hugedir);/* parse numa map */
lib/librte_eal/linuxapp/eal/eal_pci.c +14 -14
@@ -69,7 +69,7 @@ pci_unbind_kernel_driver(struct rte_pci_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_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 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 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 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 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/* 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 }/* 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_d 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(structif (!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(structreturn -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 ) {
lib/librte_eal/linuxapp/eal/eal_pci_uio.c +12 -12
@@ -61,14 +61,14 @@ pci_uio_get_mappings(const char *devnamefor (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 }/* 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 }/* 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_/* 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_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 *d/* 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 *d 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 *d 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_devi "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_devireturn -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 */
lib/librte_eal/linuxapp/eal/eal_pci_vfio.c +3 -3
@@ -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_admemset (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_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 */
lib/librte_eal/linuxapp/eal/eal_pci_vfio_mp_sync.c +1 -1
@@ -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); }
lib/librte_eal/linuxapp/eal/eal_xen_memory.c +3 -3
@@ -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);
lib/librte_eal/linuxapp/eal/include/eal_filesystem.h +4 -4
@@ -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, sizestatic 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;
lib/librte_hash/rte_fbk_hash.c +2 -2
@@ -129,7 +129,7 @@ rte_fbk_hash_create(const struct rte_fbkreturn 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_fbkmemset (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 ;
lib/librte_hash/rte_hash.c +2 -2
@@ -192,7 +192,7 @@ rte_hash_create(const struct rte_hash_pareturn 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_pa }/* 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;
lib/librte_ivshmem/rte_ivshmem.c +8 -8
@@ -229,7 +229,7 @@ get_hugefile_by_virt_addr(uint64_t virt_ }/* 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 sstatic 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 ch/* 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(chrte_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(ch 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(ch 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" ,0x0 , zero_size);
@@ -790,7 +790,7 @@ rte_ivshmem_metadata_cmdline_generate(ch }/* 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,0x0 ,METADATA_SIZE_ALIGNED );
@@ -812,7 +812,7 @@ rte_ivshmem_metadata_cmdline_generate(chreturn -1 ; }/* complete the command-line */ -rte_snprintf (buffer, size, +snprintf (buffer, size,IVSHMEM_QEMU_CMD_LINE_HEADER_FMT , total_size >>20 , cmdline);
lib/librte_kni/rte_kni.c +16 -16
@@ -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 *pktmbu } } -rte_snprintf (intf_name,RTE_KNI_NAMESIZE , conf->name); -rte_snprintf (mz_name,RTE_MEMZONE_NAMESIZE ,"KNI_INFO_%s" , intf_name); +snprintf (intf_name,RTE_KNI_NAMESIZE , 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 *pktmbu dev_info.group_id = conf->group_id; dev_info.mbuf_size = conf->mbuf_size; -rte_snprintf (ctx->name,RTE_KNI_NAMESIZE , intf_name); -rte_snprintf (dev_info.name,RTE_KNI_NAMESIZE , intf_name); +snprintf (ctx->name,RTE_KNI_NAMESIZE , intf_name); +snprintf (dev_info.name,RTE_KNI_NAMESIZE , 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 *pktmbu 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 *pktmbu 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 *pktmbu 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 *pktmbu 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 *pktmbu 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 *pktmbu 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 *pktmbu 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), kni->name); +snprintf (dev_info.name,sizeof (dev_info.name), 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); }
lib/librte_lpm/rte_lpm.c +2 -2
@@ -168,7 +168,7 @@ rte_lpm_create(const char *name, int socreturn 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 soc/* 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);
lib/librte_lpm/rte_lpm6.c +2 -2
@@ -169,7 +169,7 @@ rte_lpm6_create(const char *name, int soreturn 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 so/* 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);
lib/librte_malloc/malloc_heap.c +1 -1
@@ -90,7 +90,7 @@ malloc_heap_add_memzone(struct malloc_he 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
lib/librte_mempool/rte_dom0_mempool.c +1 -1
@@ -111,7 +111,7 @@ rte_dom0_mempool_create(const char *nameif (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);
lib/librte_mempool/rte_mempool.c +3 -3
@@ -510,7 +510,7 @@ rte_mempool_xmem_create(const char *name 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);
@@ -537,7 +537,7 @@ rte_mempool_xmem_create(const char *name/* 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;
@@ -545,7 +545,7 @@ rte_mempool_xmem_create(const char *name/* 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;
lib/librte_pipeline/rte_pipeline.c +1 -1
@@ -212,7 +212,7 @@ rte_pipeline_create(struct rte_pipeline_ }/* 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;
lib/librte_pmd_e1000/em_rxtx.c +1 -1
@@ -1093,7 +1093,7 @@ ring_dma_zone_reserve(struct rte_eth_devconst 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);
lib/librte_pmd_e1000/igb_rxtx.c +1 -1
@@ -1089,7 +1089,7 @@ ring_dma_zone_reserve(struct rte_eth_devchar 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);
lib/librte_pmd_i40e/i40e_ethdev.c +1 -1
@@ -1517,7 +1517,7 @@ i40e_allocate_dma_mem_d(__attribute__((ureturn I40E_ERR_PARAM ; id++; -rte_snprintf (z_name,sizeof (z_name),"i40e_dma_%lu" , id); +snprintf (z_name,sizeof (z_name),"i40e_dma_%lu" , id); mz =rte_memzone_reserve_aligned (z_name, size,0 ,0 , alignment);if (!mz)return I40E_ERR_NO_MEMORY ;
lib/librte_pmd_i40e/i40e_rxtx.c +1 -1
@@ -1829,7 +1829,7 @@ i40e_ring_dma_zone_reserve(struct rte_etchar 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);
lib/librte_pmd_ixgbe/ixgbe_rxtx.c +1 -1
@@ -1611,7 +1611,7 @@ ring_dma_zone_reserve(struct rte_eth_devchar 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);
lib/librte_pmd_ring/rte_eth_ring.c +4 -4
@@ -326,7 +326,7 @@ eth_dev_ring_create(const char *name, co 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 *nam 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 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++;
lib/librte_pmd_virtio/virtio_ethdev.c +11 -11
@@ -267,19 +267,19 @@ int virtio_dev_queue_setup(struct rte_et }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_et/* * 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_et 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_ad/* 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_ad 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_ad 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 structreturn -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 }/* 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",
lib/librte_pmd_virtio/virtio_rxtx.c +1 -1
@@ -103,7 +103,7 @@ virtio_dev_vring_start(struct rte_eth_de*/ 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);
lib/librte_pmd_vmxnet3/vmxnet3_ethdev.c +1 -1
@@ -126,7 +126,7 @@ gpa_zone_reserve(struct rte_eth_dev *devchar 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);
lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c +2 -2
@@ -594,7 +594,7 @@ ring_dma_zone_reserve(struct rte_eth_devchar 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_et 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 ) {
lib/librte_pmd_xenvirt/rte_eth_xenvirt.c +10 -10
@@ -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 *maRTE_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, ui }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 *d/* 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 *d }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 );
lib/librte_pmd_xenvirt/rte_xen_lib.c +10 -10
@@ -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, consRTE_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, uint3while (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_mempchar 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 ;
lib/librte_power/rte_power.c +5 -5
@@ -158,7 +158,7 @@ power_set_governor_userspace(struct rte_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_ 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_powchar *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_puint32_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_pchar *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);
lib/librte_ring/rte_ring.c +2 -2
@@ -135,7 +135,7 @@ rte_ring_init(struct rte_ring *r, const/* 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, unsignreturn 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 );
lib/librte_table/rte_table_acl.c +2 -2
@@ -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];
PATCH 2/3 test: remove no longer valid tests
In reply to a message not in the archiveSince GCC catches calling snprintf() with NULL argument at compile time (which is even better). These string function tests are unnecessary and no longer compile.
app/test/test_string_fns.c +0 -26
@@ -149,32 +149,6 @@ test_snprintf(void)return -1 ; } -memset (buf,DATA_BYTE ,sizeof (buf)); -/* call with a NULL format and zero-size should return error -* without affecting the buffer */ -if (snprintf (buf,0 ,NULL ) !=-1 || - errno !=EINVAL ) { -LOG ("Failed to get suitable error when passing NULL buffer\n" ); -return -1 ; - } -if (buf[0 ] !=DATA_BYTE ) { -LOG ("Error, zero-length buffer modified after call with NULL" -" format string\n" ); -return -1 ; - } - -/* call with a NULL format should return error but also null-terminate -* the buffer */ -if (snprintf (buf,sizeof (buf),NULL ) !=-1 || - errno !=EINVAL ) { -LOG ("Failed to get suitable error when passing NULL buffer\n" ); -return -1 ; - } -if (buf[0 ] !='\0' ) { -LOG ("Error, buffer not null-terminated after call with NULL" -" format string\n" ); -return -1 ; - } }while (0 );LOG ("%s - PASSED\n" , __func__);
PATCH 3/3 fix incorrect snprintf usage
In reply to a message not in the archiveNow that snprintf is used, Gcc finds more uses of unsafe arguments. Fix where found. These may have already been fixed by other patches on the mailing list.
lib/librte_kni/rte_kni.c +4 -4
@@ -158,7 +158,7 @@ rte_kni_alloc(struct rte_mempool *pktmbu } } -snprintf (intf_name,RTE_KNI_NAMESIZE , conf->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 );
@@ -184,8 +184,8 @@ rte_kni_alloc(struct rte_mempool *pktmbu dev_info.group_id = conf->group_id; dev_info.mbuf_size = conf->mbuf_size; -snprintf (ctx->name,RTE_KNI_NAMESIZE , intf_name); -snprintf (dev_info.name,RTE_KNI_NAMESIZE , 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,
@@ -291,7 +291,7 @@ rte_kni_release(struct rte_kni *kni)if (!kni || !kni->in_use)return -1 ; -snprintf (dev_info.name,sizeof (dev_info.name), 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 ;
app/test/test_cmdline_etheraddr.c +1 -1
@@ -147,7 +147,7 @@ test_parse_etheraddr_invalid_param(void)/* copy string to buffer */ snprintf (buf,sizeof (buf),"%s" , - ether_addr_valid_strs[0 ]); + ether_addr_valid_strs[0 ].str); ret =cmdline_parse_etheraddr (NULL , buf,NULL );if (ret ==-1 ) {
app/test/test_eal_flags.c +1 -1
@@ -268,7 +268,7 @@ get_current_prefix(char * prefix, int si/* copy string all the way from second char up to start of _config */ snprintf (prefix, size,"%.*s" , -strnlen (buf,sizeof (buf)) -sizeof ("_config" ), &buf[1 ]); + (int )(strnlen (buf,sizeof (buf)) -sizeof ("_config" )), &buf[1 ]);return prefix; }
app/test/test_mp_secondary.c +1 -1
@@ -103,7 +103,7 @@ get_current_prefix(char * prefix, int si/* copy string all the way from second char up to start of _config */ snprintf (prefix, size,"%.*s" , -strnlen (buf,sizeof (buf)) -sizeof ("_config" ), &buf[1 ]); + (int )(strnlen (buf,sizeof (buf)) -sizeof ("_config" )), &buf[1 ]);return prefix; }
Quoted 6 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Stephen Hemminger
Sent: Tuesday, June 24, 2014 9:03 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH 1/3] stringfns: removerte_snprintf
Quoted 6 lines
The function
rte_snprintfserves no useful purpose. It is the same assnprintf()for all valid inputs. Just remove it and replace all uses in current code.Signed-off-by Stephen Hemminger <[email protected]>
NAK to this as is.
Approve of replacing all instance of the rte_snprintf function with the standard version in all our code and libraries.
However, rather than just removing the function completely, I think we should just flag the function as deprecated initially, and then later on look to remove it completely.
/Bruce
Quoted 10 lines · Bruce
Quoted 10 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Stephen Hemminger
Sent: Tuesday, June 24, 2014 9:03 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH 1/3] stringfns: removerte_snprintfThe function
rte_snprintfserves no useful purpose. It is the same assnprintf()for all valid inputs. Just remove it and replace all uses in current code.
Quoted 8 lines
Quoted 2 lines
Signed-off-by Stephen Hemminger <[email protected]>NAK to this as is.
Approve of replacing all instance of therte_snprintffunction with the standard version in all our code and libraries.
However, rather than just removing the function completely, I think we should just flag the function as deprecated initially, and then later on look to remove it completely./Bruce
I want to get it out now rather than some 2 year life cycle. The issue was discussed and marking it as deprecated breaks the build. Alternate is removing all instances and adding:
#define rte_snprintf snprintf
in header file for user compatiablity.
Quoted 33 lines
-----Original Message-----
From: Stephen Hemminger [mailto:[email protected]]
Sent: Tuesday, June 24, 2014 10:54 AM
To: Richardson, Bruce
Cc: [email protected]
Subject: Re: [dpdk-dev] [PATCH 1/3] stringfns: removerte_snprintfQuoted 2 lines · Bruce
Quoted 2 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of StephenHemminger
Quoted 8 lines
Quoted 8 lines
Sent: Tuesday, June 24, 2014 9:03 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH 1/3] stringfns: removerte_snprintfThe function
rte_snprintfserves no useful purpose. It is the same assnprintf()for all valid inputs. Just remove it and replace all uses in current code.Quoted 5 lines
Quoted 2 lines
Signed-off-by Stephen Hemminger <[email protected]>NAK to this as is.
Approve of replacing all instance of therte_snprintffunction with the standardversion in all our code and libraries.
Quoted 1 line
However, rather than just removing the function completely, I think we should
just flag the function as deprecated initially, and then later on look to remove it completely.
Quoted 2 lines
/Bruce
Quoted 7 lines
I want to get it out now rather than some 2 year life cycle. The issue was discussed and marking it as deprecated breaks the build. Alternate is removing all instances and adding:
#define
rte_snprintfsnprintfin header file for user compatiablity.
We can remove it from all our apps and then mark as deprecated and all our code would still build.
An interesting point I'd never thought of is, is it right for us to force user apps to treat all warnings as errors? Perhaps we should also consider removing -Werror from the CFLAGS when using rte.extapp.mk.
Hi Bruce,
Quoted 10 lines · Bruce
Quoted 7 lines
I want to get it out now rather than some 2 year life cycle. The issue was discussed and marking it as deprecated breaks the build. Alternate is removing all instances and adding:
#define
rte_snprintfsnprintfin header file for user compatiablity.
We can remove it from all our apps and then mark as deprecated and all our code would still build.
An interesting point I'd never thought of is, is it right for us to force user apps to treat all warnings as errors? Perhaps we should also consider removing -Werror from the CFLAGS when using rte.extapp.mk.
I don't understand why removing a function like rte_snprintf() in a new version of DPDK would be a problem. Yes, it would break the build of external applications, but that's the best way to fix the problem in the external code. Adding a compatibility layer just delays the issue. Maybe having a line about this in a "release note" or a "porting guide" would be enough? It could even references the commit id, showing how to solve the issue.
About the -Werror flag, I would say that removing it is not a good idea. From my experience, many issues are pointed out by warnings, and forcing the compiler to stop on warning helps to have better code quality.
Regards,
Olivier
2014-06-24 17:39, Richardson, Bruce:
Quoted 10 lines
From: dev [mailto:[email protected]] On Behalf Of Stephen Hemminger
Quoted 3 lines
The function
rte_snprintfserves no useful purpose. It is the same assnprintf()for all valid inputs. Just remove it and replace all uses in current code.NAK to this as is.
Approve of replacing all instance of therte_snprintffunction with the standard version in all our code and libraries. However, rather than just removing the function completely, I think we should just flag the function as deprecated initially, and then later on look to remove it completely.
I agree we should try to use the "deprecated" attribute when possible. So application porting effort will be smoother.
But in this case, there is something different: as Stephen wrote, rte_snprintf is useless. It's useless inside the DPDK so it's even more useless for user applications.
As it's really useless, it has no sense to keep it as deprecated. Please, let's simply remove it.
Signature · 1 line
Thomas
Quoted 19 lines
-----Original Message-----
From: Thomas Monjalon [mailto:[email protected]]
Sent: Wednesday, June 25, 2014 1:33 AM
To: Richardson, Bruce
Cc: [email protected]; Stephen Hemminger
Subject: Re: [dpdk-dev] [PATCH 1/3] stringfns: removerte_snprintf2014-06-24 17:39, Richardson, Bruce:
Quoted 10 lines
From: dev [mailto:[email protected]] On Behalf Of Stephen Hemminger
Quoted 3 lines
The function
rte_snprintfserves no useful purpose. It is the same assnprintf()for all valid inputs. Just remove it and replace all uses in current code.NAK to this as is.
Approve of replacing all instance of therte_snprintffunction with the standard version in all our code and libraries. However, rather than just removing the function completely, I think we should just flag the function as deprecated initially, and then later on look to remove it completely.
Quoted 9 lines
I agree we should try to use the "deprecated" attribute when possible. So application porting effort will be smoother.
But in this case, there is something different: as Stephen wrote,
rte_snprintfis useless. It's useless inside the DPDK so it's even more useless for user applications.
As it's really useless, it has no sense to keep it as deprecated. Please, let's simply remove it.
The reason to keep it as deprecated is so that those customers who don't want to do a huge amount of search-replace immediately can get things working again temporarily using -Wno-deprecated. It provides a simple temporary fallback cushion, and then we can completely remove the function later. So, I'd like to see us remove all our usage of the function internally in 1.7, along with marking as deprecated, and then completely remove in 1.8, (i.e. in a week's time or so) :-)
Quoted 10 lines · Bruce
Quoted 9 lines
I agree we should try to use the "deprecated" attribute when possible. So application porting effort will be smoother.
But in this case, there is something different: as Stephen wrote,
rte_snprintfis useless. It's useless inside the DPDK so it's even more useless for user applications.
As it's really useless, it has no sense to keep it as deprecated. Please, let's simply remove it.
Quoted 2 lines
The reason to keep it as deprecated is so that those customers who don't want to do a huge amount of search-replace immediately can get things working again temporarily using -Wno-deprecated. It provides a simple temporary fallback cushion, and then we can completely remove the function later. So, I'd like to see us remove all our usage of the function internally in 1.7, along with marking as deprecated, and then completely remove in 1.8, (i.e. in a week's time or so) :-)
As a DPDK user, I’d vote to kill it now. I doubt it is widely used in any external applications. Such usage would be mostly from copy/pasting the sample code, is my guess.
-Aaron
2014-06-26 13:20, Aaron Campbell:
Quoted 1 line
On Jun 26, 2014, at 12:09 PM, Richardson, Bruce <[email protected]>
Quoted 17 lines · wrote:
Quoted 9 lines
Quoted 8 lines
I agree we should try to use the "deprecated" attribute when possible. So application porting effort will be smoother.
But in this case, there is something different: as Stephen wrote,
rte_snprintfis useless. It's useless inside the DPDK so it's even more useless for user applications.
As it's really useless, it has no sense to keep it as deprecated. Please, let's simply remove it.Quoted 7 lines
The reason to keep it as deprecated is so that those customers who don't want to do a huge amount of search-replace immediately can get things working again temporarily using -Wno-deprecated. It provides a simple temporary fallback cushion, and then we can completely remove the function later. So, I'd like to see us remove all our usage of the function internally in 1.7, along with marking as deprecated, and then completely remove in 1.8, (i.e. in a week's time or so) :-)
Quoted 3 lines
As a DPDK user, I’d vote to kill it now. I doubt it is widely used in any external applications. Such usage would be mostly from copy/pasting the sample code, is my guess.
I think everybody understood the idea: we'll try to use deprecation model when possible.
In this case, it's probably useless but we close the discussion by deprecating it. We'll remove it soon, don't worry :)
Signature · 1 line
Thomas