From: Igor Mammedov <imammedo@redhat.com>
To: Eduardo Habkost <ehabkost@redhat.com>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Anthony Liguori" <aliguori@us.ibm.com>,
qemu-devel@nongnu.org, "Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] [RFC 2/3 v2] qom: introduce post_init() function
Date: Thu, 11 Jul 2013 08:29:15 +0200 [thread overview]
Message-ID: <20130711082915.2ae4ef00@nial.usersys.redhat.com> (raw)
In-Reply-To: <1373486922-24209-3-git-send-email-ehabkost@redhat.com>
On Wed, 10 Jul 2013 17:08:41 -0300
Eduardo Habkost <ehabkost@redhat.com> wrote:
> This will allow classes to specify a function to be called after all
> instance_init() functions were called.
>
> This will be used by DeviceState to call qdev_prop_set_globals() at the
> right moment.
>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> include/qom/object.h | 3 +++
> qom/object.c | 14 ++++++++++++++
> 2 files changed, 17 insertions(+)
>
> diff --git a/include/qom/object.h b/include/qom/object.h
> index 23fc048..1a54f64 100644
> --- a/include/qom/object.h
> +++ b/include/qom/object.h
> @@ -398,6 +398,8 @@ struct Object
> * @instance_init: This function is called to initialize an object. The parent
> * class will have already been initialized so the type is only responsible
> * for initializing its own members.
> + * @instance_post_init: This function is called to finish initialization of
> + * an object, after all instance_init functions were called.
> * @instance_finalize: This function is called during object destruction. This
> * is called before the parent @instance_finalize function has been called.
> * An object should only free the members that are unique to its type in this
> @@ -433,6 +435,7 @@ struct TypeInfo
[...]
>
> +static void object_post_init_with_type(Object *obj, TypeImpl *ti)
> +{
> + if (ti->instance_post_init) {
> + ti->instance_post_init(obj);
> + }
> +
> + if (type_has_parent(ti)) {
> + object_post_init_with_type(obj, type_get_parent(ti));
> + }
Is there a reason why post init called in opposite order than
instance_init() ?
> +}
> +
> void object_initialize_with_type(void *data, TypeImpl *type)
> {
> Object *obj = data;
> @@ -313,6 +326,7 @@ void object_initialize_with_type(void *data, TypeImpl *type)
> object_ref(obj);
> QTAILQ_INIT(&obj->properties);
> object_init_with_type(obj, type);
> + object_post_init_with_type(obj, type);
> }
>
> void object_initialize(void *data, const char *typename)
next prev parent reply other threads:[~2013-07-11 6:29 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-03 17:48 [Qemu-devel] [PATCH 0/6] qdev: handle global properties after all instance_init calls Eduardo Habkost
2012-10-03 17:48 ` [Qemu-devel] [PATCH 1/6] qdev: split up header so it can be used in cpu.h Eduardo Habkost
2012-10-03 17:48 ` [Qemu-devel] [PATCH 2/6] qapi-types.h doesn't really need to include qemu-common.h Eduardo Habkost
2012-10-03 17:48 ` [Qemu-devel] [PATCH 3/6] qdev: separate core from the code used only by qemu-system-* Eduardo Habkost
2012-10-03 17:48 ` [Qemu-devel] [PATCH 4/6] tests: unit tests for qdev global-properties handling Eduardo Habkost
2012-10-03 17:48 ` [Qemu-devel] [PATCH 5/6] qom: introduce post_init() function Eduardo Habkost
2012-10-03 17:48 ` [Qemu-devel] [PATCH 6/6] qdev: set globals on " Eduardo Habkost
2013-07-09 14:32 ` [Qemu-devel] [PATCH 0/6] qdev: handle global properties after all instance_init calls Andreas Färber
2013-07-10 20:08 ` [Qemu-devel] [RFC 0/3 v2] " Eduardo Habkost
2013-07-10 20:08 ` [Qemu-devel] [RFC 1/3 v2] tests: unit tests for qdev global-properties handling Eduardo Habkost
2013-07-10 20:08 ` [Qemu-devel] [RFC 2/3 v2] qom: introduce post_init() function Eduardo Habkost
2013-07-11 6:29 ` Igor Mammedov [this message]
2013-07-12 0:29 ` Eduardo Habkost
2013-07-10 20:08 ` [Qemu-devel] [RFC 3/3 v2] qdev: set globals on " Eduardo Habkost
2013-07-11 6:48 ` Igor Mammedov
2013-07-12 14:57 ` Eduardo Habkost
2013-07-28 19:44 ` [Qemu-devel] [RFC 0/3 v2] qdev: handle global properties after all instance_init calls Andreas Färber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130711082915.2ae4ef00@nial.usersys.redhat.com \
--to=imammedo@redhat.com \
--cc=afaerber@suse.de \
--cc=aliguori@us.ibm.com \
--cc=ehabkost@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).