WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [qemu-xen-unstable] qemu xen upstream synch (Gerd): [PAT

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [qemu-xen-unstable] qemu xen upstream synch (Gerd): [PATCH 5/7] logging fixups.
From: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Date: Wed, 20 May 2009 00:36:04 -0700
Delivery-date: Thu, 11 Jun 2009 08:01:05 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
commit a7e5469d71781c6269689aa607bd4629ef4fd352
Author: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Date:   Tue May 19 15:41:04 2009 +0100

    qemu xen upstream synch (Gerd): [PATCH 5/7] logging fixups.
    
    Use new logging API.
    Kill a few fprintf(stderr, "...") calls.
    
    [This is] a series of patches for qemu-xen, making the code identical
    to the xen support patches being submitted to upstream qemu.  The review
    process on qemu-devel resulted in a number of fixes and cleanups in the
    backend code, this is where most of the changes come from.
    
    There are also some xenfb changes due to displaystate reorganization and
    xenfb being merged in steps due to that.
    
    Signed-off-by: Gerd Hoffmann <kraxel@xxxxxxxxxx>
---
 hw/xen_backend.c |   42 +++++++++++++++++++++++++++++-------------
 hw/xen_console.c |    6 ------
 hw/xenfb.c       |   15 +++++++--------
 3 files changed, 36 insertions(+), 27 deletions(-)

diff --git a/hw/xen_backend.c b/hw/xen_backend.c
index bb02634..2f2ec7f 100644
--- a/hw/xen_backend.c
+++ b/hw/xen_backend.c
@@ -209,7 +209,7 @@ static struct XenDevice *xen_be_get_xendev(const char 
*type, int dom, int dev,
 
     xendev->evtchndev = xc_evtchn_open();
     if (xendev->evtchndev < 0) {
-       fprintf(stderr, "can't open evtchn device\n");
+       xen_be_printf(NULL, 0, "can't open evtchn device\n");
        qemu_free(xendev);
        return NULL;
     }
@@ -218,7 +218,7 @@ static struct XenDevice *xen_be_get_xendev(const char 
*type, int dom, int dev,
     if (ops->flags & DEVOPS_FLAG_NEED_GNTDEV) {
        xendev->gnttabdev = xc_gnttab_open();
        if (xendev->gnttabdev < 0) {
-           fprintf(stderr, "can't open gnttab device\n");
+           xen_be_printf(NULL, 0, "can't open gnttab device\n");
            xc_evtchn_close(xendev->evtchndev);
            qemu_free(xendev);
            return NULL;
@@ -511,7 +511,7 @@ static int xenstore_scan(const char *type, int dom, struct 
XenDevOps *ops)
     snprintf(path, sizeof(path), "%s/backend/%s/%d", dom0, type, dom);
     free(dom0);
     if (!xs_watch(xenstore, path, token)) {
-       fprintf(stderr, "xen be: watching backend path (%s) failed\n", path);
+       xen_be_printf(NULL, 0, "xen be: watching backend path (%s) failed\n", 
path);
        return -1;
     }
 
@@ -620,7 +620,7 @@ int xen_be_init(void)
 {
     xenstore = xs_daemon_open();
     if (!xenstore) {
-       fprintf(stderr, "can't connect to xenstored\n");
+       xen_be_printf(NULL, 0, "can't connect to xenstored\n");
        return -1;
     }
 
@@ -629,7 +629,7 @@ int xen_be_init(void)
 
     xen_xc = xc_interface_open();
     if (xen_xc == -1) {
-       fprintf(stderr, "can't open xen interface\n");
+       xen_be_printf(NULL, 0, "can't open xen interface\n");
        goto err;
     }
     return 0;
@@ -680,19 +680,35 @@ int xen_be_send_notify(struct XenDevice *xendev)
 
 /*
  * msg_level:
- *  0 == errors.
- *  1 == informative debug messages.
- *  2 == noisy debug messages.
- *  3 == will flood your log.
+ *  0 == errors (stderr + logfile).
+ *  1 == informative debug messages (logfile only).
+ *  2 == noisy debug messages (logfile only).
+ *  3 == will flood your log (logfile only).
  */
 void xen_be_printf(struct XenDevice *xendev, int msg_level, const char *fmt, 
...)
 {
     va_list args;
 
-    if (msg_level > xendev->debug)
-       return;
-    fprintf(stderr, "xen be: %s: ", xendev->name);
+    if (xendev) {
+        if (msg_level > xendev->debug)
+            return;
+        qemu_log("xen be: %s: ", xendev->name);
+        if (msg_level == 0)
+            fprintf(stderr, "xen be: %s: ", xendev->name);
+    } else {
+        if (msg_level > debug)
+            return;
+        qemu_log("xen be core: ");
+        if (msg_level == 0)
+            fprintf(stderr, "xen be core: ");
+    }
     va_start(args, fmt);
-    vfprintf(stderr, fmt, args);
+    qemu_log_vprintf(fmt, args);
     va_end(args);
+    if (msg_level == 0) {
+        va_start(args, fmt);
+        vfprintf(stderr, fmt, args);
+        va_end(args);
+    }
+    qemu_log_flush();
 }
diff --git a/hw/xen_console.c b/hw/xen_console.c
index 707075e..27f809d 100644
--- a/hw/xen_console.c
+++ b/hw/xen_console.c
@@ -38,8 +38,6 @@
 #include "qemu-char.h"
 #include "xen_backend.h"
 
-#define dolog(val, fmt, ...) fprintf(stderr, fmt "\n", ## __VA_ARGS__)
-
 struct buffer {
     uint8_t *data;
     size_t consumed;
@@ -75,10 +73,6 @@ static void buffer_append(struct XenConsole *con)
     if ((buffer->capacity - buffer->size) < size) {
        buffer->capacity += (size + 1024);
        buffer->data = qemu_realloc(buffer->data, buffer->capacity);
-       if (buffer->data == NULL) {
-           dolog(LOG_ERR, "Memory allocation failed");
-           exit(ENOMEM);
-       }
     }
 
     while (cons != prod)
diff --git a/hw/xenfb.c b/hw/xenfb.c
index 1764ac2..d9e5c33 100644
--- a/hw/xenfb.c
+++ b/hw/xenfb.c
@@ -813,15 +813,14 @@ static void xenfb_handle_events(struct XenFB *xenfb)
            w = MIN(event->update.width, xenfb->width - x);
            h = MIN(event->update.height, xenfb->height - y);
            if (w < 0 || h < 0) {
-               fprintf(stderr, "xen be: %s: bogus update ignored\n",
-                       xenfb->c.xendev.name);
+                xen_be_printf(&xenfb->c.xendev, 1, "bogus update ignored\n");
                break;
            }
-           if (x != event->update.x || y != event->update.y
-               || w != event->update.width
-               || h != event->update.height) {
-               fprintf(stderr, "xen be: %s: bogus update clipped\n",
-                       xenfb->c.xendev.name);
+           if (x != event->update.x ||
+                y != event->update.y ||
+               w != event->update.width ||
+               h != event->update.height) {
+                xen_be_printf(&xenfb->c.xendev, 1, "bogus update clipped\n");
            }
            if (w == xenfb->width && h > xenfb->height / 2) {
                /* scroll detector: updated more than 50% of the lines,
@@ -993,7 +992,7 @@ wait_more:
     if (!xfb || !xin) {
         if (i < 256)
             goto wait_more;
-        fprintf(stderr, "%s: displaystate setup failed\n", __FUNCTION__);
+        xen_be_printf(NULL, 1, "displaystate setup failed\n");
         return;
     }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen-unstable.git

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [qemu-xen-unstable] qemu xen upstream synch (Gerd): [PATCH 5/7] logging fixups., Ian Jackson <=