mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
Merge remote-tracking branch 'afaerber-or/qom-next-2' into staging
* afaerber-or/qom-next-2: (22 commits) qom: Push error reporting to object_property_find() qdev: Remove qdev_prop_exists() qbus: Initialize in standard way qbus: Make child devices links qdev: Connect busses with their parent devices qdev: Convert busses to QEMU Object Model qdev: Move SysBus initialization to sysbus.c qdev: Use wrapper for qdev_get_path qdev: Remove qdev_prop_set_defaults qdev: Clean up global properties qdev: Move bus properties to abstract superclasses qdev: Move bus properties to a separate global qdev: Push "type" property up to Object arm_l2x0: Rename "type" property to "cache-type" m48t59: Rename "type" property to "model" qom: Assert that public types have a non-NULL parent field qom: Drop type_register_static_alias() macro qom: Make Object a type qom: Add class_base_init qom: Add object_child_foreach() ...
This commit is contained in:
commit
8aca521512
41 changed files with 869 additions and 503 deletions
|
@ -33,7 +33,7 @@ typedef struct TypeInfo TypeInfo;
|
|||
typedef struct InterfaceClass InterfaceClass;
|
||||
typedef struct InterfaceInfo InterfaceInfo;
|
||||
|
||||
#define TYPE_OBJECT NULL
|
||||
#define TYPE_OBJECT "object"
|
||||
|
||||
/**
|
||||
* SECTION:object.h
|
||||
|
@ -291,10 +291,15 @@ struct Object
|
|||
* has occurred to allow a class to set its default virtual method pointers.
|
||||
* This is also the function to use to override virtual methods from a parent
|
||||
* class.
|
||||
* @class_base_init: This function is called for all base classes after all
|
||||
* parent class initialization has occurred, but before the class itself
|
||||
* is initialized. This is the function to use to undo the effects of
|
||||
* memcpy from the parent class to the descendents.
|
||||
* @class_finalize: This function is called during class destruction and is
|
||||
* meant to release and dynamic parameters allocated by @class_init.
|
||||
* @class_data: Data to pass to the @class_init and @class_finalize functions.
|
||||
* This can be useful when building dynamic classes.
|
||||
* @class_data: Data to pass to the @class_init, @class_base_init and
|
||||
* @class_finalize functions. This can be useful when building dynamic
|
||||
* classes.
|
||||
* @interfaces: The list of interfaces associated with this type. This
|
||||
* should point to a static array that's terminated with a zero filled
|
||||
* element.
|
||||
|
@ -312,6 +317,7 @@ struct TypeInfo
|
|||
size_t class_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;
|
||||
|
||||
|
@ -521,8 +527,6 @@ const char *object_get_typename(Object *obj);
|
|||
*/
|
||||
Type type_register_static(const TypeInfo *info);
|
||||
|
||||
#define type_register_static_alias(info, name) do { } while (0)
|
||||
|
||||
/**
|
||||
* type_register:
|
||||
* @info: The #TypeInfo of the new type
|
||||
|
@ -547,6 +551,14 @@ ObjectClass *object_class_dynamic_cast_assert(ObjectClass *klass,
|
|||
ObjectClass *object_class_dynamic_cast(ObjectClass *klass,
|
||||
const char *typename);
|
||||
|
||||
/**
|
||||
* object_class_get_parent:
|
||||
* @klass: The class to obtain the parent for.
|
||||
*
|
||||
* Returns: The parent for @klass or %NULL if none.
|
||||
*/
|
||||
ObjectClass *object_class_get_parent(ObjectClass *klass);
|
||||
|
||||
/**
|
||||
* object_class_get_name:
|
||||
* @klass: The class to obtain the QOM typename for.
|
||||
|
@ -623,6 +635,17 @@ void object_property_add(Object *obj, const char *name, const char *type,
|
|||
|
||||
void object_property_del(Object *obj, const char *name, struct Error **errp);
|
||||
|
||||
/**
|
||||
* object_property_find:
|
||||
* @obj: the object
|
||||
* @name: the name of the property
|
||||
* @errp: returns an error if this function fails
|
||||
*
|
||||
* Look up a property for an object and return its #ObjectProperty if found.
|
||||
*/
|
||||
ObjectProperty *object_property_find(Object *obj, const char *name,
|
||||
struct Error **errp);
|
||||
|
||||
void object_unparent(Object *obj);
|
||||
|
||||
/**
|
||||
|
@ -909,6 +932,20 @@ void object_property_add_str(Object *obj, const char *name,
|
|||
void (*set)(Object *, const char *, struct Error **),
|
||||
struct Error **errp);
|
||||
|
||||
/**
|
||||
* object_child_foreach:
|
||||
* @obj: the object whose children will be navigated
|
||||
* @fn: the iterator function to be called
|
||||
* @opaque: an opaque value that will be passed to the iterator
|
||||
*
|
||||
* Call @fn passing each child of @obj and @opaque to it, until @fn returns
|
||||
* non-zero.
|
||||
*
|
||||
* Returns: The last value returned by @fn, or 0 if there is no child.
|
||||
*/
|
||||
int object_child_foreach(Object *obj, int (*fn)(Object *child, void *opaque),
|
||||
void *opaque);
|
||||
|
||||
/**
|
||||
* container_get:
|
||||
* @root: root of the #path, e.g., object_get_root()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue