mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-17 07:02:03 -06:00
qdev: Reuse DEFINE_PROP in all DEFINE_PROP_* macros
Instead of duplicating the code that sets name, info, offset, and does type checking, make DEFINE_PROP accept a variable number of arguments and reuse it in all DEFINE_PROP_* macros. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Message-Id: <20201211220529.2290218-17-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
parent
ce35e2295e
commit
45efa07f0f
2 changed files with 46 additions and 87 deletions
|
@ -63,22 +63,15 @@ extern const PropertyInfo qdev_prop_pcie_link_width;
|
|||
DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_pcie_link_width, \
|
||||
PCIExpLinkWidth)
|
||||
|
||||
#define DEFINE_PROP_UUID(_name, _state, _field) { \
|
||||
.name = (_name), \
|
||||
.info = &qdev_prop_uuid, \
|
||||
.offset = offsetof(_state, _field) \
|
||||
+ type_check(QemuUUID, typeof_field(_state, _field)), \
|
||||
.set_default = true, \
|
||||
}
|
||||
#define DEFINE_PROP_UUID(_name, _state, _field) \
|
||||
DEFINE_PROP(_name, _state, _field, qdev_prop_uuid, QemuUUID, \
|
||||
.set_default = true)
|
||||
|
||||
#define DEFINE_PROP_AUDIODEV(_n, _s, _f) \
|
||||
DEFINE_PROP(_n, _s, _f, qdev_prop_audiodev, QEMUSoundCard)
|
||||
|
||||
#define DEFINE_PROP_UUID_NODEFAULT(_name, _state, _field) { \
|
||||
.name = (_name), \
|
||||
.info = &qdev_prop_uuid, \
|
||||
.offset = offsetof(_state, _field) \
|
||||
+ type_check(QemuUUID, typeof_field(_state, _field)), \
|
||||
}
|
||||
#define DEFINE_PROP_UUID_NODEFAULT(_name, _state, _field) \
|
||||
DEFINE_PROP(_name, _state, _field, qdev_prop_uuid, QemuUUID)
|
||||
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue