Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M0GGK-0003MQ-U6 for qemu-devel@nongnu.org; Sat, 02 May 2009 10:32:20 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M0GGJ-0003Li-Hg for qemu-devel@nongnu.org; Sat, 02 May 2009 10:32:20 -0400 Received: from [199.232.76.173] (port=49553 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M0GGJ-0003Le-7m for qemu-devel@nongnu.org; Sat, 02 May 2009 10:32:19 -0400 Received: from gelbbaer.kn-bremen.de ([78.46.108.116]:36958 helo=smtp.kn-bremen.de) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M0GGI-0001VD-S0 for qemu-devel@nongnu.org; Sat, 02 May 2009 10:32:19 -0400 From: Juergen Lock Date: Sat, 2 May 2009 16:30:45 +0200 Subject: Re: [Qemu-devel] PATCH: add missing (dummy) raw_aio_ioctl() for FreeBSD case Message-ID: <20090502143045.GA3948@triton.kn-bremen.de> References: <20090501193030.GA44740@triton.kn-bremen.de> <49FB55ED.7050005@codemonkey.ws> <20090501.141852.-1646077921.imp@bsdimp.com> <20090501211918.GA48123@triton.kn-bremen.de> <20090501215226.GA32559@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090501215226.GA32559@lst.de> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Christoph Hellwig Cc: qemu-devel@nongnu.org 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)