Skip to content

Commit

Permalink
qapi: make use of new BlockJobType
Browse files Browse the repository at this point in the history
Switch the string to enum type BlockJobType in BlockJobDriver.

Signed-off-by: Fam Zheng <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Kevin Wolf <[email protected]>
  • Loading branch information
Fam Zheng authored and kevmw committed Oct 11, 2013
1 parent 2cb5b22 commit 79e14bf
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion block/backup.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ static void backup_iostatus_reset(BlockJob *job)

static const BlockJobDriver backup_job_driver = {
.instance_size = sizeof(BackupBlockJob),
.job_type = "backup",
.job_type = BLOCK_JOB_TYPE_BACKUP,
.set_speed = backup_set_speed,
.iostatus_reset = backup_iostatus_reset,
};
Expand Down
2 changes: 1 addition & 1 deletion block/commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ static void commit_set_speed(BlockJob *job, int64_t speed, Error **errp)

static const BlockJobDriver commit_job_driver = {
.instance_size = sizeof(CommitBlockJob),
.job_type = "commit",
.job_type = BLOCK_JOB_TYPE_COMMIT,
.set_speed = commit_set_speed,
};

Expand Down
2 changes: 1 addition & 1 deletion block/mirror.c
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ static void mirror_complete(BlockJob *job, Error **errp)

static const BlockJobDriver mirror_job_driver = {
.instance_size = sizeof(MirrorBlockJob),
.job_type = "mirror",
.job_type = BLOCK_JOB_TYPE_MIRROR,
.set_speed = mirror_set_speed,
.iostatus_reset= mirror_iostatus_reset,
.complete = mirror_complete,
Expand Down
2 changes: 1 addition & 1 deletion block/stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ static void stream_set_speed(BlockJob *job, int64_t speed, Error **errp)

static const BlockJobDriver stream_job_driver = {
.instance_size = sizeof(StreamBlockJob),
.job_type = "stream",
.job_type = BLOCK_JOB_TYPE_STREAM,
.set_speed = stream_set_speed,
};

Expand Down
4 changes: 2 additions & 2 deletions blockjob.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ void block_job_sleep_ns(BlockJob *job, QEMUClockType type, int64_t ns)
BlockJobInfo *block_job_query(BlockJob *job)
{
BlockJobInfo *info = g_new0(BlockJobInfo, 1);
info->type = g_strdup(job->driver->job_type);
info->type = g_strdup(BlockJobType_lookup[job->driver->job_type]);
info->device = g_strdup(bdrv_get_device_name(job->bs));
info->len = job->len;
info->busy = job->busy;
Expand All @@ -236,7 +236,7 @@ QObject *qobject_from_block_job(BlockJob *job)
"'len': %" PRId64 ","
"'offset': %" PRId64 ","
"'speed': %" PRId64 " }",
job->driver->job_type,
BlockJobType_lookup[job->driver->job_type],
bdrv_get_device_name(job->bs),
job->len,
job->offset,
Expand Down
2 changes: 1 addition & 1 deletion include/block/blockjob.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ typedef struct BlockJobDriver {
size_t instance_size;

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

/** Optional callback for job types that support setting a speed limit */
void (*set_speed)(BlockJob *job, int64_t speed, Error **errp);
Expand Down

0 comments on commit 79e14bf

Please sign in to comment.