From: Julien Grall Date: Tue, 2 Apr 2019 14:30:21 +0000 (+0100) Subject: xen/console: Simplify domU console handling in guest_console_write X-Git-Tag: archive/raspbian/4.14.0+80-gd101b417b7-1+rpi1^2~63^2~1734 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=f7efd9c792738f579e3c7062d8d3e90b21d8a771;p=xen.git xen/console: Simplify domU console handling in guest_console_write 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 Reviewed-by: Stefano Stabellini Acked-by: Wei Liu --- diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c index f6913b9f46..2c14c2ca73 100644 --- a/xen/drivers/char/console.c +++ b/xen/drivers/char/console.c @@ -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);