diff options
author | John Snow <jsnow@redhat.com> | 2018-08-29 21:57:33 -0400 |
---|---|---|
committer | Max Reitz <mreitz@redhat.com> | 2018-08-31 16:28:33 +0200 |
commit | 404ff28d6ae59fc1c24d631710d4063fc68aed03 (patch) | |
tree | 3a3372e88ef7416810959e99d312d0ac7c6defbe /job.c | |
parent | 6870277535493fea31761d8d11ec23add2de0fb0 (diff) | |
download | qemu-404ff28d6ae59fc1c24d631710d4063fc68aed03.zip qemu-404ff28d6ae59fc1c24d631710d4063fc68aed03.tar.gz qemu-404ff28d6ae59fc1c24d631710d4063fc68aed03.tar.bz2 |
jobs: remove ret argument to job_completed; privatize it
Jobs are now expected to return their retcode on the stack, from the
.run callback, so we can remove that argument.
job_cancel does not need to set -ECANCELED because job_completed will
update the return code itself if the job was canceled.
While we're here, make job_completed static to job.c and remove it from
job.h; move the documentation of return code to the .run() callback and
to the job->ret property, accordingly.
Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 20180830015734.19765-9-jsnow@redhat.com
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'job.c')
-rw-r--r-- | job.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -535,6 +535,8 @@ void job_drain(Job *job) } } +static void job_completed(Job *job); + static void job_exit(void *opaque) { Job *job = (Job *)opaque; @@ -545,7 +547,7 @@ static void job_exit(void *opaque) job->driver->exit(job); aio_context_release(aio_context); } - job_completed(job, job->ret); + job_completed(job); } /** @@ -883,13 +885,12 @@ static void job_completed_txn_success(Job *job) } } -void job_completed(Job *job, int ret) +static void job_completed(Job *job) { assert(job && job->txn && !job_is_completed(job)); - job->ret = ret; job_update_rc(job); - trace_job_completed(job, ret, job->ret); + trace_job_completed(job, job->ret); if (job->ret) { job_completed_txn_abort(job); } else { @@ -905,7 +906,7 @@ void job_cancel(Job *job, bool force) } job_cancel_async(job, force); if (!job_started(job)) { - job_completed(job, -ECANCELED); + job_completed(job); } else if (job->deferred_to_main_loop) { job_completed_txn_abort(job); } else { |