Re: [Qemu-devel] [PATCH RFC 0/2] QMP command qom-new

2012-05-24 Thread Peter Maydell
On 24 May 2012 15:35, Anthony Liguori wrote: > Ah, okay.  So you're taking those comments a bit out of context. > > The right way to use object_new() is: > > Object *foo = object_new(TYPE_E1000); > > If you mistype TYPE_E1000, you should get a compile failure.  There's > basically no way that this

Re: [Qemu-devel] [PATCH RFC 0/2] QMP command qom-new

2012-05-24 Thread Markus Armbruster
Andreas Färber writes: > Am 24.05.2012 16:08, schrieb Markus Armbruster: >> Andreas Färber writes: >> >>> Am 24.05.2012 13:43, schrieb Markus Armbruster: Beware: second patch is the product of voodoo-coding. >>> >>> Hm, I don't like the voodoo. ;) I would rather expose a proper C API >>> l

Re: [Qemu-devel] [PATCH RFC 0/2] QMP command qom-new

2012-05-24 Thread Anthony Liguori
On 05/24/2012 09:23 AM, Peter Maydell wrote: On 24 May 2012 15:10, Anthony Liguori wrote: On 05/24/2012 08:18 AM, Peter Maydell wrote: Last time I was trying to argue for keeping the "create, set properties, realize" interface for devices/objects as simple as possible you wanted it to have an

Re: [Qemu-devel] [PATCH RFC 0/2] QMP command qom-new

2012-05-24 Thread Andreas Färber
Am 24.05.2012 16:08, schrieb Markus Armbruster: > Andreas Färber writes: > >> Am 24.05.2012 13:43, schrieb Markus Armbruster: >>> Beware: second patch is the product of voodoo-coding. >> >> Hm, I don't like the voodoo. ;) I would rather expose a proper C API >> like object_try_new(const char *, E

Re: [Qemu-devel] [PATCH RFC 0/2] QMP command qom-new

2012-05-24 Thread Peter Maydell
On 24 May 2012 15:10, Anthony Liguori wrote: > On 05/24/2012 08:18 AM, Peter Maydell wrote: >> Last time I was trying to argue for keeping the "create, set properties, >> realize" interface for devices/objects as simple as possible you wanted >> it to have an error-return interface rather than ass

Re: [Qemu-devel] [PATCH RFC 0/2] QMP command qom-new

2012-05-24 Thread Anthony Liguori
On 05/24/2012 08:18 AM, Peter Maydell wrote: On 24 May 2012 14:06, Anthony Liguori wrote: There are very few places where errors can be handled gracefully. They are exceptions and can be treated as such. I think it's far better for the QOM infrastructure to assert when it detects something ba

Re: [Qemu-devel] [PATCH RFC 0/2] QMP command qom-new

2012-05-24 Thread Markus Armbruster
Andreas Färber writes: > Am 24.05.2012 13:43, schrieb Markus Armbruster: >> Beware: second patch is the product of voodoo-coding. > > Hm, I don't like the voodoo. ;) I would rather expose a proper C API > like object_try_new(const char *, Error **) than opening up the TypeImpl > internals to the

Re: [Qemu-devel] [PATCH RFC 0/2] QMP command qom-new

2012-05-24 Thread Peter Maydell
On 24 May 2012 14:06, Anthony Liguori wrote: > There are very few places where errors can be handled gracefully.  They are > exceptions and can be treated as such. > > I think it's far better for the QOM infrastructure to assert when it detects > something bad because 99% of the users of QOM do no

Re: [Qemu-devel] [PATCH RFC 0/2] QMP command qom-new

2012-05-24 Thread Anthony Liguori
On 05/24/2012 07:32 AM, Andreas Färber wrote: Am 24.05.2012 13:43, schrieb Markus Armbruster: Beware: second patch is the product of voodoo-coding. Hm, I don't like the voodoo. ;) I would rather expose a proper C API like object_try_new(const char *, Error **) than opening up the TypeImpl inte

Re: [Qemu-devel] [PATCH RFC 0/2] QMP command qom-new

2012-05-24 Thread Andreas Färber
Am 24.05.2012 13:43, schrieb Markus Armbruster: > Beware: second patch is the product of voodoo-coding. Hm, I don't like the voodoo. ;) I would rather expose a proper C API like object_try_new(const char *, Error **) than opening up the TypeImpl internals to the public and hand-coding it everywher

[Qemu-devel] [PATCH RFC 0/2] QMP command qom-new

2012-05-24 Thread Markus Armbruster
Beware: second patch is the product of voodoo-coding. Markus Armbruster (2): qom: Give type_get_by_name() external linkage qmp: New command qom-new include/qemu/object.h |8 qapi-schema.json | 22 ++ qmp-commands.hx |5 + qmp.c