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: Gerd Hoffmann
Subject: Re: [Qemu-devel] [PATCH RFC] ps2: set the keybord output buffer size as the same as kernel
Date: Wed, 23 Apr 2014 15:37:36 +0200

  Hi,

>     /* the new version id for this patch */
>     if (version_id == 4) {
>         return 0;
>     }

I don't think we need a new version.

>     /* 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.

>     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.

cheers,
  Gerd





reply via email to

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