qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/1] Make qemu_peek_buffer loop until it gets it


From: Juan Quintela
Subject: Re: [Qemu-devel] [PATCH 1/1] Make qemu_peek_buffer loop until it gets it's data
Date: Fri, 21 Mar 2014 18:55:39 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

"Dr. David Alan Gilbert" <address@hidden> wrote:
> * Juan Quintela (address@hidden) wrote:
>> "Dr. David Alan Gilbert" <address@hidden> wrote:
>> >> > +    while (index >= f->buf_size) {
>> >> > +        int received = qemu_fill_buffer(f);
>> >> > +
>> >> > +        if (received <= 0) {
>> >> 
>> >> here, I don't know really what to do.  We just need one character, so
>> >> the 1st call to qemu_fill_buffer() gives it to us, or we are already on
>> >> problems.  i.e. no need of the while() loop.
>> >
>> > The problem is that peek_byte takes an offset, so while qemu_fill_buffer
>> > will get us a byte, we actually need it to get us all the bytes upto the
>> > offset, and that's not guaranteed from one call.
>> 
>> that is not a problem.
>> 
>> We never got a "hole" on the things that we ask for.  We ask for the
>> "next byte", or the "next bytes", so in qemu_peek_byte() we are
>> guaranteed (with current users) that we would only have to read a single
>> byte.
>> 
>> I.e. qemu_peek_{buffer,byte}(....,offset, size) means that we have
>> "already" peek until offset, and now we want size more bytes.
>
> Hmm ok, that is convenient but is neither documented or enforced;
> I'll rework my patch and at least document it, and possibly enforce it.

thanks very much to take the time to understand it and document it O;-)

Later, Juan.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]