diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/hw/core/cpu.h | 4 | ||||
-rw-r--r-- | include/hw/qdev-core.h | 15 | ||||
-rw-r--r-- | include/hw/qdev-properties.h | 3 | ||||
-rw-r--r-- | include/qapi/qmp/qstring.h | 1 | ||||
-rw-r--r-- | include/qom/object.h | 109 | ||||
-rw-r--r-- | include/sysemu/accel.h | 2 | ||||
-rw-r--r-- | include/sysemu/runstate.h | 1 |
7 files changed, 115 insertions, 20 deletions
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h index 77c6f05299..73e9a869a4 100644 --- a/include/hw/core/cpu.h +++ b/include/hw/core/cpu.h @@ -1135,6 +1135,10 @@ void cpu_exec_unrealizefn(CPUState *cpu); */ bool target_words_bigendian(void); +void cpu_class_set_parent_reset(CPUClass *cc, + void (*child_reset)(CPUState *cpu), + void (**parent_reset)(CPUState *cpu)); + #ifdef NEED_CPU_H #ifdef CONFIG_SOFTMMU diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 1518495b1e..5da94f872a 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -100,7 +100,12 @@ typedef struct DeviceClass { DECLARE_BITMAP(categories, DEVICE_CATEGORY_MAX); const char *fw_name; const char *desc; - Property *props; + + /* + * The underscore at the end ensures a compile-time error if someone + * assigns to dc->props instead of using device_class_set_props. + */ + Property *props_; /* * Can this device be instantiated with -device / device_add? @@ -258,8 +263,8 @@ struct PropertyInfo { const char *description; const QEnumLookup *enum_table; int (*print)(DeviceState *dev, Property *prop, char *dest, size_t len); - void (*set_default_value)(Object *obj, const Property *prop); - void (*create)(Object *obj, Property *prop, Error **errp); + void (*set_default_value)(ObjectProperty *op, const Property *prop); + void (*create)(ObjectClass *oc, Property *prop, Error **errp); ObjectPropertyAccessor *get; ObjectPropertyAccessor *set; ObjectPropertyRelease *release; @@ -433,6 +438,8 @@ void qdev_machine_init(void); */ void device_reset(DeviceState *dev); +void device_class_set_props(DeviceClass *dc, Property *props); + void device_class_set_parent_reset(DeviceClass *dc, DeviceReset dev_reset, DeviceReset *parent_reset); @@ -457,8 +464,6 @@ extern bool qdev_hot_removed; char *qdev_get_dev_path(DeviceState *dev); -GSList *qdev_build_hotpluggable_device_list(Object *peripheral); - void qbus_set_hotplug_handler(BusState *bus, Object *handler, Error **errp); void qbus_set_bus_hotplug_handler(BusState *bus, Error **errp); diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index a90a9cec80..906e697c58 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -253,13 +253,12 @@ void error_set_from_qdev_prop_error(Error **errp, int ret, DeviceState *dev, * qdev_property_add_static: * @dev: Device to add the property to. * @prop: The qdev property definition. - * @errp: location to store error information. * * Add a static QOM property to @dev for qdev property @prop. * On error, store error in @errp. Static properties access data in a struct. * The type of the QOM property is derived from prop->info. */ -void qdev_property_add_static(DeviceState *dev, Property *prop, Error **errp); +void qdev_property_add_static(DeviceState *dev, Property *prop); void qdev_alias_all_properties(DeviceState *target, Object *source); diff --git a/include/qapi/qmp/qstring.h b/include/qapi/qmp/qstring.h index 3e83e3a95d..e2e356e5e7 100644 --- a/include/qapi/qmp/qstring.h +++ b/include/qapi/qmp/qstring.h @@ -33,6 +33,7 @@ void qstring_append_int(QString *qstring, int64_t value); void qstring_append(QString *qstring, const char *str); void qstring_append_chr(QString *qstring, int c); bool qstring_is_equal(const QObject *x, const QObject *y); +char *qstring_free(QString *qstring, bool return_str); void qstring_destroy_obj(QObject *obj); #endif /* QSTRING_H */ diff --git a/include/qom/object.h b/include/qom/object.h index 54a548868c..29546496c1 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -309,6 +309,8 @@ typedef struct InterfaceInfo InterfaceInfo; */ +typedef struct ObjectProperty ObjectProperty; + /** * ObjectPropertyAccessor: * @obj: the object that owns the property @@ -356,7 +358,16 @@ typedef void (ObjectPropertyRelease)(Object *obj, const char *name, void *opaque); -typedef struct ObjectProperty +/** + * ObjectPropertyInit: + * @obj: the object that owns the property + * @prop: the property to set + * + * Called when a property is initialized. + */ +typedef void (ObjectPropertyInit)(Object *obj, ObjectProperty *prop); + +struct ObjectProperty { gchar *name; gchar *type; @@ -365,8 +376,10 @@ typedef struct ObjectProperty ObjectPropertyAccessor *set; ObjectPropertyResolve *resolve; ObjectPropertyRelease *release; + ObjectPropertyInit *init; void *opaque; -} ObjectProperty; + QObject *defval; +}; /** * ObjectUnparent: @@ -992,8 +1005,9 @@ GSList *object_class_get_list_sorted(const char *implements_type, * * Increase the reference count of a object. A object cannot be freed as long * as its reference count is greater than zero. + * Returns: @obj */ -void object_ref(Object *obj); +Object *object_ref(Object *obj); /** * object_unref: @@ -1044,6 +1058,42 @@ ObjectProperty *object_class_property_add(ObjectClass *klass, const char *name, void *opaque, Error **errp); /** + * object_property_set_default_bool: + * @prop: the property to set + * @value: the value to be written to the property + * + * Set the property default value. + */ +void object_property_set_default_bool(ObjectProperty *prop, bool value); + +/** + * object_property_set_default_str: + * @prop: the property to set + * @value: the value to be written to the property + * + * Set the property default value. + */ +void object_property_set_default_str(ObjectProperty *prop, const char *value); + +/** + * object_property_set_default_int: + * @prop: the property to set + * @value: the value to be written to the property + * + * Set the property default value. + */ +void object_property_set_default_int(ObjectProperty *prop, int64_t value); + +/** + * object_property_set_default_uint: + * @prop: the property to set + * @value: the value to be written to the property + * + * Set the property default value. + */ +void object_property_set_default_uint(ObjectProperty *prop, uint64_t value); + +/** * object_property_find: * @obj: the object * @name: the name of the property @@ -1462,6 +1512,10 @@ void object_property_add_child(Object *obj, const char *name, typedef enum { /* Unref the link pointer when the property is deleted */ OBJ_PROP_LINK_STRONG = 0x1, + + /* private */ + OBJ_PROP_LINK_DIRECT = 0x2, + OBJ_PROP_LINK_CLASS = 0x4, } ObjectPropertyLinkFlags; /** @@ -1479,7 +1533,7 @@ void object_property_allow_set_link(const Object *, const char *, * @obj: the object to add a property to * @name: the name of the property * @type: the qobj type of the link - * @child: a pointer to where the link object reference is stored + * @targetp: a pointer to where the link object reference is stored * @check: callback to veto setting or NULL if the property is read-only * @flags: additional options for the link * @errp: if an error occurs, a pointer to an area to store the error @@ -1504,7 +1558,15 @@ void object_property_allow_set_link(const Object *, const char *, * modified. */ void object_property_add_link(Object *obj, const char *name, - const char *type, Object **child, + const char *type, Object **targetp, + void (*check)(const Object *obj, const char *name, + Object *val, Error **errp), + ObjectPropertyLinkFlags flags, + Error **errp); + +ObjectProperty *object_class_property_add_link(ObjectClass *oc, + const char *name, + const char *type, ptrdiff_t offset, void (*check)(const Object *obj, const char *name, Object *val, Error **errp), ObjectPropertyLinkFlags flags, @@ -1527,7 +1589,8 @@ void object_property_add_str(Object *obj, const char *name, void (*set)(Object *, const char *, Error **), Error **errp); -void object_class_property_add_str(ObjectClass *klass, const char *name, +ObjectProperty *object_class_property_add_str(ObjectClass *klass, + const char *name, char *(*get)(Object *, Error **), void (*set)(Object *, const char *, Error **), @@ -1549,7 +1612,8 @@ void object_property_add_bool(Object *obj, const char *name, void (*set)(Object *, bool, Error **), Error **errp); -void object_class_property_add_bool(ObjectClass *klass, const char *name, +ObjectProperty *object_class_property_add_bool(ObjectClass *klass, + const char *name, bool (*get)(Object *, Error **), void (*set)(Object *, bool, Error **), Error **errp); @@ -1573,7 +1637,8 @@ void object_property_add_enum(Object *obj, const char *name, void (*set)(Object *, int, Error **), Error **errp); -void object_class_property_add_enum(ObjectClass *klass, const char *name, +ObjectProperty *object_class_property_add_enum(ObjectClass *klass, + const char *name, const char *typename, const QEnumLookup *lookup, int (*get)(Object *, Error **), @@ -1594,7 +1659,8 @@ void object_property_add_tm(Object *obj, const char *name, void (*get)(Object *, struct tm *, Error **), Error **errp); -void object_class_property_add_tm(ObjectClass *klass, const char *name, +ObjectProperty *object_class_property_add_tm(ObjectClass *klass, + const char *name, void (*get)(Object *, struct tm *, Error **), Error **errp); @@ -1610,7 +1676,8 @@ void object_class_property_add_tm(ObjectClass *klass, const char *name, */ void object_property_add_uint8_ptr(Object *obj, const char *name, const uint8_t *v, Error **errp); -void object_class_property_add_uint8_ptr(ObjectClass *klass, const char *name, +ObjectProperty *object_class_property_add_uint8_ptr(ObjectClass *klass, + const char *name, const uint8_t *v, Error **errp); /** @@ -1625,7 +1692,8 @@ void object_class_property_add_uint8_ptr(ObjectClass *klass, const char *name, */ void object_property_add_uint16_ptr(Object *obj, const char *name, const uint16_t *v, Error **errp); -void object_class_property_add_uint16_ptr(ObjectClass *klass, const char *name, +ObjectProperty *object_class_property_add_uint16_ptr(ObjectClass *klass, + const char *name, const uint16_t *v, Error **errp); /** @@ -1640,7 +1708,8 @@ void object_class_property_add_uint16_ptr(ObjectClass *klass, const char *name, */ void object_property_add_uint32_ptr(Object *obj, const char *name, const uint32_t *v, Error **errp); -void object_class_property_add_uint32_ptr(ObjectClass *klass, const char *name, +ObjectProperty *object_class_property_add_uint32_ptr(ObjectClass *klass, + const char *name, const uint32_t *v, Error **errp); /** @@ -1655,7 +1724,8 @@ void object_class_property_add_uint32_ptr(ObjectClass *klass, const char *name, */ void object_property_add_uint64_ptr(Object *obj, const char *name, const uint64_t *v, Error **errp); -void object_class_property_add_uint64_ptr(ObjectClass *klass, const char *name, +ObjectProperty *object_class_property_add_uint64_ptr(ObjectClass *klass, + const char *name, const uint64_t *v, Error **errp); /** @@ -1767,6 +1837,19 @@ Object *container_get(Object *root, const char *path); */ size_t object_type_get_instance_size(const char *typename); +/** + * object_property_help: + * @name: the name of the property + * @type: the type of the property + * @defval: the default value + * @description: description of the property + * + * Returns: a user-friendly formatted string describing the property + * for help purposes. + */ +char *object_property_help(const char *name, const char *type, + QObject *defval, const char *description); + G_DEFINE_AUTOPTR_CLEANUP_FUNC(Object, object_unref) #endif diff --git a/include/sysemu/accel.h b/include/sysemu/accel.h index d4c1429711..47e5788530 100644 --- a/include/sysemu/accel.h +++ b/include/sysemu/accel.h @@ -70,4 +70,6 @@ int accel_init_machine(AccelState *accel, MachineState *ms); /* Called just before os_setup_post (ie just before drop OS privs) */ void accel_setup_post(MachineState *ms); +AccelState *current_accel(void); + #endif diff --git a/include/sysemu/runstate.h b/include/sysemu/runstate.h index 0b41555609..f760094858 100644 --- a/include/sysemu/runstate.h +++ b/include/sysemu/runstate.h @@ -63,6 +63,7 @@ ShutdownCause qemu_reset_requested_get(void); void qemu_system_killed(int signal, pid_t pid); void qemu_system_reset(ShutdownCause reason); void qemu_system_guest_panicked(GuestPanicInformation *info); +void qemu_system_guest_crashloaded(GuestPanicInformation *info); #endif |