mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-31 14:23:53 -06:00
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:
parent
cdece0467c
commit
99e15582de
3 changed files with 23 additions and 17 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue