qdev error logging
Use the new qemu_error() function in qdev.c Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
84fc5589f8
commit
286c2321ec
26
hw/qdev.c
26
hw/qdev.c
|
@ -138,7 +138,7 @@ static int set_property(const char *name, const char *value, void *opaque)
|
|||
return 0;
|
||||
|
||||
if (-1 == qdev_prop_parse(dev, name, value)) {
|
||||
fprintf(stderr, "can't set property \"%s\" to \"%s\" for \"%s\"\n",
|
||||
qemu_error("can't set property \"%s\" to \"%s\" for \"%s\"\n",
|
||||
name, value, dev->info->name);
|
||||
return -1;
|
||||
}
|
||||
|
@ -154,14 +154,14 @@ DeviceState *qdev_device_add(QemuOpts *opts)
|
|||
|
||||
driver = qemu_opt_get(opts, "driver");
|
||||
if (!driver) {
|
||||
fprintf(stderr, "-device: no driver specified\n");
|
||||
qemu_error("-device: no driver specified\n");
|
||||
return NULL;
|
||||
}
|
||||
if (strcmp(driver, "?") == 0) {
|
||||
char msg[256];
|
||||
for (info = device_info_list; info != NULL; info = info->next) {
|
||||
qdev_print_devinfo(info, msg, sizeof(msg));
|
||||
fprintf(stderr, "%s\n", msg);
|
||||
qemu_error("%s\n", msg);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@ -169,12 +169,12 @@ DeviceState *qdev_device_add(QemuOpts *opts)
|
|||
/* find driver */
|
||||
info = qdev_find_info(NULL, driver);
|
||||
if (!info) {
|
||||
fprintf(stderr, "Device \"%s\" not found. Try -device '?' for a list.\n",
|
||||
qemu_error("Device \"%s\" not found. Try -device '?' for a list.\n",
|
||||
driver);
|
||||
return NULL;
|
||||
}
|
||||
if (info->no_user) {
|
||||
fprintf(stderr, "device \"%s\" can't be added via command line\n",
|
||||
qemu_error("device \"%s\" can't be added via command line\n",
|
||||
info->name);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -442,12 +442,12 @@ static BusState *qbus_find(const char *path)
|
|||
pos = 0;
|
||||
} else {
|
||||
if (sscanf(path, "%127[^/]%n", elem, &len) != 1) {
|
||||
fprintf(stderr, "path parse error (\"%s\")\n", path);
|
||||
qemu_error("path parse error (\"%s\")\n", path);
|
||||
return NULL;
|
||||
}
|
||||
bus = qbus_find_recursive(main_system_bus, elem, NULL);
|
||||
if (!bus) {
|
||||
fprintf(stderr, "bus \"%s\" not found\n", elem);
|
||||
qemu_error("bus \"%s\" not found\n", elem);
|
||||
return NULL;
|
||||
}
|
||||
pos = len;
|
||||
|
@ -461,14 +461,14 @@ static BusState *qbus_find(const char *path)
|
|||
|
||||
/* find device */
|
||||
if (sscanf(path+pos, "/%127[^/]%n", elem, &len) != 1) {
|
||||
fprintf(stderr, "path parse error (\"%s\" pos %d)\n", path, pos);
|
||||
qemu_error("path parse error (\"%s\" pos %d)\n", path, pos);
|
||||
return NULL;
|
||||
}
|
||||
pos += len;
|
||||
dev = qbus_find_dev(bus, elem);
|
||||
if (!dev) {
|
||||
qbus_list_dev(bus, msg, sizeof(msg));
|
||||
fprintf(stderr, "device \"%s\" not found\n%s\n", elem, msg);
|
||||
qemu_error("device \"%s\" not found\n%s\n", elem, msg);
|
||||
return NULL;
|
||||
}
|
||||
if (path[pos] == '\0') {
|
||||
|
@ -476,13 +476,13 @@ static BusState *qbus_find(const char *path)
|
|||
* one child bus accept it nevertheless */
|
||||
switch (dev->num_child_bus) {
|
||||
case 0:
|
||||
fprintf(stderr, "device has no child bus (%s)\n", path);
|
||||
qemu_error("device has no child bus (%s)\n", path);
|
||||
return NULL;
|
||||
case 1:
|
||||
return LIST_FIRST(&dev->child_bus);
|
||||
default:
|
||||
qbus_list_bus(dev, msg, sizeof(msg));
|
||||
fprintf(stderr, "device has multiple child busses (%s)\n%s\n",
|
||||
qemu_error("device has multiple child busses (%s)\n%s\n",
|
||||
path, msg);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -490,14 +490,14 @@ static BusState *qbus_find(const char *path)
|
|||
|
||||
/* find bus */
|
||||
if (sscanf(path+pos, "/%127[^/]%n", elem, &len) != 1) {
|
||||
fprintf(stderr, "path parse error (\"%s\" pos %d)\n", path, pos);
|
||||
qemu_error("path parse error (\"%s\" pos %d)\n", path, pos);
|
||||
return NULL;
|
||||
}
|
||||
pos += len;
|
||||
bus = qbus_find_bus(dev, elem);
|
||||
if (!bus) {
|
||||
qbus_list_bus(dev, msg, sizeof(msg));
|
||||
fprintf(stderr, "child bus \"%s\" not found\n%s\n", elem, msg);
|
||||
qemu_error("child bus \"%s\" not found\n%s\n", elem, msg);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue