On Mon, Aug 1, 2011 at 3:23 PM, Anthony Liguori <aligu...@us.ibm.com> wrote: > While the front tx queue has no flow control, the backend tx queue uses a > polling function to determine when the front end can receive data. > > To convert this to the new queue model, we simply try to flush the backend tx > queue whenever we poll. We then return the remaining space in the queue as > the value of the polling function. > > Signed-off-by: Anthony Liguori <aligu...@us.ibm.com> > --- > qemu-char.c | 49 ++++++++++++++++++++++++++++++++++++++++--------- > qemu-char.h | 3 ++- > 2 files changed, 42 insertions(+), 10 deletions(-) > > diff --git a/qemu-char.c b/qemu-char.c > index 3f9b32c..2746652 100644 > --- a/qemu-char.c > +++ b/qemu-char.c > @@ -173,6 +173,11 @@ static size_t char_queue_read(CharQueue *q, void *data, > size_t size) > return i; > } > > +static uint32_t char_queue_get_avail(CharQueue *q) > +{ > + return sizeof(q->ring) - (q->prod - q->cons); > +}
"avail" confuses me. How many bytes are available for the consumer? How many bytes are available for the producer? How about char_queue_get_space() or char_queue_get_nfree()? Stefan