[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v7 10/35] hostmem-file: clean up memory allocation
From: |
Xiao Guangrong |
Subject: |
[Qemu-devel] [PATCH v7 10/35] hostmem-file: clean up memory allocation |
Date: |
Mon, 2 Nov 2015 17:13:12 +0800 |
- hostmem-file.c is compiled only if CONFIG_LINUX is enabled so that is
unnecessary to do the same check in the source file
- the interface, HostMemoryBackendClass->alloc(), is not called many
times, do not need to check if the memory-region is initialized
Reviewed-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Signed-off-by: Xiao Guangrong <address@hidden>
---
backends/hostmem-file.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c
index e9b6d21..9097a57 100644
--- a/backends/hostmem-file.c
+++ b/backends/hostmem-file.c
@@ -46,17 +46,12 @@ file_backend_memory_alloc(HostMemoryBackend *backend, Error
**errp)
error_setg(errp, "mem-path property not set");
return;
}
-#ifndef CONFIG_LINUX
- error_setg(errp, "-mem-path not supported on this host");
-#else
- if (!memory_region_size(&backend->mr)) {
- backend->force_prealloc = mem_prealloc;
- memory_region_init_ram_from_file(&backend->mr, OBJECT(backend),
+
+ backend->force_prealloc = mem_prealloc;
+ memory_region_init_ram_from_file(&backend->mr, OBJECT(backend),
object_get_canonical_path(OBJECT(backend)),
backend->size, fb->share,
fb->mem_path, errp);
- }
-#endif
}
static void
--
1.8.3.1
- [Qemu-devel] [PATCH v7 00/35] implement vNVDIMM, Xiao Guangrong, 2015/11/02
- [Qemu-devel] [PATCH v7 01/35] acpi: add aml_derefof, Xiao Guangrong, 2015/11/02
- [Qemu-devel] [PATCH v7 02/35] acpi: add aml_sizeof, Xiao Guangrong, 2015/11/02
- [Qemu-devel] [PATCH v7 03/35] acpi: add aml_create_field, Xiao Guangrong, 2015/11/02
- [Qemu-devel] [PATCH v7 04/35] acpi: add aml_concatenate, Xiao Guangrong, 2015/11/02
- [Qemu-devel] [PATCH v7 05/35] acpi: add aml_object_type, Xiao Guangrong, 2015/11/02
- [Qemu-devel] [PATCH v7 10/35] hostmem-file: clean up memory allocation,
Xiao Guangrong <=
- [Qemu-devel] [PATCH v7 06/35] acpi: add aml_method_serialized, Xiao Guangrong, 2015/11/02
- [Qemu-devel] [PATCH v7 09/35] exec: allow file_ram_alloc to work on file, Xiao Guangrong, 2015/11/02
- Re: [Qemu-devel] [PATCH v7 09/35] exec: allow file_ram_alloc to work on file, Paolo Bonzini, 2015/11/02