mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 02:24:58 -06:00
job: Add job_delete()
This moves freeing the Job object and its fields from block_job_unref() to job_delete(). Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com>
This commit is contained in:
parent
252291eaea
commit
fd61a701f1
3 changed files with 10 additions and 2 deletions
|
@ -261,9 +261,8 @@ void block_job_unref(BlockJob *job)
|
||||||
block_job_detach_aio_context, job);
|
block_job_detach_aio_context, job);
|
||||||
blk_unref(job->blk);
|
blk_unref(job->blk);
|
||||||
error_free(job->blocker);
|
error_free(job->blocker);
|
||||||
g_free(job->job.id);
|
|
||||||
assert(!timer_pending(&job->sleep_timer));
|
assert(!timer_pending(&job->sleep_timer));
|
||||||
g_free(job);
|
job_delete(&job->job);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,9 @@ struct JobDriver {
|
||||||
*/
|
*/
|
||||||
void *job_create(const char *job_id, const JobDriver *driver, Error **errp);
|
void *job_create(const char *job_id, const JobDriver *driver, Error **errp);
|
||||||
|
|
||||||
|
/** Frees the @job object. */
|
||||||
|
void job_delete(Job *job);
|
||||||
|
|
||||||
/** Returns the JobType of a given Job. */
|
/** Returns the JobType of a given Job. */
|
||||||
JobType job_type(const Job *job);
|
JobType job_type(const Job *job);
|
||||||
|
|
||||||
|
|
6
job.c
6
job.c
|
@ -56,3 +56,9 @@ void *job_create(const char *job_id, const JobDriver *driver, Error **errp)
|
||||||
|
|
||||||
return job;
|
return job;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void job_delete(Job *job)
|
||||||
|
{
|
||||||
|
g_free(job->id);
|
||||||
|
g_free(job);
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue