mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
job: Move BlockJobCreateFlags to Job
This renames the BlockJobCreateFlags constants, moves a few JOB_INTERNAL checks to job_create() and the auto_{finalize,dismiss} fields from BlockJob to Job. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
parent
dbe5e6c1f7
commit
bb02b65c7d
13 changed files with 53 additions and 57 deletions
11
job.c
11
job.c
|
@ -182,11 +182,15 @@ static void job_sleep_timer_cb(void *opaque)
|
|||
}
|
||||
|
||||
void *job_create(const char *job_id, const JobDriver *driver, AioContext *ctx,
|
||||
Error **errp)
|
||||
int flags, Error **errp)
|
||||
{
|
||||
Job *job;
|
||||
|
||||
if (job_id) {
|
||||
if (flags & JOB_INTERNAL) {
|
||||
error_setg(errp, "Cannot specify job ID for internal job");
|
||||
return NULL;
|
||||
}
|
||||
if (!id_wellformed(job_id)) {
|
||||
error_setg(errp, "Invalid job ID '%s'", job_id);
|
||||
return NULL;
|
||||
|
@ -195,6 +199,9 @@ void *job_create(const char *job_id, const JobDriver *driver, AioContext *ctx,
|
|||
error_setg(errp, "Job ID '%s' already in use", job_id);
|
||||
return NULL;
|
||||
}
|
||||
} else if (!(flags & JOB_INTERNAL)) {
|
||||
error_setg(errp, "An explicit job ID is required");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
job = g_malloc0(driver->instance_size);
|
||||
|
@ -205,6 +212,8 @@ void *job_create(const char *job_id, const JobDriver *driver, AioContext *ctx,
|
|||
job->busy = false;
|
||||
job->paused = true;
|
||||
job->pause_count = 1;
|
||||
job->auto_finalize = !(flags & JOB_MANUAL_FINALIZE);
|
||||
job->auto_dismiss = !(flags & JOB_MANUAL_DISMISS);
|
||||
|
||||
job_state_transition(job, JOB_STATUS_CREATED);
|
||||
aio_timer_init(qemu_get_aio_context(), &job->sleep_timer,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue