[PATCH v2 1/7] eal: fix header build with C++

David Marchand david.marchand at redhat.com
Thu Feb 10 13:57:09 CET 2022


On Thu, Feb 10, 2022 at 1:03 PM Bruce Richardson
<bruce.richardson at intel.com> wrote:
>
> C++ files could not include some headers because:
>
> * "new" is a keyword in C++, so can't be a variable name
> * there is no automatic casting to/from void *
>
> Fixes: 184104fc6121 ("ticketlock: introduce fair ticket based locking")
> Fixes: ebaee6409702 ("trace: simplify trace point headers")

rte_strcpy was moved in this commit.
This is more about:
Fixes: 032a7e5499a0 ("trace: implement provider payload")

> Cc: joyce.kong at arm.com
> Cc: david.marchand at redhat.com
> Cc: stable at dpdk.org
>
> Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
> ---
>  lib/eal/include/generic/rte_ticketlock.h | 14 +++++++-------
>  lib/eal/include/rte_trace_point.h        |  2 +-
>  2 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/lib/eal/include/generic/rte_ticketlock.h b/lib/eal/include/generic/rte_ticketlock.h
> index c1b8808f51..693c67b517 100644
> --- a/lib/eal/include/generic/rte_ticketlock.h
> +++ b/lib/eal/include/generic/rte_ticketlock.h
> @@ -91,13 +91,13 @@ rte_ticketlock_unlock(rte_ticketlock_t *tl)
>  static inline int
>  rte_ticketlock_trylock(rte_ticketlock_t *tl)
>  {
> -       rte_ticketlock_t old, new;
> -       old.tickets = __atomic_load_n(&tl->tickets, __ATOMIC_RELAXED);
> -       new.tickets = old.tickets;
> -       new.s.next++;
> -       if (old.s.next == old.s.current) {
> -               if (__atomic_compare_exchange_n(&tl->tickets, &old.tickets,
> -                   new.tickets, 0, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED))
> +       rte_ticketlock_t oldl, newl;
> +       oldl.tickets = __atomic_load_n(&tl->tickets, __ATOMIC_RELAXED);
> +       newl.tickets = oldl.tickets;
> +       newl.s.next++;
> +       if (oldl.s.next == oldl.s.current) {
> +               if (__atomic_compare_exchange_n(&tl->tickets, &oldl.tickets,
> +                   newl.tickets, 0, __ATOMIC_ACQUIRE, __ATOMIC_RELAXED))
>                         return 1;
>         }
>
> diff --git a/lib/eal/include/rte_trace_point.h b/lib/eal/include/rte_trace_point.h
> index e226f073f7..0f8700974f 100644
> --- a/lib/eal/include/rte_trace_point.h
> +++ b/lib/eal/include/rte_trace_point.h
> @@ -370,7 +370,7 @@ do { \
>  do { \
>         if (unlikely(in == NULL)) \
>                 return; \
> -       rte_strscpy(mem, in, __RTE_TRACE_EMIT_STRING_LEN_MAX); \
> +       rte_strscpy((char *)mem, in, __RTE_TRACE_EMIT_STRING_LEN_MAX); \
>         mem = RTE_PTR_ADD(mem, __RTE_TRACE_EMIT_STRING_LEN_MAX); \
>  } while (0)
>
> --
> 2.32.0
>

lgtm, thanks.


-- 
David Marchand



More information about the stable mailing list