[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC v2 04/15] Convert .bdrv_open and .bdrv_file_open to co
From: |
Charlie Shepherd |
Subject: |
[Qemu-devel] [RFC v2 04/15] Convert .bdrv_open and .bdrv_file_open to coroutine_fn |
Date: |
Fri, 9 Aug 2013 19:43:54 +0200 |
Signed-off-by: Charlie Shepherd <address@hidden>
---
block.c | 8 ++++----
block/blkdebug.c | 4 ++--
block/blkverify.c | 4 ++--
block/bochs.c | 4 ++--
block/cloop.c | 4 ++--
block/cow.c | 4 ++--
block/curl.c | 12 ++++++------
block/dmg.c | 4 ++--
block/nbd.c | 6 +++---
block/parallels.c | 4 ++--
block/qcow.c | 4 ++--
block/qcow2.c | 2 +-
block/qed.c | 4 ++--
block/raw-posix.c | 20 ++++++++++----------
block/raw.c | 4 ++--
block/sheepdog.c | 10 +++++-----
block/ssh.c | 4 ++--
block/vdi.c | 4 ++--
block/vhdx.c | 4 ++--
block/vmdk.c | 4 ++--
block/vpc.c | 4 ++--
block/vvfat.c | 6 +++---
include/block/block_int.h | 4 ++--
23 files changed, 64 insertions(+), 64 deletions(-)
diff --git a/block.c b/block.c
index 40f73ee..75a1e6b 100644
--- a/block.c
+++ b/block.c
@@ -699,7 +699,7 @@ static int bdrv_open_common(BlockDriverState *bs,
BlockDriverState *file,
/* bdrv_open() with directly using a protocol as drv. This layer is already
* opened, so assign it to bs (while file becomes a closed
BlockDriverState)
* and return immediately. */
- if (file != NULL && drv->bdrv_file_open) {
+ if (file != NULL && drv->bdrv_co_file_open) {
bdrv_swap(file, bs);
return 0;
}
@@ -730,10 +730,10 @@ static int bdrv_open_common(BlockDriverState *bs,
BlockDriverState *file,
bs->enable_write_cache = !!(flags & BDRV_O_CACHE_WB);
/* Open the image, either directly or using a protocol */
- if (drv->bdrv_file_open) {
+ if (drv->bdrv_co_file_open) {
assert(file == NULL);
assert(drv->bdrv_parse_filename || filename != NULL);
- ret = drv->bdrv_file_open(bs, options, open_flags);
+ ret = drv->bdrv_co_file_open(bs, options, open_flags);
} else {
if (file == NULL) {
qerror_report(ERROR_CLASS_GENERIC_ERROR, "Can't use '%s' as a "
@@ -744,7 +744,7 @@ static int bdrv_open_common(BlockDriverState *bs,
BlockDriverState *file,
}
assert(file != NULL);
bs->file = file;
- ret = drv->bdrv_open(bs, options, open_flags);
+ ret = drv->bdrv_co_open(bs, options, open_flags);
}
if (ret < 0) {
diff --git a/block/blkdebug.c b/block/blkdebug.c
index ccb627a..7e022e4 100644
--- a/block/blkdebug.c
+++ b/block/blkdebug.c
@@ -349,7 +349,7 @@ static QemuOptsList runtime_opts = {
},
};
-static int blkdebug_open(BlockDriverState *bs, QDict *options, int flags)
+static int coroutine_fn blkdebug_open(BlockDriverState *bs, QDict *options,
int flags)
{
BDRVBlkdebugState *s = bs->opaque;
QemuOpts *opts;
@@ -626,7 +626,7 @@ static BlockDriver bdrv_blkdebug = {
.instance_size = sizeof(BDRVBlkdebugState),
.bdrv_parse_filename = blkdebug_parse_filename,
- .bdrv_file_open = blkdebug_open,
+ .bdrv_co_file_open = blkdebug_open,
.bdrv_close = blkdebug_close,
.bdrv_getlength = blkdebug_getlength,
diff --git a/block/blkverify.c b/block/blkverify.c
index 1d58cc3..0b89cfe 100644
--- a/block/blkverify.c
+++ b/block/blkverify.c
@@ -116,7 +116,7 @@ static QemuOptsList runtime_opts = {
},
};
-static int blkverify_open(BlockDriverState *bs, QDict *options, int flags)
+static int coroutine_fn blkverify_co_open(BlockDriverState *bs, QDict
*options, int flags)
{
BDRVBlkverifyState *s = bs->opaque;
QemuOpts *opts;
@@ -405,7 +405,7 @@ static BlockDriver bdrv_blkverify = {
.instance_size = sizeof(BDRVBlkverifyState),
.bdrv_parse_filename = blkverify_parse_filename,
- .bdrv_file_open = blkverify_open,
+ .bdrv_co_file_open = blkverify_co_open,
.bdrv_close = blkverify_close,
.bdrv_getlength = blkverify_getlength,
diff --git a/block/bochs.c b/block/bochs.c
index d7078c0..aab9028 100644
--- a/block/bochs.c
+++ b/block/bochs.c
@@ -108,7 +108,7 @@ static int bochs_probe(const uint8_t *buf, int buf_size,
const char *filename)
return 0;
}
-static int bochs_open(BlockDriverState *bs, QDict *options, int flags)
+static int coroutine_fn bochs_open(BlockDriverState *bs, QDict *options, int
flags)
{
BDRVBochsState *s = bs->opaque;
int i;
@@ -238,8 +238,8 @@ static BlockDriver bdrv_bochs = {
.format_name = "bochs",
.instance_size = sizeof(BDRVBochsState),
.bdrv_probe = bochs_probe,
- .bdrv_open = bochs_open,
.bdrv_read = bochs_co_read,
+ .bdrv_co_open = bochs_open,
.bdrv_close = bochs_close,
};
diff --git a/block/cloop.c b/block/cloop.c
index 6ea7cf4..b7c1551 100644
--- a/block/cloop.c
+++ b/block/cloop.c
@@ -53,7 +53,7 @@ static int cloop_probe(const uint8_t *buf, int buf_size,
const char *filename)
return 0;
}
-static int cloop_open(BlockDriverState *bs, QDict *options, int flags)
+static int coroutine_fn cloop_open(BlockDriverState *bs, QDict *options, int
flags)
{
BDRVCloopState *s = bs->opaque;
uint32_t offsets_size, max_compressed_block_size = 1, i;
@@ -191,8 +191,8 @@ static BlockDriver bdrv_cloop = {
.format_name = "cloop",
.instance_size = sizeof(BDRVCloopState),
.bdrv_probe = cloop_probe,
- .bdrv_open = cloop_open,
.bdrv_read = cloop_co_read,
+ .bdrv_co_open = cloop_open,
.bdrv_close = cloop_close,
};
diff --git a/block/cow.c b/block/cow.c
index 34c181a..e2a1550 100644
--- a/block/cow.c
+++ b/block/cow.c
@@ -58,7 +58,7 @@ static int cow_probe(const uint8_t *buf, int buf_size, const
char *filename)
return 0;
}
-static int cow_open(BlockDriverState *bs, QDict *options, int flags)
+static int coroutine_fn cow_co_open(BlockDriverState *bs, QDict *options, int
flags)
{
BDRVCowState *s = bs->opaque;
struct cow_header_v2 cow_header;
@@ -337,7 +337,7 @@ static BlockDriver bdrv_cow = {
.instance_size = sizeof(BDRVCowState),
.bdrv_probe = cow_probe,
- .bdrv_open = cow_open,
+ .bdrv_co_open = cow_co_open,
.bdrv_close = cow_close,
.bdrv_co_create = cow_co_create,
.bdrv_has_zero_init = bdrv_has_zero_init_1,
diff --git a/block/curl.c b/block/curl.c
index 82d39ff..8b01840 100644
--- a/block/curl.c
+++ b/block/curl.c
@@ -397,7 +397,7 @@ static QemuOptsList runtime_opts = {
},
};
-static int curl_open(BlockDriverState *bs, QDict *options, int flags)
+static int coroutine_fn curl_co_open(BlockDriverState *bs, QDict *options, int
flags)
{
BDRVCURLState *s = bs->opaque;
CURLState *state = NULL;
@@ -634,7 +634,7 @@ static BlockDriver bdrv_http = {
.instance_size = sizeof(BDRVCURLState),
.bdrv_parse_filename = curl_parse_filename,
- .bdrv_file_open = curl_open,
+ .bdrv_co_file_open = curl_co_open,
.bdrv_close = curl_close,
.bdrv_getlength = curl_getlength,
@@ -647,7 +647,7 @@ static BlockDriver bdrv_https = {
.instance_size = sizeof(BDRVCURLState),
.bdrv_parse_filename = curl_parse_filename,
- .bdrv_file_open = curl_open,
+ .bdrv_co_file_open = curl_co_open,
.bdrv_close = curl_close,
.bdrv_getlength = curl_getlength,
@@ -660,7 +660,7 @@ static BlockDriver bdrv_ftp = {
.instance_size = sizeof(BDRVCURLState),
.bdrv_parse_filename = curl_parse_filename,
- .bdrv_file_open = curl_open,
+ .bdrv_co_file_open = curl_co_open,
.bdrv_close = curl_close,
.bdrv_getlength = curl_getlength,
@@ -673,7 +673,7 @@ static BlockDriver bdrv_ftps = {
.instance_size = sizeof(BDRVCURLState),
.bdrv_parse_filename = curl_parse_filename,
- .bdrv_file_open = curl_open,
+ .bdrv_co_file_open = curl_co_open,
.bdrv_close = curl_close,
.bdrv_getlength = curl_getlength,
@@ -686,7 +686,7 @@ static BlockDriver bdrv_tftp = {
.instance_size = sizeof(BDRVCURLState),
.bdrv_parse_filename = curl_parse_filename,
- .bdrv_file_open = curl_open,
+ .bdrv_co_file_open = curl_co_open,
.bdrv_close = curl_close,
.bdrv_getlength = curl_getlength,
diff --git a/block/dmg.c b/block/dmg.c
index 3141cb5..745703f 100644
--- a/block/dmg.c
+++ b/block/dmg.c
@@ -92,7 +92,7 @@ static int read_uint32(BlockDriverState *bs, int64_t offset,
uint32_t *result)
return 0;
}
-static int dmg_open(BlockDriverState *bs, QDict *options, int flags)
+static int coroutine_fn dmg_co_open(BlockDriverState *bs, QDict *options, int
flags)
{
BDRVDMGState *s = bs->opaque;
uint64_t info_begin,info_end,last_in_offset,last_out_offset;
@@ -378,8 +378,8 @@ static BlockDriver bdrv_dmg = {
.format_name = "dmg",
.instance_size = sizeof(BDRVDMGState),
.bdrv_probe = dmg_probe,
- .bdrv_open = dmg_open,
.bdrv_read = dmg_co_read,
+ .bdrv_co_open = dmg_co_open,
.bdrv_close = dmg_close,
};
diff --git a/block/nbd.c b/block/nbd.c
index 9c480b8..a0e3562 100644
--- a/block/nbd.c
+++ b/block/nbd.c
@@ -653,7 +653,7 @@ static BlockDriver bdrv_nbd = {
.protocol_name = "nbd",
.instance_size = sizeof(BDRVNBDState),
.bdrv_parse_filename = nbd_parse_filename,
- .bdrv_file_open = nbd_open,
+ .bdrv_co_file_open = nbd_co_open,
.bdrv_co_readv = nbd_co_readv,
.bdrv_co_writev = nbd_co_writev,
.bdrv_close = nbd_close,
@@ -667,7 +667,7 @@ static BlockDriver bdrv_nbd_tcp = {
.protocol_name = "nbd+tcp",
.instance_size = sizeof(BDRVNBDState),
.bdrv_parse_filename = nbd_parse_filename,
- .bdrv_file_open = nbd_open,
+ .bdrv_co_file_open = nbd_co_open,
.bdrv_co_readv = nbd_co_readv,
.bdrv_co_writev = nbd_co_writev,
.bdrv_close = nbd_close,
@@ -681,7 +681,7 @@ static BlockDriver bdrv_nbd_unix = {
.protocol_name = "nbd+unix",
.instance_size = sizeof(BDRVNBDState),
.bdrv_parse_filename = nbd_parse_filename,
- .bdrv_file_open = nbd_open,
+ .bdrv_co_file_open = nbd_co_open,
.bdrv_co_readv = nbd_co_readv,
.bdrv_co_writev = nbd_co_writev,
.bdrv_close = nbd_close,
diff --git a/block/parallels.c b/block/parallels.c
index 18b3ac0..75175a8 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -68,7 +68,7 @@ static int parallels_probe(const uint8_t *buf, int buf_size,
const char *filenam
return 0;
}
-static int parallels_open(BlockDriverState *bs, QDict *options, int flags)
+static int coroutine_fn parallels_co_open(BlockDriverState *bs, QDict
*options, int flags)
{
BDRVParallelsState *s = bs->opaque;
int i;
@@ -164,8 +164,8 @@ static BlockDriver bdrv_parallels = {
.format_name = "parallels",
.instance_size = sizeof(BDRVParallelsState),
.bdrv_probe = parallels_probe,
- .bdrv_open = parallels_open,
.bdrv_read = parallels_co_read,
+ .bdrv_co_open = parallels_co_open,
.bdrv_close = parallels_close,
};
diff --git a/block/qcow.c b/block/qcow.c
index c367c55..04f59f2 100644
--- a/block/qcow.c
+++ b/block/qcow.c
@@ -92,7 +92,7 @@ static int qcow_probe(const uint8_t *buf, int buf_size, const
char *filename)
return 0;
}
-static int qcow_open(BlockDriverState *bs, QDict *options, int flags)
+static int coroutine_fn qcow_co_open(BlockDriverState *bs, QDict *options, int
flags)
{
BDRVQcowState *s = bs->opaque;
int len, i, shift, ret;
@@ -888,7 +888,7 @@ static BlockDriver bdrv_qcow = {
.format_name = "qcow",
.instance_size = sizeof(BDRVQcowState),
.bdrv_probe = qcow_probe,
- .bdrv_open = qcow_open,
+ .bdrv_co_open = qcow_co_open,
.bdrv_close = qcow_close,
.bdrv_reopen_prepare = qcow_reopen_prepare,
.bdrv_co_create = qcow_create,
diff --git a/block/qcow2.c b/block/qcow2.c
index 656deb9..c6dc209 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -1781,7 +1781,7 @@ static BlockDriver bdrv_qcow2 = {
.format_name = "qcow2",
.instance_size = sizeof(BDRVQcowState),
.bdrv_probe = qcow2_probe,
- .bdrv_open = qcow2_open,
+ .bdrv_co_open = qcow2_co_open,
.bdrv_close = qcow2_close,
.bdrv_reopen_prepare = qcow2_reopen_prepare,
.bdrv_co_create = qcow2_co_create,
diff --git a/block/qed.c b/block/qed.c
index 083f20f..5f4ba79 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -373,7 +373,7 @@ static void bdrv_qed_rebind(BlockDriverState *bs)
s->bs = bs;
}
-static int bdrv_qed_open(BlockDriverState *bs, QDict *options, int flags)
+static int coroutine_fn bdrv_qed_co_open(BlockDriverState *bs, QDict *options,
int flags)
{
BDRVQEDState *s = bs->opaque;
QEDHeader le_header;
@@ -1570,7 +1570,7 @@ static BlockDriver bdrv_qed = {
.bdrv_probe = bdrv_qed_probe,
.bdrv_rebind = bdrv_qed_rebind,
- .bdrv_open = bdrv_qed_open,
+ .bdrv_co_open = bdrv_qed_co_open,
.bdrv_close = bdrv_qed_close,
.bdrv_reopen_prepare = bdrv_qed_reopen_prepare,
.bdrv_co_create = bdrv_qed_co_create,
diff --git a/block/raw-posix.c b/block/raw-posix.c
index 306a0b0..e9f0890 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -335,7 +335,7 @@ fail:
return ret;
}
-static int raw_open(BlockDriverState *bs, QDict *options, int flags)
+static int coroutine_fn raw_co_open(BlockDriverState *bs, QDict *options, int
flags)
{
BDRVRawState *s = bs->opaque;
@@ -1193,7 +1193,7 @@ static BlockDriver bdrv_file = {
.protocol_name = "file",
.instance_size = sizeof(BDRVRawState),
.bdrv_probe = NULL, /* no probe for protocols */
- .bdrv_file_open = raw_open,
+ .bdrv_co_file_open = raw_co_open,
.bdrv_reopen_prepare = raw_reopen_prepare,
.bdrv_reopen_commit = raw_reopen_commit,
.bdrv_reopen_abort = raw_reopen_abort,
@@ -1325,7 +1325,7 @@ static int check_hdev_writable(BDRVRawState *s)
return 0;
}
-static int hdev_open(BlockDriverState *bs, QDict *options, int flags)
+static int coroutine_fn hdev_co_open(BlockDriverState *bs, QDict *options, int
flags)
{
BDRVRawState *s = bs->opaque;
int ret;
@@ -1533,7 +1533,7 @@ static BlockDriver bdrv_host_device = {
.protocol_name = "host_device",
.instance_size = sizeof(BDRVRawState),
.bdrv_probe_device = hdev_probe_device,
- .bdrv_file_open = hdev_open,
+ .bdrv_co_file_open = hdev_co_open,
.bdrv_close = raw_close,
.bdrv_reopen_prepare = raw_reopen_prepare,
.bdrv_reopen_commit = raw_reopen_commit,
@@ -1559,7 +1559,7 @@ static BlockDriver bdrv_host_device = {
};
#ifdef __linux__
-static int floppy_open(BlockDriverState *bs, QDict *options, int flags)
+static int coroutine_fn floppy_co_open(BlockDriverState *bs, QDict *options,
int flags)
{
BDRVRawState *s = bs->opaque;
int ret;
@@ -1657,7 +1657,7 @@ static BlockDriver bdrv_host_floppy = {
.protocol_name = "host_floppy",
.instance_size = sizeof(BDRVRawState),
.bdrv_probe_device = floppy_probe_device,
- .bdrv_file_open = floppy_open,
+ .bdrv_co_file_open = floppy_co_open,
.bdrv_close = raw_close,
.bdrv_reopen_prepare = raw_reopen_prepare,
.bdrv_reopen_commit = raw_reopen_commit,
@@ -1680,7 +1680,7 @@ static BlockDriver bdrv_host_floppy = {
.bdrv_eject = floppy_eject,
};
-static int cdrom_open(BlockDriverState *bs, QDict *options, int flags)
+static int coroutine_fn cdrom_co_open(BlockDriverState *bs, QDict *options,
int flags)
{
BDRVRawState *s = bs->opaque;
@@ -1758,7 +1758,7 @@ static BlockDriver bdrv_host_cdrom = {
.protocol_name = "host_cdrom",
.instance_size = sizeof(BDRVRawState),
.bdrv_probe_device = cdrom_probe_device,
- .bdrv_file_open = cdrom_open,
+ .bdrv_co_file_open = cdrom_co_open,
.bdrv_close = raw_close,
.bdrv_reopen_prepare = raw_reopen_prepare,
.bdrv_reopen_commit = raw_reopen_commit,
@@ -1787,7 +1787,7 @@ static BlockDriver bdrv_host_cdrom = {
#endif /* __linux__ */
#if defined (__FreeBSD__) || defined(__FreeBSD_kernel__)
-static int cdrom_open(BlockDriverState *bs, QDict *options, int flags)
+static int coroutine_fn cdrom_co_open(BlockDriverState *bs, QDict *options,
int flags)
{
BDRVRawState *s = bs->opaque;
int ret;
@@ -1879,7 +1879,7 @@ static BlockDriver bdrv_host_cdrom = {
.protocol_name = "host_cdrom",
.instance_size = sizeof(BDRVRawState),
.bdrv_probe_device = cdrom_probe_device,
- .bdrv_file_open = cdrom_open,
+ .bdrv_co_file_open = cdrom_co_open,
.bdrv_close = raw_close,
.bdrv_reopen_prepare = raw_reopen_prepare,
.bdrv_reopen_commit = raw_reopen_commit,
diff --git a/block/raw.c b/block/raw.c
index 6f1f4e7..e4d3db2 100644
--- a/block/raw.c
+++ b/block/raw.c
@@ -3,7 +3,7 @@
#include "block/block_int.h"
#include "qemu/module.h"
-static int raw_open(BlockDriverState *bs, QDict *options, int flags)
+static int coroutine_fn raw_co_open(BlockDriverState *bs, QDict *options, int
flags)
{
bs->sg = bs->file->sg;
return 0;
@@ -132,7 +132,7 @@ static BlockDriver bdrv_raw = {
/* It's really 0, but we need to make g_malloc() happy */
.instance_size = 1,
- .bdrv_open = raw_open,
+ .bdrv_co_open = raw_co_open,
.bdrv_close = raw_close,
.bdrv_reopen_prepare = raw_reopen_prepare,
diff --git a/block/sheepdog.c b/block/sheepdog.c
index 7ca70de..7456954 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -1259,7 +1259,7 @@ static QemuOptsList runtime_opts = {
},
};
-static int sd_open(BlockDriverState *bs, QDict *options, int flags)
+static int coroutine_fn sd_co_open(BlockDriverState *bs, QDict *options, int
flags)
{
int ret, fd;
uint32_t vid = 0;
@@ -2186,7 +2186,7 @@ out:
return found;
}
-static int do_load_save_vmstate(BDRVSheepdogState *s, uint8_t *data,
+static int coroutine_fn do_load_save_vmstate(BDRVSheepdogState *s, uint8_t
*data,
int64_t pos, int size, int load)
{
bool create;
@@ -2344,8 +2344,8 @@ static BlockDriver bdrv_sheepdog = {
.format_name = "sheepdog",
.protocol_name = "sheepdog",
.instance_size = sizeof(BDRVSheepdogState),
- .bdrv_file_open = sd_open,
.bdrv_close = sd_close,
+ .bdrv_co_file_open = sd_co_open,
.bdrv_co_create = sd_co_create,
.bdrv_has_zero_init = bdrv_has_zero_init_1,
.bdrv_getlength = sd_getlength,
@@ -2372,8 +2372,8 @@ static BlockDriver bdrv_sheepdog_tcp = {
.format_name = "sheepdog",
.protocol_name = "sheepdog+tcp",
.instance_size = sizeof(BDRVSheepdogState),
- .bdrv_file_open = sd_open,
.bdrv_close = sd_close,
+ .bdrv_co_file_open = sd_co_open,
.bdrv_co_create = sd_co_create,
.bdrv_has_zero_init = bdrv_has_zero_init_1,
.bdrv_getlength = sd_getlength,
@@ -2400,8 +2400,8 @@ static BlockDriver bdrv_sheepdog_unix = {
.format_name = "sheepdog",
.protocol_name = "sheepdog+unix",
.instance_size = sizeof(BDRVSheepdogState),
- .bdrv_file_open = sd_open,
.bdrv_close = sd_close,
+ .bdrv_co_file_open = sd_co_open,
.bdrv_co_create = sd_co_create,
.bdrv_has_zero_init = bdrv_has_zero_init_1,
.bdrv_getlength = sd_getlength,
diff --git a/block/ssh.c b/block/ssh.c
index 3246185..2afb7cc 100644
--- a/block/ssh.c
+++ b/block/ssh.c
@@ -608,7 +608,7 @@ static int connect_to_ssh(BDRVSSHState *s, QDict *options,
return ret;
}
-static int ssh_file_open(BlockDriverState *bs, QDict *options, int bdrv_flags)
+static int coroutine_fn ssh_co_file_open(BlockDriverState *bs, QDict *options,
int bdrv_flags)
{
BDRVSSHState *s = bs->opaque;
int ret;
@@ -1049,7 +1049,7 @@ static BlockDriver bdrv_ssh = {
.protocol_name = "ssh",
.instance_size = sizeof(BDRVSSHState),
.bdrv_parse_filename = ssh_parse_filename,
- .bdrv_file_open = ssh_file_open,
+ .bdrv_co_file_open = ssh_co_file_open,
.bdrv_co_create = ssh_co_create,
.bdrv_close = ssh_close,
.bdrv_has_zero_init = ssh_has_zero_init,
diff --git a/block/vdi.c b/block/vdi.c
index 38e08fe..40818c4 100644
--- a/block/vdi.c
+++ b/block/vdi.c
@@ -364,7 +364,7 @@ static int vdi_probe(const uint8_t *buf, int buf_size,
const char *filename)
return result;
}
-static int vdi_open(BlockDriverState *bs, QDict *options, int flags)
+static int coroutine_fn vdi_co_open(BlockDriverState *bs, QDict *options, int
flags)
{
BDRVVdiState *s = bs->opaque;
VdiHeader header;
@@ -775,7 +775,7 @@ static BlockDriver bdrv_vdi = {
.format_name = "vdi",
.instance_size = sizeof(BDRVVdiState),
.bdrv_probe = vdi_probe,
- .bdrv_open = vdi_open,
+ .bdrv_co_open = vdi_co_open,
.bdrv_close = vdi_close,
.bdrv_reopen_prepare = vdi_reopen_prepare,
.bdrv_co_create = vdi_co_create,
diff --git a/block/vhdx.c b/block/vhdx.c
index e9704b1..af38098 100644
--- a/block/vhdx.c
+++ b/block/vhdx.c
@@ -715,7 +715,7 @@ exit:
}
-static int vhdx_open(BlockDriverState *bs, QDict *options, int flags)
+static int coroutine_fn vhdx_co_open(BlockDriverState *bs, QDict *options, int
flags)
{
BDRVVHDXState *s = bs->opaque;
int ret = 0;
@@ -957,7 +957,7 @@ static BlockDriver bdrv_vhdx = {
.format_name = "vhdx",
.instance_size = sizeof(BDRVVHDXState),
.bdrv_probe = vhdx_probe,
- .bdrv_open = vhdx_open,
+ .bdrv_co_open = vhdx_co_open,
.bdrv_close = vhdx_close,
.bdrv_reopen_prepare = vhdx_reopen_prepare,
.bdrv_co_readv = vhdx_co_readv,
diff --git a/block/vmdk.c b/block/vmdk.c
index 5e81519..a58b551 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -803,7 +803,7 @@ exit:
return ret;
}
-static int vmdk_open(BlockDriverState *bs, QDict *options, int flags)
+static int coroutine_fn vmdk_co_open(BlockDriverState *bs, QDict *options, int
flags)
{
int ret;
BDRVVmdkState *s = bs->opaque;
@@ -1827,7 +1827,7 @@ static BlockDriver bdrv_vmdk = {
.format_name = "vmdk",
.instance_size = sizeof(BDRVVmdkState),
.bdrv_probe = vmdk_probe,
- .bdrv_open = vmdk_open,
+ .bdrv_co_open = vmdk_co_open,
.bdrv_reopen_prepare = vmdk_reopen_prepare,
.bdrv_read = vmdk_co_read,
.bdrv_write = vmdk_co_write,
diff --git a/block/vpc.c b/block/vpc.c
index 0dc9812..241c1a6 100644
--- a/block/vpc.c
+++ b/block/vpc.c
@@ -155,7 +155,7 @@ static int vpc_probe(const uint8_t *buf, int buf_size,
const char *filename)
return 0;
}
-static int vpc_open(BlockDriverState *bs, QDict *options, int flags)
+static int coroutine_fn vpc_co_open(BlockDriverState *bs, QDict *options, int
flags)
{
BDRVVPCState *s = bs->opaque;
int i;
@@ -831,7 +831,7 @@ static BlockDriver bdrv_vpc = {
.instance_size = sizeof(BDRVVPCState),
.bdrv_probe = vpc_probe,
- .bdrv_open = vpc_open,
+ .bdrv_co_open = vpc_co_open,
.bdrv_close = vpc_close,
.bdrv_reopen_prepare = vpc_reopen_prepare,
.bdrv_co_create = vpc_co_create,
diff --git a/block/vvfat.c b/block/vvfat.c
index cd3b8ed..27129da 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -1065,7 +1065,7 @@ static void vvfat_parse_filename(const char *filename,
QDict *options,
qdict_put(options, "rw", qbool_from_int(rw));
}
-static int vvfat_open(BlockDriverState *bs, QDict *options, int flags)
+static int coroutine_fn vvfat_co_open(BlockDriverState *bs, QDict *options,
int flags)
{
BDRVVVFATState *s = bs->opaque;
int cyls, heads, secs;
@@ -2886,7 +2886,7 @@ static int coroutine_fn
vvfat_co_is_allocated(BlockDriverState *bs,
return 1;
}
-static int write_target_commit(BlockDriverState *bs, int64_t sector_num,
+static int coroutine_fn write_target_commit(BlockDriverState *bs, int64_t
sector_num,
const uint8_t* buffer, int nb_sectors) {
BDRVVVFATState* s = *((BDRVVVFATState**) bs->opaque);
return try_commit(s);
@@ -2978,7 +2978,7 @@ static BlockDriver bdrv_vvfat = {
.instance_size = sizeof(BDRVVVFATState),
.bdrv_parse_filename = vvfat_parse_filename,
- .bdrv_file_open = vvfat_open,
+ .bdrv_co_file_open = vvfat_co_open,
.bdrv_close = vvfat_close,
.bdrv_rebind = vvfat_rebind,
diff --git a/include/block/block_int.h b/include/block/block_int.h
index d7f59a8..926cf87 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -96,9 +96,9 @@ struct BlockDriver {
void (*bdrv_reopen_commit)(BDRVReopenState *reopen_state);
void (*bdrv_reopen_abort)(BDRVReopenState *reopen_state);
- int (*bdrv_open)(BlockDriverState *bs, QDict *options, int flags);
- int (*bdrv_file_open)(BlockDriverState *bs, QDict *options, int flags);
int (*bdrv_read)(BlockDriverState *bs, int64_t sector_num,
+ int coroutine_fn (*bdrv_co_open)(BlockDriverState *bs, QDict *options, int
flags);
+ int coroutine_fn (*bdrv_co_file_open)(BlockDriverState *bs, QDict
*options, int flags);
uint8_t *buf, int nb_sectors);
int (*bdrv_write)(BlockDriverState *bs, int64_t sector_num,
const uint8_t *buf, int nb_sectors);
--
1.8.3.2
- [Qemu-devel] [RFC v2 01/15] Add an explanation of when a function should be marked coroutine_fn, Charlie Shepherd, 2013/08/09
- [Qemu-devel] [RFC v2 02/15] Rename qemu_coroutine_self to qemu_coroutine_self_int and add an annotated wrapper, Charlie Shepherd, 2013/08/09
- [Qemu-devel] [RFC v2 03/15] Explicitly mark BlockDriver function .bdrv_create as coroutine and rename it bdrv_co_create., Charlie Shepherd, 2013/08/09
- [Qemu-devel] [RFC v2 05/15] Make qcow2_open synchronous, Charlie Shepherd, 2013/08/09
- [Qemu-devel] [RFC v2 04/15] Convert .bdrv_open and .bdrv_file_open to coroutine_fn,
Charlie Shepherd <=
- [Qemu-devel] [RFC v2 07/15] Call bdrv->open via a synchronous wrapper in block/snapshot.c, Charlie Shepherd, 2013/08/09
- [Qemu-devel] [RFC v2 06/15] Explicitly mark BlockDriver functions .bdrv_write and .bdrv_read as coroutine functions, Charlie Shepherd, 2013/08/09
- [Qemu-devel] [RFC v2 08/15] Convert bdrv_create and associated functions to be coroutine_fn, Charlie Shepherd, 2013/08/09
- [Qemu-devel] [RFC v2 09/15] Add a synchronous wrapper bdrv_sync_rwco, Charlie Shepherd, 2013/08/09
- [Qemu-devel] [RFC v2 11/15] Make bdrv_discard coroutine only and add bdrv_sync_discard, Charlie Shepherd, 2013/08/09