[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/5] qom: introduce object_is_type_str(), so we
From: |
liu ping fan |
Subject: |
Re: [Qemu-devel] [PATCH 2/5] qom: introduce object_is_type_str(), so we can judge its type. |
Date: |
Wed, 11 Jul 2012 09:17:11 +0800 |
On Tue, Jul 10, 2012 at 4:39 PM, Paolo Bonzini <address@hidden> wrote:
> Il 10/07/2012 08:16, Liu Ping Fan ha scritto:
>> Signed-off-by: Liu Ping Fan <address@hidden>
>> ---
>> 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.
>
OK, will update it in next version
regards,
pingfan
> 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);
>>
>
>
- [Qemu-devel] make apic hot-plugable, Liu Ping Fan, 2012/07/10
- [Qemu-devel] [PATCH 2/5] qom: introduce object_is_type_str(), so we can judge its type., Liu Ping Fan, 2012/07/10
- [Qemu-devel] [PATCH 3/5] qdev: export the bus reset interface, Liu Ping Fan, 2012/07/10
- [Qemu-devel] [PATCH 4/5] qom-cpu: during cpu reset, it will reset its child, Liu Ping Fan, 2012/07/10
- Re: [Qemu-devel] [PATCH 4/5] qom-cpu: during cpu reset, it will reset its child, liu ping fan, 2012/07/10
- Re: [Qemu-devel] [PATCH 4/5] qom-cpu: during cpu reset, it will reset its child, Paolo Bonzini, 2012/07/11
[Qemu-devel] [PATCH 5/5] apic: create apic as a child of cpu, not system_bus any longer, Liu Ping Fan, 2012/07/10