|
From: | Anthony Liguori |
Subject: | Re: [Qemu-devel] [PATCH v2] qom: Introduce object_realize_nofail() |
Date: | Thu, 12 Apr 2012 14:59:51 -0500 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120310 Thunderbird/11.0 |
On 04/12/2012 11:52 AM, Andreas Färber wrote:
Am 12.04.2012 17:41, schrieb Anthony Liguori:On 04/12/2012 09:04 AM, Andreas Färber wrote:Am 12.04.2012 16:59, schrieb Paolo Bonzini:Il 12/04/2012 16:47, Anthony Liguori ha scritto:Wrap setting of Object::realized property, error reporting and exit(1) into a helper function. It is the equivalent of qdev_init_nofail().I don't like this. If for no reason other than, a much more specific justification is needed for this. I absolutely don't want to repeat the error handling mistakes of qdev. I would rather we refactor all of the users of qdev_init_nofail() to propagate errors.I agree about this in general, but for a different reason. There should be only one call to object_realize_nofail, in vl.c, which might as well be inlined---I'll include it in my series. All calls to qdev_init_nofail and qdev_init should disappear from boards that are properly converted to QOM.We had talked about this on IRC and found that it won't work for selecting the type of an object.Can you be more specific? Selecting the type of an object should be done by having a link<> property and letting the user create an object and setup the link.No, that's not what a link does. A link<> property lets the user associate one instance, not a type that can be used for multiple instances. We'd need a template<> or clone<> mechanism for that!
No, you misunderstood. A link allows a user to create an object and make an associate. If you want to let a user choose a type, just have them make an object. Since you need no parameters to create an object, there's no advantage of telling something about a type name vs. giving it an object of that type.
Regards, Anthony Liguori
For example, the user specifies -cpu cortex-a9,+neon,-fpu and we have a dual-core exynos4210 SoC. I originally had a patch on my qom-cpu-sh4 v1 series where exactly such a link got criticized by Peter: http://patchwork.ozlabs.org/patch/146669/ And I agree, it was an ugly workaround around the missing two-stage constructor support. Therefore I had posted my object_realize() series! https://github.com/afaerber/qemu-cpu/commit/32e4dd701694fffcf312d111c79eedad243be2b3 Andreas
[Prev in Thread] | Current Thread | [Next in Thread] |