qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] virtio: Prepend "virtio" prefix in virtio_error
@ 2023-05-13  9:26 Maxim Kostin
  2023-05-14 22:24 ` Alex Bennée
  0 siblings, 1 reply; 2+ messages in thread
From: Maxim Kostin @ 2023-05-13  9:26 UTC (permalink / raw)
  To: qemu-devel

Rename virtio_error function to virtio_error_impl and wrap it with
virtio_error macro, it adds the "virtio" prefix to the error message.

Remove redundant "virtio" prefixes in virtio_error calls.

Signed-off-by: Maxim Kostin <ttxinee@outlook.com>
---
 hw/virtio/virtio.c         | 10 +++++-----
 include/hw/virtio/virtio.h |  6 +++++-
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 272d930721..efdc425063 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -1375,15 +1375,14 @@ static bool virtqueue_map_desc(VirtIODevice *vdev, unsigned int *p_num_sg,
     assert(num_sg <= max_num_sg);
 
     if (!sz) {
-        virtio_error(vdev, "virtio: zero sized buffers are not allowed");
+        virtio_error(vdev, "zero sized buffers are not allowed");
         goto out;
     }
 
     while (sz) {
         hwaddr len = sz;
-
         if (num_sg == max_num_sg) {
-            virtio_error(vdev, "virtio: too many write descriptors in "
+            virtio_error(vdev, "too many write descriptors in "
                                "indirect table");
             goto out;
         }
@@ -1394,7 +1393,7 @@ static bool virtqueue_map_desc(VirtIODevice *vdev, unsigned int *p_num_sg,
                                               DMA_DIRECTION_TO_DEVICE,
                                               MEMTXATTRS_UNSPECIFIED);
         if (!iov[num_sg].iov_base) {
-            virtio_error(vdev, "virtio: bogus descriptor or out of resources");
+            virtio_error(vdev, "bogus descriptor or out of resources");
             goto out;
         }
 
@@ -3563,7 +3562,8 @@ void virtio_device_set_child_bus_name(VirtIODevice *vdev, char *bus_name)
     vdev->bus_name = g_strdup(bus_name);
 }
 
-void G_GNUC_PRINTF(2, 3) virtio_error(VirtIODevice *vdev, const char *fmt, ...)
+G_GNUC_PRINTF(2, 3)
+void virtio_error_impl(VirtIODevice *vdev, const char *fmt, ...)
 {
     va_list ap;
 
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index f6b38f7e9c..7022b67c72 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -221,7 +221,11 @@ void virtio_init(VirtIODevice *vdev, uint16_t device_id, size_t config_size);
 
 void virtio_cleanup(VirtIODevice *vdev);
 
-void virtio_error(VirtIODevice *vdev, const char *fmt, ...) G_GNUC_PRINTF(2, 3);
+#define virtio_error(vdev, fmt, ...) \
+    virtio_error_impl(vdev, "%s: " fmt, "virtio", ## __VA_ARGS__)
+
+void virtio_error_impl(VirtIODevice *vdev, const char *fmt, ...)
+    G_GNUC_PRINTF(2, 3);
 
 /* Set the child bus name. */
 void virtio_device_set_child_bus_name(VirtIODevice *vdev, char *bus_name);
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] virtio: Prepend "virtio" prefix in virtio_error
  2023-05-13  9:26 [PATCH] virtio: Prepend "virtio" prefix in virtio_error Maxim Kostin
@ 2023-05-14 22:24 ` Alex Bennée
  0 siblings, 0 replies; 2+ messages in thread
From: Alex Bennée @ 2023-05-14 22:24 UTC (permalink / raw)
  To: Maxim Kostin; +Cc: qemu-devel


Maxim Kostin <ttxinee@outlook.com> writes:

> Rename virtio_error function to virtio_error_impl and wrap it with
> virtio_error macro, it adds the "virtio" prefix to the error message.
>
> Remove redundant "virtio" prefixes in virtio_error calls.
>
> Signed-off-by: Maxim Kostin <ttxinee@outlook.com>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

-- 
Alex Bennée
Virtualisation Tech Lead @ Linaro


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-14 22:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-13  9:26 [PATCH] virtio: Prepend "virtio" prefix in virtio_error Maxim Kostin
2023-05-14 22:24 ` Alex Bennée

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).