From patchwork Tue Oct 8 09:29:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fam Zheng X-Patchwork-Id: 281380 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 7C4622C00AD for ; Tue, 8 Oct 2013 20:31:02 +1100 (EST) Received: from localhost ([::1]:35459 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VTTd6-00005L-7g for incoming@patchwork.ozlabs.org; Tue, 08 Oct 2013 05:31:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49938) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VTTcE-0008Go-Px for qemu-devel@nongnu.org; Tue, 08 Oct 2013 05:30:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VTTc8-0007e9-ND for qemu-devel@nongnu.org; Tue, 08 Oct 2013 05:30:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:8443) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VTTc8-0007e5-FI for qemu-devel@nongnu.org; Tue, 08 Oct 2013 05:30:00 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r989Txv7030384 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 8 Oct 2013 05:30:00 -0400 Received: from T430s.nay.redhat.com ([10.66.6.118]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r989Tftr007590; Tue, 8 Oct 2013 05:29:56 -0400 From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 8 Oct 2013 17:29:40 +0800 Message-Id: <1381224580-14950-4-git-send-email-famz@redhat.com> In-Reply-To: <1381224580-14950-1-git-send-email-famz@redhat.com> References: <1381224580-14950-1-git-send-email-famz@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, stefanha@redhat.com Subject: [Qemu-devel] [PATCH 3/3] qapi: make use of new BlockJobType X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Switch the string to enum type BlockJobType in BlockJobDriver. Signed-off-by: Fam Zheng --- block/backup.c | 2 +- block/commit.c | 2 +- block/mirror.c | 2 +- block/stream.c | 2 +- blockjob.c | 4 ++-- include/block/blockjob.h | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/block/backup.c b/block/backup.c index d374472..cad14c9 100644 --- a/block/backup.c +++ b/block/backup.c @@ -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, }; diff --git a/block/commit.c b/block/commit.c index 5146138..d4090cb 100644 --- a/block/commit.c +++ b/block/commit.c @@ -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, }; diff --git a/block/mirror.c b/block/mirror.c index 991cc24..7b95acf 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -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, diff --git a/block/stream.c b/block/stream.c index 7f412bd..694fd42 100644 --- a/block/stream.c +++ b/block/stream.c @@ -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, }; diff --git a/blockjob.c b/blockjob.c index 6814e69..9e5fd5c 100644 --- a/blockjob.c +++ b/blockjob.c @@ -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; @@ -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, diff --git a/include/block/blockjob.h b/include/block/blockjob.h index 99359b5..d76de62 100644 --- a/include/block/blockjob.h +++ b/include/block/blockjob.h @@ -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);