]> xenbits.xensource.com Git - people/dwmw2/xen.git/commitdiff
xen/console: Simplify domU console handling in guest_console_write
authorJulien Grall <julien.grall@arm.com>
Tue, 2 Apr 2019 14:30:21 +0000 (15:30 +0100)
committerJulien Grall <julien.grall@arm.com>
Fri, 16 Aug 2019 21:44:34 +0000 (22:44 +0100)
2 paths in the domU console handling are now the same. So they can be
merged to make the code simpler.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Acked-by: Wei Liu <wei.liu2@citrix.com>
xen/drivers/char/console.c

index f6913b9f466fc572ca8a21a34ce778da173c1103..2c14c2ca739fad68bf34879ccc536742ecb2171b 100644 (file)
@@ -585,13 +585,8 @@ static long guest_console_write(XEN_GUEST_HANDLE_PARAM(char) buffer,
             *kout = '\0';
             spin_lock(&cd->pbuf_lock);
             kcount = kin - kbuf;
-            if ( c == '\n' )
-            {
-                cd->pbuf[cd->pbuf_idx] = '\0';
-                guest_printk(cd, XENLOG_G_DEBUG "%s%s\n", cd->pbuf, kbuf);
-                cd->pbuf_idx = 0;
-            }
-            else if ( cd->pbuf_idx + (kout - kbuf) < (DOMAIN_PBUF_SIZE - 1) )
+            if ( c != '\n' &&
+                 (cd->pbuf_idx + (kout - kbuf) < (DOMAIN_PBUF_SIZE - 1)) )
             {
                 /* buffer the output until a newline */
                 memcpy(cd->pbuf + cd->pbuf_idx, kbuf, kout - kbuf);