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

[Xen-changelog] [xen master] xen/conring: Clean up writing to the console ring



commit cc90bf1894daf9f97791495e2256e7e342e25704
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Tue Aug 6 17:44:31 2013 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Aug 6 17:44:31 2013 +0200

    xen/conring: Clean up writing to the console ring
    
    Refactor putchar_console_ring() to conring_puts().  This allows for
    consistency with {sercon,vga}_puts(), prevents needless recalculation of
    the conring consumer index, and slight cleanup at the two callsites.
    
    There is no functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Acked-by: Matt Wilson <msw@xxxxxxxxxx>
    Acked-by: Keir Fraser <keir@xxxxxxx>
---
 xen/drivers/char/console.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c
index b696b3e..45b81b3 100644
--- a/xen/drivers/char/console.c
+++ b/xen/drivers/char/console.c
@@ -175,10 +175,15 @@ static char * __init loglvl_str(int lvl)
  * ********************************************************
  */
 
-static void putchar_console_ring(int c)
+static void conring_puts(const char *str)
 {
+    char c;
+
     ASSERT(spin_is_locked(&console_lock));
-    conring[CONRING_IDX_MASK(conringp++)] = c;
+
+    while ( (c = *str++) != '\0' )
+        conring[CONRING_IDX_MASK(conringp++)] = c;
+
     if ( (uint32_t)(conringp - conringc) > conring_size )
         conringc = conringp - conring_size;
 }
@@ -368,7 +373,7 @@ static DECLARE_SOFTIRQ_TASKLET(notify_dom0_con_ring_tasklet,
 
 static long guest_console_write(XEN_GUEST_HANDLE_PARAM(char) buffer, int count)
 {
-    char kbuf[128], *kptr;
+    char kbuf[128];
     int kcount;
 
     while ( count > 0 )
@@ -390,8 +395,7 @@ static long 
guest_console_write(XEN_GUEST_HANDLE_PARAM(char) buffer, int count)
 
         if ( opt_console_to_ring )
         {
-            for ( kptr = kbuf; *kptr != '\0'; kptr++ )
-                putchar_console_ring(*kptr);
+            conring_puts(kbuf);
             tasklet_schedule(&notify_dom0_con_ring_tasklet);
         }
 
@@ -456,8 +460,6 @@ static bool_t console_locks_busted;
 
 static void __putstr(const char *str)
 {
-    int c;
-
     ASSERT(spin_is_locked(&console_lock));
 
     sercon_puts(str);
@@ -465,8 +467,7 @@ static void __putstr(const char *str)
 
     if ( !console_locks_busted )
     {
-        while ( (c = *str++) != '\0' )
-            putchar_console_ring(c);
+        conring_puts(str);
         tasklet_schedule(&notify_dom0_con_ring_tasklet);
     }
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.