mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
qdev: Make error_set_from_qdev_prop_error() get Object* argument
Make the code more generic and not specific to TYPE_DEVICE. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> #s390 parts Message-Id: <20201211220529.2290218-13-ehabkost@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
parent
381481597c
commit
c7525b183c
4 changed files with 12 additions and 12 deletions
|
@ -581,7 +581,7 @@ static void set_uuid(Object *obj, Visitor *v, const char *name, void *opaque,
|
|||
if (!strcmp(str, UUID_VALUE_AUTO)) {
|
||||
qemu_uuid_generate(uuid);
|
||||
} else if (qemu_uuid_parse(str, uuid) < 0) {
|
||||
error_set_from_qdev_prop_error(errp, EINVAL, dev, prop, str);
|
||||
error_set_from_qdev_prop_error(errp, EINVAL, obj, prop, str);
|
||||
}
|
||||
g_free(str);
|
||||
}
|
||||
|
@ -735,22 +735,22 @@ static Property *qdev_prop_find(DeviceState *dev, const char *name)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void error_set_from_qdev_prop_error(Error **errp, int ret, DeviceState *dev,
|
||||
void error_set_from_qdev_prop_error(Error **errp, int ret, Object *obj,
|
||||
Property *prop, const char *value)
|
||||
{
|
||||
switch (ret) {
|
||||
case -EEXIST:
|
||||
error_setg(errp, "Property '%s.%s' can't take value '%s', it's in use",
|
||||
object_get_typename(OBJECT(dev)), prop->name, value);
|
||||
object_get_typename(obj), prop->name, value);
|
||||
break;
|
||||
default:
|
||||
case -EINVAL:
|
||||
error_setg(errp, QERR_PROPERTY_VALUE_BAD,
|
||||
object_get_typename(OBJECT(dev)), prop->name, value);
|
||||
object_get_typename(obj), prop->name, value);
|
||||
break;
|
||||
case -ENOENT:
|
||||
error_setg(errp, "Property '%s.%s' can't find value '%s'",
|
||||
object_get_typename(OBJECT(dev)), prop->name, value);
|
||||
object_get_typename(obj), prop->name, value);
|
||||
break;
|
||||
case 0:
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue