From: Paolo Bonzini <pbonzini@redhat.com>
To: Liu Ping Fan <qemulist@gmail.com>
Cc: "Blue Swirl" <blauwirbel@gmail.com>,
"Jan Kiszka" <jan.kiszka@siemens.com>,
qemu-devel@nongnu.org, "Anthony Liguori" <anthony@codemonkey.ws>,
"Andreas Färber" <afaerber@suse.de>
Subject: Re: [Qemu-devel] [PATCH 2/5] qom: introduce object_is_type_str(), so we can judge its type.
Date: Tue, 10 Jul 2012 10:39:01 +0200 [thread overview]
Message-ID: <4FFBEA25.6060705@redhat.com> (raw)
In-Reply-To: <1341900967-4344-3-git-send-email-qemulist@gmail.com>
Il 10/07/2012 08:16, Liu Ping Fan ha scritto:
> Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
> ---
> include/qemu/object.h | 2 ++
> qom/object.c | 6 ++++++
> 2 files changed, 8 insertions(+), 0 deletions(-)
>
> diff --git a/include/qemu/object.h b/include/qemu/object.h
> index 8b17776..a66e996 100644
> --- a/include/qemu/object.h
> +++ b/include/qemu/object.h
> @@ -479,6 +479,8 @@ void object_initialize(void *obj, const char *typename);
> */
> void object_finalize(void *obj);
>
> +bool object_is_type_str(Object *obj, const char *typename);
Please call this object_is_instance_of, and just call
object_dynamic_cast internally so that interfaces are handled properly.
Paolo
> +
> /**
> * object_dynamic_cast:
> * @obj: The object to cast.
> diff --git a/qom/object.c b/qom/object.c
> index 00bb3b0..6c27d90 100644
> --- a/qom/object.c
> +++ b/qom/object.c
> @@ -425,6 +425,12 @@ static bool type_is_ancestor(TypeImpl *type, TypeImpl *target_type)
> return false;
> }
>
> +bool object_is_type_str(Object *obj, const char *typename)
> +{
> + TypeImpl *target_type = type_get_by_name(typename);
> + return !target_type || type_is_ancestor(obj->class->type, target_type);
> +}
> +
> static bool object_is_type(Object *obj, TypeImpl *target_type)
> {
> return !target_type || type_is_ancestor(obj->class->type, target_type);
>
next prev parent reply other threads:[~2012-07-10 8:39 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-10 6:16 [Qemu-devel] make apic hot-plugable Liu Ping Fan
2012-07-10 6:16 ` [Qemu-devel] [PATCH 1/5] qdev: introduce qdev_create_kid(Object *parent, const char *type) Liu Ping Fan
2012-07-10 8:12 ` Andreas Färber
2012-07-10 8:45 ` Paolo Bonzini
2012-07-11 1:17 ` liu ping fan
2012-07-11 7:01 ` Paolo Bonzini
2012-07-10 6:16 ` [Qemu-devel] [PATCH 2/5] qom: introduce object_is_type_str(), so we can judge its type Liu Ping Fan
2012-07-10 8:39 ` Paolo Bonzini [this message]
2012-07-11 1:17 ` liu ping fan
2012-07-10 6:16 ` [Qemu-devel] [PATCH 3/5] qdev: export the bus reset interface Liu Ping Fan
2012-07-10 8:40 ` Paolo Bonzini
2012-07-10 6:16 ` [Qemu-devel] [PATCH 4/5] qom-cpu: during cpu reset, it will reset its child Liu Ping Fan
2012-07-10 8:41 ` Paolo Bonzini
2012-07-10 10:12 ` Andreas Färber
2012-07-11 1:17 ` liu ping fan
2012-07-11 12:37 ` Igor Mammedov
2012-07-11 1:17 ` liu ping fan
2012-07-11 7:02 ` Paolo Bonzini
2012-07-10 6:16 ` [Qemu-devel] [PATCH 5/5] apic: create apic as a child of cpu, not system_bus any longer Liu Ping Fan
2012-07-10 8:45 ` Paolo Bonzini
2012-07-10 10:41 ` Andreas Färber
2012-07-11 8:41 ` Igor Mammedov
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=4FFBEA25.6060705@redhat.com \
--to=pbonzini@redhat.com \
--cc=afaerber@suse.de \
--cc=anthony@codemonkey.ws \
--cc=blauwirbel@gmail.com \
--cc=jan.kiszka@siemens.com \
--cc=qemu-devel@nongnu.org \
--cc=qemulist@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.