Re: [Qemu-devel] [PATCH] qom: helper macro for adding read-only properties

2013-09-16 Thread Andreas Färber
Am 15.09.2013 19:23, schrieb Michael S. Tsirkin: Add a helper macro for adding read-only properties, that works in the common case where the value is a constant. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- I'm using this patch in my acpi work - any objections to applying it on

Re: [Qemu-devel] [PATCH] qom: helper macro for adding read-only properties

2013-09-16 Thread Michael S. Tsirkin
On Mon, Sep 16, 2013 at 08:32:13AM +0200, Andreas Färber wrote: Am 15.09.2013 19:23, schrieb Michael S. Tsirkin: Add a helper macro for adding read-only properties, that works in the common case where the value is a constant. Signed-off-by: Michael S. Tsirkin m...@redhat.com ---

Re: [Qemu-devel] [PATCH] qom: helper macro for adding read-only properties

2013-09-16 Thread Andreas Färber
Am 16.09.2013 14:33, schrieb Michael S. Tsirkin: On Mon, Sep 16, 2013 at 08:32:13AM +0200, Andreas Färber wrote: Am 15.09.2013 19:23, schrieb Michael S. Tsirkin: Add a helper macro for adding read-only properties, that works in the common case where the value is a constant. Signed-off-by:

Re: [Qemu-devel] [PATCH] qom: helper macro for adding read-only properties

2013-09-16 Thread Michael S. Tsirkin
On Mon, Sep 16, 2013 at 08:32:13AM +0200, Andreas Färber wrote: Am 15.09.2013 19:23, schrieb Michael S. Tsirkin: Add a helper macro for adding read-only properties, that works in the common case where the value is a constant. Signed-off-by: Michael S. Tsirkin m...@redhat.com ---

Re: [Qemu-devel] [PATCH] qom: helper macro for adding read-only properties

2013-09-16 Thread Paolo Bonzini
Il 16/09/2013 17:48, Michael S. Tsirkin ha scritto: http://sweng.the-davies.net/Home/rustys-api-design-manifesto Even then: it will be at best 5. Do it right or it will always break at runtime. We need to switch to APIs at 9. The compiler/linker won't let you get it wrong. We definitely

Re: [Qemu-devel] [PATCH] qom: helper macro for adding read-only properties

2013-09-16 Thread Paolo Bonzini
Il 16/09/2013 17:24, Andreas Färber ha scritto: Shouldn't we have a constant for the realized string? That's a two-sided sword: We actually shouldn't be setting realized = true manually but once on machine init - in that case we wouldn't strictly need a constant. I pushed to get that

Re: [Qemu-devel] [PATCH] qom: helper macro for adding read-only properties

2013-09-16 Thread Paolo Bonzini
Il 16/09/2013 18:01, Michael S. Tsirkin ha scritto: On Mon, Sep 16, 2013 at 05:56:56PM +0200, Paolo Bonzini wrote: Il 16/09/2013 17:48, Michael S. Tsirkin ha scritto: http://sweng.the-davies.net/Home/rustys-api-design-manifesto Even then: it will be at best 5. Do it right or it will always

Re: [Qemu-devel] [PATCH] qom: helper macro for adding read-only properties

2013-09-16 Thread Michael S. Tsirkin
On Mon, Sep 16, 2013 at 05:56:56PM +0200, Paolo Bonzini wrote: Il 16/09/2013 17:48, Michael S. Tsirkin ha scritto: http://sweng.the-davies.net/Home/rustys-api-design-manifesto Even then: it will be at best 5. Do it right or it will always break at runtime. We need to switch to APIs

Re: [Qemu-devel] [PATCH] qom: helper macro for adding read-only properties

2013-09-16 Thread Michael S. Tsirkin
On Mon, Sep 16, 2013 at 05:24:46PM +0200, Andreas Färber wrote: Am 16.09.2013 14:33, schrieb Michael S. Tsirkin: On Mon, Sep 16, 2013 at 08:32:13AM +0200, Andreas Färber wrote: Am 15.09.2013 19:23, schrieb Michael S. Tsirkin: Add a helper macro for adding read-only properties, that works in

Re: [Qemu-devel] [PATCH] qom: helper macro for adding read-only properties

2013-09-16 Thread Michael S. Tsirkin
On Mon, Sep 16, 2013 at 06:07:33PM +0200, Paolo Bonzini wrote: Il 16/09/2013 18:01, Michael S. Tsirkin ha scritto: On Mon, Sep 16, 2013 at 05:56:56PM +0200, Paolo Bonzini wrote: Il 16/09/2013 17:48, Michael S. Tsirkin ha scritto: http://sweng.the-davies.net/Home/rustys-api-design-manifesto

Re: [Qemu-devel] [PATCH] qom: helper macro for adding read-only properties

2013-09-16 Thread Paolo Bonzini
Il 16/09/2013 18:51, Michael S. Tsirkin ha scritto: We can have make check run QEMU once for each board, which would trap things that will always break at runtime such as a misspelled property. Similarly, we could have tests that try to instantiate every device, even if they do not do

[Qemu-devel] [PATCH] qom: helper macro for adding read-only properties

2013-09-15 Thread Michael S. Tsirkin
Add a helper macro for adding read-only properties, that works in the common case where the value is a constant. Signed-off-by: Michael S. Tsirkin m...@redhat.com --- I'm using this patch in my acpi work - any objections to applying it on my tree? include/qom/object.h | 21

Re: [Qemu-devel] [PATCH] qom: helper macro for adding read-only properties

2013-09-15 Thread Peter Maydell
On 15 September 2013 18:23, Michael S. Tsirkin m...@redhat.com wrote: +/* Add a property that is an integer constant. */ +#define OBJECT_ADD_PROP_CONST(obj, name, value) \ +do {\ +void

Re: [Qemu-devel] [PATCH] qom: helper macro for adding read-only properties

2013-09-15 Thread Michael S. Tsirkin
On Sun, Sep 15, 2013 at 06:54:35PM +0100, Peter Maydell wrote: On 15 September 2013 18:23, Michael S. Tsirkin m...@redhat.com wrote: +/* Add a property that is an integer constant. */ +#define OBJECT_ADD_PROP_CONST(obj, name, value) \ +do {