]> git.proxmox.com Git - mirror_qemu.git/commit - tests/check-qom-proplist.c
qom: Allow properties to be registered against classes
authorDaniel P. Berrange <berrange@redhat.com>
Tue, 13 Oct 2015 12:37:46 +0000 (13:37 +0100)
committerAndreas Färber <afaerber@suse.de>
Mon, 18 Jan 2016 16:47:58 +0000 (17:47 +0100)
commit16bf7f522a2ff68993f80631ed86254c71eaf5d4
tree2cbfc341f1ac60e39bf7b54727a187c469b3fab2
parent46188349ad7e23abef0e453d2b0406985f6552a1
qom: Allow properties to be registered against classes

When there are many instances of a given class, registering
properties against the instance is wasteful of resources. The
majority of objects have a statically defined list of possible
properties, so most of the properties are easily registerable
against the class. Only those properties which are conditionally
registered at runtime need be recorded against the klass.

Registering properties against classes also makes it possible
to provide static introspection of QOM - currently introspection
is only possible after creating an instance of a class, which
severely limits its usefulness.

This impl only supports simple scalar properties. It does not
attempt to allow child object / link object properties against
the class. There are ways to support those too, but it would
make this patch more complicated, so it is left as an exercise
for the future.

There is no equivalent to object_property_del() provided, since
classes must be immutable once they are defined.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
include/qom/object.h
qom/object.c
tests/check-qom-proplist.c