X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=include%2Fqom%2Fobject.h;h=1d7b7e5a794bb5337e977b55bc30dc51e44e2246;hb=48008198270e3ebcc9394401d676c54ed5ac139c;hp=7bb82a7f5650e324d32f789246d8df221e2291c5;hpb=a050901d4b40092dc356b59912c6df39e389c7b9;p=mirror_qemu.git diff --git a/include/qom/object.h b/include/qom/object.h index 7bb82a7f56..1d7b7e5a79 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -15,7 +15,6 @@ #define QEMU_OBJECT_H #include "qapi/qapi-builtin-types.h" -#include "qemu/queue.h" #include "qemu/module.h" struct TypeImpl; @@ -201,8 +200,14 @@ typedef struct InterfaceInfo InterfaceInfo; * * Interfaces allow a limited form of multiple inheritance. Instances are * similar to normal types except for the fact that are only defined by - * their classes and never carry any state. You can dynamically cast an object - * to one of its #Interface types and vice versa. + * their classes and never carry any state. As a consequence, a pointer to + * an interface instance should always be of incomplete type in order to be + * sure it cannot be dereferenced. That is, you should define the + * 'typedef struct SomethingIf SomethingIf' so that you can pass around + * 'SomethingIf *si' arguments, but not define a 'struct SomethingIf { ... }'. + * The only things you can validly do with a 'SomethingIf *' are to pass it as + * an argument to a method on its corresponding SomethingIfClass, or to + * dynamically cast it to an object that implements the interface. * * # Methods # * @@ -593,6 +598,18 @@ struct InterfaceClass ((interface *)object_dynamic_cast_assert(OBJECT((obj)), (name), \ __FILE__, __LINE__, __func__)) +/** + * object_new_with_class: + * @klass: The class to instantiate. + * + * This function will initialize a new object using heap allocated memory. + * The returned object has a reference count of 1, and will be freed when + * the last reference is dropped. + * + * Returns: The newly allocated and instantiated object. + */ +Object *object_new_with_class(ObjectClass *klass); + /** * object_new: * @typename: The name of the type of the object to instantiate. @@ -680,6 +697,7 @@ void object_apply_global_props(Object *obj, const GPtrArray *props, Error **errp); void object_set_machine_compat_props(GPtrArray *compat_props); void object_set_accelerator_compat_props(GPtrArray *compat_props); +void object_register_sugar_prop(const char *driver, const char *prop, const char *value); void object_apply_compat_props(Object *obj); /** @@ -1636,9 +1654,9 @@ void object_class_property_add_uint32_ptr(ObjectClass *klass, const char *name, * property of type 'uint64'. */ void object_property_add_uint64_ptr(Object *obj, const char *name, - const uint64_t *v, Error **Errp); + const uint64_t *v, Error **errp); void object_class_property_add_uint64_ptr(ObjectClass *klass, const char *name, - const uint64_t *v, Error **Errp); + const uint64_t *v, Error **errp); /** * object_property_add_alias: