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