aboutsummaryrefslogtreecommitdiff
path: root/block-raw-win32.c
diff options
context:
space:
mode:
Diffstat (limited to 'block-raw-win32.c')
-rw-r--r--block-raw-win32.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/block-raw-win32.c b/block-raw-win32.c
index 6387b09593..8564a72762 100644
--- a/block-raw-win32.c
+++ b/block-raw-win32.c
@@ -122,13 +122,15 @@ static int raw_open(BlockDriverState *bs, const char *filename, int flags)
return 0;
}
-static int raw_pread(BlockDriverState *bs, int64_t offset,
- uint8_t *buf, int count)
+static int raw_read(BlockDriverState *bs, int64_t sector_num,
+ uint8_t *buf, int nb_sectors)
{
BDRVRawState *s = bs->opaque;
OVERLAPPED ov;
DWORD ret_count;
int ret;
+ int64_t offset = sector_num * 512;
+ int count = nb_sectors * 512;
memset(&ov, 0, sizeof(ov));
ov.Offset = offset;
@@ -146,13 +148,15 @@ static int raw_pread(BlockDriverState *bs, int64_t offset,
return ret_count;
}
-static int raw_pwrite(BlockDriverState *bs, int64_t offset,
- const uint8_t *buf, int count)
+static int raw_write(BlockDriverState *bs, int64_t sector_num,
+ const uint8_t *buf, int nb_sectors)
{
BDRVRawState *s = bs->opaque;
OVERLAPPED ov;
DWORD ret_count;
int ret;
+ int64_t offset = sector_num * 512;
+ int count = nb_sectors * 512;
memset(&ov, 0, sizeof(ov));
ov.Offset = offset;
@@ -359,8 +363,8 @@ BlockDriver bdrv_raw = {
.bdrv_aio_cancel = raw_aio_cancel,
.aiocb_size = sizeof(RawAIOCB);
#endif
- .bdrv_pread = raw_pread,
- .bdrv_pwrite = raw_pwrite,
+ .bdrv_read = raw_read,
+ .bdrv_write = raw_write,
.bdrv_truncate = raw_truncate,
.bdrv_getlength = raw_getlength,
};
@@ -508,7 +512,7 @@ BlockDriver bdrv_host_device = {
.bdrv_aio_cancel = raw_aio_cancel,
.aiocb_size = sizeof(RawAIOCB);
#endif
- .bdrv_pread = raw_pread,
- .bdrv_pwrite = raw_pwrite,
+ .bdrv_read = raw_read,
+ .bdrv_write = raw_write,
.bdrv_getlength = raw_getlength,
};