mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 02:03:56 -06:00
error: Replace qemu_error() by error_report()
error_report() terminates the message with a newline. Strip it it from its arguments. This fixes a few error messages lacking a newline: net_handle_fd_param()'s "No file descriptor named %s found", and tap_open()'s "vnet_hdr=1 requested, but no kernel support for IFF_VNET_HDR available" (all three versions). There's one place that passes arguments without newlines intentionally: load_vmstate(). Fix it up.
This commit is contained in:
parent
6fdb03d58c
commit
1ecda02b24
29 changed files with 127 additions and 119 deletions
6
hw/pc.c
6
hw/pc.c
|
@ -238,14 +238,14 @@ static int set_boot_dev(RTCState *s, const char *boot_device, int fd_bootchk)
|
|||
|
||||
nbds = strlen(boot_device);
|
||||
if (nbds > PC_MAX_BOOT_DEVICES) {
|
||||
qemu_error("Too many boot devices for PC\n");
|
||||
error_report("Too many boot devices for PC");
|
||||
return(1);
|
||||
}
|
||||
for (i = 0; i < nbds; i++) {
|
||||
bds[i] = boot_device2nibble(boot_device[i]);
|
||||
if (bds[i] == 0) {
|
||||
qemu_error("Invalid boot device for PC: '%c'\n",
|
||||
boot_device[i]);
|
||||
error_report("Invalid boot device for PC: '%c'",
|
||||
boot_device[i]);
|
||||
return(1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ static int scsi_hot_add(Monitor *mon, DeviceState *adapter,
|
|||
|
||||
scsibus = DO_UPCAST(SCSIBus, qbus, QLIST_FIRST(&adapter->child_bus));
|
||||
if (!scsibus || strcmp(scsibus->qbus.info->name, "SCSI") != 0) {
|
||||
qemu_error("Device is not a SCSI adapter\n");
|
||||
error_report("Device is not a SCSI adapter");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
14
hw/pci.c
14
hw/pci.c
|
@ -589,12 +589,12 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
|
|||
if (!bus->devices[devfn])
|
||||
goto found;
|
||||
}
|
||||
qemu_error("PCI: no devfn available for %s, all in use\n", name);
|
||||
error_report("PCI: no devfn available for %s, all in use", name);
|
||||
return NULL;
|
||||
found: ;
|
||||
} else if (bus->devices[devfn]) {
|
||||
qemu_error("PCI: devfn %d not available for %s, in use by %s\n", devfn,
|
||||
name, bus->devices[devfn]->name);
|
||||
error_report("PCI: devfn %d not available for %s, in use by %s",
|
||||
devfn, name, bus->devices[devfn]->name);
|
||||
return NULL;
|
||||
}
|
||||
pci_dev->bus = bus;
|
||||
|
@ -1476,8 +1476,8 @@ PCIDevice *pci_nic_init(NICInfo *nd, const char *default_model,
|
|||
|
||||
bus = pci_get_bus_devfn(&devfn, devaddr);
|
||||
if (!bus) {
|
||||
qemu_error("Invalid PCI device address %s for device %s\n",
|
||||
devaddr, pci_nic_names[i]);
|
||||
error_report("Invalid PCI device address %s for device %s",
|
||||
devaddr, pci_nic_names[i]);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -1768,8 +1768,8 @@ static int pci_add_option_rom(PCIDevice *pdev)
|
|||
|
||||
size = get_image_size(path);
|
||||
if (size < 0) {
|
||||
qemu_error("%s: failed to find romfile \"%s\"\n", __FUNCTION__,
|
||||
pdev->romfile);
|
||||
error_report("%s: failed to find romfile \"%s\"",
|
||||
__FUNCTION__, pdev->romfile);
|
||||
return -1;
|
||||
}
|
||||
if (size & (size - 1)) {
|
||||
|
|
42
hw/qdev.c
42
hw/qdev.c
|
@ -139,8 +139,8 @@ static int set_property(const char *name, const char *value, void *opaque)
|
|||
return 0;
|
||||
|
||||
if (qdev_prop_parse(dev, name, value) == -1) {
|
||||
qemu_error("can't set property \"%s\" to \"%s\" for \"%s\"\n",
|
||||
name, value, dev->info->name);
|
||||
error_report("can't set property \"%s\" to \"%s\" for \"%s\"",
|
||||
name, value, dev->info->name);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -184,7 +184,7 @@ DeviceState *qdev_device_add(QemuOpts *opts)
|
|||
|
||||
driver = qemu_opt_get(opts, "driver");
|
||||
if (!driver) {
|
||||
qemu_error("-device: no driver specified\n");
|
||||
error_report("-device: no driver specified");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -195,8 +195,8 @@ DeviceState *qdev_device_add(QemuOpts *opts)
|
|||
return NULL;
|
||||
}
|
||||
if (info->no_user) {
|
||||
qemu_error("device \"%s\" can't be added via command line\n",
|
||||
info->name);
|
||||
error_report("device \"%s\" can't be added via command line",
|
||||
info->name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -208,13 +208,13 @@ DeviceState *qdev_device_add(QemuOpts *opts)
|
|||
bus = qbus_find_recursive(main_system_bus, NULL, info->bus_info);
|
||||
}
|
||||
if (!bus) {
|
||||
qemu_error("Did not find %s bus for %s\n",
|
||||
path ? path : info->bus_info->name, info->name);
|
||||
error_report("Did not find %s bus for %s",
|
||||
path ? path : info->bus_info->name, info->name);
|
||||
return NULL;
|
||||
}
|
||||
if (qdev_hotplug && !bus->allow_hotplug) {
|
||||
qemu_error("Bus %s does not support hotplugging\n",
|
||||
bus->name);
|
||||
error_report("Bus %s does not support hotplugging",
|
||||
bus->name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -229,7 +229,7 @@ DeviceState *qdev_device_add(QemuOpts *opts)
|
|||
return NULL;
|
||||
}
|
||||
if (qdev_init(qdev) < 0) {
|
||||
qemu_error("Error initializing device %s\n", driver);
|
||||
error_report("Error initializing device %s", driver);
|
||||
return NULL;
|
||||
}
|
||||
qdev->opts = opts;
|
||||
|
@ -268,8 +268,8 @@ int qdev_init(DeviceState *dev)
|
|||
int qdev_unplug(DeviceState *dev)
|
||||
{
|
||||
if (!dev->parent_bus->allow_hotplug) {
|
||||
qemu_error("Bus %s does not support hotplugging\n",
|
||||
dev->parent_bus->name);
|
||||
error_report("Bus %s does not support hotplugging",
|
||||
dev->parent_bus->name);
|
||||
return -1;
|
||||
}
|
||||
assert(dev->info->unplug != NULL);
|
||||
|
@ -538,12 +538,12 @@ static BusState *qbus_find(const char *path)
|
|||
pos = 0;
|
||||
} else {
|
||||
if (sscanf(path, "%127[^/]%n", elem, &len) != 1) {
|
||||
qemu_error("path parse error (\"%s\")\n", path);
|
||||
error_report("path parse error (\"%s\")", path);
|
||||
return NULL;
|
||||
}
|
||||
bus = qbus_find_recursive(main_system_bus, elem, NULL);
|
||||
if (!bus) {
|
||||
qemu_error("bus \"%s\" not found\n", elem);
|
||||
error_report("bus \"%s\" not found", elem);
|
||||
return NULL;
|
||||
}
|
||||
pos = len;
|
||||
|
@ -557,13 +557,13 @@ static BusState *qbus_find(const char *path)
|
|||
|
||||
/* find device */
|
||||
if (sscanf(path+pos, "/%127[^/]%n", elem, &len) != 1) {
|
||||
qemu_error("path parse error (\"%s\" pos %d)\n", path, pos);
|
||||
error_report("path parse error (\"%s\" pos %d)", path, pos);
|
||||
return NULL;
|
||||
}
|
||||
pos += len;
|
||||
dev = qbus_find_dev(bus, elem);
|
||||
if (!dev) {
|
||||
qemu_error("device \"%s\" not found\n", elem);
|
||||
error_report("device \"%s\" not found", elem);
|
||||
qbus_list_dev(bus);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -572,12 +572,12 @@ static BusState *qbus_find(const char *path)
|
|||
* one child bus accept it nevertheless */
|
||||
switch (dev->num_child_bus) {
|
||||
case 0:
|
||||
qemu_error("device has no child bus (%s)\n", path);
|
||||
error_report("device has no child bus (%s)", path);
|
||||
return NULL;
|
||||
case 1:
|
||||
return QLIST_FIRST(&dev->child_bus);
|
||||
default:
|
||||
qemu_error("device has multiple child busses (%s)\n", path);
|
||||
error_report("device has multiple child busses (%s)", path);
|
||||
qbus_list_bus(dev);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -585,13 +585,13 @@ static BusState *qbus_find(const char *path)
|
|||
|
||||
/* find bus */
|
||||
if (sscanf(path+pos, "/%127[^/]%n", elem, &len) != 1) {
|
||||
qemu_error("path parse error (\"%s\" pos %d)\n", path, pos);
|
||||
error_report("path parse error (\"%s\" pos %d)", path, pos);
|
||||
return NULL;
|
||||
}
|
||||
pos += len;
|
||||
bus = qbus_find_bus(dev, elem);
|
||||
if (!bus) {
|
||||
qemu_error("child bus \"%s\" not found\n", elem);
|
||||
error_report("child bus \"%s\" not found", elem);
|
||||
qbus_list_bus(dev);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -749,7 +749,7 @@ void do_device_del(Monitor *mon, const QDict *qdict)
|
|||
|
||||
dev = qdev_find_recursive(main_system_bus, id);
|
||||
if (NULL == dev) {
|
||||
qemu_error("Device '%s' not found\n", id);
|
||||
error_report("Device '%s' not found", id);
|
||||
return;
|
||||
}
|
||||
qdev_unplug(dev);
|
||||
|
|
|
@ -41,7 +41,7 @@ static int scsi_qdev_init(DeviceState *qdev, DeviceInfo *base)
|
|||
}
|
||||
}
|
||||
if (dev->id >= bus->ndev) {
|
||||
qemu_error("bad scsi device id: %d\n", dev->id);
|
||||
error_report("bad scsi device id: %d", dev->id);
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
|
|
@ -1025,13 +1025,13 @@ static int scsi_disk_initfn(SCSIDevice *dev)
|
|||
uint64_t nb_sectors;
|
||||
|
||||
if (!s->qdev.conf.dinfo || !s->qdev.conf.dinfo->bdrv) {
|
||||
qemu_error("scsi-disk: drive property not set\n");
|
||||
error_report("scsi-disk: drive property not set");
|
||||
return -1;
|
||||
}
|
||||
s->bs = s->qdev.conf.dinfo->bdrv;
|
||||
|
||||
if (bdrv_is_sg(s->bs)) {
|
||||
qemu_error("scsi-disk: unwanted /dev/sg*\n");
|
||||
error_report("scsi-disk: unwanted /dev/sg*");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -464,27 +464,27 @@ static int scsi_generic_initfn(SCSIDevice *dev)
|
|||
struct sg_scsi_id scsiid;
|
||||
|
||||
if (!s->qdev.conf.dinfo || !s->qdev.conf.dinfo->bdrv) {
|
||||
qemu_error("scsi-generic: drive property not set\n");
|
||||
error_report("scsi-generic: drive property not set");
|
||||
return -1;
|
||||
}
|
||||
s->bs = s->qdev.conf.dinfo->bdrv;
|
||||
|
||||
/* check we are really using a /dev/sg* file */
|
||||
if (!bdrv_is_sg(s->bs)) {
|
||||
qemu_error("scsi-generic: not /dev/sg*\n");
|
||||
error_report("scsi-generic: not /dev/sg*");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* check we are using a driver managing SG_IO (version 3 and after */
|
||||
if (bdrv_ioctl(s->bs, SG_GET_VERSION_NUM, &sg_version) < 0 ||
|
||||
sg_version < 30000) {
|
||||
qemu_error("scsi-generic: scsi generic interface too old\n");
|
||||
error_report("scsi-generic: scsi generic interface too old");
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* get LUN of the /dev/sg? */
|
||||
if (bdrv_ioctl(s->bs, SG_GET_SCSI_ID, &scsiid)) {
|
||||
qemu_error("scsi-generic: SG_GET_SCSI_ID ioctl failed\n");
|
||||
error_report("scsi-generic: SG_GET_SCSI_ID ioctl failed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -291,14 +291,14 @@ USBDevice *usbdevice_create(const char *cmdline)
|
|||
if (info == NULL) {
|
||||
#if 0
|
||||
/* no error because some drivers are not converted (yet) */
|
||||
qemu_error("usbdevice %s not found\n", driver);
|
||||
error_report("usbdevice %s not found", driver);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!usb->usbdevice_init) {
|
||||
if (params) {
|
||||
qemu_error("usbdevice %s accepts no params\n", driver);
|
||||
error_report("usbdevice %s accepts no params", driver);
|
||||
return NULL;
|
||||
}
|
||||
return usb_create_simple(bus, usb->qdev.name);
|
||||
|
|
|
@ -524,7 +524,7 @@ static int usb_msd_initfn(USBDevice *dev)
|
|||
MSDState *s = DO_UPCAST(MSDState, dev, dev);
|
||||
|
||||
if (!s->conf.dinfo || !s->conf.dinfo->bdrv) {
|
||||
qemu_error("usb-msd: drive property not set\n");
|
||||
error_report("usb-msd: drive property not set");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -565,26 +565,26 @@ static USBDevice *usb_serial_init(const char *filename)
|
|||
if (strstart(filename, "vendorid=", &p)) {
|
||||
vendorid = strtol(p, &e, 16);
|
||||
if (e == p || (*e && *e != ',' && *e != ':')) {
|
||||
qemu_error("bogus vendor ID %s\n", p);
|
||||
error_report("bogus vendor ID %s", p);
|
||||
return NULL;
|
||||
}
|
||||
filename = e;
|
||||
} else if (strstart(filename, "productid=", &p)) {
|
||||
productid = strtol(p, &e, 16);
|
||||
if (e == p || (*e && *e != ',' && *e != ':')) {
|
||||
qemu_error("bogus product ID %s\n", p);
|
||||
error_report("bogus product ID %s", p);
|
||||
return NULL;
|
||||
}
|
||||
filename = e;
|
||||
} else {
|
||||
qemu_error("unrecognized serial USB option %s\n", filename);
|
||||
error_report("unrecognized serial USB option %s", filename);
|
||||
return NULL;
|
||||
}
|
||||
while(*filename == ',')
|
||||
filename++;
|
||||
}
|
||||
if (!*filename) {
|
||||
qemu_error("character device specification needed\n");
|
||||
error_report("character device specification needed");
|
||||
return NULL;
|
||||
}
|
||||
filename++;
|
||||
|
|
|
@ -765,7 +765,7 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
|
|||
|
||||
if (version_id >= 7) {
|
||||
if (qemu_get_be32(f) && !peer_has_vnet_hdr(n)) {
|
||||
qemu_error("virtio-net: saved image requires vnet_hdr=on\n");
|
||||
error_report("virtio-net: saved image requires vnet_hdr=on");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -794,7 +794,7 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
|
|||
|
||||
if (version_id >= 11) {
|
||||
if (qemu_get_byte(f) && !peer_has_ufo(n)) {
|
||||
qemu_error("virtio-net: saved image requires TUN_F_UFO support\n");
|
||||
error_report("virtio-net: saved image requires TUN_F_UFO support");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -459,7 +459,7 @@ static int virtio_blk_init_pci(PCIDevice *pci_dev)
|
|||
proxy->class_code = PCI_CLASS_STORAGE_SCSI;
|
||||
|
||||
if (!proxy->block.dinfo) {
|
||||
qemu_error("virtio-blk-pci: drive property not set\n");
|
||||
error_report("virtio-blk-pci: drive property not set");
|
||||
return -1;
|
||||
}
|
||||
vdev = virtio_blk_init(&pci_dev->qdev, &proxy->block);
|
||||
|
|
|
@ -485,7 +485,7 @@ static int virtser_port_qdev_init(DeviceState *qdev, DeviceInfo *base)
|
|||
plugging_port0 = port->is_console && !find_port_by_id(port->vser, 0);
|
||||
|
||||
if (port->vser->config.nr_ports == bus->max_nr_ports && !plugging_port0) {
|
||||
qemu_error("virtio-serial-bus: Maximum device limit reached\n");
|
||||
error_report("virtio-serial-bus: Maximum device limit reached");
|
||||
return -1;
|
||||
}
|
||||
dev->info = info;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue