qemu-trivial
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-trivial] [PATCH v6] qdev: Add support for property type bool


From: Jan Kiszka
Subject: Re: [Qemu-trivial] [PATCH v6] qdev: Add support for property type bool
Date: Tue, 24 Jan 2012 18:59:36 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

On 2012-01-24 18:38, Andreas Färber wrote:
> Am 24.01.2012 18:29, schrieb Jan Kiszka:
>> On 2012-01-24 18:17, Andreas Färber wrote:
>>> From: Andreas Färber <address@hidden>
>>>
>>> VMState supports the type bool but qdev instead supports bit, backed by
>>> uint32_t. Therefore let's add DEFINE_PROP_BOOL() and qdev_prop_set_bool().
>>>
>>> bool by definition is either true or false. Should the need arise to
>>> parse yes/no, on/off, 1/0 or whatever as well, we can still add that at
>>> a later point in time.
>>
>> To make it a real replacement for PROP_TYPE_BIT, let's use on/off, also
>> for printing. Not only programmers may use this interface. ;)
> 
> Actually non-programmers are the reason for this: cache=on/off makes a
> great deal of sense in English (noun), but not enabled=off (adjective),
> which was my use case of this patch for ISA devices.

Agreed, there are use cases for both.

> 
> I'm fine with accepting the whole range of possibilities for parsing.
> For printing I see no reason to, since there's no legacy users of this
> new type we could break. true/false seemed better than yes/no.

We have a few single-bit booleans I would like to convert to bool. So
the best option may be having control over what is printed. Could we
easily provide a PROP_TYPE_SWITCH based on bool?

> 
>>> +PropertyInfo qdev_prop_bool = {
>>> +    .name = "bool",
>>
>> Now we have "bool" and "boolean". Can we rename the latter to bit?
> 
> I'd be fine with that, just don't know if that would break anything
> elsewhere for qdev or QOM?

Hmm, to me it looks like it's only used for verbose error reporting. But
I may miss something.

Jan

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux



reply via email to

[Prev in Thread] Current Thread [Next in Thread]