[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Re: [PATCH 2/2] virtio-console: Add interface for generic g
From: |
Amit Shah |
Subject: |
[Qemu-devel] Re: [PATCH 2/2] virtio-console: Add interface for generic guest-host communication |
Date: |
Fri, 4 Sep 2009 14:07:49 +0530 |
User-agent: |
Mutt/1.5.19 (2009-01-05) |
On (Thu) Sep 03 2009 [17:20:44], Juan Quintela wrote:
> Amit Shah <address@hidden> wrote:
>
> Hi
>
> >> > > +static void virtio_console_set_port_active(uint32_t idx)
> >> > > +{
> >> > > + int i = 0;
> >> > > +
> >> > > + while (idx / 32) {
> >> > > + i++;
> >> > > + idx -= 32;
> >> > > + }
> >> >
> >> > It is just me, or you are doing a division + modulus in a very strange
> >> > way?
> >> >
> >> > i = idx / 32;
> >> > idx = idx % 32;
> >> >
> >> > ???
> >
> > Er, sorry I left this out.
> >
> > That won't work for MAX_PORTS > 32.
>
> Why not?
After a good night's sleep, I see that I was wrong :-)
You're right and I don't remember why I did it this way instead of just
using % from the start. Maybe I had a different way of storing it back
then; it's been a long time.
I also saw that I was wrong about the casts:
> > > +/* Readiness of the guest to accept data on a port */
> > > +static int vcon_can_read(void *opaque)
> > > +{
> > > + VirtIOConsolePort *port = (VirtIOConsolePort *) opaque;
> >
> > Cast is not needed here.
> This is original code that I've not modified (just moved around).
> But you're right; I could do that in this patch itself.
These were indeed introduced by me (and are now corrected).
Thanks!
Amit
- [Qemu-devel] Multiple Port Support for virtio-console, Amit Shah, 2009/09/09
- [Qemu-devel] [PATCH] virtio_console: Add support for multiple ports for generic guest and host communication, Amit Shah, 2009/09/09
- [Qemu-devel] [PATCH 1/5] char: Emit 'OPENED' events on char device open, Amit Shah, 2009/09/09
- [Qemu-devel] [PATCH 2/5] virtio-console: Add support for multiple ports for generic guest-host communication, Amit Shah, 2009/09/09
- [Qemu-devel] [PATCH 3/5] virtio-console: in-qemu api for open/read/write/close ports, Amit Shah, 2009/09/09
- [Qemu-devel] [PATCH 4/5] vnc: add a is_vnc_active() helper, Amit Shah, 2009/09/09
- [Qemu-devel] [PATCH 5/5] vnc: Send / receive guest clipboard if virtio-console connected to clipboard port, Amit Shah, 2009/09/09
[Qemu-devel] Re: Multiple Port Support for virtio-console, Amit Shah, 2009/09/10
[Qemu-devel] Multiple port support for virtio-console, Amit Shah, 2009/09/22