From patchwork Tue Nov 15 10:19:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cedric Bosdonnat X-Patchwork-Id: 9429369 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1045F60469 for ; Tue, 15 Nov 2016 10:22:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EBE1B286B9 for ; Tue, 15 Nov 2016 10:22:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E0D08286C4; Tue, 15 Nov 2016 10:22:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4FE3E286E3 for ; Tue, 15 Nov 2016 10:22:27 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c6aqi-00062h-So; Tue, 15 Nov 2016 10:20:20 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c6aqh-0005vC-6i for xen-devel@lists.xen.org; Tue, 15 Nov 2016 10:20:19 +0000 Received: from [85.158.139.211] by server-3.bemta-5.messagelabs.com id 88/5D-01948-261EA285; Tue, 15 Nov 2016 10:20:18 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprIIsWRWlGSWpSXmKPExsVyuP0uq27cQ60 Ig693TSyWfFzM4sDocXT3b6YAxijWzLyk/IoE1owLW3awFTx2rbi1qY+1gfGTQRcjF4eQwBJG if8TjrJ0MXJysAnYS3T9OcoEYosISEtc+3yZEaSIWeAEo0TPxs1sIAlhAQeJqV27wRpYBFQl9 h1dCtbAK2ApMXHONDBbQkBe4sLVU2A1nEDxn0efsoPYQgIWEksudzND1AtKnJz5BKiGA2iBus T6eUIgYWag1uats5knMPLOQlI1C6FqFpKqBYzMqxg1ilOLylKLdI3M9JKKMtMzSnITM3N0DQ1 M9XJTi4sT01NzEpOK9ZLzczcxAoOqnoGBcQfj7cl+hxglOZiURHmFVmtFCPEl5adUZiQWZ8QX leakFh9ilOHgUJLgVXgAlBMsSk1PrUjLzAGGN0xagoNHSYQ3BiTNW1yQmFucmQ6ROsWoKCXOG wCSEABJZJTmwbXBYuoSo6yUMC8jAwODEE9BalFuZgmq/CtGcQ5GJWHeV/eBpvBk5pXATX8FtJ gJaPEucw2QxSWJCCmpBkamBgbN/Xs/+RjKn76QcPnVllrNVcfTeoqTej9mBX9eO5m7WIuhOOD /YwfXeQaGb7XWKu+s++LJ7Xdq2sPNL0xmOvqXTH6z4RyD3UHrBW0PNs1xji3y3yMnuJnRzee9 uPa6lO3tuxrDTA1OWWs4q3GsTDC3uWQ886N55W/bD5OWnHrIO4W/9pkSS3FGoqEWc1FxIgB+S B5XpAIAAA== X-Env-Sender: cbosdonnat@suse.com X-Msg-Ref: server-6.tower-206.messagelabs.com!1479205214!70128962!1 X-Originating-IP: [195.135.221.5] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 9.0.16; banners=-,-,- X-VirusChecked: Checked Received: (qmail 4840 invoked from network); 15 Nov 2016 10:20:14 -0000 Received: from smtp.nue.novell.com (HELO smtp.nue.novell.com) (195.135.221.5) by server-6.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 15 Nov 2016 10:20:14 -0000 Received: from laptop.vms (mhy71-2-88-167-63-197.fbx.proxad.net [88.167.63.197]) by smtp.nue.novell.com with ESMTP (TLS encrypted); Tue, 15 Nov 2016 11:20:13 +0100 From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= To: xen-devel@lists.xen.org Date: Tue, 15 Nov 2016 11:19:05 +0100 Message-Id: <20161115101913.10396-28-cbosdonnat@suse.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20161115101913.10396-1-cbosdonnat@suse.com> References: <20161115101913.10396-1-cbosdonnat@suse.com> MIME-Version: 1.0 Cc: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= , Wei Liu , Ian Jackson , =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= Subject: [Xen-devel] [PATCH 27/35] libxl/libxl_pvusb.c: used LOG*D functions X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Cédric Bosdonnat Use LOG*D logging functions where possible instead of the LOG* ones. Signed-off-by: Cédric Bosdonnat --- tools/libxl/libxl_usb.c | 57 ++++++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/tools/libxl/libxl_usb.c b/tools/libxl/libxl_usb.c index 76260b1..ea7a2ab 100644 --- a/tools/libxl/libxl_usb.c +++ b/tools/libxl/libxl_usb.c @@ -254,7 +254,7 @@ static int libxl__device_usbctrl_add_xenstore(libxl__gc *gc, uint32_t domid, 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; } @@ -269,7 +269,7 @@ static int libxl__device_usbctrl_add_xenstore(libxl__gc *gc, uint32_t domid, 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; } @@ -536,7 +536,7 @@ void libxl__initiate_device_usbctrl_remove(libxl__egc *egc, 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; } @@ -633,7 +633,7 @@ libxl_device_usbctrl_list(libxl_ctx *ctx, uint32_t domid, int *num) 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; @@ -1067,7 +1067,8 @@ static int libxl__device_usbdev_setdefault(libxl__gc *gc, 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; } @@ -1119,7 +1120,7 @@ static int libxl__device_usbdev_setdefault(libxl__gc *gc, 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; } @@ -1146,7 +1147,7 @@ static int libxl__device_usbdev_setdefault(libxl__gc *gc, } 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; } @@ -1183,7 +1184,7 @@ static int libxl__device_usbdev_add_xenstore(libxl__gc *gc, uint32_t domid, 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; } @@ -1217,7 +1218,7 @@ static int libxl__device_usbdev_add_xenstore(libxl__gc *gc, uint32_t domid, 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); @@ -1245,8 +1246,8 @@ static int libxl__device_usbdev_remove_xenstore(libxl__gc *gc, uint32_t domid, 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, ""); } @@ -1634,7 +1635,7 @@ static int do_usbdev_add(libxl__gc *gc, uint32_t domid, } break; default: - LOG(ERROR, "Unsupported usb controller type"); + LOGD(ERROR, domid, "Unsupported usb controller type"); rc = ERROR_FAIL; goto out; } @@ -1687,7 +1688,8 @@ static void libxl__device_usbdev_add(libxl__egc *egc, uint32_t domid, 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; } @@ -1695,7 +1697,7 @@ static void libxl__device_usbdev_add(libxl__egc *egc, uint32_t domid, /* 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; } @@ -1703,13 +1705,13 @@ static void libxl__device_usbdev_add(libxl__egc *egc, uint32_t domid, /* 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; } @@ -1771,24 +1773,24 @@ static int do_usbdev_remove(libxl__gc *gc, uint32_t domid, */ 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; } @@ -1814,7 +1816,7 @@ static int do_usbdev_remove(libxl__gc *gc, uint32_t domid, break; default: - LOG(ERROR, "Unsupported usb controller type"); + LOGD(ERROR, domid, "Unsupported usb controller type"); rc = ERROR_FAIL; goto out; } @@ -1843,7 +1845,7 @@ static int libxl__device_usbdev_remove(libxl__gc *gc, uint32_t domid, int rc; if (usbdev->ctrl < 0 || usbdev->port < 1) { - LOG(ERROR, "Invalid USB device"); + LOGD(ERROR, domid, "Invalid USB device"); return ERROR_FAIL; } @@ -1855,7 +1857,8 @@ static int libxl__device_usbdev_remove(libxl__gc *gc, uint32_t domid, 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; }