aboutsummaryrefslogtreecommitdiff
path: root/exec.c
diff options
context:
space:
mode:
authorHu Tao <hutao@cn.fujitsu.com>2014-04-02 15:13:26 +0800
committerPaolo Bonzini <pbonzini@redhat.com>2014-06-17 16:07:37 +0200
commit20cfe8810d08c99e3fc37be2a5a3355a3a51d208 (patch)
tree6bb2b7e00b3b4ad5e343fd1c7609e3c05b727b88 /exec.c
parent01a9c03c39debe843aea7f4df18274f18d8c6974 (diff)
exec: introduce qemu_ram_unset_idstr() to unset RAMBlock idstr
Signed-off-by: Hu Tao <hutao@cn.fujitsu.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/exec.c b/exec.c
index 4e179a6f66..6ce989a912 100644
--- a/exec.c
+++ b/exec.c
@@ -1201,17 +1201,24 @@ static void qemu_ram_setup_dump(void *addr, ram_addr_t size)
}
}
-void qemu_ram_set_idstr(ram_addr_t addr, const char *name, DeviceState *dev)
+static RAMBlock *find_ram_block(ram_addr_t addr)
{
- RAMBlock *new_block, *block;
+ RAMBlock *block;
- new_block = NULL;
QTAILQ_FOREACH(block, &ram_list.blocks, next) {
if (block->offset == addr) {
- new_block = block;
- break;
+ return block;
}
}
+
+ return NULL;
+}
+
+void qemu_ram_set_idstr(ram_addr_t addr, const char *name, DeviceState *dev)
+{
+ RAMBlock *new_block = find_ram_block(addr);
+ RAMBlock *block;
+
assert(new_block);
assert(!new_block->idstr[0]);
@@ -1236,6 +1243,15 @@ void qemu_ram_set_idstr(ram_addr_t addr, const char *name, DeviceState *dev)
qemu_mutex_unlock_ramlist();
}
+void qemu_ram_unset_idstr(ram_addr_t addr)
+{
+ RAMBlock *block = find_ram_block(addr);
+
+ if (block) {
+ memset(block->idstr, 0, sizeof(block->idstr));
+ }
+}
+
static int memory_try_enable_merging(void *addr, size_t len)
{
if (!qemu_opt_get_bool(qemu_get_machine_opts(), "mem-merge", true)) {