mirror of https://github.com/xqemu/xqemu.git
qdev: convert setting device properties to QError
This commit is contained in:
parent
84745d68e7
commit
fdcfa190ab
|
@ -548,24 +548,23 @@ int qdev_prop_parse(DeviceState *dev, const char *name, const char *value)
|
||||||
* removed along with it.
|
* removed along with it.
|
||||||
*/
|
*/
|
||||||
if (!prop || !prop->info->parse) {
|
if (!prop || !prop->info->parse) {
|
||||||
fprintf(stderr, "property \"%s.%s\" not found\n",
|
qerror_report(QERR_PROPERTY_NOT_FOUND, dev->info->name, name);
|
||||||
dev->info->name, name);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
ret = prop->info->parse(dev, prop, value);
|
ret = prop->info->parse(dev, prop, value);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
switch (ret) {
|
switch (ret) {
|
||||||
case -EEXIST:
|
case -EEXIST:
|
||||||
fprintf(stderr, "property \"%s.%s\": \"%s\" is already in use\n",
|
qerror_report(QERR_PROPERTY_VALUE_IN_USE,
|
||||||
dev->info->name, name, value);
|
dev->info->name, name, value);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
case -EINVAL:
|
case -EINVAL:
|
||||||
fprintf(stderr, "property \"%s.%s\": failed to parse \"%s\"\n",
|
qerror_report(QERR_PROPERTY_VALUE_BAD,
|
||||||
dev->info->name, name, value);
|
dev->info->name, name, value);
|
||||||
break;
|
break;
|
||||||
case -ENOENT:
|
case -ENOENT:
|
||||||
fprintf(stderr, "property \"%s.%s\": could not find \"%s\"\n",
|
qerror_report(QERR_PROPERTY_VALUE_NOT_FOUND,
|
||||||
dev->info->name, name, value);
|
dev->info->name, name, value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,8 +146,6 @@ static int set_property(const char *name, const char *value, void *opaque)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (qdev_prop_parse(dev, name, value) == -1) {
|
if (qdev_prop_parse(dev, name, value) == -1) {
|
||||||
error_report("can't set property \"%s\" to \"%s\" for \"%s\"",
|
|
||||||
name, value, dev->info->name);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue