From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:38066) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwE6e-0001ed-5N for qemu-devel@nongnu.org; Fri, 18 Jan 2013 10:43:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TwE6Z-0001j7-55 for qemu-devel@nongnu.org; Fri, 18 Jan 2013 10:43:47 -0500 Received: from mout.web.de ([212.227.17.12]:53391) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwE6Y-0001iN-St for qemu-devel@nongnu.org; Fri, 18 Jan 2013 10:43:43 -0500 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Fri, 18 Jan 2013 16:43:35 +0100 Message-Id: <1358523815-24212-1-git-send-email-andreas.faerber@web.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PATCH for-1.4] block/raw-posix: Make hdev_aio_discard() available outside Linux List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Paolo Bonzini , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Stefan Hajnoczi Fixes the build on OpenBSD among others. Suggested-by: Kevin Wolf Signed-off-by: Andreas Färber Cc: Paolo Bonzini --- block/raw-posix.c | 26 +++++++++++++------------- 1 Datei geändert, 13 Zeilen hinzugefügt(+), 13 Zeilen entfernt(-) diff --git a/block/raw-posix.c b/block/raw-posix.c index 679fcc5..657af95 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -1371,19 +1371,6 @@ static BlockDriverAIOCB *hdev_aio_ioctl(BlockDriverState *bs, return thread_pool_submit_aio(aio_worker, acb, cb, opaque); } -static coroutine_fn BlockDriverAIOCB *hdev_aio_discard(BlockDriverState *bs, - int64_t sector_num, int nb_sectors, - BlockDriverCompletionFunc *cb, void *opaque) -{ - BDRVRawState *s = bs->opaque; - - if (fd_open(bs) < 0) { - return NULL; - } - return paio_submit(bs, s->fd, sector_num, NULL, nb_sectors, - cb, opaque, QEMU_AIO_DISCARD|QEMU_AIO_BLKDEV); -} - #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) static int fd_open(BlockDriverState *bs) { @@ -1403,6 +1390,19 @@ static int fd_open(BlockDriverState *bs) #endif /* !linux && !FreeBSD */ +static coroutine_fn BlockDriverAIOCB *hdev_aio_discard(BlockDriverState *bs, + int64_t sector_num, int nb_sectors, + BlockDriverCompletionFunc *cb, void *opaque) +{ + BDRVRawState *s = bs->opaque; + + if (fd_open(bs) < 0) { + return NULL; + } + return paio_submit(bs, s->fd, sector_num, NULL, nb_sectors, + cb, opaque, QEMU_AIO_DISCARD|QEMU_AIO_BLKDEV); +} + static int hdev_create(const char *filename, QEMUOptionParameter *options) { int fd; -- 1.7.10.4