From f67432a2019caf05b57a146bf45c1024a5cb608e Mon Sep 17 00:00:00 2001 From: John Snow Date: Wed, 29 Aug 2018 21:57:26 -0400 Subject: jobs: change start callback to run callback Presently we codify the entry point for a job as the "start" callback, but a more apt name would be "run" to clarify the idea that when this function returns we consider the job to have "finished," except for any cleanup which occurs in separate callbacks later. As part of this clarification, change the signature to include an error object and a return code. The error ptr is not yet used, and the return code while captured, will be overwritten by actions in the job_completed function. Signed-off-by: John Snow Reviewed-by: Max Reitz Message-id: 20180830015734.19765-2-jsnow@redhat.com Reviewed-by: Jeff Cody Signed-off-by: Max Reitz --- block/stream.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'block/stream.c') diff --git a/block/stream.c b/block/stream.c index 9264b68..b4b987d 100644 --- a/block/stream.c +++ b/block/stream.c @@ -97,9 +97,9 @@ out: g_free(data); } -static void coroutine_fn stream_run(void *opaque) +static int coroutine_fn stream_run(Job *job, Error **errp) { - StreamBlockJob *s = opaque; + StreamBlockJob *s = container_of(job, StreamBlockJob, common.job); StreamCompleteData *data; BlockBackend *blk = s->common.blk; BlockDriverState *bs = blk_bs(blk); @@ -206,6 +206,7 @@ out: data = g_malloc(sizeof(*data)); data->ret = ret; job_defer_to_main_loop(&s->common.job, stream_complete, data); + return ret; } static const BlockJobDriver stream_job_driver = { @@ -213,7 +214,7 @@ static const BlockJobDriver stream_job_driver = { .instance_size = sizeof(StreamBlockJob), .job_type = JOB_TYPE_STREAM, .free = block_job_free, - .start = stream_run, + .run = stream_run, .user_resume = block_job_user_resume, .drain = block_job_drain, }, -- cgit v1.1