From patchwork Fri Jan 18 15:43:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 213645 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 312D62C007C for ; Sat, 19 Jan 2013 02:44:06 +1100 (EST) Received: from localhost ([::1]:55216 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TwE6s-0001vx-64 for incoming@patchwork.ozlabs.org; Fri, 18 Jan 2013 10:44:02 -0500 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 Received: from envy.de ([195.135.221.2]) by smtp.web.de (mrweb101) with ESMTPSA (Nemesis) id 0Lo0V2-1TGZhB0wJM-00gQRH; Fri, 18 Jan 2013 16:43:37 +0100 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Fri, 18 Jan 2013 16:43:35 +0100 Message-Id: <1358523815-24212-1-git-send-email-andreas.faerber@web.de> X-Mailer: git-send-email 1.7.10.4 MIME-Version: 1.0 X-Provags-ID: V02:K0:IJVqfnr/NFjq07ZJB/1mdoY6QFTs0oTt5ecBAFpc6ZA Ge5dFCBIdeMbrjNhGmMRmF4g3AzfDJIuLzFG0/mZhVpzA+SVda qF/ATt/2AC+PXcxYgTkGkwvc+aePx8+JZjJZee9HYOa1EDcYEB yfJuvRoRDHlxLRuH2knsI869Uz0RGyfWLIvQI8s0+YwTlp9KD5 yTvpUZgJsvAG7MZiP6Hyw== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 212.227.17.12 Cc: Kevin Wolf , Paolo Bonzini , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Stefan Hajnoczi Subject: [Qemu-devel] [PATCH for-1.4] block/raw-posix: Make hdev_aio_discard() available outside Linux X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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;