diff options
| author | Peter Xu | 2017-05-12 06:17:39 +0200 |
|---|---|---|
| committer | Dr. David Alan Gilbert | 2017-05-17 18:30:37 +0200 |
| commit | 99e15582dea30d4a7c6fa5be9196d0f4d759231c (patch) | |
| tree | 082f2e55209efa3bce4598cb427c60d9ff39e6db /include/exec | |
| parent | block/win32: fix 'ret not initialized' warning (diff) | |
| download | qemu-99e15582dea30d4a7c6fa5be9196d0f4d759231c.tar.gz qemu-99e15582dea30d4a7c6fa5be9196d0f4d759231c.tar.xz qemu-99e15582dea30d4a7c6fa5be9196d0f4d759231c.zip | |
ramblock: add RAMBLOCK_FOREACH()
So that it can simplifies the iterators.
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Message-Id: <1494562661-9063-2-git-send-email-peterx@redhat.com>
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Diffstat (limited to 'include/exec')
| -rw-r--r-- | include/exec/ramlist.h | 5 |
1 files changed, 5 insertions, 0 deletions
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); |
