[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[UNIKRAFT PATCH 08/18] lib/ukalloc: Iterator helper for allocators



This commit provides `uk_alloc_foreach()`, a helper macro for
iterating over all registered allocators.

Signed-off-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx>
---
 lib/ukalloc/include/uk/alloc.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/ukalloc/include/uk/alloc.h b/lib/ukalloc/include/uk/alloc.h
index b711b56a..d7eba237 100644
--- a/lib/ukalloc/include/uk/alloc.h
+++ b/lib/ukalloc/include/uk/alloc.h
@@ -103,6 +103,12 @@ struct uk_alloc {
 
 extern struct uk_alloc *_uk_alloc_head;
 
+/* Iterate over all registered allocators */
+#define uk_alloc_foreach(iter)                 \
+       for (iter = _uk_alloc_head;             \
+            iter != NULL;                      \
+            iter = iter->next)
+
 static inline struct uk_alloc *uk_alloc_get_default(void)
 {
        return _uk_alloc_head;
-- 
2.20.1



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.