[PATCH v6 74/79] exec: drop bogus mem_path from qemu_ram_alloc_from_fd()

Igor Mammedov posted 79 patches 5 years, 11 months ago
Maintainers: Andrew Baumann <Andrew.Baumann@microsoft.com>, David Gibson <david@gibson.dropbear.id.au>, Aleksandar Rikalo <aleksandar.rikalo@rt-rk.com>, Andrew Jeffery <andrew@aj.id.au>, Radoslaw Biernacki <radoslaw.biernacki@linaro.org>, Jan Kiszka <jan.kiszka@web.de>, Sergio Lopez <slp@redhat.com>, Aurelien Jarno <aurelien@aurel32.net>, Antony Pavlov <antonynpavlov@gmail.com>, "Michael S. Tsirkin" <mst@redhat.com>, Beniamino Galvani <b.galvani@gmail.com>, David Hildenbrand <david@redhat.com>, Leif Lindholm <leif@nuviainc.com>, Andrzej Zaborowski <balrogg@gmail.com>, Cornelia Huck <cohuck@redhat.com>, Halil Pasic <pasic@linux.ibm.com>, Eduardo Habkost <ehabkost@redhat.com>, BALATON Zoltan <balaton@eik.bme.hu>, "Hervé Poussineau" <hpoussin@reactos.org>, Jean-Christophe Dubois <jcd@tribudubois.net>, Aleksandar Markovic <amarkovic@wavecomp.com>, Igor Mammedov <imammedo@redhat.com>, Paul Burton <pburton@wavecomp.com>, Andrey Smirnov <andrew.smirnov@gmail.com>, Peter Maydell <peter.maydell@linaro.org>, Christian Borntraeger <borntraeger@de.ibm.com>, Laurent Vivier <lvivier@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Artyom Tarasenko <atar4qemu@gmail.com>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Richard Henderson <rth@twiddle.net>, Laurent Vivier <laurent@vivier.eu>, Alistair Francis <alistair@alistair23.me>, Michael Walle <michael@walle.cc>, Fabien Chouteau <chouteau@adacore.com>, Thomas Huth <thuth@redhat.com>, Helge Deller <deller@gmx.de>, "Philippe Mathieu-Daudé" <philmd@redhat.com>, Joel Stanley <joel@jms.id.au>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Rob Herring <robh@kernel.org>, "Cédric Le Goater" <clg@kaod.org>, Peter Chubb <peter.chubb@nicta.com.au>, Thomas Huth <huth@tuxfamily.org>, KONRAD Frederic <frederic.konrad@adacore.com>, Paolo Bonzini <pbonzini@redhat.com>
[PATCH v6 74/79] exec: drop bogus mem_path from qemu_ram_alloc_from_fd()
Posted by Igor Mammedov 5 years, 11 months ago
Function will report error that will mention global mem_path,
which was valid the only if legacy -mem-path was used and
only in case of main RAM.

However it doesn't work with hostmem backends
(for example:
"
  qemu: -object memory-backend-file,id=ram0,size=128M,mem-path=foo:
    backing store (null) size 0x200000 does not match 'size' option 0x8000000
")
and couldn't possibly work in general FD case the function
is supposed to handle.

Taking in account that main RAM was converted into
memory-backend-foo object, there is no point in printing
file name (from inappropriate place) as failing path is
a part of backend's error message.

Hence drop bogus mem_path usage from qemu_ram_alloc_from_fd(),
it's a job of its user to add file name to error message if applicable.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
 exec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/exec.c b/exec.c
index d85a8689d4..6ebff8bd3a 100644
--- a/exec.c
+++ b/exec.c
@@ -2307,9 +2307,9 @@ RAMBlock *qemu_ram_alloc_from_fd(ram_addr_t size, MemoryRegion *mr,
     size = HOST_PAGE_ALIGN(size);
     file_size = get_file_size(fd);
     if (file_size > 0 && file_size < size) {
-        error_setg(errp, "backing store %s size 0x%" PRIx64
+        error_setg(errp, "backing store size 0x%" PRIx64
                    " does not match 'size' option 0x" RAM_ADDR_FMT,
-                   mem_path, file_size, size);
+                   file_size, size);
         return NULL;
     }
 
-- 
2.18.1