qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v2] qxl: make qxl_guest_bug take variable arguments


From: Alon Levy
Subject: [Qemu-devel] [PATCH v2] qxl: make qxl_guest_bug take variable arguments
Date: Thu, 7 Jul 2011 18:50:49 +0200

---
 hw/qxl.c |   18 +++++++++++-------
 hw/qxl.h |    2 +-
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/hw/qxl.c b/hw/qxl.c
index 0d62036..935bac0 100644
--- a/hw/qxl.c
+++ b/hw/qxl.c
@@ -124,11 +124,15 @@ static void qxl_reset_memslots(PCIQXLDevice *d);
 static void qxl_reset_surfaces(PCIQXLDevice *d);
 static void qxl_ring_set_dirty(PCIQXLDevice *qxl);
 
-void qxl_guest_bug(PCIQXLDevice *qxl, const char *msg)
+void qxl_guest_bug(PCIQXLDevice *qxl, const char *msg, ...)
 {
     qxl_send_events(qxl, QXL_INTERRUPT_ERROR);
     if (qxl->guestdebug) {
-        fprintf(stderr, "qxl-%d: guest bug: %s\n", qxl->id, msg);
+        va_list ap;
+        va_start(ap, msg);
+        fprintf(stderr, "qxl-%d: guest bug: ", qxl->id);
+        vfprintf(stderr, msg, ap);
+        va_end(ap);
     }
 }
 
@@ -1114,11 +1118,11 @@ static void ioport_write(void *opaque, uint32_t addr, 
uint32_t val)
         break;
     case QXL_IO_MEMSLOT_ADD:
         if (val >= NUM_MEMSLOTS) {
-            qxl_guest_bug(d, "QXL_IO_MEMSLOT_ADD: val out of range");
+            qxl_guest_bug(d, "QXL_IO_MEMSLOT_ADD: val out of range\n");
             break;
         }
         if (d->guest_slots[val].active) {
-            qxl_guest_bug(d, "QXL_IO_MEMSLOT_ADD: memory slot already active");
+            qxl_guest_bug(d, "QXL_IO_MEMSLOT_ADD: memory slot already 
active\n");
             break;
         }
         d->guest_slots[val].slot = d->ram->mem_slot;
@@ -1126,14 +1130,14 @@ static void ioport_write(void *opaque, uint32_t addr, 
uint32_t val)
         break;
     case QXL_IO_MEMSLOT_DEL:
         if (val >= NUM_MEMSLOTS) {
-            qxl_guest_bug(d, "QXL_IO_MEMSLOT_DEL: val out of range");
+            qxl_guest_bug(d, "QXL_IO_MEMSLOT_DEL: val out of range\n");
             break;
         }
         qxl_del_memslot(d, val);
         break;
     case QXL_IO_CREATE_PRIMARY:
         if (val != 0) {
-            qxl_guest_bug(d, "QXL_IO_CREATE_PRIMARY: val != 0");
+            qxl_guest_bug(d, "QXL_IO_CREATE_PRIMARY: val != 0\n");
             break;
         }
         dprint(d, 1, "QXL_IO_CREATE_PRIMARY\n");
@@ -1142,7 +1146,7 @@ static void ioport_write(void *opaque, uint32_t addr, 
uint32_t val)
         break;
     case QXL_IO_DESTROY_PRIMARY:
         if (val != 0) {
-            qxl_guest_bug(d, "QXL_IO_DESTROY_PRIMARY: val != 0");
+            qxl_guest_bug(d, "QXL_IO_DESTROY_PRIMARY: val != 0\n");
             break;
         }
         dprint(d, 1, "QXL_IO_DESTROY_PRIMARY (%s)\n", 
qxl_mode_to_string(d->mode));
diff --git a/hw/qxl.h b/hw/qxl.h
index 88393c2..e361bc6 100644
--- a/hw/qxl.h
+++ b/hw/qxl.h
@@ -99,7 +99,7 @@ typedef struct PCIQXLDevice {
 
 /* qxl.c */
 void *qxl_phys2virt(PCIQXLDevice *qxl, QXLPHYSICAL phys, int group_id);
-void qxl_guest_bug(PCIQXLDevice *qxl, const char *msg);
+void qxl_guest_bug(PCIQXLDevice *qxl, const char *msg, ...);
 
 void qxl_spice_update_area(PCIQXLDevice *qxl, uint32_t surface_id,
                            struct QXLRect *area, struct QXLRect *dirty_rects,
-- 
1.7.5.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]