From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:50387) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWHXB-0005Xx-LE for qemu-devel@nongnu.org; Thu, 01 Dec 2011 20:03:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RWHXA-0001kI-Lz for qemu-devel@nongnu.org; Thu, 01 Dec 2011 20:03:25 -0500 Received: from mail-yx0-f173.google.com ([209.85.213.173]:41730) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RWHXA-0001k6-I9 for qemu-devel@nongnu.org; Thu, 01 Dec 2011 20:03:24 -0500 Received: by yenq3 with SMTP id q3so3039001yen.4 for ; Thu, 01 Dec 2011 17:03:23 -0800 (PST) Message-ID: <4ED823D7.3030207@codemonkey.ws> Date: Thu, 01 Dec 2011 19:03:19 -0600 From: Anthony Liguori MIME-Version: 1.0 References: <1322687028-29714-1-git-send-email-aliguori@us.ibm.com> <1322687028-29714-3-git-send-email-aliguori@us.ibm.com> <4ED7A276.4080803@redhat.com> In-Reply-To: <4ED7A276.4080803@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 02/18] qom: register legacy properties as new style properties List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: Kevin Wolf , Peter Maydell , Anthony Liguori , Stefan Hajnoczi , Jan Kiszka , qemu-devel@nongnu.org, Markus Armbruster , Luiz Capitulino On 12/01/2011 09:51 AM, Gerd Hoffmann wrote: > Hi, > >> + for (prop = dev->info->props; prop&& prop->name; prop++) { >> + qdev_property_add_legacy(dev, prop, NULL); >> + } > > bus properties? Hrm, okay, I can fix that. Thanks for pointing that out. > >> +static void qdev_get_legacy_property(DeviceState *dev, Visitor *v, void *opaque, >> + const char *name, Error **errp) >> +{ >> + Property *prop = opaque; >> + >> + if (prop->info->print) { >> + char buffer[1024]; >> + char *ptr = buffer; >> + >> + prop->info->print(dev, prop, buffer, sizeof(buffer)); >> + visit_type_str(v,&ptr, name, errp); > > I think you can look at prop->info->type here and do something more > clever at least for the bool + integer properties. That might get a little tough because I want legacy<> types to be handled as strings. I guess we could promote bool/int to non-legacy types. Regards, Anthony Liguori > > cheers, > Gerd >