aboutsummaryrefslogtreecommitdiff
path: root/job.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2018-04-24 17:10:12 +0200
committerKevin Wolf <kwolf@redhat.com>2018-05-23 14:30:51 +0200
commit5f9a6a08e8f65e01746d2485fc65a3a78e74865f (patch)
tree48101bce5087ce23d966590f75d9697f837e0b0a /job.c
parent198c49cc8d81e8eb0df3749d395599895c3a3a76 (diff)
job: Add job_dismiss()
This moves block_job_dismiss() to the Job layer. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'job.c')
-rw-r--r--job.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/job.c b/job.c
index eede6802ae..7cd3602782 100644
--- a/job.c
+++ b/job.c
@@ -568,7 +568,7 @@ void job_user_resume(Job *job, Error **errp)
job_resume(job);
}
-void job_do_dismiss(Job *job)
+static void job_do_dismiss(Job *job)
{
assert(job);
job->busy = false;
@@ -581,6 +581,19 @@ void job_do_dismiss(Job *job)
job_unref(job);
}
+void job_dismiss(Job **jobptr, Error **errp)
+{
+ Job *job = *jobptr;
+ /* similarly to _complete, this is QMP-interface only. */
+ assert(job->id);
+ if (job_apply_verb(job, JOB_VERB_DISMISS, errp)) {
+ return;
+ }
+
+ job_do_dismiss(job);
+ *jobptr = NULL;
+}
+
void job_early_fail(Job *job)
{
assert(job->status == JOB_STATUS_CREATED);