mirror of
https://github.com/mii443/qemu.git
synced 2025-08-22 23:25:48 +00:00
qom: simplify object_find_property / object_class_find_property
When debugging QEMU it is often useful to put a breakpoint on the error_setg_internal method impl. Unfortunately the object_property_add / object_class_property_add methods call object_property_find / object_class_property_find methods to check if a property exists already before adding the new property. As a result there are a huge number of calls to error_setg_internal on startup of most QEMU commands, making it very painful to set a breakpoint on this method. Most callers of object_find_property and object_class_find_property, however, pass in a NULL for the Error parameter. This simplifies the methods to remove the Error parameter entirely, and then adds some new wrapper methods that are able to raise an Error when needed. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200914135617.1493072-1-berrange@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
committed by
Eduardo Habkost
parent
834b9273d5
commit
efba15959c
@ -1463,14 +1463,52 @@ void object_property_set_default_uint(ObjectProperty *prop, uint64_t value);
|
||||
* object_property_find:
|
||||
* @obj: the object
|
||||
* @name: the name of the property
|
||||
*
|
||||
* Look up a property for an object.
|
||||
*
|
||||
* Return its #ObjectProperty if found, or NULL.
|
||||
*/
|
||||
ObjectProperty *object_property_find(Object *obj, const char *name);
|
||||
|
||||
/**
|
||||
* object_property_find_err:
|
||||
* @obj: the object
|
||||
* @name: the name of the property
|
||||
* @errp: returns an error if this function fails
|
||||
*
|
||||
* Look up a property for an object and return its #ObjectProperty if found.
|
||||
* Look up a property for an object.
|
||||
*
|
||||
* Return its #ObjectProperty if found, or NULL.
|
||||
*/
|
||||
ObjectProperty *object_property_find(Object *obj, const char *name,
|
||||
Error **errp);
|
||||
ObjectProperty *object_class_property_find(ObjectClass *klass, const char *name,
|
||||
Error **errp);
|
||||
ObjectProperty *object_property_find_err(Object *obj,
|
||||
const char *name,
|
||||
Error **errp);
|
||||
|
||||
/**
|
||||
* object_class_property_find:
|
||||
* @klass: the object class
|
||||
* @name: the name of the property
|
||||
*
|
||||
* Look up a property for an object class.
|
||||
*
|
||||
* Return its #ObjectProperty if found, or NULL.
|
||||
*/
|
||||
ObjectProperty *object_class_property_find(ObjectClass *klass,
|
||||
const char *name);
|
||||
|
||||
/**
|
||||
* object_class_property_find_err:
|
||||
* @klass: the object class
|
||||
* @name: the name of the property
|
||||
* @errp: returns an error if this function fails
|
||||
*
|
||||
* Look up a property for an object class.
|
||||
*
|
||||
* Return its #ObjectProperty if found, or NULL.
|
||||
*/
|
||||
ObjectProperty *object_class_property_find_err(ObjectClass *klass,
|
||||
const char *name,
|
||||
Error **errp);
|
||||
|
||||
typedef struct ObjectPropertyIterator {
|
||||
ObjectClass *nextclass;
|
||||
|
Reference in New Issue
Block a user