[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 1/2] hostmem: simplify ifdef-s in file_backen
From: |
Wei Yang |
Subject: |
Re: [Qemu-devel] [PATCH v3 1/2] hostmem: simplify ifdef-s in file_backend_memory_alloc() |
Date: |
Thu, 14 Feb 2019 15:26:29 +0800 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
Maybe change the title
s/hotmem/hostmem-file/
would be more proper.
I missed this in previous review.
On Thu, Feb 14, 2019 at 11:10:03AM +0800, Stefan Hajnoczi wrote:
>From: Igor Mammedov <address@hidden>
>
>cleanup file_backend_memory_alloc() by using one CONFIG_POSIX ifdef
>instead of several ones within the function to make it simpler to follow.
>
>Signed-off-by: Igor Mammedov <address@hidden>
>Suggested-by: Wei Yang <address@hidden>
>Reviewed-by: Wei Yang <address@hidden>
>Message-Id: <address@hidden>
>Signed-off-by: Stefan Hajnoczi <address@hidden>
>---
> backends/hostmem-file.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
>diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c
>index ba601ce940..ce54788048 100644
>--- a/backends/hostmem-file.c
>+++ b/backends/hostmem-file.c
>@@ -41,10 +41,12 @@ struct HostMemoryBackendFile {
> static void
> file_backend_memory_alloc(HostMemoryBackend *backend, Error **errp)
> {
>+#ifndef CONFIG_POSIX
>+ error_setg(errp, "backend '%s' not supported on this host",
>+ object_get_typename(OBJECT(backend)));
>+#else
> HostMemoryBackendFile *fb = MEMORY_BACKEND_FILE(backend);
>-#ifdef CONFIG_POSIX
> gchar *name;
>-#endif
>
> if (!backend->size) {
> error_setg(errp, "can't create backend with size 0");
>@@ -54,9 +56,6 @@ file_backend_memory_alloc(HostMemoryBackend *backend, Error
>**errp)
> error_setg(errp, "mem-path property not set");
> return;
> }
>-#ifndef CONFIG_POSIX
>- error_setg(errp, "-mem-path not supported on this host");
>-#else
> backend->force_prealloc = mem_prealloc;
> name = host_memory_backend_get_name(backend);
> memory_region_init_ram_from_file(&backend->mr, OBJECT(backend),
>--
>2.20.1
--
Wei Yang
Help you, Help me