[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: |
Christoph Hellwig |
Subject: |
Re: [Qemu-devel] PATCH: add missing (dummy) raw_aio_ioctl() for FreeBSD case |
Date: |
Sat, 2 May 2009 20:01:55 +0200 |
User-agent: |
Mutt/1.3.28i |
On Sat, May 02, 2009 at 04:30:45PM +0200, Juergen Lock wrote:
>
> 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
Shouldn't we just make these implementations totally unconditional
(bdrv_ioctl) or conditional on CONFIG_AIO only (bdrv_aio_ioctl)?
I can't think of any Posix-ish operating system that wouldn't provide
the ioctl system call.