qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
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 06/15] Explicitly mark BlockDriver functions .bdrv_write and .bdrv_read as coroutine functions
Date: Fri,  9 Aug 2013 19:43:56 +0200	[thread overview]
Message-ID: <1376070245-22557-6-git-send-email-charlie@ctshepherd.com> (raw)
In-Reply-To: <1376070245-22557-1-git-send-email-charlie@ctshepherd.com>

Convert .bdrv_write and .bdrv_read to coroutine functions and rename them to .bdrv_co_write and
.bdrv_co_read.

Signed-off-by: Charlie Shepherd <charlie@ctshepherd.com>
---
 block.c                   | 4 ++--
 block/bochs.c             | 2 +-
 block/cloop.c             | 2 +-
 block/cow.c               | 4 ++--
 block/dmg.c               | 2 +-
 block/parallels.c         | 2 +-
 block/ssh.c               | 2 +-
 block/vdi.c               | 4 ++--
 block/vmdk.c              | 4 ++--
 block/vpc.c               | 4 ++--
 block/vvfat.c             | 6 +++---
 include/block/block_int.h | 4 ++--
 12 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/block.c b/block.c
index 75a1e6b..1f9f653 100644
--- a/block.c
+++ b/block.c
@@ -3790,9 +3790,9 @@ static BlockDriverAIOCB *bdrv_aio_rw_vector(BlockDriverState *bs,
 
     if (is_write) {
         qemu_iovec_to_buf(acb->qiov, 0, acb->bounce, qiov->size);
-        acb->ret = bs->drv->bdrv_write(bs, sector_num, acb->bounce, nb_sectors);
+        acb->ret = bs->drv->bdrv_co_write(bs, sector_num, acb->bounce, nb_sectors);
     } else {
-        acb->ret = bs->drv->bdrv_read(bs, sector_num, acb->bounce, nb_sectors);
+        acb->ret = bs->drv->bdrv_co_read(bs, sector_num, acb->bounce, nb_sectors);
     }
 
     qemu_bh_schedule(acb->bh);
diff --git a/block/bochs.c b/block/bochs.c
index aab9028..3111ab9 100644
--- a/block/bochs.c
+++ b/block/bochs.c
@@ -238,7 +238,7 @@ static BlockDriver bdrv_bochs = {
     .format_name	= "bochs",
     .instance_size	= sizeof(BDRVBochsState),
     .bdrv_probe		= bochs_probe,
-    .bdrv_read          = bochs_co_read,
+    .bdrv_co_read	= bochs_co_read,
     .bdrv_co_open	= bochs_open,
     .bdrv_close		= bochs_close,
 };
diff --git a/block/cloop.c b/block/cloop.c
index b7c1551..122f650 100644
--- a/block/cloop.c
+++ b/block/cloop.c
@@ -191,7 +191,7 @@ static BlockDriver bdrv_cloop = {
     .format_name    = "cloop",
     .instance_size  = sizeof(BDRVCloopState),
     .bdrv_probe     = cloop_probe,
-    .bdrv_read      = cloop_co_read,
+    .bdrv_co_read   = cloop_co_read,
     .bdrv_co_open   = cloop_open,
     .bdrv_close     = cloop_close,
 };
diff --git a/block/cow.c b/block/cow.c
index e2a1550..c68c5ae 100644
--- a/block/cow.c
+++ b/block/cow.c
@@ -342,8 +342,8 @@ static BlockDriver bdrv_cow = {
     .bdrv_co_create = cow_co_create,
     .bdrv_has_zero_init     = bdrv_has_zero_init_1,
 
-    .bdrv_read              = cow_co_read,
-    .bdrv_write             = cow_co_write,
+    .bdrv_co_read           = cow_co_read,
+    .bdrv_co_write          = cow_co_write,
     .bdrv_co_is_allocated   = cow_co_is_allocated,
 
     .create_options = cow_create_options,
diff --git a/block/dmg.c b/block/dmg.c
index 745703f..146207a 100644
--- a/block/dmg.c
+++ b/block/dmg.c
@@ -378,7 +378,7 @@ static BlockDriver bdrv_dmg = {
     .format_name	= "dmg",
     .instance_size	= sizeof(BDRVDMGState),
     .bdrv_probe		= dmg_probe,
-    .bdrv_read          = dmg_co_read,
+    .bdrv_co_read	= dmg_co_read,
     .bdrv_co_open	= dmg_co_open,
     .bdrv_close		= dmg_close,
 };
diff --git a/block/parallels.c b/block/parallels.c
index 75175a8..b765aed 100644
--- a/block/parallels.c
+++ b/block/parallels.c
@@ -164,7 +164,7 @@ static BlockDriver bdrv_parallels = {
     .format_name	= "parallels",
     .instance_size	= sizeof(BDRVParallelsState),
     .bdrv_probe		= parallels_probe,
-    .bdrv_read          = parallels_co_read,
+    .bdrv_co_read	= parallels_co_read,
     .bdrv_co_open	= parallels_co_open,
     .bdrv_close		= parallels_close,
 };
diff --git a/block/ssh.c b/block/ssh.c
index 2afb7cc..22f112c 100644
--- a/block/ssh.c
+++ b/block/ssh.c
@@ -888,7 +888,7 @@ static coroutine_fn int ssh_co_readv(BlockDriverState *bs,
     return ret;
 }
 
-static int ssh_write(BDRVSSHState *s,
+static int coroutine_fn ssh_write(BDRVSSHState *s,
                      int64_t offset, size_t size,
                      QEMUIOVector *qiov)
 {
diff --git a/block/vdi.c b/block/vdi.c
index 40818c4..577a638 100644
--- a/block/vdi.c
+++ b/block/vdi.c
@@ -783,9 +783,9 @@ static BlockDriver bdrv_vdi = {
     .bdrv_co_is_allocated = vdi_co_is_allocated,
     .bdrv_make_empty = vdi_make_empty,
 
-    .bdrv_read = vdi_co_read,
+    .bdrv_co_read = vdi_co_read,
 #if defined(CONFIG_VDI_WRITE)
-    .bdrv_write = vdi_co_write,
+    .bdrv_co_write = vdi_co_write,
 #endif
 
     .bdrv_get_info = vdi_get_info,
diff --git a/block/vmdk.c b/block/vmdk.c
index a58b551..16d593b 100644
--- a/block/vmdk.c
+++ b/block/vmdk.c
@@ -1829,8 +1829,8 @@ static BlockDriver bdrv_vmdk = {
     .bdrv_probe                   = vmdk_probe,
     .bdrv_co_open                 = vmdk_co_open,
     .bdrv_reopen_prepare          = vmdk_reopen_prepare,
-    .bdrv_read                    = vmdk_co_read,
-    .bdrv_write                   = vmdk_co_write,
+    .bdrv_co_read                 = vmdk_co_read,
+    .bdrv_co_write                = vmdk_co_write,
     .bdrv_co_write_zeroes         = vmdk_co_write_zeroes,
     .bdrv_close                   = vmdk_close,
     .bdrv_co_create               = vmdk_co_create,
diff --git a/block/vpc.c b/block/vpc.c
index 241c1a6..6eb293a 100644
--- a/block/vpc.c
+++ b/block/vpc.c
@@ -836,8 +836,8 @@ static BlockDriver bdrv_vpc = {
     .bdrv_reopen_prepare    = vpc_reopen_prepare,
     .bdrv_co_create         = vpc_co_create,
 
-    .bdrv_read              = vpc_co_read,
-    .bdrv_write             = vpc_co_write,
+    .bdrv_co_read           = vpc_co_read,
+    .bdrv_co_write          = vpc_co_write,
 
     .create_options         = vpc_create_options,
     .bdrv_has_zero_init     = vpc_has_zero_init,
diff --git a/block/vvfat.c b/block/vvfat.c
index 27129da..87ce631 100644
--- a/block/vvfat.c
+++ b/block/vvfat.c
@@ -2900,7 +2900,7 @@ static void write_target_close(BlockDriverState *bs) {
 
 static BlockDriver vvfat_write_target = {
     .format_name        = "vvfat_write_target",
-    .bdrv_write         = write_target_commit,
+    .bdrv_co_write      = write_target_commit,
     .bdrv_close         = write_target_close,
 };
 
@@ -2982,8 +2982,8 @@ static BlockDriver bdrv_vvfat = {
     .bdrv_close             = vvfat_close,
     .bdrv_rebind            = vvfat_rebind,
 
-    .bdrv_read              = vvfat_co_read,
-    .bdrv_write             = vvfat_co_write,
+    .bdrv_co_read           = vvfat_co_read,
+    .bdrv_co_write          = vvfat_co_write,
     .bdrv_co_is_allocated   = vvfat_co_is_allocated,
 };
 
diff --git a/include/block/block_int.h b/include/block/block_int.h
index 926cf87..c9632a0 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -96,11 +96,11 @@ struct BlockDriver {
     void (*bdrv_reopen_commit)(BDRVReopenState *reopen_state);
     void (*bdrv_reopen_abort)(BDRVReopenState *reopen_state);
 
-    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);
+    int coroutine_fn (*bdrv_co_read)(BlockDriverState *bs, int64_t sector_num,
                      uint8_t *buf, int nb_sectors);
-    int (*bdrv_write)(BlockDriverState *bs, int64_t sector_num,
+    int coroutine_fn (*bdrv_co_write)(BlockDriverState *bs, int64_t sector_num,
                       const uint8_t *buf, int nb_sectors);
     void (*bdrv_close)(BlockDriverState *bs);
     void (*bdrv_rebind)(BlockDriverState *bs);
-- 
1.8.3.2

  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 ` [Qemu-devel] [RFC v2 03/15] Explicitly mark BlockDriver function .bdrv_create as coroutine and rename it bdrv_co_create Charlie Shepherd
2013-08-14 14:26   ` 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 ` Charlie Shepherd [this message]
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-6-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).