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>
This commit is contained in:
Peter Xu 2017-05-12 12:17:39 +08:00 committed by Dr. David Alan Gilbert
parent cdece0467c
commit 99e15582de
3 changed files with 23 additions and 17 deletions

View file

@ -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);