Received: from eggs.gnu.org ([140.186.70.92]:54199) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ROuGQ-0007hL-9m for qemu-devel@nongnu.org; Fri, 11 Nov 2011 11:47:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ROuGN-0000ou-Uy for qemu-devel@nongnu.org; Fri, 11 Nov 2011 11:47:38 -0500 Received: from mtagate2.uk.ibm.com ([194.196.100.162]:39074) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ROuGN-0000ob-Ni for qemu-devel@nongnu.org; Fri, 11 Nov 2011 11:47:35 -0500 Received: from d06nrmr1507.portsmouth.uk.ibm.com (d06nrmr1507.portsmouth.uk.ibm.com [9.149.38.233]) by mtagate2.uk.ibm.com (8.13.1/8.13.1) with ESMTP id pABGlZej017494 for ; Fri, 11 Nov 2011 16:47:35 GMT Received: from d06av02.portsmouth.uk.ibm.com (d06av02.portsmouth.uk.ibm.com [9.149.37.228]) by d06nrmr1507.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id pABGlYDD2363546 for ; Fri, 11 Nov 2011 16:47:34 GMT Received: from d06av02.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av02.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id pABGlYIL007901 for ; Fri, 11 Nov 2011 09:47:34 -0700 From: Stefan Hajnoczi Date: Fri, 11 Nov 2011 16:47:17 +0000 Message-Id: <1321030042-20446-6-git-send-email-stefanha@linux.vnet.ibm.com> In-Reply-To: <1321030042-20446-1-git-send-email-stefanha@linux.vnet.ibm.com> References: <1321030042-20446-1-git-send-email-stefanha@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 05/10] vvfat: use public block layer interface List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Paolo Bonzini , Marcelo Tosatti , Stefan Hajnoczi For some reason vvfat.c invokes BlockDriver functions directly and does not go through block.h functions. Change all direct calls except for the .bdrv_make_empty() call for which there is no public interface. This change makes the conversion to .bdrv_co_is_allocated() possible. Signed-off-by: Stefan Hajnoczi --- block/vvfat.c | 15 ++++++--------- 1 files changed, 6 insertions(+), 9 deletions(-) diff --git a/block/vvfat.c b/block/vvfat.c index 8511fe5..ce8049f 100644 --- a/block/vvfat.c +++ b/block/vvfat.c @@ -1254,10 +1254,9 @@ static int vvfat_read(BlockDriverState *bs, int64_t sector_num, return -1; if (s->qcow) { int n; - if (s->qcow->drv->bdrv_is_allocated(s->qcow, - sector_num, nb_sectors-i, &n)) { + if (bdrv_is_allocated(s->qcow, sector_num, nb_sectors-i, &n)) { DLOG(fprintf(stderr, "sectors %d+%d allocated\n", (int)sector_num, n)); - if (s->qcow->drv->bdrv_read(s->qcow, sector_num, buf+i*0x200, n)) + if (bdrv_read(s->qcow, sector_num, buf+i*0x200, n)) return -1; i += n - 1; sector_num += n - 1; @@ -1516,7 +1515,7 @@ static inline int cluster_was_modified(BDRVVVFATState* s, uint32_t cluster_num) return 0; for (i = 0; !was_modified && i < s->sectors_per_cluster; i++) - was_modified = s->qcow->drv->bdrv_is_allocated(s->qcow, + was_modified = bdrv_is_allocated(s->qcow, cluster2sector(s, cluster_num) + i, 1, &dummy); return was_modified; @@ -1666,13 +1665,11 @@ static uint32_t get_cluster_count_for_direntry(BDRVVVFATState* s, vvfat_close_current_file(s); for (i = 0; i < s->sectors_per_cluster; i++) - if (!s->qcow->drv->bdrv_is_allocated(s->qcow, - offset + i, 1, &dummy)) { + if (!bdrv_is_allocated(s->qcow, offset + i, 1, &dummy)) { if (vvfat_read(s->bs, offset, s->cluster_buffer, 1)) return -1; - if (s->qcow->drv->bdrv_write(s->qcow, - offset, s->cluster_buffer, 1)) + if (bdrv_write(s->qcow, offset, s->cluster_buffer, 1)) return -2; } } @@ -2714,7 +2711,7 @@ DLOG(checkpoint()); * Use qcow backend. Commit later. */ DLOG(fprintf(stderr, "Write to qcow backend: %d + %d\n", (int)sector_num, nb_sectors)); - ret = s->qcow->drv->bdrv_write(s->qcow, sector_num, buf, nb_sectors); + ret = bdrv_write(s->qcow, sector_num, buf, nb_sectors); if (ret < 0) { fprintf(stderr, "Error writing to qcow backend\n"); return ret; -- 1.7.7.1