Useful for cases where code is not converted to QOM and/or QDEV yet, but needs to check the value of a global property.
Signed-off-by: Eduardo Habkost <[email protected]> --- global-properties.c | 11 +++++++++++ hw/qdev.h | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/global-properties.c b/global-properties.c index 20a838c..0c3d1b6 100644 --- a/global-properties.c +++ b/global-properties.c @@ -49,6 +49,17 @@ static void object_set_globals(Object *obj, } while (class); } +const char *qemu_global_get(const char *driver, const char *property) +{ + GlobalProperty *prop; + QTAILQ_FOREACH(prop, &global_props, next) { + if (!strcmp(prop->driver, driver) && !strcmp(prop->property, property)) { + return prop->value; + } + } + return NULL; +} + void qdev_prop_set_globals(DeviceState *dev) { return object_set_globals(OBJECT(dev), qdev_global_parse); diff --git a/hw/qdev.h b/hw/qdev.h index 5941cae..d3210d8 100644 --- a/hw/qdev.h +++ b/hw/qdev.h @@ -337,6 +337,14 @@ void qemu_globals_register_list(GlobalProperty *props); void qdev_prop_set_globals(DeviceState *dev); void object_prop_set_globals(Object *obj); +/* Get the string value of a global property directly + * + * Using this function is discouraged. Code should be converted to use + * QOM and/or qdev instead of using it. It is provided only as a convenience + * for code that is not converted yet. + */ +const char *qemu_global_get(const char *driver, const char *property); + char *qdev_get_fw_dev_path(DeviceState *dev); /** -- 1.7.11.2
