[PATCH 1/5] eal: add lcore set name and get name API

Stephen Hemminger stephen at networkplumber.org
Thu Dec 8 05:07:16 CET 2022


On Wed, 7 Dec 2022 14:33:31 -0800
Tyler Retzlaff <roretzla at linux.microsoft.com> wrote:

> On Wed, Dec 07, 2022 at 01:03:41PM -0800, Stephen Hemminger wrote:
> > On Wed,  7 Dec 2022 11:00:13 -0800
> > Tyler Retzlaff <roretzla at linux.microsoft.com> wrote:
> >   
> > > +static char lcore_names[RTE_MAX_LCORE][RTE_LCORE_NAME_MAX_LEN];  
> > 
> > This copy would redundant on Linux.
> >   
> > > +
> > > +int
> > > +rte_lcore_set_name(unsigned int lcore_id, const char *name)
> > > +{
> > > +	if (unlikely(lcore_id >= RTE_MAX_LCORE))
> > > +		return -EINVAL;
> > > +
> > > +	if (strlen(name) >= RTE_LCORE_NAME_MAX_LEN)
> > > +		return -ERANGE;
> > > +
> > > +	(void)strcpy(&lcore_names[lcore_id][0], name);  
> > 
> > Why the void cast?  
> 
> it's a common convention used in various open source projects indicating
> the that ignoring the return value is intentional as opposed to being
> sloppy or accidental.
> 
> if it's a violation of dpdk style i'll remove it. but i have come across
> a lot of dpdk code where i honestly can't tell if it is on purpose or
> just sloppyness. (sticks out in code reviews too).

I think it is an old BSD lint ism.
Haven't seen it used in years.


More information about the dev mailing list