Skip to content

Commit

Permalink
job: Rename BlockJobType into JobType
Browse files Browse the repository at this point in the history
QAPI types aren't externally visible, so we can rename them without
causing problems. Before we add a job type to Job, rename the enum
so it can be used for more than just block jobs.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
  • Loading branch information
kevmw committed May 23, 2018
1 parent 33e9e9b commit 8e4c870
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion block/backup.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ static const BlockJobDriver backup_job_driver = {
.job_driver = {
.instance_size = sizeof(BackupBlockJob),
},
.job_type = BLOCK_JOB_TYPE_BACKUP,
.job_type = JOB_TYPE_BACKUP,
.start = backup_run,
.commit = backup_commit,
.abort = backup_abort,
Expand Down
2 changes: 1 addition & 1 deletion block/commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ static const BlockJobDriver commit_job_driver = {
.job_driver = {
.instance_size = sizeof(CommitBlockJob),
},
.job_type = BLOCK_JOB_TYPE_COMMIT,
.job_type = JOB_TYPE_COMMIT,
.start = commit_run,
};

Expand Down
4 changes: 2 additions & 2 deletions block/mirror.c
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,7 @@ static const BlockJobDriver mirror_job_driver = {
.job_driver = {
.instance_size = sizeof(MirrorBlockJob),
},
.job_type = BLOCK_JOB_TYPE_MIRROR,
.job_type = JOB_TYPE_MIRROR,
.start = mirror_run,
.complete = mirror_complete,
.pause = mirror_pause,
Expand All @@ -1001,7 +1001,7 @@ static const BlockJobDriver commit_active_job_driver = {
.job_driver = {
.instance_size = sizeof(MirrorBlockJob),
},
.job_type = BLOCK_JOB_TYPE_COMMIT,
.job_type = JOB_TYPE_COMMIT,
.start = mirror_run,
.complete = mirror_complete,
.pause = mirror_pause,
Expand Down
2 changes: 1 addition & 1 deletion block/stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ static const BlockJobDriver stream_job_driver = {
.job_driver = {
.instance_size = sizeof(StreamBlockJob),
},
.job_type = BLOCK_JOB_TYPE_STREAM,
.job_type = JOB_TYPE_STREAM,
.start = stream_run,
};

Expand Down
6 changes: 3 additions & 3 deletions blockjob.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ static char *child_job_get_parent_desc(BdrvChild *c)
{
BlockJob *job = c->opaque;
return g_strdup_printf("%s job '%s'",
BlockJobType_str(job->driver->job_type),
JobType_str(job->driver->job_type),
job->job.id);
}

Expand Down Expand Up @@ -847,7 +847,7 @@ BlockJobInfo *block_job_query(BlockJob *job, Error **errp)
return NULL;
}
info = g_new0(BlockJobInfo, 1);
info->type = g_strdup(BlockJobType_str(job->driver->job_type));
info->type = g_strdup(JobType_str(job->driver->job_type));
info->device = g_strdup(job->job.id);
info->len = job->len;
info->busy = atomic_read(&job->busy);
Expand Down Expand Up @@ -980,7 +980,7 @@ void *block_job_create(const char *job_id, const BlockJobDriver *driver,
block_job_sleep_timer_cb, job);

error_setg(&job->blocker, "block device is in use by block job: %s",
BlockJobType_str(driver->job_type));
JobType_str(driver->job_type));
block_job_add_bdrv(job, "main node", bs, 0, BLK_PERM_ALL, &error_abort);
bs->job = job;

Expand Down
2 changes: 1 addition & 1 deletion include/block/blockjob_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct BlockJobDriver {
JobDriver job_driver;

/** String describing the operation, part of query-block-jobs QMP API */
BlockJobType job_type;
JobType job_type;

/** Mandatory: Entrypoint for the Coroutine. */
CoroutineEntry *start;
Expand Down
14 changes: 7 additions & 7 deletions qapi/block-core.json
Original file line number Diff line number Diff line change
Expand Up @@ -1050,9 +1050,9 @@
'data': ['top', 'full', 'none', 'incremental'] }

##
# @BlockJobType:
# @JobType:
#
# Type of a block job.
# Type of a background job.
#
# @commit: block commit job type, see "block-commit"
#
Expand All @@ -1064,7 +1064,7 @@
#
# Since: 1.7
##
{ 'enum': 'BlockJobType',
{ 'enum': 'JobType',
'data': ['commit', 'stream', 'mirror', 'backup'] }

##
Expand Down Expand Up @@ -4499,7 +4499,7 @@
#
##
{ 'event': 'BLOCK_JOB_COMPLETED',
'data': { 'type' : 'BlockJobType',
'data': { 'type' : 'JobType',
'device': 'str',
'len' : 'int',
'offset': 'int',
Expand Down Expand Up @@ -4535,7 +4535,7 @@
#
##
{ 'event': 'BLOCK_JOB_CANCELLED',
'data': { 'type' : 'BlockJobType',
'data': { 'type' : 'JobType',
'device': 'str',
'len' : 'int',
'offset': 'int',
Expand Down Expand Up @@ -4600,7 +4600,7 @@
#
##
{ 'event': 'BLOCK_JOB_READY',
'data': { 'type' : 'BlockJobType',
'data': { 'type' : 'JobType',
'device': 'str',
'len' : 'int',
'offset': 'int',
Expand All @@ -4627,7 +4627,7 @@
#
##
{ 'event': 'BLOCK_JOB_PENDING',
'data': { 'type' : 'BlockJobType',
'data': { 'type' : 'JobType',
'id' : 'str' } }

##
Expand Down

0 comments on commit 8e4c870

Please sign in to comment.