From: Jeff Cody <jcody@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: qemu-devel@nongnu.org, kwolf@redhat.com, mreitz@redhat.com,
qemu-block@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] blockjob: use qapi enum helpers
Date: Wed, 28 Mar 2018 14:25:10 -0400 [thread overview]
Message-ID: <20180328182510.GB30186@localhost.localdomain> (raw)
In-Reply-To: <20180327153011.29569-1-marcandre.lureau@redhat.com>
On Tue, Mar 27, 2018 at 05:30:11PM +0200, Marc-André Lureau wrote:
> QAPI generator provide #define helpers for looking up enum string.
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> blockjob.c | 14 +++++---------
> 1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/blockjob.c b/blockjob.c
> index ef3ed69ff1..11c9ce124d 100644
> --- a/blockjob.c
> +++ b/blockjob.c
> @@ -75,10 +75,8 @@ static void block_job_state_transition(BlockJob *job, BlockJobStatus s1)
> assert(s1 >= 0 && s1 <= BLOCK_JOB_STATUS__MAX);
> trace_block_job_state_transition(job, job->ret, BlockJobSTT[s0][s1] ?
> "allowed" : "disallowed",
> - qapi_enum_lookup(&BlockJobStatus_lookup,
> - s0),
> - qapi_enum_lookup(&BlockJobStatus_lookup,
> - s1));
> + BlockJobStatus_str(s0),
> + BlockJobStatus_str(s1));
> assert(BlockJobSTT[s0][s1]);
> job->status = s1;
> }
> @@ -86,17 +84,15 @@ static void block_job_state_transition(BlockJob *job, BlockJobStatus s1)
> static int block_job_apply_verb(BlockJob *job, BlockJobVerb bv, Error **errp)
> {
> assert(bv >= 0 && bv <= BLOCK_JOB_VERB__MAX);
> - trace_block_job_apply_verb(job, qapi_enum_lookup(&BlockJobStatus_lookup,
> - job->status),
> - qapi_enum_lookup(&BlockJobVerb_lookup, bv),
> + trace_block_job_apply_verb(job, BlockJobStatus_str(job->status),
> + BlockJobVerb_str(bv),
> BlockJobVerbTable[bv][job->status] ?
> "allowed" : "prohibited");
> if (BlockJobVerbTable[bv][job->status]) {
> return 0;
> }
> error_setg(errp, "Job '%s' in state '%s' cannot accept command verb '%s'",
> - job->id, qapi_enum_lookup(&BlockJobStatus_lookup, job->status),
> - qapi_enum_lookup(&BlockJobVerb_lookup, bv));
> + job->id, BlockJobStatus_str(job->status), BlockJobVerb_str(bv));
> return -EPERM;
> }
>
> --
> 2.17.0.rc1.1.g4c4f2b46a3
>
Thanks,
Looks like a bug fix to me.
Applied to my block branch:
git://github.com/codyprime/qemu-kvm-jtc block
-Jeff
next prev parent reply other threads:[~2018-03-28 18:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-27 15:30 [Qemu-devel] [PATCH] blockjob: use qapi enum helpers Marc-André Lureau
2018-03-27 16:42 ` [Qemu-devel] [Qemu-block] " John Snow
2018-03-28 18:25 ` Jeff Cody [this message]
2018-03-31 7:18 ` [Qemu-devel] " no-reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180328182510.GB30186@localhost.localdomain \
--to=jcody@redhat.com \
--cc=kwolf@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).