The error message introduced in commit e45da653223 in
virtio_init_region_cache() was unclear:
qemu-system-i386: Cannot map used
This patch modifies virtio_error() to prepend all error messages with
"virtio: ", making it easier to trace their origin.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/230
Buglink: https://bugs.launchpad.net/qemu/+bug/1919021
Signed-off-by: Alessandro Ratti <alessandro@0x65c.net>
---
hw/virtio/virtio.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 9a81ad912e..c43ac4d320 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -3934,11 +3934,16 @@ void virtio_device_set_child_bus_name(VirtIODevice *vdev, char *bus_name)
void G_GNUC_PRINTF(2, 3) virtio_error(VirtIODevice *vdev, const char *fmt, ...)
{
va_list ap;
+ char *prefixed_fmt;
+
+ prefixed_fmt = g_strdup_printf("virtio: %s", fmt);
va_start(ap, fmt);
- error_vreport(fmt, ap);
+ error_vreport(prefixed_fmt, ap);
va_end(ap);
+ g_free(prefixed_fmt);
+
if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {
vdev->status = vdev->status | VIRTIO_CONFIG_S_NEEDS_RESET;
virtio_notify_config(vdev);
--
2.39.5