2012-08-11 01:00:43 +08:00
|
|
|
#ifndef QEMU_QDEV_PROPERTIES_H
|
|
|
|
#define QEMU_QDEV_PROPERTIES_H
|
|
|
|
|
2013-02-04 22:40:22 +08:00
|
|
|
#include "hw/qdev-core.h"
|
2012-08-11 01:00:43 +08:00
|
|
|
|
2020-12-12 06:05:00 +08:00
|
|
|
/**
|
|
|
|
* Property:
|
|
|
|
* @set_default: true if the default value should be set from @defval,
|
|
|
|
* in which case @info->set_default_value must not be NULL
|
|
|
|
* (if false then no default value is set by the property system
|
|
|
|
* and the field retains whatever value it was given by instance_init).
|
|
|
|
* @defval: default value for the property. This is used only if @set_default
|
|
|
|
* is true.
|
|
|
|
*/
|
|
|
|
struct Property {
|
|
|
|
const char *name;
|
|
|
|
const PropertyInfo *info;
|
|
|
|
ptrdiff_t offset;
|
|
|
|
uint8_t bitnr;
|
|
|
|
bool set_default;
|
|
|
|
union {
|
|
|
|
int64_t i;
|
|
|
|
uint64_t u;
|
|
|
|
} defval;
|
|
|
|
int arrayoffset;
|
|
|
|
const PropertyInfo *arrayinfo;
|
|
|
|
int arrayfieldsize;
|
|
|
|
const char *link_type;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct PropertyInfo {
|
|
|
|
const char *name;
|
|
|
|
const char *description;
|
|
|
|
const QEnumLookup *enum_table;
|
2021-08-24 16:38:25 +08:00
|
|
|
bool realized_set_allowed; /* allow setting property on realized device */
|
2020-12-12 06:05:04 +08:00
|
|
|
int (*print)(Object *obj, Property *prop, char *dest, size_t len);
|
2020-12-12 06:05:00 +08:00
|
|
|
void (*set_default_value)(ObjectProperty *op, const Property *prop);
|
2020-12-12 06:05:21 +08:00
|
|
|
ObjectProperty *(*create)(ObjectClass *oc, const char *name,
|
|
|
|
Property *prop);
|
2020-12-12 06:05:00 +08:00
|
|
|
ObjectPropertyAccessor *get;
|
|
|
|
ObjectPropertyAccessor *set;
|
|
|
|
ObjectPropertyRelease *release;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-08-11 01:00:43 +08:00
|
|
|
/*** qdev-properties.c ***/
|
|
|
|
|
2017-07-14 10:14:54 +08:00
|
|
|
extern const PropertyInfo qdev_prop_bit;
|
|
|
|
extern const PropertyInfo qdev_prop_bit64;
|
|
|
|
extern const PropertyInfo qdev_prop_bool;
|
2020-10-01 00:49:44 +08:00
|
|
|
extern const PropertyInfo qdev_prop_enum;
|
2017-07-14 10:14:54 +08:00
|
|
|
extern const PropertyInfo qdev_prop_uint8;
|
|
|
|
extern const PropertyInfo qdev_prop_uint16;
|
|
|
|
extern const PropertyInfo qdev_prop_uint32;
|
|
|
|
extern const PropertyInfo qdev_prop_int32;
|
|
|
|
extern const PropertyInfo qdev_prop_uint64;
|
2017-07-18 11:39:01 +08:00
|
|
|
extern const PropertyInfo qdev_prop_int64;
|
2017-07-14 10:14:54 +08:00
|
|
|
extern const PropertyInfo qdev_prop_size;
|
|
|
|
extern const PropertyInfo qdev_prop_string;
|
|
|
|
extern const PropertyInfo qdev_prop_on_off_auto;
|
2020-05-29 06:55:12 +08:00
|
|
|
extern const PropertyInfo qdev_prop_size32;
|
2017-07-14 10:14:54 +08:00
|
|
|
extern const PropertyInfo qdev_prop_arraylen;
|
|
|
|
extern const PropertyInfo qdev_prop_link;
|
2012-08-11 01:00:43 +08:00
|
|
|
|
2020-12-12 06:05:13 +08:00
|
|
|
#define DEFINE_PROP(_name, _state, _field, _prop, _type, ...) { \
|
2012-08-11 01:00:43 +08:00
|
|
|
.name = (_name), \
|
|
|
|
.info = &(_prop), \
|
|
|
|
.offset = offsetof(_state, _field) \
|
2013-01-30 19:12:28 +08:00
|
|
|
+ type_check(_type, typeof_field(_state, _field)), \
|
2020-12-12 06:05:13 +08:00
|
|
|
__VA_ARGS__ \
|
2012-08-11 01:00:43 +08:00
|
|
|
}
|
2017-06-08 00:36:09 +08:00
|
|
|
|
2020-12-12 06:05:13 +08:00
|
|
|
#define DEFINE_PROP_SIGNED(_name, _state, _field, _defval, _prop, _type) \
|
|
|
|
DEFINE_PROP(_name, _state, _field, _prop, _type, \
|
|
|
|
.set_default = true, \
|
|
|
|
.defval.i = (_type)_defval)
|
2017-06-08 00:36:09 +08:00
|
|
|
|
2020-12-12 06:05:13 +08:00
|
|
|
#define DEFINE_PROP_SIGNED_NODEFAULT(_name, _state, _field, _prop, _type) \
|
|
|
|
DEFINE_PROP(_name, _state, _field, _prop, _type)
|
2017-07-17 20:36:06 +08:00
|
|
|
|
2020-12-12 06:05:13 +08:00
|
|
|
#define DEFINE_PROP_BIT(_name, _state, _field, _bit, _defval) \
|
|
|
|
DEFINE_PROP(_name, _state, _field, qdev_prop_bit, uint32_t, \
|
|
|
|
.bitnr = (_bit), \
|
|
|
|
.set_default = true, \
|
|
|
|
.defval.u = (bool)_defval)
|
2017-06-08 00:36:09 +08:00
|
|
|
|
2020-12-12 06:05:13 +08:00
|
|
|
#define DEFINE_PROP_UNSIGNED(_name, _state, _field, _defval, _prop, _type) \
|
|
|
|
DEFINE_PROP(_name, _state, _field, _prop, _type, \
|
|
|
|
.set_default = true, \
|
|
|
|
.defval.u = (_type)_defval)
|
2017-06-08 00:36:09 +08:00
|
|
|
|
2020-12-12 06:05:13 +08:00
|
|
|
#define DEFINE_PROP_UNSIGNED_NODEFAULT(_name, _state, _field, _prop, _type) \
|
|
|
|
DEFINE_PROP(_name, _state, _field, _prop, _type)
|
2017-07-17 20:36:06 +08:00
|
|
|
|
2020-12-12 06:05:13 +08:00
|
|
|
#define DEFINE_PROP_BIT64(_name, _state, _field, _bit, _defval) \
|
|
|
|
DEFINE_PROP(_name, _state, _field, qdev_prop_bit64, uint64_t, \
|
|
|
|
.bitnr = (_bit), \
|
|
|
|
.set_default = true, \
|
|
|
|
.defval.u = (bool)_defval)
|
2012-08-11 01:00:43 +08:00
|
|
|
|
2020-12-12 06:05:13 +08:00
|
|
|
#define DEFINE_PROP_BOOL(_name, _state, _field, _defval) \
|
|
|
|
DEFINE_PROP(_name, _state, _field, qdev_prop_bool, bool, \
|
|
|
|
.set_default = true, \
|
|
|
|
.defval.u = (bool)_defval)
|
2013-03-08 00:16:18 +08:00
|
|
|
|
2013-03-16 00:41:57 +08:00
|
|
|
#define PROP_ARRAY_LEN_PREFIX "len-"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* DEFINE_PROP_ARRAY:
|
|
|
|
* @_name: name of the array
|
|
|
|
* @_state: name of the device state structure type
|
|
|
|
* @_field: uint32_t field in @_state to hold the array length
|
|
|
|
* @_arrayfield: field in @_state (of type '@_arraytype *') which
|
|
|
|
* will point to the array
|
|
|
|
* @_arrayprop: PropertyInfo defining what property the array elements have
|
|
|
|
* @_arraytype: C type of the array elements
|
|
|
|
*
|
|
|
|
* Define device properties for a variable-length array _name. A
|
|
|
|
* static property "len-arrayname" is defined. When the device creator
|
|
|
|
* sets this property to the desired length of array, further dynamic
|
|
|
|
* properties "arrayname[0]", "arrayname[1]", ... are defined so the
|
|
|
|
* device creator can set the array element values. Setting the
|
|
|
|
* "len-arrayname" property more than once is an error.
|
|
|
|
*
|
|
|
|
* When the array length is set, the @_field member of the device
|
|
|
|
* struct is set to the array length, and @_arrayfield is set to point
|
|
|
|
* to (zero-initialised) memory allocated for the array. For a zero
|
|
|
|
* length array, @_field will be set to 0 and @_arrayfield to NULL.
|
|
|
|
* It is the responsibility of the device deinit code to free the
|
|
|
|
* @_arrayfield memory.
|
|
|
|
*/
|
2020-12-12 06:05:13 +08:00
|
|
|
#define DEFINE_PROP_ARRAY(_name, _state, _field, \
|
|
|
|
_arrayfield, _arrayprop, _arraytype) \
|
|
|
|
DEFINE_PROP((PROP_ARRAY_LEN_PREFIX _name), \
|
|
|
|
_state, _field, qdev_prop_arraylen, uint32_t, \
|
|
|
|
.set_default = true, \
|
|
|
|
.defval.u = 0, \
|
|
|
|
.arrayinfo = &(_arrayprop), \
|
|
|
|
.arrayfieldsize = sizeof(_arraytype), \
|
|
|
|
.arrayoffset = offsetof(_state, _arrayfield))
|
|
|
|
|
|
|
|
#define DEFINE_PROP_LINK(_name, _state, _field, _type, _ptr_type) \
|
|
|
|
DEFINE_PROP(_name, _state, _field, qdev_prop_link, _ptr_type, \
|
|
|
|
.link_type = _type)
|
2017-07-14 10:14:52 +08:00
|
|
|
|
2012-08-11 01:00:43 +08:00
|
|
|
#define DEFINE_PROP_UINT8(_n, _s, _f, _d) \
|
2017-06-08 00:36:09 +08:00
|
|
|
DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_uint8, uint8_t)
|
2012-08-11 01:00:43 +08:00
|
|
|
#define DEFINE_PROP_UINT16(_n, _s, _f, _d) \
|
2017-06-08 00:36:09 +08:00
|
|
|
DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_uint16, uint16_t)
|
2012-08-11 01:00:43 +08:00
|
|
|
#define DEFINE_PROP_UINT32(_n, _s, _f, _d) \
|
2017-06-08 00:36:09 +08:00
|
|
|
DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_uint32, uint32_t)
|
2012-08-11 01:00:43 +08:00
|
|
|
#define DEFINE_PROP_INT32(_n, _s, _f, _d) \
|
2017-06-08 00:36:07 +08:00
|
|
|
DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_int32, int32_t)
|
2012-08-11 01:00:43 +08:00
|
|
|
#define DEFINE_PROP_UINT64(_n, _s, _f, _d) \
|
2017-06-08 00:36:09 +08:00
|
|
|
DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_uint64, uint64_t)
|
2017-07-18 11:39:01 +08:00
|
|
|
#define DEFINE_PROP_INT64(_n, _s, _f, _d) \
|
|
|
|
DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_int64, int64_t)
|
2013-07-29 22:47:56 +08:00
|
|
|
#define DEFINE_PROP_SIZE(_n, _s, _f, _d) \
|
2017-06-08 00:36:09 +08:00
|
|
|
DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_size, uint64_t)
|
2012-08-11 01:00:43 +08:00
|
|
|
#define DEFINE_PROP_STRING(_n, _s, _f) \
|
|
|
|
DEFINE_PROP(_n, _s, _f, qdev_prop_string, char*)
|
2016-03-16 02:34:49 +08:00
|
|
|
#define DEFINE_PROP_ON_OFF_AUTO(_n, _s, _f, _d) \
|
2017-06-08 00:36:07 +08:00
|
|
|
DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_on_off_auto, OnOffAuto)
|
2020-05-29 06:55:12 +08:00
|
|
|
#define DEFINE_PROP_SIZE32(_n, _s, _f, _d) \
|
|
|
|
DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_size32, uint32_t)
|
2018-11-08 06:33:09 +08:00
|
|
|
|
2012-08-11 01:00:43 +08:00
|
|
|
#define DEFINE_PROP_END_OF_LIST() \
|
|
|
|
{}
|
|
|
|
|
qdev: Make qdev_prop_set_drive() match the other helpers
qdev_prop_set_drive() can fail. None of the other qdev_prop_set_FOO()
can; they abort on error.
To clean up this inconsistency, rename qdev_prop_set_drive() to
qdev_prop_set_drive_err(), and create a qdev_prop_set_drive() that
aborts on error.
Coccinelle script to update callers:
@ depends on !(file in "hw/core/qdev-properties-system.c")@
expression dev, name, value;
symbol error_abort;
@@
- qdev_prop_set_drive(dev, name, value, &error_abort);
+ qdev_prop_set_drive(dev, name, value);
@@
expression dev, name, value, errp;
@@
- qdev_prop_set_drive(dev, name, value, errp);
+ qdev_prop_set_drive_err(dev, name, value, errp);
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200622094227.1271650-14-armbru@redhat.com>
2020-06-22 17:42:24 +08:00
|
|
|
/*
|
|
|
|
* Set properties between creation and realization.
|
2020-07-20 20:16:59 +08:00
|
|
|
*
|
|
|
|
* Returns: %true on success, %false on error.
|
qdev: Make qdev_prop_set_drive() match the other helpers
qdev_prop_set_drive() can fail. None of the other qdev_prop_set_FOO()
can; they abort on error.
To clean up this inconsistency, rename qdev_prop_set_drive() to
qdev_prop_set_drive_err(), and create a qdev_prop_set_drive() that
aborts on error.
Coccinelle script to update callers:
@ depends on !(file in "hw/core/qdev-properties-system.c")@
expression dev, name, value;
symbol error_abort;
@@
- qdev_prop_set_drive(dev, name, value, &error_abort);
+ qdev_prop_set_drive(dev, name, value);
@@
expression dev, name, value, errp;
@@
- qdev_prop_set_drive(dev, name, value, errp);
+ qdev_prop_set_drive_err(dev, name, value, errp);
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200622094227.1271650-14-armbru@redhat.com>
2020-06-22 17:42:24 +08:00
|
|
|
*/
|
2020-07-08 00:05:59 +08:00
|
|
|
bool qdev_prop_set_drive_err(DeviceState *dev, const char *name,
|
|
|
|
BlockBackend *value, Error **errp);
|
qdev: Make qdev_prop_set_drive() match the other helpers
qdev_prop_set_drive() can fail. None of the other qdev_prop_set_FOO()
can; they abort on error.
To clean up this inconsistency, rename qdev_prop_set_drive() to
qdev_prop_set_drive_err(), and create a qdev_prop_set_drive() that
aborts on error.
Coccinelle script to update callers:
@ depends on !(file in "hw/core/qdev-properties-system.c")@
expression dev, name, value;
symbol error_abort;
@@
- qdev_prop_set_drive(dev, name, value, &error_abort);
+ qdev_prop_set_drive(dev, name, value);
@@
expression dev, name, value, errp;
@@
- qdev_prop_set_drive(dev, name, value, errp);
+ qdev_prop_set_drive_err(dev, name, value, errp);
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200622094227.1271650-14-armbru@redhat.com>
2020-06-22 17:42:24 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Set properties between creation and realization.
|
|
|
|
* @value must be valid. Each property may be set at most once.
|
|
|
|
*/
|
2012-08-11 01:00:43 +08:00
|
|
|
void qdev_prop_set_bit(DeviceState *dev, const char *name, bool value);
|
|
|
|
void qdev_prop_set_uint8(DeviceState *dev, const char *name, uint8_t value);
|
|
|
|
void qdev_prop_set_uint16(DeviceState *dev, const char *name, uint16_t value);
|
|
|
|
void qdev_prop_set_uint32(DeviceState *dev, const char *name, uint32_t value);
|
|
|
|
void qdev_prop_set_int32(DeviceState *dev, const char *name, int32_t value);
|
|
|
|
void qdev_prop_set_uint64(DeviceState *dev, const char *name, uint64_t value);
|
|
|
|
void qdev_prop_set_string(DeviceState *dev, const char *name, const char *value);
|
2016-12-07 21:20:22 +08:00
|
|
|
void qdev_prop_set_chr(DeviceState *dev, const char *name, Chardev *value);
|
2012-08-11 01:00:43 +08:00
|
|
|
void qdev_prop_set_netdev(DeviceState *dev, const char *name, NetClientState *value);
|
2015-03-10 02:17:26 +08:00
|
|
|
void qdev_prop_set_drive(DeviceState *dev, const char *name,
|
qdev: Make qdev_prop_set_drive() match the other helpers
qdev_prop_set_drive() can fail. None of the other qdev_prop_set_FOO()
can; they abort on error.
To clean up this inconsistency, rename qdev_prop_set_drive() to
qdev_prop_set_drive_err(), and create a qdev_prop_set_drive() that
aborts on error.
Coccinelle script to update callers:
@ depends on !(file in "hw/core/qdev-properties-system.c")@
expression dev, name, value;
symbol error_abort;
@@
- qdev_prop_set_drive(dev, name, value, &error_abort);
+ qdev_prop_set_drive(dev, name, value);
@@
expression dev, name, value, errp;
@@
- qdev_prop_set_drive(dev, name, value, errp);
+ qdev_prop_set_drive_err(dev, name, value, errp);
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200622094227.1271650-14-armbru@redhat.com>
2020-06-22 17:42:24 +08:00
|
|
|
BlockBackend *value);
|
2017-03-11 04:05:49 +08:00
|
|
|
void qdev_prop_set_macaddr(DeviceState *dev, const char *name,
|
|
|
|
const uint8_t *value);
|
2012-08-11 01:00:43 +08:00
|
|
|
void qdev_prop_set_enum(DeviceState *dev, const char *name, int value);
|
|
|
|
|
2020-12-12 06:05:27 +08:00
|
|
|
void *object_field_prop_ptr(Object *obj, Property *prop);
|
qdev: Make qdev_prop_set_drive() match the other helpers
qdev_prop_set_drive() can fail. None of the other qdev_prop_set_FOO()
can; they abort on error.
To clean up this inconsistency, rename qdev_prop_set_drive() to
qdev_prop_set_drive_err(), and create a qdev_prop_set_drive() that
aborts on error.
Coccinelle script to update callers:
@ depends on !(file in "hw/core/qdev-properties-system.c")@
expression dev, name, value;
symbol error_abort;
@@
- qdev_prop_set_drive(dev, name, value, &error_abort);
+ qdev_prop_set_drive(dev, name, value);
@@
expression dev, name, value, errp;
@@
- qdev_prop_set_drive(dev, name, value, errp);
+ qdev_prop_set_drive_err(dev, name, value, errp);
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200622094227.1271650-14-armbru@redhat.com>
2020-06-22 17:42:24 +08:00
|
|
|
|
2012-12-06 00:49:11 +08:00
|
|
|
void qdev_prop_register_global(GlobalProperty *prop);
|
2020-12-12 06:05:07 +08:00
|
|
|
const GlobalProperty *qdev_find_global_prop(Object *obj,
|
qdev: Improve netdev property override error a bit
qdev_prop_set_netdev() fails when the property already has a non-null
value. Seems to go back to commit 30c367ed44
"qdev-properties-system.c: Allow vlan or netdev for -device, not
both", v1.7.0. Board code doesn't expect failure, and crashes:
$ qemu-system-x86_64 --nodefaults -nic user -netdev user,id=nic0 -global e1000.netdev=nic0
Unexpected error in error_set_from_qdev_prop_error() at /work/armbru/qemu/hw/core/qdev-properties.c:1101:
qemu-system-x86_64: Property 'e1000.netdev' doesn't take value '__org.qemu.nic0
'
Aborted (core dumped)
-device and device_add handle the failure:
$ qemu-system-x86_64 -nodefaults -netdev user,id=net0 -netdev user,id=net1 -device e1000,netdev=net0,netdev=net1
qemu-system-x86_64: -device e1000,netdev=net0,netdev=net1: Property 'e1000.netdev' doesn't take value 'net1'
$ qemu-system-x86_64 -nodefaults -S -display none -monitor stdio -netdev user,id=net0 -netdev user,id=net1 -global e1000.netdev=net0
QEMU 5.0.50 monitor - type 'help' for more information
(qemu) qemu-system-x86_64: warning: netdev net0 has no peer
qemu-system-x86_64: warning: netdev net1 has no peer
device_add e1000,netdev=net1
Error: Property 'e1000.netdev' doesn't take value 'net1'
Perhaps netdev property override could be made to work. Perhaps it
should. I'm not the right guy to figure this out. What I can do is
improve the error message a bit:
(qemu) device_add e1000,netdev=net1
Error: -global e1000.netdev=... conflicts with netdev=net1
Cc: Jason Wang <jasowang@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20200622094227.1271650-11-armbru@redhat.com>
2020-06-22 17:42:21 +08:00
|
|
|
const char *name);
|
2014-08-09 03:03:30 +08:00
|
|
|
int qdev_prop_check_globals(void);
|
2015-01-20 17:04:07 +08:00
|
|
|
void qdev_prop_set_globals(DeviceState *dev);
|
2020-12-12 06:05:09 +08:00
|
|
|
void error_set_from_qdev_prop_error(Error **errp, int ret, Object *obj,
|
2020-12-12 06:05:15 +08:00
|
|
|
const char *name, const char *value);
|
2012-08-11 01:00:43 +08:00
|
|
|
|
|
|
|
/**
|
2016-04-17 15:45:54 +08:00
|
|
|
* qdev_property_add_static:
|
|
|
|
* @dev: Device to add the property to.
|
|
|
|
* @prop: The qdev property definition.
|
|
|
|
*
|
|
|
|
* 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.
|
2012-08-11 01:00:43 +08:00
|
|
|
*/
|
2020-01-10 23:30:16 +08:00
|
|
|
void qdev_property_add_static(DeviceState *dev, Property *prop);
|
2012-08-11 01:00:43 +08:00
|
|
|
|
2020-07-11 22:24:23 +08:00
|
|
|
/**
|
|
|
|
* qdev_alias_all_properties: Create aliases on source for all target properties
|
|
|
|
* @target: Device which has properties to be aliased
|
|
|
|
* @source: Object to add alias properties to
|
|
|
|
*
|
|
|
|
* Add alias properties to the @source object for all qdev properties on
|
|
|
|
* the @target DeviceState.
|
|
|
|
*
|
|
|
|
* This is useful when @target is an internal implementation object
|
|
|
|
* owned by @source, and you want to expose all the properties of that
|
|
|
|
* implementation object as properties on the @source object so that users
|
|
|
|
* of @source can set them.
|
|
|
|
*/
|
2014-06-18 17:58:32 +08:00
|
|
|
void qdev_alias_all_properties(DeviceState *target, Object *source);
|
|
|
|
|
2013-03-25 21:40:44 +08:00
|
|
|
/**
|
|
|
|
* @qdev_prop_set_after_realize:
|
|
|
|
* @dev: device
|
|
|
|
* @name: name of property
|
|
|
|
* @errp: indirect pointer to Error to be set
|
|
|
|
* Set the Error object to report that an attempt was made to set a property
|
|
|
|
* on a device after it has already been realized. This is a utility function
|
|
|
|
* which allows property-setter functions to easily report the error in
|
|
|
|
* a friendly format identifying both the device and the property.
|
|
|
|
*/
|
|
|
|
void qdev_prop_set_after_realize(DeviceState *dev, const char *name,
|
|
|
|
Error **errp);
|
2014-03-19 15:58:56 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* qdev_prop_allow_set_link_before_realize:
|
|
|
|
*
|
|
|
|
* Set the #Error object if an attempt is made to set the link after realize.
|
|
|
|
* This function should be used as the check() argument to
|
|
|
|
* object_property_add_link().
|
|
|
|
*/
|
2017-07-14 10:14:50 +08:00
|
|
|
void qdev_prop_allow_set_link_before_realize(const Object *obj,
|
|
|
|
const char *name,
|
2014-03-19 15:58:56 +08:00
|
|
|
Object *val, Error **errp);
|
|
|
|
|
2012-08-11 01:00:43 +08:00
|
|
|
#endif
|