[dpdk-dev,v2,04/18] devargs: introduce foreach macro

Message ID b880b56dd7c9bcf9cbe6799a34e3311cb32e0aa7.1507796100.git.gaetan.rivet@6wind.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation fail apply patch file failure

Commit Message

Gaëtan Rivet Oct. 12, 2017, 8:21 a.m. UTC
  Introduce new rte_devargs accessor allowing to iterate over all
rte_devargs pertaining to a bus.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
---
 lib/librte_eal/common/include/rte_devargs.h | 8 ++++++++
 1 file changed, 8 insertions(+)
  

Patch

diff --git a/lib/librte_eal/common/include/rte_devargs.h b/lib/librte_eal/common/include/rte_devargs.h
index 0eec406..6222677 100644
--- a/lib/librte_eal/common/include/rte_devargs.h
+++ b/lib/librte_eal/common/include/rte_devargs.h
@@ -206,6 +206,14 @@  void rte_eal_devargs_dump(FILE *f);
 struct rte_devargs *
 rte_eal_devargs_next(const char *busname, const struct rte_devargs *start);
 
+/**
+ * Iterate over all rte_devargs for a specific bus.
+ */
+#define RTE_EAL_DEVARGS_FOREACH(busname, da) \
+	for (da = rte_eal_devargs_next(busname, NULL); \
+	     da != NULL; \
+	     da = rte_eal_devargs_next(busname, da)) \
+
 #ifdef __cplusplus
 }
 #endif