[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 05/10] vvfat: use public block layer interface
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PATCH 05/10] vvfat: use public block layer interface |
Date: |
Fri, 11 Nov 2011 16:47:17 +0000 |
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 <address@hidden>
---
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
[Qemu-devel] [PATCH 05/10] vvfat: use public block layer interface,
Stefan Hajnoczi <=
[Qemu-devel] [PATCH 08/10] cow: convert to .bdrv_co_is_allocated(), Stefan Hajnoczi, 2011/11/11
[Qemu-devel] [PATCH 06/10] vvfat: convert to .bdrv_co_is_allocated(), Stefan Hajnoczi, 2011/11/11
[Qemu-devel] [PATCH 09/10] block: drop .bdrv_is_allocated() interface, Stefan Hajnoczi, 2011/11/11
[Qemu-devel] [PATCH 04/10] block: convert qcow2, qcow2, and vmdk to .bdrv_co_is_allocated(), Stefan Hajnoczi, 2011/11/11
[Qemu-devel] [PATCH 07/10] vdi: convert to .bdrv_co_is_allocated(), Stefan Hajnoczi, 2011/11/11
[Qemu-devel] [PATCH 10/10] block: add bdrv_co_is_allocated() interface, Stefan Hajnoczi, 2011/11/11