From a7815a764c40c9dcf204f666c2d90248095376a8 Mon Sep 17 00:00:00 2001 From: John Snow Date: Tue, 8 Nov 2016 01:50:36 -0500 Subject: blockjob: add .start field Add an explicit start field to specify the entrypoint. We already have ownership of the coroutine itself AND managing the lifetime of the coroutine, let's take control of creation of the coroutine, too. This will allow us to delay creation of the actual coroutine until we know we'll actually start a BlockJob in block_job_start. This avoids the sticky question of how to "un-create" a Coroutine that hasn't been started yet. Signed-off-by: John Snow Reviewed-by: Kevin Wolf Message-id: 1478587839-9834-4-git-send-email-jsnow@redhat.com Signed-off-by: Jeff Cody --- block/stream.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'block/stream.c') diff --git a/block/stream.c b/block/stream.c index b05856bd65..92309ffc2e 100644 --- a/block/stream.c +++ b/block/stream.c @@ -218,6 +218,7 @@ static const BlockJobDriver stream_job_driver = { .instance_size = sizeof(StreamBlockJob), .job_type = BLOCK_JOB_TYPE_STREAM, .set_speed = stream_set_speed, + .start = stream_run, }; void stream_start(const char *job_id, BlockDriverState *bs, @@ -254,7 +255,7 @@ void stream_start(const char *job_id, BlockDriverState *bs, s->bs_flags = orig_bs_flags; s->on_error = on_error; - s->common.co = qemu_coroutine_create(stream_run, s); + s->common.co = qemu_coroutine_create(s->common.driver->start, s); trace_stream_start(bs, base, s, s->common.co); qemu_coroutine_enter(s->common.co); } -- cgit v1.2.3