if (usbctrl->type == LIBXL_USBCTRL_TYPE_QUSB) {
if (!libxl__query_qemu_backend(gc, domid, usbctrl->backend_domid,
"qusb", false)) {
- LOG(ERROR, "backend type not supported by device model");
+ LOGD(ERROR, domid, "backend type not supported by device model");
rc = ERROR_FAIL;
goto out;
}
if (rc < 0) goto out;
if (rc == 1) {
/* already exists in xenstore */
- LOG(ERROR, "device already exists in xenstore");
+ LOGD(ERROR, domid, "device already exists in xenstore");
rc = ERROR_DEVICE_EXISTS;
goto out;
}
for (i = 0; i < num_usbdev; i++) {
rc = libxl__device_usbdev_remove(gc, domid, &usbdevs[i]);
if (rc) {
- LOG(ERROR, "libxl__device_usbdev_remove failed: controller %d, "
+ LOGD(ERROR, domid, "libxl__device_usbdev_remove failed: controller %d, "
"port %d", usbdevs[i].ctrl, usbdevs[i].port);
goto out;
}
return usbctrls;
out:
- LOG(ERROR, "Unable to list USB Controllers");
+ LOGD(ERROR, domid, "Unable to list USB Controllers");
libxl_device_usbctrl_list_free(usbctrls, *num);
GC_FREE;
*num = 0;
if (usbdev->ctrl == -1) {
if (usbdev->port) {
- LOG(ERROR, "USB controller must be specified if you specify port");
+ LOGD(ERROR, domid,
+ "USB controller must be specified if you specify port");
return ERROR_INVAL;
}
if (rc) goto out;
if (tmp && strcmp(tmp, "")) {
- LOG(ERROR, "The controller port isn't available");
+ LOGD(ERROR, domid, "The controller port isn't available");
rc = ERROR_FAIL;
goto out;
}
}
if (!usbdev->port) {
- LOG(ERROR, "No available port under specified controller");
+ LOGD(ERROR, domid, "No available port under specified controller");
rc = ERROR_FAIL;
goto out;
}
busid = usbdev_busaddr_to_busid(gc, usbdev->u.hostdev.hostbus,
usbdev->u.hostdev.hostaddr);
if (!busid) {
- LOG(DEBUG, "Fail to get busid of usb device");
+ LOGD(DEBUG, domid, "Fail to get busid of usb device");
rc = ERROR_FAIL;
goto out;
}
be_path = vusb_get_port_path(gc, domid, type, usbdev->ctrl,
usbdev->port);
- LOG(DEBUG, "Adding usb device %s to xenstore: controller %d, port %d",
+ LOGD(DEBUG, domid, "Adding usb device %s to xenstore: controller %d, port %d",
busid, usbdev->ctrl, usbdev->port);
rc = libxl__xs_write_checked(gc, t, be_path, busid);
be_path = vusb_get_port_path(gc, domid, type, usbdev->ctrl, usbdev->port);
- LOG(DEBUG, "Removing usb device from xenstore: controller %d, port %d",
- usbdev->ctrl, usbdev->port);
+ LOGD(DEBUG, domid, "Removing usb device from xenstore: controller %d, port %d",
+ usbdev->ctrl, usbdev->port);
return libxl__xs_write_checked(gc, XBT_NULL, be_path, "");
}
}
break;
default:
- LOG(ERROR, "Unsupported usb controller type");
+ LOGD(ERROR, domid, "Unsupported usb controller type");
rc = ERROR_FAIL;
goto out;
}
if (rc) goto out;
if (usbctrlinfo.backend_id != LIBXL_TOOLSTACK_DOMID) {
- LOG(ERROR, "Don't support adding USB device from non-Dom0 backend");
+ LOGD(ERROR, domid,
+ "Don't support adding USB device from non-Dom0 backend");
rc = ERROR_INVAL;
goto out;
}
/* check usb device is assignable type */
if (!is_usbdev_assignable(gc, usbdev)) {
- LOG(ERROR, "USB device is not assignable.");
+ LOGD(ERROR, domid, "USB device is not assignable.");
rc = ERROR_FAIL;
goto out;
}
/* check usb device is already assigned */
rc = get_assigned_devices(gc, &assigned, &num_assigned);
if (rc) {
- LOG(ERROR, "cannot determine if device is assigned,"
- " refusing to continue");
+ LOGD(ERROR, domid, "cannot determine if device is assigned,"
+ " refusing to continue");
goto out;
}
if (is_usbdev_in_array(assigned, num_assigned, usbdev)) {
- LOG(ERROR, "USB device already attached to a domain");
+ LOGD(ERROR, domid, "USB device already attached to a domain");
rc = ERROR_INVAL;
goto out;
}
*/
rc = usbback_dev_unassign(gc, busid);
if (rc) {
- LOG(ERROR, "Error removing device from guest."
- " Try running usbdev-detach again.");
+ LOGD(ERROR, domid, "Error removing device from guest."
+ " Try running usbdev-detach again.");
goto out;
}
rc = libxl__device_usbdev_remove_xenstore(gc, domid, usbdev,
LIBXL_USBCTRL_TYPE_PV);
if (rc) {
- LOG(ERROR, "Error removing device from guest."
- " Try running usbdev-detach again.");
+ LOGD(ERROR, domid, "Error removing device from guest."
+ " Try running usbdev-detach again.");
goto out;
}
rc = usbdev_rebind(gc, busid);
if (rc) {
- LOG(ERROR, "USB device removed from guest, but couldn't"
- " re-bind to domain 0. Try removing and re-inserting"
- " the USB device or reloading the driver modules.");
+ LOGD(ERROR, domid, "USB device removed from guest, but couldn't"
+ " re-bind to domain 0. Try removing and re-inserting"
+ " the USB device or reloading the driver modules.");
goto out;
}
break;
default:
- LOG(ERROR, "Unsupported usb controller type");
+ LOGD(ERROR, domid, "Unsupported usb controller type");
rc = ERROR_FAIL;
goto out;
}
int rc;
if (usbdev->ctrl < 0 || usbdev->port < 1) {
- LOG(ERROR, "Invalid USB device");
+ LOGD(ERROR, domid, "Invalid USB device");
return ERROR_FAIL;
}
if (rc) goto out;
if (usbctrlinfo.backend_id != LIBXL_TOOLSTACK_DOMID) {
- LOG(ERROR, "Don't support removing USB device from non-Dom0 backend");
+ LOGD(ERROR, domid,
+ "Don't support removing USB device from non-Dom0 backend");
rc = ERROR_INVAL;
goto out;
}