Re: [Qemu-devel] [RFC PATCH 08/33] job: Rename BlockJobType into JobType

2018-04-24 Thread Eric Blake
On 04/24/2018 10:24 AM, Kevin Wolf wrote:
> 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 
> ---

Reviewed-by: Eric Blake 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.   +1-919-301-3266
Virtualization:  qemu.org | libvirt.org



signature.asc
Description: OpenPGP digital signature


[Qemu-devel] [RFC PATCH 08/33] job: Rename BlockJobType into JobType

2018-04-24 Thread Kevin Wolf
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 
---
 qapi/block-core.json | 14 +++---
 include/block/blockjob_int.h |  2 +-
 block/backup.c   |  2 +-
 block/commit.c   |  2 +-
 block/mirror.c   |  4 ++--
 block/stream.c   |  2 +-
 blockjob.c   |  6 +++---
 7 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/qapi/block-core.json b/qapi/block-core.json
index c50517bff3..f2579d46f8 100644
--- a/qapi/block-core.json
+++ b/qapi/block-core.json
@@ -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"
 #
@@ -1064,7 +1064,7 @@
 #
 # Since: 1.7
 ##
-{ 'enum': 'BlockJobType',
+{ 'enum': 'JobType',
   'data': ['commit', 'stream', 'mirror', 'backup'] }
 
 ##
@@ -4485,7 +4485,7 @@
 #
 ##
 { 'event': 'BLOCK_JOB_COMPLETED',
-  'data': { 'type'  : 'BlockJobType',
+  'data': { 'type'  : 'JobType',
 'device': 'str',
 'len'   : 'int',
 'offset': 'int',
@@ -4521,7 +4521,7 @@
 #
 ##
 { 'event': 'BLOCK_JOB_CANCELLED',
-  'data': { 'type'  : 'BlockJobType',
+  'data': { 'type'  : 'JobType',
 'device': 'str',
 'len'   : 'int',
 'offset': 'int',
@@ -4586,7 +4586,7 @@
 #
 ##
 { 'event': 'BLOCK_JOB_READY',
-  'data': { 'type'  : 'BlockJobType',
+  'data': { 'type'  : 'JobType',
 'device': 'str',
 'len'   : 'int',
 'offset': 'int',
@@ -4613,7 +4613,7 @@
 #
 ##
 { 'event': 'BLOCK_JOB_PENDING',
-  'data': { 'type'  : 'BlockJobType',
+  'data': { 'type'  : 'JobType',
 'id': 'str' } }
 
 ##
diff --git a/include/block/blockjob_int.h b/include/block/blockjob_int.h
index a357ad6c5e..354d43 100644
--- a/include/block/blockjob_int.h
+++ b/include/block/blockjob_int.h
@@ -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;
diff --git a/block/backup.c b/block/backup.c
index fa468a64bb..1a23e6fb63 100644
--- a/block/backup.c
+++ b/block/backup.c
@@ -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,
diff --git a/block/commit.c b/block/commit.c
index 18cbb2f9c4..afa2b2bacf 100644
--- a/block/commit.c
+++ b/block/commit.c
@@ -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,
 };
 
diff --git a/block/mirror.c b/block/mirror.c
index 84de8105e6..8cf275d87f 100644
--- a/block/mirror.c
+++ b/block/mirror.c
@@ -985,7 +985,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,
@@ -997,7 +997,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,
diff --git a/block/stream.c b/block/stream.c
index f88fc75141..048bceb5d0 100644
--- a/block/stream.c
+++ b/block/stream.c
@@ -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,
 };
 
diff --git a/blockjob.c b/blockjob.c
index abdfc68729..dad6e509f0 100644
--- a/blockjob.c
+++ b/blockjob.c
@@ -296,7 +296,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),
+