public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>,
	virtualization@lists.linux-foundation.org,
	Anthony Liguori <anthony@codemonkey.ws>,
	kvm@vger.kernel.org, avi@redhat.com,
	Carsten Otte <cotte@de.ibm.com>
Subject: Re: [PATCH 1/3] virtio: find_vqs/del_vqs virtio operations
Date: Wed, 13 May 2009 10:18:34 +0300	[thread overview]
Message-ID: <20090513071834.GC31139@redhat.com> (raw)
In-Reply-To: <200905131047.09416.rusty@rustcorp.com.au>

On Wed, May 13, 2009 at 10:47:08AM +0930, Rusty Russell wrote:
> On Wed, 13 May 2009 01:03:30 am Michael S. Tsirkin wrote:
> > On Wed, May 13, 2009 at 12:00:02AM +0930, Rusty Russell wrote
> > > and perhaps consider
> > > varargs for the callbacks (or would that be too horrible at the
> > > implementation end?)
> > >
> > > Thanks,
> > > Rusty.
> >
> > Ugh ... I think it will be. And AFAIK gcc generates a lot of code
> > for varargs - not something we want to do in each interrupt handler.
> 
> Err, no I mean for find_vqs:  eg.
> 	(block device)
> 	err = vdev->config->find_vqs(vdev, 1, &vblk->vq, blk_done);
> 
> 	(net device)
> 	err = vdev->config->find_vqs(vdev, 3, vqs, skb_recv_done, skb_xmit_done, NULL);
> 
> A bit neater for for the single-queue case.
> 
> Cheers,
> Rusty.

Oh. I see. But it becomes messy now that we also need to pass in the
names, and we lose type safety.
Let's just add a helper function for the single vq case?

static inline struct virtqueue *virtio_find_vq(struct virtio_devide *vdev,
					       vq_callback_t *c, const char *n)
{
	vq_callback_t *callbacks[] = { c };
	const char *names[] = { n };
	struct virtqueue *vq;
	int err = vdev->config->find_vqs(vdev, 1, &vq, callbacks, names);
	if (err < 0)
		return ERR_PTR(err);
	return vq;
}


-- 
MST

  reply	other threads:[~2009-05-13  7:20 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1242080138.git.mst@redhat.com>
2009-05-11 22:19 ` [PATCH 1/3] virtio: find_vqs/del_vqs virtio operations Michael S. Tsirkin
2009-05-12  8:55   ` Christian Borntraeger
2009-05-12 14:30   ` Rusty Russell
2009-05-12 15:33     ` Michael S. Tsirkin
2009-05-13  1:17       ` Rusty Russell
2009-05-13  7:18         ` Michael S. Tsirkin [this message]
2009-05-13  7:26           ` Avi Kivity
2009-05-13 11:33           ` Rusty Russell
2009-05-11 22:19 ` [PATCH 2/3] virtio_pci: split up vp_interrupt Michael S. Tsirkin
2009-05-11 22:19 ` [PATCH 3/3] virtio_pci: optional MSI-X support Michael S. Tsirkin
     [not found] <cover.1241700929.git.mst@redhat.com>
2009-05-07 14:10 ` [PATCH 1/3] virtio: find_vqs/del_vqs virtio operations Michael S. Tsirkin
2009-05-08  7:07   ` Rusty Russell
2009-05-08 12:48     ` Michael S. Tsirkin
2009-05-10  4:07       ` Rusty Russell
2009-05-10  7:25         ` Michael S. Tsirkin
2009-05-12 13:03           ` Rusty Russell
2009-05-10 18:51         ` Christian Borntraeger

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=20090513071834.GC31139@redhat.com \
    --to=mst@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=avi@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cotte@de.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    --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