Am 26.01.2012 16:27, schrieb Andreas Färber:
> From: Andreas Färber <[email protected]>
>
> VMState supports the type bool but qdev instead supports bit, backed by
> uint32_t. Therefore let's add PROP_TYPE_BOOL and qdev_prop_set_bool().
>
> With non-programmers in mind, instead of universal true/false provide
> two different property types:
> * on/off for DEFINE_PROP_SWITCH() (requested by Jan) and
> * yes/no for DEFINE_PROP_BOOL() (also accepting true/false as input).
>
> Signed-off-by: Andreas Färber <[email protected]>
> Cc: Juan Quintela <[email protected]>
> Cc: Markus Armbruster <[email protected]>
> Cc: Jan Kiszka <[email protected]>
> Cc: Vasilis Liaskovitis <[email protected]>
> ---
> v6 -> v7:
> * Rename existing "boolean" type to "bit".
> * Re-introduce qdev_prop_set_bool().
> * Split "bool" into "switch" (on/off) and "boolean" (yes/no; true/false
> input).
>
> v5 -> v6:
> * Rebased onto QOM properties.
> * Parse and print true/false for bool, leave bit untouched.
> Please review, v6 untested.
> [* Accidentally dropped qdev_prop_set_bool().]
>
> v4 -> v5 (40P):
> * Parse on/off in addition to yes/no for both bit and bool, print yes/no for
> bool.
>
> v4 (ISA):
> * Introduced.
>
> hw/qdev-properties.c | 102
> +++++++++++++++++++++++++++++++++++++++++++++++++-
> hw/qdev.h | 7 +++
> 2 files changed, 108 insertions(+), 1 deletions(-)
> diff --git a/hw/qdev.h b/hw/qdev.h
> index 6b58dd8..37167d4 100644
> --- a/hw/qdev.h
> +++ b/hw/qdev.h
> @@ -152,6 +152,7 @@ enum PropertyType {
> PROP_TYPE_VLAN,
> PROP_TYPE_PTR,
> PROP_TYPE_BIT,
> + PROP_TYPE_BOOL,
> };
>
> struct PropertyInfo {
> @@ -276,6 +277,7 @@ int do_device_del(Monitor *mon, const QDict *qdict,
> QObject **ret_data);
> /*** qdev-properties.c ***/
>
> extern PropertyInfo qdev_prop_bit;
> +extern PropertyInfo qdev_prop_bool;
Sorry, missing
extern PropertyInfo qdev_prop_bool_switch;
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg