qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Amit Shah <amit.shah@redhat.com>
To: Juan Quintela <quintela@trasno.org>
Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org,
	virtualization@lists.linux-foundation.org
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	[thread overview]
Message-ID: <20090904083749.GA22230@amit-x200.redhat.com> (raw)
In-Reply-To: <m3my5c6omr.fsf@neno.mitica>

On (Thu) Sep 03 2009 [17:20:44], Juan Quintela wrote:
> Amit Shah <amit.shah@redhat.com> 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

      parent reply	other threads:[~2009-09-04  8:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-03 12:53 [Qemu-devel] Multiple port support for virtio-console Amit Shah
2009-09-03 12:53 ` [Qemu-devel] [PATCH 1/1] virtio_console: Add interface for guest and host communication Amit Shah
2009-09-03 12:53   ` [Qemu-devel] [PATCH 1/2] char: Emit 'OPENED' events on char device open Amit Shah
2009-09-03 12:53     ` [Qemu-devel] [PATCH 2/2] virtio-console: Add interface for generic guest-host communication Amit Shah
     [not found]       ` <m3ab1c9l6p.fsf@neno.mitica>
2009-09-03 14:26         ` [Qemu-devel] " Amit Shah
2009-09-03 14:42           ` Amit Shah
     [not found]             ` <m3my5c6omr.fsf@neno.mitica>
2009-09-04  8:37               ` Amit Shah [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090904083749.GA22230@amit-x200.redhat.com \
    --to=amit.shah@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@trasno.org \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).