All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [1/4] put xen console message into syslog but xm dmesg is not affected
@ 2006-07-07  8:17 MINAI Katsuhito
  2006-07-10 15:00 ` Keir Fraser
  0 siblings, 1 reply; 6+ messages in thread
From: MINAI Katsuhito @ 2006-07-07  8:17 UTC (permalink / raw)
  To: Akio Takebe; +Cc: Hans-Christian Armingeon, xen-devel, Mark Williamson

[-- Attachment #1: Type: text/plain, Size: 104 bytes --]


[1/4] add read pointer to the xen console ring

Signed-off-by: Katsuhito Minai <minai@jp.fujitsu.com>


[-- Attachment #2: 1.consdev.patch --]
[-- Type: application/octet-stream, Size: 1860 bytes --]

diff -r 8e55c5c11475 xen/drivers/char/console.c
--- a/xen/drivers/char/console.c	Wed Jul 05 18:48:41 2006 +0100
+++ b/xen/drivers/char/console.c	Fri Jul 07 16:40:56 2006 +0900
@@ -217,19 +217,27 @@ static void putchar_console_ring(int c)
 static void putchar_console_ring(int c)
 {
     conring[CONRING_IDX_MASK(conringp++)] = c;
-    if ( (conringp - conringc) > CONRING_SIZE )
-        conringc = conringp - CONRING_SIZE;
 }
 
 long read_console_ring(XEN_GUEST_HANDLE(char) str, u32 *pcount, int clear)
 {
     unsigned int idx, len, max, sofar, c;
     unsigned long flags;
+    static int conringlogp = 0;
 
     max   = *pcount;
     sofar = 0;
 
-    c = conringc;
+    if (clear < 0) {
+        if ( (conringp - conringlogp) > CONRING_SIZE )
+            conringlogp = conringp - CONRING_SIZE;
+            c = conringlogp;
+    } else {
+        if ( (conringp - conringc) > CONRING_SIZE )
+            conringc = conringp - CONRING_SIZE;
+            c = conringc;
+    }
+
     while ( (c != conringp) && (sofar < max) )
     {
         idx = CONRING_IDX_MASK(c);
@@ -244,7 +252,7 @@ long read_console_ring(XEN_GUEST_HANDLE(
         c += len;
     }
 
-    if ( clear )
+    if ( clear > 0 )
     {
         spin_lock_irqsave(&console_lock, flags);
         if ( (conringp - c) > CONRING_SIZE )
@@ -252,7 +260,14 @@ long read_console_ring(XEN_GUEST_HANDLE(
         else
             conringc = c;
         spin_unlock_irqrestore(&console_lock, flags);
-    }
+    } else if ( clear < 0 ) {
+        spin_lock_irqsave(&console_lock, flags);
+        if ( (conringp - c) > CONRING_SIZE )
+            conringlogp = conringp - CONRING_SIZE;
+        else
+            conringlogp = c;
+        spin_unlock_irqrestore(&console_lock, flags);
+    }        
 
     *pcount = sofar;
     return 0;

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

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

end of thread, other threads:[~2006-07-11 15:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-07  8:17 [PATCH] [1/4] put xen console message into syslog but xm dmesg is not affected MINAI Katsuhito
2006-07-10 15:00 ` Keir Fraser
2006-07-11  1:28   ` MINAI Katsuhito
2006-07-11  6:42     ` Keir Fraser
2006-07-11  8:34       ` [PATCH] [1/4] put xen console message into syslog butxm " MINAI Katsuhito
2006-07-11 15:07         ` Keir Fraser

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.