[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] PATCH: add missing (dummy) raw_aio_ioctl() for FreeBSD
From: |
Juergen Lock |
Subject: |
Re: [Qemu-devel] PATCH: add missing (dummy) raw_aio_ioctl() for FreeBSD case |
Date: |
Sat, 2 May 2009 16:30:45 +0200 |
User-agent: |
Mutt/1.5.19 (2009-01-05) |
On Fri, May 01, 2009 at 11:52:26PM +0200, Christoph Hellwig wrote:
> On Fri, May 01, 2009 at 11:19:18PM +0200, Juergen Lock wrote:
> > Oh, we are using aio afaict, at least configure says
> > ...
> > AIO support yes
> > ...
> > - but isn't this raw_aio_ioctl() only used for SG_IO i.e. scsi passthru?
> > (which isn't implemented for FreeBSD yet because doing direct scsi
> > commands from userland works differently there than on linux.)
> >
> > Or am I confused? :)
>
> You're not. Currently aio_ioctl is only used for SG_IO. But I don't
> think wiring up for freebsd would hurt. The actual posix-aio-compat.c
> code for it is compiled on freebsd anyway, so hooking it up is easy,
> and you're prepared if other users pop up.
Alright I can do that too... Tho in that case I'd say raw_ioctl() needs
to be hooked up too:
Index: qemu/block-raw-posix.c
@@ -1321,8 +1321,44 @@
static int raw_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
{
- return -ENOTSUP;
+ BDRVRawState *s = bs->opaque;
+
+ return ioctl(s->fd, req, buf);
+}
+
+#ifdef CONFIG_AIO
+static BlockDriverAIOCB *raw_aio_ioctl(BlockDriverState *bs,
+ unsigned long int req, void *buf,
+ BlockDriverCompletionFunc *cb, void *opaque)
+{
+ BDRVRawState *s = bs->opaque;
+ RawAIOCB *acb;
+
+ if (fd_open(bs) < 0)
+ return NULL;
+
+ acb = qemu_aio_get(bs, cb, opaque);
+ if (!acb)
+ return NULL;
+ acb->aiocb.aio_fildes = s->fd;
+ acb->aiocb.ev_signo = SIGUSR2;
+ acb->aiocb.aio_offset = 0;
+ acb->aiocb.aio_flags = 0;
+
+ acb->next = posix_aio_state->first_aio;
+ posix_aio_state->first_aio = acb;
+
+ acb->aiocb.aio_ioctl_buf = buf;
+ acb->aiocb.aio_ioctl_cmd = req;
+ if (qemu_paio_ioctl(&acb->aiocb) < 0) {
+ raw_aio_remove(acb);
+ return NULL;
+ }
+
+ return &acb->common;
}
+#endif
+
#else /* !linux && !FreeBSD */
static int fd_open(BlockDriverState *bs)