From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:51246) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rt2uy-0006nw-DY for qemu-devel@nongnu.org; Thu, 02 Feb 2012 15:06:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rt2uu-0003pe-28 for qemu-devel@nongnu.org; Thu, 02 Feb 2012 15:06:04 -0500 Received: from mail-pz0-f45.google.com ([209.85.210.45]:64345) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rt2ut-0003pa-SX for qemu-devel@nongnu.org; Thu, 02 Feb 2012 15:06:00 -0500 Received: by dadp14 with SMTP id p14so2695218dad.4 for ; Thu, 02 Feb 2012 12:05:59 -0800 (PST) Message-ID: <4F2AECA3.6070609@codemonkey.ws> Date: Thu, 02 Feb 2012 14:05:55 -0600 From: Anthony Liguori MIME-Version: 1.0 References: <1328201142-26145-1-git-send-email-pbonzini@redhat.com> <1328201142-26145-10-git-send-email-pbonzini@redhat.com> In-Reply-To: <1328201142-26145-10-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 09/16] qdev: remove parse/print methods for mac properties List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org On 02/02/2012 10:45 AM, Paolo Bonzini wrote: > Signed-off-by: Paolo Bonzini > --- > hw/qdev-properties.c | 61 ++++++++++++++++++++++++++++++++++--------------- > 1 files changed, 42 insertions(+), 19 deletions(-) > > diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c > index 0a293af..4fb5cf8 100644 > --- a/hw/qdev-properties.c > +++ b/hw/qdev-properties.c > @@ -848,46 +848,69 @@ PropertyInfo qdev_prop_ptr = { > * 01:02:03:04:05:06 > * 01-02-03-04-05-06 > */ > -static int parse_mac(DeviceState *dev, Property *prop, const char *str) > +static void get_mac(Object *obj, Visitor *v, void *opaque, > + const char *name, Error **errp) > +{ > + DeviceState *dev = DEVICE(obj); > + Property *prop = opaque; > + MACAddr *mac = qdev_get_prop_ptr(dev, prop); > + char buffer[2 * 6 + 5 + 1]; > + char *p = buffer; > + > + snprintf(buffer, sizeof(buffer), "%02x:%02x:%02x:%02x:%02x:%02x", > + mac->a[0], mac->a[1], mac->a[2], > + mac->a[3], mac->a[4], mac->a[5]); > + > + visit_type_str(v,&p, name, errp); > +} Part of me wonders, given that we can structure properties in a more friendly way, would we still do macs as strings? Would we instead do a list of ints or something like that? Regards, Anthony Liguori