[PATCH 1/2] common: add safe version of foreach-list to Linux

Thomas Monjalon thomas at monjalon.net
Thu Jul 7 21:09:57 CEST 2022


07/07/2022 17:59, Khan, Hamza:
> 
> > -----Original Message-----
> > From: Thomas Monjalon <thomas at monjalon.net>
> > Sent: Tuesday 5 July 2022 17:16
> > To: Khan, Hamza <hamza.khan at intel.com>
> > Cc: dev at dpdk.org
> > Subject: Re: [PATCH 1/2] common: add safe version of foreach-list to Linux
> > 
> > 01/06/2022 12:54, Hamza Khan:
> > > Linux EAL does not have the LIST_FOREACH_SAFE version of the iterator
> > > macros. Add it.
> > >
> > > Signed-off-by: Hamza Khan <hamza.khan at intel.com>
> > > ---
> > >  lib/eal/linux/include/rte_os.h | 7 +++++++
> > >  1 file changed, 7 insertions(+)
> > >
> > > diff --git a/lib/eal/linux/include/rte_os.h
> > > b/lib/eal/linux/include/rte_os.h index c72bf5b7e6..00d7714181 100644
> > > --- a/lib/eal/linux/include/rte_os.h
> > > +++ b/lib/eal/linux/include/rte_os.h
> > > @@ -26,6 +26,13 @@ extern "C" {
> > >  #define RTE_STAILQ_HEAD(name, type) STAILQ_HEAD(name, type)
> > #define
> > > RTE_STAILQ_ENTRY(type) STAILQ_ENTRY(type)
> > >
> > > +#ifndef LIST_FOREACH_SAFE
> > > +#define	LIST_FOREACH_SAFE(var, head, field, tvar)
> > 	\
> > > +	for ((var) = LIST_FIRST((head));				\
> > > +	    (var) && ((tvar) = LIST_NEXT((var), field), 1);		\
> > > +	    (var) = (tvar))
> > > +#endif
> > 
> > I'm not sure we want to add such thing without a RTE_ prefix.
> > And we should not need LIST_*, we have RTE_TAILQ_*.
> > 
> > 
> I have sent v2 patch with the aforementioned fix. 
> However Is being held until the list moderator can review it for approval

I've unblocked it.
This is blocked because you are not registered in the mailing list,
so it is considered as spam.




More information about the dev mailing list