All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Cédric Bosdonnat" <cbosdonnat@suse.com>
To: xen-devel@lists.xen.org
Cc: Ian Jackson <ian.jackson@eu.citrix.com>,
	Wei Liu <wei.liu2@citrix.com>,
	Cedric Bosdonnat <cbosdonnat@suse.com>
Subject: [PATCH v2 27/35] libxl/libxl_pvusb.c: used LOG*D functions
Date: Fri,  2 Dec 2016 16:08:33 +0100	[thread overview]
Message-ID: <20161202150841.31227-28-cbosdonnat@suse.com> (raw)
In-Reply-To: <20161202150841.31227-1-cbosdonnat@suse.com>

From: Cedric Bosdonnat <cbosdonnat@suse.com>

Use LOG*D logging functions where possible instead of the LOG* ones.

Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
---
 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;
     }
-- 
2.10.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  parent reply	other threads:[~2016-12-02 15:08 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-02 15:08 [PATCH v2 00/35] libxl LOG*D functions Cédric Bosdonnat
2016-12-02 15:08 ` [PATCH v2 01/35] libxl: add LIBXL_LOGD_* and LOG*D function families Cédric Bosdonnat
2016-12-02 15:08 ` [PATCH v2 02/35] libxl.c: switch to LOG*D use Cédric Bosdonnat
2016-12-02 15:08 ` [PATCH v2 03/35] libxl.c: switch to LOG*D use (refactored messages) Cédric Bosdonnat
2016-12-02 15:08 ` [PATCH v2 04/35] libxl.c: switch to LOG*D use Cédric Bosdonnat
2016-12-02 15:08 ` [PATCH v2 05/35] libxl/libxl_bootloader.c: used LOG*D functions Cédric Bosdonnat
2016-12-02 15:08 ` [PATCH v2 06/35] libxl/libxl_checkpoint_device.c: " Cédric Bosdonnat
2016-12-02 15:08 ` [PATCH v2 07/35] libxl/libxl_colo.h: " Cédric Bosdonnat
2016-12-02 15:08 ` [PATCH v2 08/35] libxl/libxl_colo_nic.c: " Cédric Bosdonnat
2016-12-02 15:08 ` [PATCH v2 09/35] libxl/libxl_colo_proxy.c: " Cédric Bosdonnat
2016-12-02 15:08 ` [PATCH v2 10/35] libxl/libxl_colo_qdisk.c: " Cédric Bosdonnat
2016-12-02 15:08 ` [PATCH v2 11/35] libxl/libxl_colo_restore.c: " Cédric Bosdonnat
2016-12-02 15:08 ` [PATCH v2 12/35] libxl/libxl_colo_save.c: " Cédric Bosdonnat
2016-12-02 15:08 ` [PATCH v2 13/35] libxl/libxl_create.c: " Cédric Bosdonnat
2016-12-02 15:08 ` [PATCH v2 14/35] libxl/libxl_device.c: " Cédric Bosdonnat
2016-12-02 15:08 ` [PATCH v2 15/35] libxl/libxl_dm.c: " Cédric Bosdonnat
2016-12-02 15:08 ` [PATCH v2 16/35] libxl/libxl_dom_save.c: " Cédric Bosdonnat
2016-12-02 15:08 ` [PATCH v2 17/35] libxl/libxl_dom_suspend.c: " Cédric Bosdonnat
2016-12-02 15:08 ` [PATCH v2 18/35] libxl/libxl_freebsd.c: " Cédric Bosdonnat
2016-12-02 15:08 ` [PATCH v2 19/35] libxl/libxl_internal.c: " Cédric Bosdonnat
2016-12-02 15:08 ` [PATCH v2 20/35] libxl/libxl_linux.c: " Cédric Bosdonnat
2016-12-02 15:08 ` [PATCH v2 21/35] libxl/libxl_netbsd.c: " Cédric Bosdonnat
2016-12-02 15:08 ` [PATCH v2 22/35] libxl/libxl_netbuffer.c: " Cédric Bosdonnat
2016-12-02 15:08 ` [PATCH v2 23/35] libxl/libxl_nic.c: " Cédric Bosdonnat
2016-12-02 15:08 ` [PATCH v2 24/35] libxl/libxl_no_colo.c: " Cédric Bosdonnat
2016-12-02 15:08 ` [PATCH v2 25/35] libxl/libxl_pci.c: " Cédric Bosdonnat
2016-12-02 15:08 ` [PATCH v2 26/35] libxl/libxl_psr.c: " Cédric Bosdonnat
2016-12-02 15:08 ` Cédric Bosdonnat [this message]
2016-12-02 15:08 ` [PATCH v2 28/35] libxl/libxl_qmp.c: " Cédric Bosdonnat
2016-12-02 15:08 ` [PATCH v2 29/35] libxl/libxl_remus.c: " Cédric Bosdonnat
2016-12-02 15:08 ` [PATCH v2 30/35] libxl/libxl_save_callout.c: " Cédric Bosdonnat
2016-12-02 15:08 ` [PATCH v2 31/35] libxl/libxl_stream_write.c: " Cédric Bosdonnat
2016-12-02 15:08 ` [PATCH v2 32/35] libxl/libxl_vnuma.c: " Cédric Bosdonnat
2016-12-02 15:08 ` [PATCH v2 33/35] libxl/libxl_vtpm.c: " Cédric Bosdonnat
2016-12-02 15:08 ` [PATCH v2 34/35] libxl/libxl_x86.c: " Cédric Bosdonnat
2016-12-02 15:08 ` [PATCH v2 35/35] libxl/libxl_xshelp.c: " Cédric Bosdonnat
2016-12-03 16:03 ` [PATCH v2 00/35] libxl " Wei Liu
2016-12-05 12:05   ` Wei Liu
  -- strict thread matches above, loose matches on Subject: below --
2016-11-17 17:35 Cédric Bosdonnat
2016-11-17 17:36 ` [PATCH v2 27/35] libxl/libxl_pvusb.c: used " Cédric Bosdonnat

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161202150841.31227-28-cbosdonnat@suse.com \
    --to=cbosdonnat@suse.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.