[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 36/40] qemu-char: do not call chr_write directly
From: |
Luiz Capitulino |
Subject: |
[Qemu-devel] [PULL 36/40] qemu-char: do not call chr_write directly |
Date: |
Thu, 19 Jun 2014 15:39:48 -0400 |
From: Paolo Bonzini <address@hidden>
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 <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>
---
qemu-char.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/qemu-char.c b/qemu-char.c
index 56a0a9a..26994aa 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -279,7 +279,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;
@@ -301,10 +301,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;
}
@@ -339,13 +339,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);
}
}
}
@@ -370,7 +370,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
- [Qemu-devel] [PULL 30/40] qapi event: convert SPICE events, (continued)
- [Qemu-devel] [PULL 30/40] qapi event: convert SPICE events, Luiz Capitulino, 2014/06/19
- [Qemu-devel] [PULL 34/40] qapi event: clean up, Luiz Capitulino, 2014/06/19
- [Qemu-devel] [PULL 28/40] qapi event: convert NIC_RX_FILTER_CHANGED, Luiz Capitulino, 2014/06/19
- [Qemu-devel] [PULL 35/40] qemu-char: introduce qemu_chr_alloc, Luiz Capitulino, 2014/06/19
- [Qemu-devel] [PULL 29/40] qapi event: convert VNC events, Luiz Capitulino, 2014/06/19
- [Qemu-devel] [PULL 32/40] qapi event: convert GUEST_PANICKED, Luiz Capitulino, 2014/06/19
- [Qemu-devel] [PULL 31/40] qapi event: convert BALLOON_CHANGE, Luiz Capitulino, 2014/06/19
- [Qemu-devel] [PULL 37/40] qemu-char: move pty_chr_update_read_handler around, Luiz Capitulino, 2014/06/19
- [Qemu-devel] [PULL 33/40] qapi event: convert QUORUM events, Luiz Capitulino, 2014/06/19
- [Qemu-devel] [PULL 38/40] qemu-char: make writes thread-safe, Luiz Capitulino, 2014/06/19
- [Qemu-devel] [PULL 36/40] qemu-char: do not call chr_write directly,
Luiz Capitulino <=
- [Qemu-devel] [PULL 40/40] monitor: protect event emission, Luiz Capitulino, 2014/06/19
- [Qemu-devel] [PULL 39/40] monitor: protect outbuf and mux_out with mutex, Luiz Capitulino, 2014/06/19
- [Qemu-devel] [PULL 12/40] qapi: add new schema file qapi-event.json, Luiz Capitulino, 2014/06/19
- Re: [Qemu-devel] [PULL for-2.1 00/40] QMP queue, Peter Maydell, 2014/06/20
- Re: [Qemu-devel] [PULL for-2.1 00/40] QMP queue, Luiz Capitulino, 2014/06/20
- Re: [Qemu-devel] [PULL for-2.1 00/40] QMP queue, Paolo Bonzini, 2014/06/20
- Re: [Qemu-devel] [PULL for-2.1 00/40] QMP queue, Paolo Bonzini, 2014/06/20
- Re: [Qemu-devel] [PULL for-2.1 00/40] QMP queue, Eric Blake, 2014/06/20
- Re: [Qemu-devel] [PULL for-2.1 00/40] QMP queue, Wenchao Xia, 2014/06/24
- Re: [Qemu-devel] [PULL for-2.1 00/40] QMP queue, Eric Blake, 2014/06/24