From: Charlie Shepherd <charlie@ctshepherd.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, stefanha@gmail.com, gabriel@kerneis.info,
Charlie Shepherd <charlie@ctshepherd.com>,
pbonzini@redhat.com
Subject: [Qemu-devel] [RFC v2 03/15] Explicitly mark BlockDriver function .bdrv_create as coroutine and rename it bdrv_co_create.
Date: Fri, 9 Aug 2013 19:43:53 +0200 [thread overview]
Message-ID: <1376070245-22557-3-git-send-email-charlie@ctshepherd.com> (raw)
In-Reply-To: <1376070245-22557-1-git-send-email-charlie@ctshepherd.com>
Signed-off-by: Charlie Shepherd <charlie@ctshepherd.com>
---
block.c | 4 ++--
block/cow.c | 4 ++--
block/qcow.c | 4 ++--
block/qcow2.c | 4 ++--
block/qed.c | 4 ++--
block/raw-posix.c | 14 +++++++-------
block/raw.c | 4 ++--
block/sheepdog.c | 8 ++++----
block/ssh.c | 4 ++--
block/vdi.c | 4 ++--
block/vmdk.c | 4 ++--
block/vpc.c | 4 ++--
include/block/block_int.h | 2 +-
13 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/block.c b/block.c
index 01b66d8..40f73ee 100644
--- a/block.c
+++ b/block.c
@@ -374,7 +374,7 @@ static void coroutine_fn bdrv_create_co_entry(void *opaque)
CreateCo *cco = opaque;
assert(cco->drv);
- cco->ret = cco->drv->bdrv_create(cco->filename, cco->options);
+ cco->ret = cco->drv->bdrv_co_create(cco->filename, cco->options);
}
int bdrv_create(BlockDriver *drv, const char* filename,
@@ -390,7 +390,7 @@ int bdrv_create(BlockDriver *drv, const char* filename,
.ret = NOT_DONE,
};
- if (!drv->bdrv_create) {
+ if (!drv->bdrv_co_create) {
ret = -ENOTSUP;
goto out;
}
diff --git a/block/cow.c b/block/cow.c
index 1cc2e89..34c181a 100644
--- a/block/cow.c
+++ b/block/cow.c
@@ -255,7 +255,7 @@ static void cow_close(BlockDriverState *bs)
{
}
-static int cow_create(const char *filename, QEMUOptionParameter *options)
+static int coroutine_fn cow_co_create(const char *filename, QEMUOptionParameter *options)
{
struct cow_header_v2 cow_header;
struct stat st;
@@ -339,7 +339,7 @@ static BlockDriver bdrv_cow = {
.bdrv_probe = cow_probe,
.bdrv_open = cow_open,
.bdrv_close = cow_close,
- .bdrv_create = cow_create,
+ .bdrv_co_create = cow_co_create,
.bdrv_has_zero_init = bdrv_has_zero_init_1,
.bdrv_read = cow_co_read,
diff --git a/block/qcow.c b/block/qcow.c
index 5239bd6..c367c55 100644
--- a/block/qcow.c
+++ b/block/qcow.c
@@ -651,7 +651,7 @@ static void qcow_close(BlockDriverState *bs)
error_free(s->migration_blocker);
}
-static int qcow_create(const char *filename, QEMUOptionParameter *options)
+static int coroutine_fn qcow_create(const char *filename, QEMUOptionParameter *options)
{
int header_size, backing_filename_len, l1_size, shift, i;
QCowHeader header;
@@ -891,7 +891,7 @@ static BlockDriver bdrv_qcow = {
.bdrv_open = qcow_open,
.bdrv_close = qcow_close,
.bdrv_reopen_prepare = qcow_reopen_prepare,
- .bdrv_create = qcow_create,
+ .bdrv_co_create = qcow_create,
.bdrv_has_zero_init = bdrv_has_zero_init_1,
.bdrv_co_readv = qcow_co_readv,
diff --git a/block/qcow2.c b/block/qcow2.c
index 3376901..656deb9 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -1394,7 +1394,7 @@ out:
return ret;
}
-static int qcow2_create(const char *filename, QEMUOptionParameter *options)
+static int coroutine_fn qcow2_co_create(const char *filename, QEMUOptionParameter *options)
{
const char *backing_file = NULL;
const char *backing_fmt = NULL;
@@ -1784,7 +1784,7 @@ static BlockDriver bdrv_qcow2 = {
.bdrv_open = qcow2_open,
.bdrv_close = qcow2_close,
.bdrv_reopen_prepare = qcow2_reopen_prepare,
- .bdrv_create = qcow2_create,
+ .bdrv_co_create = qcow2_co_create,
.bdrv_has_zero_init = bdrv_has_zero_init_1,
.bdrv_co_is_allocated = qcow2_co_is_allocated,
.bdrv_set_key = qcow2_set_key,
diff --git a/block/qed.c b/block/qed.c
index f767b05..083f20f 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -603,7 +603,7 @@ out:
return ret;
}
-static int bdrv_qed_create(const char *filename, QEMUOptionParameter *options)
+static int coroutine_fn bdrv_qed_co_create(const char *filename, QEMUOptionParameter *options)
{
uint64_t image_size = 0;
uint32_t cluster_size = QED_DEFAULT_CLUSTER_SIZE;
@@ -1573,7 +1573,7 @@ static BlockDriver bdrv_qed = {
.bdrv_open = bdrv_qed_open,
.bdrv_close = bdrv_qed_close,
.bdrv_reopen_prepare = bdrv_qed_reopen_prepare,
- .bdrv_create = bdrv_qed_create,
+ .bdrv_co_create = bdrv_qed_co_create,
.bdrv_has_zero_init = bdrv_has_zero_init_1,
.bdrv_co_is_allocated = bdrv_qed_co_is_allocated,
.bdrv_make_empty = bdrv_qed_make_empty,
diff --git a/block/raw-posix.c b/block/raw-posix.c
index ba721d3..306a0b0 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -1040,7 +1040,7 @@ static int64_t raw_get_allocated_file_size(BlockDriverState *bs)
return (int64_t)st.st_blocks * 512;
}
-static int raw_create(const char *filename, QEMUOptionParameter *options)
+static int coroutine_fn raw_co_create(const char *filename, QEMUOptionParameter *options)
{
int fd;
int result = 0;
@@ -1198,7 +1198,7 @@ static BlockDriver bdrv_file = {
.bdrv_reopen_commit = raw_reopen_commit,
.bdrv_reopen_abort = raw_reopen_abort,
.bdrv_close = raw_close,
- .bdrv_create = raw_create,
+ .bdrv_co_create = raw_co_create,
.bdrv_has_zero_init = bdrv_has_zero_init_1,
.bdrv_co_is_allocated = raw_co_is_allocated,
@@ -1498,7 +1498,7 @@ static coroutine_fn BlockDriverAIOCB *hdev_aio_discard(BlockDriverState *bs,
cb, opaque, QEMU_AIO_DISCARD|QEMU_AIO_BLKDEV);
}
-static int hdev_create(const char *filename, QEMUOptionParameter *options)
+static int coroutine_fn hdev_co_create(const char *filename, QEMUOptionParameter *options)
{
int fd;
int ret = 0;
@@ -1538,7 +1538,7 @@ static BlockDriver bdrv_host_device = {
.bdrv_reopen_prepare = raw_reopen_prepare,
.bdrv_reopen_commit = raw_reopen_commit,
.bdrv_reopen_abort = raw_reopen_abort,
- .bdrv_create = hdev_create,
+ .bdrv_co_create = hdev_co_create,
.create_options = raw_create_options,
.bdrv_aio_readv = raw_aio_readv,
@@ -1662,7 +1662,7 @@ static BlockDriver bdrv_host_floppy = {
.bdrv_reopen_prepare = raw_reopen_prepare,
.bdrv_reopen_commit = raw_reopen_commit,
.bdrv_reopen_abort = raw_reopen_abort,
- .bdrv_create = hdev_create,
+ .bdrv_co_create = hdev_co_create,
.create_options = raw_create_options,
.bdrv_aio_readv = raw_aio_readv,
@@ -1763,7 +1763,7 @@ static BlockDriver bdrv_host_cdrom = {
.bdrv_reopen_prepare = raw_reopen_prepare,
.bdrv_reopen_commit = raw_reopen_commit,
.bdrv_reopen_abort = raw_reopen_abort,
- .bdrv_create = hdev_create,
+ .bdrv_co_create = hdev_co_create,
.create_options = raw_create_options,
.bdrv_aio_readv = raw_aio_readv,
@@ -1884,7 +1884,7 @@ static BlockDriver bdrv_host_cdrom = {
.bdrv_reopen_prepare = raw_reopen_prepare,
.bdrv_reopen_commit = raw_reopen_commit,
.bdrv_reopen_abort = raw_reopen_abort,
- .bdrv_create = hdev_create,
+ .bdrv_co_create = hdev_co_create,
.create_options = raw_create_options,
.bdrv_aio_readv = raw_aio_readv,
diff --git a/block/raw.c b/block/raw.c
index f1682d4..6f1f4e7 100644
--- a/block/raw.c
+++ b/block/raw.c
@@ -102,7 +102,7 @@ static BlockDriverAIOCB *raw_aio_ioctl(BlockDriverState *bs,
return bdrv_aio_ioctl(bs->file, req, buf, cb, opaque);
}
-static int raw_create(const char *filename, QEMUOptionParameter *options)
+static int coroutine_fn raw_co_create(const char *filename, QEMUOptionParameter *options)
{
return bdrv_create_file(filename, options);
}
@@ -156,7 +156,7 @@ static BlockDriver bdrv_raw = {
.bdrv_ioctl = raw_ioctl,
.bdrv_aio_ioctl = raw_aio_ioctl,
- .bdrv_create = raw_create,
+ .bdrv_co_create = raw_co_create,
.create_options = raw_create_options,
.bdrv_has_zero_init = raw_has_zero_init,
};
diff --git a/block/sheepdog.c b/block/sheepdog.c
index afe0533..7ca70de 100644
--- a/block/sheepdog.c
+++ b/block/sheepdog.c
@@ -1454,7 +1454,7 @@ out:
return ret;
}
-static int sd_create(const char *filename, QEMUOptionParameter *options)
+static int coroutine_fn sd_co_create(const char *filename, QEMUOptionParameter *options)
{
int ret = 0;
uint32_t vid = 0, base_vid = 0;
@@ -2346,7 +2346,7 @@ static BlockDriver bdrv_sheepdog = {
.instance_size = sizeof(BDRVSheepdogState),
.bdrv_file_open = sd_open,
.bdrv_close = sd_close,
- .bdrv_create = sd_create,
+ .bdrv_co_create = sd_co_create,
.bdrv_has_zero_init = bdrv_has_zero_init_1,
.bdrv_getlength = sd_getlength,
.bdrv_truncate = sd_truncate,
@@ -2374,7 +2374,7 @@ static BlockDriver bdrv_sheepdog_tcp = {
.instance_size = sizeof(BDRVSheepdogState),
.bdrv_file_open = sd_open,
.bdrv_close = sd_close,
- .bdrv_create = sd_create,
+ .bdrv_co_create = sd_co_create,
.bdrv_has_zero_init = bdrv_has_zero_init_1,
.bdrv_getlength = sd_getlength,
.bdrv_truncate = sd_truncate,
@@ -2402,7 +2402,7 @@ static BlockDriver bdrv_sheepdog_unix = {
.instance_size = sizeof(BDRVSheepdogState),
.bdrv_file_open = sd_open,
.bdrv_close = sd_close,
- .bdrv_create = sd_create,
+ .bdrv_co_create = sd_co_create,
.bdrv_has_zero_init = bdrv_has_zero_init_1,
.bdrv_getlength = sd_getlength,
.bdrv_truncate = sd_truncate,
diff --git a/block/ssh.c b/block/ssh.c
index d7e7bf8..3246185 100644
--- a/block/ssh.c
+++ b/block/ssh.c
@@ -650,7 +650,7 @@ static QEMUOptionParameter ssh_create_options[] = {
{ NULL }
};
-static int ssh_create(const char *filename, QEMUOptionParameter *options)
+static int coroutine_fn ssh_co_create(const char *filename, QEMUOptionParameter *options)
{
int r, ret;
Error *local_err = NULL;
@@ -1050,7 +1050,7 @@ static BlockDriver bdrv_ssh = {
.instance_size = sizeof(BDRVSSHState),
.bdrv_parse_filename = ssh_parse_filename,
.bdrv_file_open = ssh_file_open,
- .bdrv_create = ssh_create,
+ .bdrv_co_create = ssh_co_create,
.bdrv_close = ssh_close,
.bdrv_has_zero_init = ssh_has_zero_init,
.bdrv_co_readv = ssh_co_readv,
diff --git a/block/vdi.c b/block/vdi.c
index 8a91525..38e08fe 100644
--- a/block/vdi.c
+++ b/block/vdi.c
@@ -633,7 +633,7 @@ static int vdi_co_write(BlockDriverState *bs,
return ret;
}
-static int vdi_create(const char *filename, QEMUOptionParameter *options)
+static int coroutine_fn vdi_co_create(const char *filename, QEMUOptionParameter *options)
{
int fd;
int result = 0;
@@ -778,7 +778,7 @@ static BlockDriver bdrv_vdi = {
.bdrv_open = vdi_open,
.bdrv_close = vdi_close,
.bdrv_reopen_prepare = vdi_reopen_prepare,
- .bdrv_create = vdi_create,
+ .bdrv_co_create = vdi_co_create,
.bdrv_has_zero_init = bdrv_has_zero_init_1,
.bdrv_co_is_allocated = vdi_co_is_allocated,
.bdrv_make_empty = vdi_make_empty,
diff --git a/block/vmdk.c b/block/vmdk.c
index 346bb5c..5e81519 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -1532,7 +1532,7 @@ static int filename_decompose(const char *filename, char *path, char *prefix,
return VMDK_OK;
}
-static int vmdk_create(const char *filename, QEMUOptionParameter *options)
+static int coroutine_fn vmdk_co_create(const char *filename, QEMUOptionParameter *options)
{
int fd, idx = 0;
char desc[BUF_SIZE];
@@ -1833,7 +1833,7 @@ static BlockDriver bdrv_vmdk = {
.bdrv_write = vmdk_co_write,
.bdrv_co_write_zeroes = vmdk_co_write_zeroes,
.bdrv_close = vmdk_close,
- .bdrv_create = vmdk_create,
+ .bdrv_co_create = vmdk_co_create,
.bdrv_co_flush_to_disk = vmdk_co_flush,
.bdrv_co_is_allocated = vmdk_co_is_allocated,
.bdrv_get_allocated_file_size = vmdk_get_allocated_file_size,
diff --git a/block/vpc.c b/block/vpc.c
index fe4f311..0dc9812 100644
--- a/block/vpc.c
+++ b/block/vpc.c
@@ -683,7 +683,7 @@ static int create_fixed_disk(int fd, uint8_t *buf, int64_t total_size)
return ret;
}
-static int vpc_create(const char *filename, QEMUOptionParameter *options)
+static int coroutine_fn vpc_co_create(const char *filename, QEMUOptionParameter *options)
{
uint8_t buf[1024];
struct vhd_footer *footer = (struct vhd_footer *) buf;
@@ -834,7 +834,7 @@ static BlockDriver bdrv_vpc = {
.bdrv_open = vpc_open,
.bdrv_close = vpc_close,
.bdrv_reopen_prepare = vpc_reopen_prepare,
- .bdrv_create = vpc_create,
+ .bdrv_co_create = vpc_co_create,
.bdrv_read = vpc_co_read,
.bdrv_write = vpc_co_write,
diff --git a/include/block/block_int.h b/include/block/block_int.h
index e45f2a0..d7f59a8 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -104,7 +104,7 @@ struct BlockDriver {
const uint8_t *buf, int nb_sectors);
void (*bdrv_close)(BlockDriverState *bs);
void (*bdrv_rebind)(BlockDriverState *bs);
- int (*bdrv_create)(const char *filename, QEMUOptionParameter *options);
+ int coroutine_fn (*bdrv_co_create)(const char *filename, QEMUOptionParameter *options);
int (*bdrv_set_key)(BlockDriverState *bs, const char *key);
int (*bdrv_make_empty)(BlockDriverState *bs);
/* aio */
--
1.8.3.2
next prev parent reply other threads:[~2013-08-09 17:45 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-09 17:43 [Qemu-devel] [RFC v2 01/15] Add an explanation of when a function should be marked coroutine_fn Charlie Shepherd
2013-08-09 17:43 ` [Qemu-devel] [RFC v2 02/15] Rename qemu_coroutine_self to qemu_coroutine_self_int and add an annotated wrapper Charlie Shepherd
2013-08-14 14:21 ` Stefan Hajnoczi
2013-08-09 17:43 ` Charlie Shepherd [this message]
2013-08-14 14:26 ` [Qemu-devel] [RFC v2 03/15] Explicitly mark BlockDriver function .bdrv_create as coroutine and rename it bdrv_co_create Stefan Hajnoczi
2013-08-09 17:43 ` [Qemu-devel] [RFC v2 04/15] Convert .bdrv_open and .bdrv_file_open to coroutine_fn Charlie Shepherd
2013-08-29 12:11 ` Stefan Hajnoczi
2013-08-29 12:16 ` Charlie Shepherd
2013-08-09 17:43 ` [Qemu-devel] [RFC v2 05/15] Make qcow2_open synchronous Charlie Shepherd
2013-08-29 12:29 ` Stefan Hajnoczi
2013-08-29 12:33 ` Stefan Hajnoczi
2013-08-29 12:43 ` Charlie Shepherd
2013-09-04 11:39 ` Stefan Hajnoczi
2013-08-09 17:43 ` [Qemu-devel] [RFC v2 06/15] Explicitly mark BlockDriver functions .bdrv_write and .bdrv_read as coroutine functions Charlie Shepherd
2013-08-09 17:43 ` [Qemu-devel] [RFC v2 07/15] Call bdrv->open via a synchronous wrapper in block/snapshot.c Charlie Shepherd
2013-08-29 15:14 ` Stefan Hajnoczi
2013-08-09 17:43 ` [Qemu-devel] [RFC v2 08/15] Convert bdrv_create and associated functions to be coroutine_fn Charlie Shepherd
2013-08-29 15:31 ` Stefan Hajnoczi
2013-08-09 17:43 ` [Qemu-devel] [RFC v2 09/15] Add a synchronous wrapper bdrv_sync_rwco Charlie Shepherd
2013-08-29 15:32 ` Stefan Hajnoczi
2013-08-09 17:44 ` [Qemu-devel] [RFC v2 10/15] Convert bdrv_read, bdrv_write and associated functions to coroutine functions Charlie Shepherd
2013-08-09 17:44 ` [Qemu-devel] [RFC v2 11/15] Make bdrv_discard coroutine only and add bdrv_sync_discard Charlie Shepherd
2013-08-09 17:44 ` [Qemu-devel] [RFC v2 12/15] Make bdrv_flush coroutine only and add bdrv_sync_flush Charlie Shepherd
2013-08-09 17:44 ` [Qemu-devel] [RFC v2 13/15] Introduce a run_handler function in qemu-img.c Charlie Shepherd
2013-08-09 17:44 ` [Qemu-devel] [RFC v2 14/15] Add coroutine annotations for qemu_co_rwlock_rdlock and qemu_co_rwlock_wrlock Charlie Shepherd
2013-08-09 17:44 ` [Qemu-devel] [RFC v2 15/15] Add coroutine_fn annotations to nbd_co_* functions Charlie Shepherd
2013-08-14 14:14 ` [Qemu-devel] [RFC v2 01/15] Add an explanation of when a function should be marked coroutine_fn Stefan Hajnoczi
2013-08-29 15:34 ` Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1376070245-22557-3-git-send-email-charlie@ctshepherd.com \
--to=charlie@ctshepherd.com \
--cc=gabriel@kerneis.info \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).