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 <jsnow@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Message-id: 20180830015734.19765-2-jsnow@redhat.com
Reviewed-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
John Snow 2018-08-29 21:57:26 -04:00 committed by Max Reitz
parent 7b43db3cd0
commit f67432a201
10 changed files with 43 additions and 34 deletions

6
job.c
View file

@ -544,16 +544,16 @@ static void coroutine_fn job_co_entry(void *opaque)
{
Job *job = opaque;
assert(job && job->driver && job->driver->start);
assert(job && job->driver && job->driver->run);
job_pause_point(job);
job->driver->start(job);
job->ret = job->driver->run(job, NULL);
}
void job_start(Job *job)
{
assert(job && !job_started(job) && job->paused &&
job->driver && job->driver->start);
job->driver && job->driver->run);
job->co = qemu_coroutine_create(job_co_entry, job);
job->pause_count--;
job->busy = true;