ramblocks: No more being lazy about duplicate names
Now that we have a working qemu_ram_free() and the primary runtime user of it has been updated, don't be lenient about duplicate id strings. We also shouldn't need to create them ondemand at the target. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
230741dcc7
commit
fb787f81e7
|
@ -369,8 +369,9 @@ int ram_load(QEMUFile *f, void *opaque, int version_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!block) {
|
if (!block) {
|
||||||
if (!qemu_ram_alloc(NULL, id, length))
|
fprintf(stderr, "Unknown ramblock \"%s\", cannot "
|
||||||
return -ENOMEM;
|
"accept migration\n", id);
|
||||||
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
total_ram_bytes -= length;
|
total_ram_bytes -= length;
|
||||||
|
|
11
exec.c
11
exec.c
|
@ -2826,18 +2826,11 @@ ram_addr_t qemu_ram_alloc(DeviceState *dev, const char *name, ram_addr_t size)
|
||||||
|
|
||||||
QLIST_FOREACH(block, &ram_list.blocks, next) {
|
QLIST_FOREACH(block, &ram_list.blocks, next) {
|
||||||
if (!strcmp(block->idstr, new_block->idstr)) {
|
if (!strcmp(block->idstr, new_block->idstr)) {
|
||||||
if (block->length == new_block->length) {
|
fprintf(stderr, "RAMBlock \"%s\" already registered, abort!\n",
|
||||||
fprintf(stderr, "RAMBlock \"%s\" exists, assuming lack of"
|
new_block->idstr);
|
||||||
"free.\n", new_block->idstr);
|
|
||||||
qemu_free(new_block);
|
|
||||||
return block->offset;
|
|
||||||
} else {
|
|
||||||
fprintf(stderr, "RAMBlock \"%s\" already registered with"
|
|
||||||
"different size, abort\n", new_block->idstr);
|
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (mem_path) {
|
if (mem_path) {
|
||||||
#if defined (__linux__) && !defined(TARGET_S390X)
|
#if defined (__linux__) && !defined(TARGET_S390X)
|
||||||
|
|
Loading…
Reference in New Issue