@@ -215,7 +215,7 @@ static void vmgenid_realize(DeviceState *dev, Error **errp)
}
static Property vmgenid_device_properties[] = {
- DEFINE_PROP_UUID(VMGENID_GUID, VmGenIdState, guid),
+ DEFINE_PROP_UUID(VMGENID_GUID, VmGenIdState, guid, true),
DEFINE_PROP_END_OF_LIST(),
};
@@ -218,12 +218,12 @@ extern const PropertyInfo qdev_prop_off_auto_pcibar;
DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_off_auto_pcibar, \
OffAutoPCIBAR)
-#define DEFINE_PROP_UUID(_name, _state, _field) { \
+#define DEFINE_PROP_UUID(_name, _state, _field, _default) { \
.name = (_name), \
.info = &qdev_prop_uuid, \
.offset = offsetof(_state, _field) \
+ type_check(QemuUUID, typeof_field(_state, _field)), \
- .set_default = true, \
+ .set_default = _default, \
}
#define DEFINE_PROP_END_OF_LIST() \
It may not always be desirable to have a random UUID stuffed into the '_field' member. Add a new option '_default' to the macro, that will allow the caller to specify if a random UUID needs be generated or not. Also modified the instance where this macro is used. Signed-off-by: Venu Busireddy <venu.busireddy@oracle.com> --- hw/acpi/vmgenid.c | 2 +- include/hw/qdev-properties.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)