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 <andreas.faer...@web.de> >>> >>> 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