aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/hostmem-file.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c
index ba601ce..ce54788 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),