From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52806) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wz7Fy-0005Js-8f for qemu-devel@nongnu.org; Mon, 23 Jun 2014 12:38:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wz7Fq-0004Jk-PP for qemu-devel@nongnu.org; Mon, 23 Jun 2014 12:38:10 -0400 Received: from mx1.redhat.com ([209.132.183.28]:27852) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wz7Fq-0004JX-GL for qemu-devel@nongnu.org; Mon, 23 Jun 2014 12:38:02 -0400 From: Luiz Capitulino Date: Mon, 23 Jun 2014 12:36:39 -0400 Message-Id: <1403541403-16468-40-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1403541403-16468-1-git-send-email-lcapitulino@redhat.com> References: <1403541403-16468-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [PULL 39/43] qemu-char: do not call chr_write directly List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: peter.maydell@linaro.org Cc: qemu-devel@nongnu.org, anthony@codemonkey.ws From: Paolo Bonzini Make the mux always go through qemu_chr_fe_write, so that we'll get the mutex for the underlying chardev. Reviewed-by: Fam Zheng Signed-off-by: Paolo Bonzini Signed-off-by: Luiz Capitulino --- qemu-char.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/qemu-char.c b/qemu-char.c index 7e4bd90..28ea9f2 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -325,7 +325,7 @@ static int mux_chr_write(CharDriverState *chr, const uint8_t *buf, int len) MuxDriver *d = chr->opaque; int ret; if (!d->timestamps) { - ret = d->drv->chr_write(d->drv, buf, len); + ret = qemu_chr_fe_write(d->drv, buf, len); } else { int i; @@ -347,10 +347,10 @@ static int mux_chr_write(CharDriverState *chr, const uint8_t *buf, int len) (secs / 60) % 60, secs % 60, (int)(ti % 1000)); - d->drv->chr_write(d->drv, (uint8_t *)buf1, strlen(buf1)); + qemu_chr_fe_write(d->drv, (uint8_t *)buf1, strlen(buf1)); d->linestart = 0; } - ret += d->drv->chr_write(d->drv, buf+i, 1); + ret += qemu_chr_fe_write(d->drv, buf+i, 1); if (buf[i] == '\n') { d->linestart = 1; } @@ -385,13 +385,13 @@ static void mux_print_help(CharDriverState *chr) "\n\rEscape-Char set to Ascii: 0x%02x\n\r\n\r", term_escape_char); } - chr->chr_write(chr, (uint8_t *)cbuf, strlen(cbuf)); + qemu_chr_fe_write(chr, (uint8_t *)cbuf, strlen(cbuf)); for (i = 0; mux_help[i] != NULL; i++) { for (j=0; mux_help[i][j] != '\0'; j++) { if (mux_help[i][j] == '%') - chr->chr_write(chr, (uint8_t *)ebuf, strlen(ebuf)); + qemu_chr_fe_write(chr, (uint8_t *)ebuf, strlen(ebuf)); else - chr->chr_write(chr, (uint8_t *)&mux_help[i][j], 1); + qemu_chr_fe_write(chr, (uint8_t *)&mux_help[i][j], 1); } } } @@ -416,7 +416,7 @@ static int mux_proc_byte(CharDriverState *chr, MuxDriver *d, int ch) case 'x': { const char *term = "QEMU: Terminated\n\r"; - chr->chr_write(chr,(uint8_t *)term,strlen(term)); + qemu_chr_fe_write(chr, (uint8_t *)term, strlen(term)); exit(0); break; } -- 1.9.3