qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC 0/9] QOM: qomify -netdev


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [RFC 0/9] QOM: qomify -netdev
Date: Tue, 27 Mar 2012 10:19:23 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.1) Gecko/20120216 Thunderbird/10.0.1

Il 26/03/2012 16:20, Zhi Yong Wu ha scritto:
> struct PropertyInfo {
>     const char *name;
>     const char *legacy_name;
>     const char **enum_table;
>     int64_t min;
>     int64_t max;
>     int (*parse)(DeviceState *dev, Property *prop, const char *str);
>     int (*print)(DeviceState *dev, Property *prop, char *dest, size_t len);
>     ObjectPropertyAccessor *get;
>     ObjectPropertyAccessor *set;
>     ObjectPropertyRelease *release;
> };
> 
> Like above, its member functions pointers use DeviceState, so we will
> have to consider how to make this PropertyInfo more generic and be
> used by other Class and Object which are not based on DeviceState.

The member functions do not really do anything that is
DeviceState-specific.  You can change the argument to Object and add a
cast inside the implementations.

Besides, most property types do not have parse/print anymore.  Another
possibility would be to forbid hexNN types for non-DeviceState, since
only those have parse/print.

Paolo



reply via email to

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