From patchwork Sat Jun 23 23:06:54 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 166858 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 816F2B6F5B for ; Sun, 24 Jun 2012 11:54:25 +1000 (EST) Received: from localhost ([::1]:56754 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SiZTa-000367-UN for incoming@patchwork.ozlabs.org; Sat, 23 Jun 2012 19:10:46 -0400 Received: from eggs.gnu.org ([208.118.235.92]:38059) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SiZR4-0007g0-5M for qemu-devel@nongnu.org; Sat, 23 Jun 2012 19:08:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SiZR0-0002M8-4O for qemu-devel@nongnu.org; Sat, 23 Jun 2012 19:08:09 -0400 Received: from cantor2.suse.de ([195.135.220.15]:34863 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SiZQz-0002LI-QE; Sat, 23 Jun 2012 19:08:05 -0400 Received: from relay1.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 7E7EFA3A49; Sun, 24 Jun 2012 01:08:04 +0200 (CEST) From: Alexander Graf To: qemu-devel qemu-devel Date: Sun, 24 Jun 2012 01:06:54 +0200 Message-Id: <1340492856-21126-31-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.6.0.2 In-Reply-To: <1340492856-21126-1-git-send-email-agraf@suse.de> References: <1340492856-21126-1-git-send-email-agraf@suse.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-Received-From: 195.135.220.15 Cc: Blue Swirl , Kevin Wolf , qemu-ppc Mailing List , Aurelien Jarno Subject: [Qemu-devel] [PATCH 30/72] raw-posix: Fix build without is_allocated support 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 From: Kevin Wolf Move the declaration of s into the #ifdef sections that actually make use of it. Signed-off-by: Kevin Wolf Signed-off-by: Alexander Graf --- block/raw-posix.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/block/raw-posix.c b/block/raw-posix.c index bf7700a..0dce089 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -606,7 +606,6 @@ static int coroutine_fn raw_co_is_allocated(BlockDriverState *bs, int64_t sector_num, int nb_sectors, int *pnum) { - BDRVRawState *s = bs->opaque; off_t start, data, hole; int ret; @@ -616,11 +615,15 @@ static int coroutine_fn raw_co_is_allocated(BlockDriverState *bs, } start = sector_num * BDRV_SECTOR_SIZE; + #ifdef CONFIG_FIEMAP + + BDRVRawState *s = bs->opaque; struct { struct fiemap fm; struct fiemap_extent fe; } f; + f.fm.fm_start = start; f.fm.fm_length = (int64_t)nb_sectors * BDRV_SECTOR_SIZE; f.fm.fm_flags = 0; @@ -643,7 +646,11 @@ static int coroutine_fn raw_co_is_allocated(BlockDriverState *bs, data = f.fe.fe_logical; hole = f.fe.fe_logical + f.fe.fe_length; } + #elif defined SEEK_HOLE && defined SEEK_DATA + + BDRVRawState *s = bs->opaque; + hole = lseek(s->fd, start, SEEK_HOLE); if (hole == -1) { /* -ENXIO indicates that sector_num was past the end of the file.