summaryrefslogtreecommitdiff
path: root/block-raw-posix.c
diff options
context:
space:
mode:
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-03-12 19:57:16 +0000
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-03-12 19:57:16 +0000
commiteda578e559879b1a6a85f924adf2942070ae7ec3 (patch)
treee2ed165dddbda7b7a1a543185ed4b86daa5a501f /block-raw-posix.c
parent04eeb8b6d68ed314746856c813ce6fa8bc1a95df (diff)
Drop internal bdrv_pread()/bdrv_pwrite() APIs (Avi Kivity)
Now that scsi generic no longer uses bdrv_pread() and bdrv_pwrite(), we can drop the corresponding internal APIs, which overlap bdrv_read()/bdrv_write() and, being byte oriented, are unnatural for a block device. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6824 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'block-raw-posix.c')
-rw-r--r--block-raw-posix.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/block-raw-posix.c b/block-raw-posix.c
index a2ac48a06..696128b80 100644
--- a/block-raw-posix.c
+++ b/block-raw-posix.c
@@ -358,6 +358,12 @@ static int raw_pread(BlockDriverState *bs, int64_t offset,
return raw_pread_aligned(bs, offset, buf, count) + sum;
}
+static int raw_read(BlockDriverState *bs, int64_t sector_num,
+ uint8_t *buf, int nb_sectors)
+{
+ return raw_pread(bs, sector_num * 512, buf, (uint64_t)nb_sectors * 512);
+}
+
/*
* offset and count are in bytes and possibly not aligned. For files opened
* with O_DIRECT, necessary alignments are ensured before calling
@@ -436,6 +442,12 @@ static int raw_pwrite(BlockDriverState *bs, int64_t offset,
return raw_pwrite_aligned(bs, offset, buf, count) + sum;
}
+static int raw_write(BlockDriverState *bs, int64_t sector_num,
+ const uint8_t *buf, int nb_sectors)
+{
+ return raw_pwrite(bs, sector_num * 512, buf, (uint64_t)nb_sectors * 512);
+}
+
#ifdef CONFIG_AIO
/***********************************************************/
/* Unix AIO using POSIX AIO */
@@ -843,8 +855,8 @@ BlockDriver bdrv_raw = {
.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,
};
@@ -1219,8 +1231,8 @@ BlockDriver bdrv_host_device = {
.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,
/* removable device support */