[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 7/8] dataplane: add virtio-blk data plane cod
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [PATCH v2 7/8] dataplane: add virtio-blk data plane code |
Date: |
Tue, 20 Nov 2012 14:54:05 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Tue, Nov 20, 2012 at 03:04:53PM +0200, Michael S. Tsirkin wrote:
> On Tue, Nov 20, 2012 at 01:31:51PM +0100, Stefan Hajnoczi wrote:
> > +static void process_request(IOQueue *ioq, struct iovec iov[],
> > + unsigned int out_num, unsigned int in_num,
> > + unsigned int head)
> > +{
> > + /* Virtio block requests look like this: */
> > + struct virtio_blk_outhdr *outhdr; /* iov[0] */
> > + /* data[] ... */
> > + struct virtio_blk_inhdr *inhdr; /* iov[out_num + in_num - 1] */
> > +
> > + if (unlikely(out_num == 0 || in_num == 0 ||
> > + iov[0].iov_len != sizeof *outhdr ||
> > + iov[out_num + in_num - 1].iov_len != sizeof *inhdr)) {
> > + fprintf(stderr, "virtio-blk invalid request\n");
> > + exit(1);
> > + }
> > +
> > + outhdr = iov[0].iov_base;
> > + inhdr = iov[out_num + in_num - 1].iov_base;
> > +
>
> Rusty is trying to get rid of hard-coded layout assumptions,
> let's not add any more if we can help it.
Will try to abstract the iov arrays in the next version. Still not a
fan of doing this because it complicates the code for little gain.
Stefan