Received: from eggs.gnu.org ([208.118.235.92]:43339) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXyUZ-0000NM-Kg for qemu-devel@nongnu.org; Fri, 25 May 2012 13:40:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SXyUX-0000NO-Qz for qemu-devel@nongnu.org; Fri, 25 May 2012 13:39:59 -0400 Received: from fe01x03-cgp.akado.ru ([77.232.31.164]:57424 helo=akado.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXyUX-0000Mo-KB for qemu-devel@nongnu.org; Fri, 25 May 2012 13:39:57 -0400 Date: Fri, 25 May 2012 21:39:34 +0400 (MSK) From: malc In-Reply-To: <4FBFB446.7080105@suse.de> Message-ID: References: <1337787881-3579-1-git-send-email-pbonzini@redhat.com> <1337787881-3579-5-git-send-email-pbonzini@redhat.com> <4FBFB446.7080105@suse.de> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [Qemu-devel] [PATCH 04/10] qom: add get_id List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?ISO-8859-15?Q?Andreas_F=E4rber?= Cc: Peter Maydell , Paolo Bonzini , qemu-devel@nongnu.org, Anthony Liguori , Igor Mammedov On Fri, 25 May 2012, Andreas F?rber wrote: > Am 23.05.2012 17:44, schrieb Paolo Bonzini: > > Some classes may present objects differently in errors, for example if they > > are not part of the composition tree or if they are not assigned an id by > > the user. Let them do this with a get_id method on Object, and use the > > method consistently where a %(device) appears in the error. > > > > Signed-off-by: Paolo Bonzini > > This patch looks new, so it's not covered by Anthony's carte blanche to > take Paolo's patches into qom-next. > > Generally I'm fine with it, some formal issues below. > > > --- > > hw/qdev-properties.c | 6 +++--- > > hw/qdev.c | 15 ++++++++++++++- > > include/qemu/object.h | 11 +++++++++++ > > qom/object.c | 26 +++++++++++++++++++++++++- > > 4 files changed, 53 insertions(+), 5 deletions(-) > > > diff --git a/hw/qdev.c b/hw/qdev.c > > index e909f3b..5d6dc1f 100644 > > --- a/hw/qdev.c > > +++ b/hw/qdev.c > [...] > > @@ -714,6 +714,13 @@ static void device_finalize(Object *obj) > > } > > } > > > > +static const char *qdev_get_id(Object *obj) > > +{ > > + DeviceState *dev = DEVICE(obj); > > + > > + return dev->id?:object_get_typename(obj); > > Spaces around ?: please. Even better is to not use gcc extensions like this one. > > > +} > > + > > static void device_class_base_init(ObjectClass *class, void *data) > > { > > DeviceClass *klass = DEVICE_CLASS(class); > [...] > > diff --git a/qom/object.c b/qom/object.c > > index 68a4c57..b19ef94 100644 > > --- a/qom/object.c > > +++ b/qom/object.c > > @@ -334,6 +334,24 @@ static void object_property_del_child(Object *obj, Object *child, Error **errp) > > } > > } > > > > +static const char *_object_get_id(Object *obj) > > malc's alarm bells will be ringing: Use of an identifier starting with > underscore. Given that it's forbidden in this context - yeah. [..snip..] -- mailto:av1474@comtv.ru