qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: Alexander Graf <agraf@suse.de>,
	qemu-devel@nongnu.org, Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH] i386: Allow cpuid bit override
Date: Tue, 28 Mar 2017 13:01:19 -0300	[thread overview]
Message-ID: <20170328160119.GA7295@thinpad.lan.raisama.net> (raw)
In-Reply-To: <39d88a40-727b-81e9-0577-27198457304e@redhat.com>

On Tue, Mar 28, 2017 at 02:41:55PM +0200, Paolo Bonzini wrote:
> 
> 
> On 28/03/2017 13:26, Alexander Graf wrote:
> >> You can define an enum type in qapi-schema.json, and use
> >> visit_type_<YourEnumType>(). You can grep for
> >> visit_type_OnOffAuto to find examples.
> >>
> >> (But I suggest naming the enum something like
> >> "X86CPUFeatureSetting" instead of "OnOffForce", because we will
> >> probably add other enum values in the future).
> >>
> >> However: we need to find a way to do this and not break
> >> compatibility with "feat=yes|true|no|false", that's supported by
> >> StringInputVisitor (which is used by object_property_parse()).
> >> Maybe fallback to visit_type_bool() in case
> >> visit_type_<YourEnumType>() fails?
> > 
> > Putting it into a special enum sounds much more fragile than the current
> > solution to me. We need to bool fallback either way, so I fail to see
> > any benefit from having the enum.
> 
> Using an on/off/force enum sounds like the right thing to do.
> 
> However, I would open code the getters and setters completely (using
> visit_type_str) instead of using visit_type_FooEnum+visit_type_bool.
> Then you can easily map yes/true to on and no/false to off.

I am wondering if it isn't simpler to define the enum to be
(on, off, force, yes, true, no, false), and document
(yes, true, no, false) as deprecated.

-- 
Eduardo

  reply	other threads:[~2017-03-28 16:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-27 22:19 [Qemu-devel] [PATCH] i386: Allow cpuid bit override Alexander Graf
2017-03-28  0:41 ` Eduardo Habkost
2017-03-28 11:26   ` Alexander Graf
2017-03-28 12:31     ` Eduardo Habkost
2017-03-28 12:35       ` Alexander Graf
2017-03-30 14:22         ` Eduardo Habkost
2017-03-30 14:23           ` Alexander Graf
2017-03-30 14:25             ` Eduardo Habkost
2017-03-30 14:27               ` Alexander Graf
2017-04-13 17:20       ` Eduardo Habkost
2017-03-28 12:41     ` Paolo Bonzini
2017-03-28 16:01       ` Eduardo Habkost [this message]
2017-03-28 16:35         ` Paolo Bonzini

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=20170328160119.GA7295@thinpad.lan.raisama.net \
    --to=ehabkost@redhat.com \
    --cc=agraf@suse.de \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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).