qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH RFC] ps2: set the keybord output buffer size as


From: Gonglei (Arei)
Subject: Re: [Qemu-devel] [PATCH RFC] ps2: set the keybord output buffer size as the same as kernel
Date: Wed, 23 Apr 2014 13:50:33 +0000

> 
>   Hi,
> 
> >     /* the new version id for this patch */
> >     if (version_id == 4) {
> >         return 0;
> >     }
> 
> I don't think we need a new version.
> 
OK.

> >     /* set the useful data buffer queue size, < PS2_QUEUE_SIZE */
> >     size = MIN(q->count, PS2_QUEUE_SIZE);
> 
> I'd rather do "size = q->count > PS2_QUEUE_SIZE ? 0 : q->count;"
> i.e. if it doesn't fit better throw away everything, which reduces the
> chance that we'll deliver a incomplete message to the guest.
> 
Sounds good, Thanks, Gerd.

> >     for (i = 0; i < size; i++) {
> >         /* move the queue elements to the start of data array */
> >         q->data[i] = q->data[q->rptr];
> >         if (++q->rptr == 256) {
> >             q->rptr = 0;
> >         }
> >     }
> 
> That fails for the wraparound (rptr > wptr) case.
> 
Yep, it should use a temporary data array to transfer, which I have written
in the previous email.


Best regards,
-Gonglei

reply via email to

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