summaryrefslogtreecommitdiffstats
path: root/backends/hostmem-ram.c
diff options
context:
space:
mode:
authorMarc-André Lureau2018-09-12 14:18:00 +0200
committerMarc-André Lureau2019-01-07 13:18:42 +0100
commitfa0cb34d2210cc749b9a70db99bb41c56ad20831 (patch)
treef8d77d4385357c78e11d80b6dddec491252ddb8d /backends/hostmem-ram.c
parentarm: replace instance_post_init() (diff)
downloadqemu-fa0cb34d2210cc749b9a70db99bb41c56ad20831.tar.gz
qemu-fa0cb34d2210cc749b9a70db99bb41c56ad20831.tar.xz
qemu-fa0cb34d2210cc749b9a70db99bb41c56ad20831.zip
hostmem: use object id for memory region name with >= 4.0
hostmem-file and hostmem-memfd use the whole object path for the memory region name, and hostname-ram uses only the path component (the object id, or canonical path basename): qemu -m 1024 -object memory-backend-file,id=mem,size=1G,mem-path=/tmp/foo -numa node,memdev=mem -monitor stdio (qemu) info ramblock Block Name PSize Offset Used Total /objects/mem 4 KiB 0x0000000000000000 0x0000000040000000 0x0000000040000000 qemu -m 1024 -object memory-backend-memfd,id=mem,size=1G -numa node,memdev=mem -monitor stdio (qemu) info ramblock Block Name PSize Offset Used Total /objects/mem 4 KiB 0x0000000000000000 0x0000000040000000 0x0000000040000000 qemu -m 1024 -object memory-backend-ram,id=mem,size=1G -numa node,memdev=mem -monitor stdio (qemu) info ramblock Block Name PSize Offset Used Total mem 4 KiB 0x0000000000000000 0x0000000040000000 0x0000000040000000 For consistency, change to use object id for -file and -memfd as well with >= 4.0. Having a consistent naming allows to migrate to different hostmem backends. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Acked-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'backends/hostmem-ram.c')
-rw-r--r--backends/hostmem-ram.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/backends/hostmem-ram.c b/backends/hostmem-ram.c
index 7ddd08d370..24b65d9ae3 100644
--- a/backends/hostmem-ram.c
+++ b/backends/hostmem-ram.c
@@ -16,21 +16,20 @@
#define TYPE_MEMORY_BACKEND_RAM "memory-backend-ram"
-
static void
ram_backend_memory_alloc(HostMemoryBackend *backend, Error **errp)
{
- char *path;
+ char *name;
if (!backend->size) {
error_setg(errp, "can't create backend with size 0");
return;
}
- path = object_get_canonical_path_component(OBJECT(backend));
- memory_region_init_ram_shared_nomigrate(&backend->mr, OBJECT(backend), path,
+ name = host_memory_backend_get_name(backend);
+ memory_region_init_ram_shared_nomigrate(&backend->mr, OBJECT(backend), name,
backend->size, backend->share, errp);
- g_free(path);
+ g_free(name);
}
static void