diff options
author | Igor Mammedov | 2019-02-14 04:10:03 +0100 |
---|---|---|
committer | Laurent Vivier | 2019-03-06 11:21:27 +0100 |
commit | 5c7ba877ef54e6a90982db729b4fda8c4790ef67 (patch) | |
tree | d7a6aaf433b6620421675d7cfd139388f02c9c1c | |
parent | build: Correct explanation of unnest-vars example (diff) | |
download | qemu-5c7ba877ef54e6a90982db729b4fda8c4790ef67.tar.gz qemu-5c7ba877ef54e6a90982db729b4fda8c4790ef67.tar.xz qemu-5c7ba877ef54e6a90982db729b4fda8c4790ef67.zip |
hostmem-file: simplify ifdef-s in file_backend_memory_alloc()
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 <imammedo@redhat.com>
Suggested-by: Wei Yang <richardw.yang@linux.intel.com>
Reviewed-by: Wei Yang <richardw.yang@linux.intel.com>
Message-Id: <20190213123858.24620-1-imammedo@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20190214031004.32522-2-stefanha@redhat.com>
[lv: s/hostmem/hostmem-file/]
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
-rw-r--r-- | backends/hostmem-file.c | 9 |
1 files 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), |