From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:47835) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCRdE-0002QE-Hx for qemu-devel@nongnu.org; Tue, 27 Mar 2012 04:19:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SCRd8-00052Z-0B for qemu-devel@nongnu.org; Tue, 27 Mar 2012 04:19:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48663) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCRd7-00052J-OQ for qemu-devel@nongnu.org; Tue, 27 Mar 2012 04:19:49 -0400 Message-ID: <4F71780B.3070103@redhat.com> Date: Tue, 27 Mar 2012 10:19:23 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1332740423-8426-1-git-send-email-zwu.kernel@gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC 0/9] QOM: qomify -netdev List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Zhi Yong Wu Cc: Stefan Hajnoczi , Zhi Yong Wu , qemu-devel@nongnu.org, stefanha@linux.vnet.ibm.com 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