aboutsummaryrefslogtreecommitdiff
path: root/block/raw.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2011-10-17 12:32:14 +0200
committerKevin Wolf <kwolf@redhat.com>2011-10-21 17:34:13 +0200
commit4265d620c5a91b58c757ce76fa2b0fff86fa1df1 (patch)
treeda029b3d1ffbdec9bfafacee4cb22a746b8a7f34 /block/raw.c
parent6f6dc6565e2b65ec8c0cf47622b4f5f1468d194e (diff)
downloadqemu-4265d620c5a91b58c757ce76fa2b0fff86fa1df1.zip
qemu-4265d620c5a91b58c757ce76fa2b0fff86fa1df1.tar.gz
qemu-4265d620c5a91b58c757ce76fa2b0fff86fa1df1.tar.bz2
block: add bdrv_co_discard and bdrv_aio_discard support
This similarly adds support for coroutine and asynchronous discard. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/raw.c')
-rw-r--r--block/raw.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/block/raw.c b/block/raw.c
index 39a3a9a..33cc471 100644
--- a/block/raw.c
+++ b/block/raw.c
@@ -45,9 +45,10 @@ static int raw_probe(const uint8_t *buf, int buf_size, const char *filename)
return 1; /* everything can be opened as raw image */
}
-static int raw_discard(BlockDriverState *bs, int64_t sector_num, int nb_sectors)
+static int coroutine_fn raw_co_discard(BlockDriverState *bs,
+ int64_t sector_num, int nb_sectors)
{
- return bdrv_discard(bs->file, sector_num, nb_sectors);
+ return bdrv_co_discard(bs->file, sector_num, nb_sectors);
}
static int raw_is_inserted(BlockDriverState *bs)
@@ -109,15 +110,16 @@ static BlockDriver bdrv_raw = {
.bdrv_open = raw_open,
.bdrv_close = raw_close,
+
.bdrv_co_readv = raw_co_readv,
.bdrv_co_writev = raw_co_writev,
.bdrv_co_flush = raw_co_flush,
+ .bdrv_co_discard = raw_co_discard,
+
.bdrv_probe = raw_probe,
.bdrv_getlength = raw_getlength,
.bdrv_truncate = raw_truncate,
- .bdrv_discard = raw_discard,
-
.bdrv_is_inserted = raw_is_inserted,
.bdrv_media_changed = raw_media_changed,
.bdrv_eject = raw_eject,