From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M0JXH-00060W-DO for qemu-devel@nongnu.org; Sat, 02 May 2009 14:02:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M0JXC-000607-Gu for qemu-devel@nongnu.org; Sat, 02 May 2009 14:02:03 -0400 Received: from [199.232.76.173] (port=34134 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M0JXC-000604-DJ for qemu-devel@nongnu.org; Sat, 02 May 2009 14:01:58 -0400 Received: from verein.lst.de ([213.95.11.210]:43083) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA1:24) (Exim 4.60) (envelope-from ) id 1M0JXB-0000X7-MW for qemu-devel@nongnu.org; Sat, 02 May 2009 14:01:58 -0400 Date: Sat, 2 May 2009 20:01:55 +0200 From: Christoph Hellwig Subject: Re: [Qemu-devel] PATCH: add missing (dummy) raw_aio_ioctl() for FreeBSD case Message-ID: <20090502180155.GA11046@lst.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> <20090502143045.GA3948@triton.kn-bremen.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090502143045.GA3948@triton.kn-bremen.de> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Juergen Lock Cc: Christoph Hellwig , qemu-devel@nongnu.org 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.