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 <pbonz...@redhat.com> > > 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:av1...@comtv.ru