char: rename qemu_chr_can_read() -> qemu_chr_be_can_read()

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Anthony Liguori 2011-08-15 11:17:31 -05:00
parent fa5efccb2a
commit 909cda12b5
5 changed files with 15 additions and 15 deletions

View file

@ -1123,7 +1123,7 @@ static void kbd_send_chars(void *opaque)
int len; int len;
uint8_t buf[16]; uint8_t buf[16];
len = qemu_chr_can_read(s->chr); len = qemu_chr_be_can_write(s->chr);
if (len > s->out_fifo.count) if (len > s->out_fifo.count)
len = s->out_fifo.count; len = s->out_fifo.count;
if (len > 0) { if (len > 0) {

View file

@ -223,7 +223,7 @@ static void baum_accept_input(struct CharDriverState *chr)
if (!baum->out_buf_used) if (!baum->out_buf_used)
return; return;
room = qemu_chr_can_read(chr); room = qemu_chr_be_can_write(chr);
if (!room) if (!room)
return; return;
if (room > baum->out_buf_used) if (room > baum->out_buf_used)
@ -250,7 +250,7 @@ static void baum_write_packet(BaumDriverState *baum, const uint8_t *buf, int len
while (len--) while (len--)
if ((*cur++ = *buf++) == ESC) if ((*cur++ = *buf++) == ESC)
*cur++ = ESC; *cur++ = ESC;
room = qemu_chr_can_read(baum->chr); room = qemu_chr_be_can_write(baum->chr);
len = cur - io_buf; len = cur - io_buf;
if (len <= room) { if (len <= room) {
/* Fits */ /* Fits */

View file

@ -151,7 +151,7 @@ int qemu_chr_ioctl(CharDriverState *s, int cmd, void *arg)
return s->chr_ioctl(s, cmd, arg); return s->chr_ioctl(s, cmd, arg);
} }
int qemu_chr_can_read(CharDriverState *s) int qemu_chr_be_can_write(CharDriverState *s)
{ {
if (!s->chr_can_read) if (!s->chr_can_read)
return 0; return 0;
@ -565,7 +565,7 @@ static int fd_chr_read_poll(void *opaque)
CharDriverState *chr = opaque; CharDriverState *chr = opaque;
FDCharDriver *s = chr->opaque; FDCharDriver *s = chr->opaque;
s->max_size = qemu_chr_can_read(chr); s->max_size = qemu_chr_be_can_write(chr);
return s->max_size; return s->max_size;
} }
@ -699,7 +699,7 @@ static int stdio_read_poll(void *opaque)
CharDriverState *chr = opaque; CharDriverState *chr = opaque;
/* try to flush the queue if needed */ /* try to flush the queue if needed */
if (term_fifo_size != 0 && qemu_chr_can_read(chr) > 0) { if (term_fifo_size != 0 && qemu_chr_be_can_write(chr) > 0) {
qemu_chr_be_write(chr, term_fifo, 1); qemu_chr_be_write(chr, term_fifo, 1);
term_fifo_size = 0; term_fifo_size = 0;
} }
@ -724,7 +724,7 @@ static void stdio_read(void *opaque)
return; return;
} }
if (size > 0) { if (size > 0) {
if (qemu_chr_can_read(chr) > 0) { if (qemu_chr_be_can_write(chr) > 0) {
qemu_chr_be_write(chr, buf, 1); qemu_chr_be_write(chr, buf, 1);
} else if (term_fifo_size == 0) { } else if (term_fifo_size == 0) {
term_fifo[term_fifo_size++] = buf[0]; term_fifo[term_fifo_size++] = buf[0];
@ -890,7 +890,7 @@ static int pty_chr_read_poll(void *opaque)
CharDriverState *chr = opaque; CharDriverState *chr = opaque;
PtyCharDriver *s = chr->opaque; PtyCharDriver *s = chr->opaque;
s->read_bytes = qemu_chr_can_read(chr); s->read_bytes = qemu_chr_be_can_write(chr);
return s->read_bytes; return s->read_bytes;
} }
@ -1602,7 +1602,7 @@ static int win_chr_read_poll(CharDriverState *chr)
{ {
WinCharState *s = chr->opaque; WinCharState *s = chr->opaque;
s->max_size = qemu_chr_can_read(chr); s->max_size = qemu_chr_be_can_write(chr);
return s->max_size; return s->max_size;
} }
@ -1840,7 +1840,7 @@ static int udp_chr_read_poll(void *opaque)
CharDriverState *chr = opaque; CharDriverState *chr = opaque;
NetCharDriver *s = chr->opaque; NetCharDriver *s = chr->opaque;
s->max_size = qemu_chr_can_read(chr); s->max_size = qemu_chr_be_can_write(chr);
/* If there were any stray characters in the queue process them /* If there were any stray characters in the queue process them
* first * first
@ -1848,7 +1848,7 @@ static int udp_chr_read_poll(void *opaque)
while (s->max_size > 0 && s->bufptr < s->bufcnt) { while (s->max_size > 0 && s->bufptr < s->bufcnt) {
qemu_chr_be_write(chr, &s->buf[s->bufptr], 1); qemu_chr_be_write(chr, &s->buf[s->bufptr], 1);
s->bufptr++; s->bufptr++;
s->max_size = qemu_chr_can_read(chr); s->max_size = qemu_chr_be_can_write(chr);
} }
return s->max_size; return s->max_size;
} }
@ -1869,7 +1869,7 @@ static void udp_chr_read(void *opaque)
while (s->max_size > 0 && s->bufptr < s->bufcnt) { while (s->max_size > 0 && s->bufptr < s->bufcnt) {
qemu_chr_be_write(chr, &s->buf[s->bufptr], 1); qemu_chr_be_write(chr, &s->buf[s->bufptr], 1);
s->bufptr++; s->bufptr++;
s->max_size = qemu_chr_can_read(chr); s->max_size = qemu_chr_be_can_write(chr);
} }
} }
@ -1963,7 +1963,7 @@ static int tcp_chr_read_poll(void *opaque)
TCPCharDriver *s = chr->opaque; TCPCharDriver *s = chr->opaque;
if (!s->connected) if (!s->connected)
return 0; return 0;
s->max_size = qemu_chr_can_read(chr); s->max_size = qemu_chr_be_can_write(chr);
return s->max_size; return s->max_size;
} }

View file

@ -96,7 +96,7 @@ void qemu_chr_add_handlers(CharDriverState *s,
void *opaque); void *opaque);
int qemu_chr_ioctl(CharDriverState *s, int cmd, void *arg); int qemu_chr_ioctl(CharDriverState *s, int cmd, void *arg);
void qemu_chr_generic_open(CharDriverState *s); void qemu_chr_generic_open(CharDriverState *s);
int qemu_chr_can_read(CharDriverState *s); int qemu_chr_be_can_write(CharDriverState *s);
void qemu_chr_be_write(CharDriverState *s, uint8_t *buf, int len); void qemu_chr_be_write(CharDriverState *s, uint8_t *buf, int len);
int qemu_chr_get_msgfd(CharDriverState *s); int qemu_chr_get_msgfd(CharDriverState *s);
void qemu_chr_accept_input(CharDriverState *s); void qemu_chr_accept_input(CharDriverState *s);

View file

@ -36,7 +36,7 @@ static int vmc_write(SpiceCharDeviceInstance *sin, const uint8_t *buf, int len)
while (len > 0) { while (len > 0) {
last_out = MIN(len, VMC_MAX_HOST_WRITE); last_out = MIN(len, VMC_MAX_HOST_WRITE);
if (qemu_chr_can_read(scd->chr) < last_out) { if (qemu_chr_be_can_write(scd->chr) < last_out) {
break; break;
} }
qemu_chr_be_write(scd->chr, p, last_out); qemu_chr_be_write(scd->chr, p, last_out);