On Wed,  7 Dec 2022 11:00:13 -0800
Tyler Retzlaff <roret...@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?

> +
> +     rte_thread_set_name((rte_thread_t){lcore_config[lcore_id].thread_id}, 
> name);
> +
> +     return 0;
> +}
> +
> +int
> +rte_lcore_get_name(unsigned int lcore_id, char *name, size_t len)
> +{
> +     if (unlikely(lcore_id >= RTE_MAX_LCORE))
> +             return -EINVAL;
> +
> +     if (len < RTE_LCORE_NAME_MAX_LEN)
> +             return -EINVAL;
> +
> +     (void)strcpy(name, &lcore_names[lcore_id][0]);
> +
> +     return 0;
> +}
> +

Reply via email to