diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-05-02 13:30:55 +0200 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2012-06-18 15:14:37 +0200 |
commit | 3b50e311b48795707fed6d4f474711db87e341b9 (patch) | |
tree | 6d98cae92d080f1a282d823daf4479b430e3edec /qom/object.c | |
parent | 32efc535b86626646442de7fe5793f3a47f4ce91 (diff) |
qom: Add class_base_init
The class_base_init TypeInfo callback was present in one of the early
QOM versions but removed (on my request...) before committing. We
will need it soon, add it.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'qom/object.c')
-rw-r--r-- | qom/object.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/qom/object.c b/qom/object.c index 7a70d52e3a..36379a1397 100644 --- a/qom/object.c +++ b/qom/object.c @@ -45,6 +45,7 @@ struct TypeImpl size_t instance_size; void (*class_init)(ObjectClass *klass, void *data); + void (*class_base_init)(ObjectClass *klass, void *data); void (*class_finalize)(ObjectClass *klass, void *data); void *class_data; @@ -112,6 +113,7 @@ TypeImpl *type_register(const TypeInfo *info) ti->instance_size = info->instance_size; ti->class_init = info->class_init; + ti->class_base_init = info->class_base_init; ti->class_finalize = info->class_finalize; ti->class_data = info->class_data; @@ -232,6 +234,13 @@ static void type_initialize(TypeImpl *ti) memcpy((void *)ti->class + sizeof(ObjectClass), (void *)parent->class + sizeof(ObjectClass), parent->class_size - sizeof(ObjectClass)); + + while (parent) { + if (parent->class_base_init) { + parent->class_base_init(ti->class, ti->class_data); + } + parent = type_get_parent(parent); + } } memset((void *)ti->class + class_size, 0, ti->class_size - class_size); |