mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 23:03:54 -06:00
qdev: Introduce DEFINE_PROP_LINK
This property can be used to replace the object_property_add_link in device code, to add a link to other objects, which is a common pattern. Signed-off-by: Fam Zheng <famz@redhat.com> Message-Id: <20170714021509.23681-4-famz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
faabdbb792
commit
5b4ff3c661
3 changed files with 28 additions and 0 deletions
|
@ -30,6 +30,7 @@ extern PropertyInfo qdev_prop_pci_devfn;
|
|||
extern PropertyInfo qdev_prop_blocksize;
|
||||
extern PropertyInfo qdev_prop_pci_host_devaddr;
|
||||
extern PropertyInfo qdev_prop_arraylen;
|
||||
extern PropertyInfo qdev_prop_link;
|
||||
|
||||
#define DEFINE_PROP(_name, _state, _field, _prop, _type) { \
|
||||
.name = (_name), \
|
||||
|
@ -117,6 +118,14 @@ extern PropertyInfo qdev_prop_arraylen;
|
|||
.arrayoffset = offsetof(_state, _arrayfield), \
|
||||
}
|
||||
|
||||
#define DEFINE_PROP_LINK(_name, _state, _field, _type, _ptr_type) { \
|
||||
.name = (_name), \
|
||||
.info = &(qdev_prop_link), \
|
||||
.offset = offsetof(_state, _field) \
|
||||
+ type_check(_ptr_type, typeof_field(_state, _field)), \
|
||||
.link_type = _type, \
|
||||
}
|
||||
|
||||
#define DEFINE_PROP_UINT8(_n, _s, _f, _d) \
|
||||
DEFINE_PROP_UNSIGNED(_n, _s, _f, _d, qdev_prop_uint8, uint8_t)
|
||||
#define DEFINE_PROP_UINT16(_n, _s, _f, _d) \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue