From 99e15582dea30d4a7c6fa5be9196d0f4d759231c Mon Sep 17 00:00:00 2001 From: Peter Xu Date: Fri, 12 May 2017 12:17:39 +0800 Subject: ramblock: add RAMBLOCK_FOREACH() So that it can simplifies the iterators. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Peter Xu Message-Id: <1494562661-9063-2-git-send-email-peterx@redhat.com> Signed-off-by: Dr. David Alan Gilbert --- include/exec/ramlist.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/exec') diff --git a/include/exec/ramlist.h b/include/exec/ramlist.h index c59880de82..f1c6b45df9 100644 --- a/include/exec/ramlist.h +++ b/include/exec/ramlist.h @@ -4,6 +4,7 @@ #include "qemu/queue.h" #include "qemu/thread.h" #include "qemu/rcu.h" +#include "qemu/rcu_queue.h" typedef struct RAMBlockNotifier RAMBlockNotifier; @@ -54,6 +55,10 @@ typedef struct RAMList { } RAMList; extern RAMList ram_list; +/* Should be holding either ram_list.mutex, or the RCU lock. */ +#define RAMBLOCK_FOREACH(block) \ + QLIST_FOREACH_RCU(block, &ram_list.blocks, next) + void qemu_mutex_lock_ramlist(void); void qemu_mutex_unlock_ramlist(void); -- cgit 1.4.1