From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Alberto Garcia <berto@igalia.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PATCH v4 3/4] block: extract bdrv_setup_io_funcs()
Date: Tue, 28 Apr 2015 14:27:51 +0100 [thread overview]
Message-ID: <1430227672-7670-4-git-send-email-stefanha@redhat.com> (raw)
In-Reply-To: <1430227672-7670-1-git-send-email-stefanha@redhat.com>
Move the code to install coroutine and aio emulation function pointers
in a BlockDriver to its own function.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
block.c | 7 ++++++-
include/block/block_int.h | 8 ++++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/block.c b/block.c
index 3b865ee..954d783 100644
--- a/block.c
+++ b/block.c
@@ -349,7 +349,7 @@ void bdrv_get_full_backing_filename(BlockDriverState *bs, char *dest, size_t sz,
dest, sz, errp);
}
-void bdrv_register(BlockDriver *bdrv)
+void bdrv_setup_io_funcs(BlockDriver *bdrv)
{
/* Block drivers without coroutine functions need emulation */
if (!bdrv->bdrv_co_readv) {
@@ -365,6 +365,11 @@ void bdrv_register(BlockDriver *bdrv)
bdrv->bdrv_aio_writev = bdrv_aio_writev_em;
}
}
+}
+
+void bdrv_register(BlockDriver *bdrv)
+{
+ bdrv_setup_io_funcs(bdrv);
QLIST_INSERT_HEAD(&bdrv_drivers, bdrv, list);
}
diff --git a/include/block/block_int.h b/include/block/block_int.h
index 5ad20b2..db29b74 100644
--- a/include/block/block_int.h
+++ b/include/block/block_int.h
@@ -439,6 +439,14 @@ extern BlockDriver bdrv_file;
extern BlockDriver bdrv_raw;
extern BlockDriver bdrv_qcow2;
+/**
+ * bdrv_setup_io_funcs:
+ *
+ * Prepare a #BlockDriver for I/O request processing by populating
+ * unimplemented coroutine and AIO interfaces with generic wrapper functions
+ * that fall back to implemented interfaces.
+ */
+void bdrv_setup_io_funcs(BlockDriver *bdrv);
int get_tmp_filename(char *filename, int size);
BlockDriver *bdrv_probe_all(const uint8_t *buf, int buf_size,
--
2.1.0
next prev parent reply other threads:[~2015-04-28 13:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-28 13:27 [Qemu-devel] [PATCH v4 0/4] block: move I/O request processing to block/io.c Stefan Hajnoczi
2015-04-28 13:27 ` [Qemu-devel] [PATCH v4 1/4] block: replace bdrv_states iteration with bdrv_next() Stefan Hajnoczi
2015-04-28 13:27 ` [Qemu-devel] [PATCH v4 2/4] block: add bdrv_set_dirty()/bdrv_reset_dirty() to block_int.h Stefan Hajnoczi
2015-04-28 13:27 ` Stefan Hajnoczi [this message]
2015-04-28 13:27 ` [Qemu-devel] [PATCH v4 4/4] block: move I/O request processing to block/io.c Stefan Hajnoczi
2015-04-28 13:49 ` [Qemu-devel] [PATCH v4 0/4] " Kevin Wolf
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=1430227672-7670-4-git-send-email-stefanha@redhat.com \
--to=stefanha@redhat.com \
--cc=berto@igalia.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).