From patchwork Fri Dec 2 15:08:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cedric Bosdonnat X-Patchwork-Id: 9458739 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 5735960236 for ; Fri, 2 Dec 2016 15:11:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 477EA284E2 for ; Fri, 2 Dec 2016 15:11:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3950F28556; Fri, 2 Dec 2016 15:11:58 +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 9BD382847C for ; Fri, 2 Dec 2016 15:11:57 +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 1cCpSg-00034r-KX; Fri, 02 Dec 2016 15:09:18 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cCpSf-00031f-2r for xen-devel@lists.xen.org; Fri, 02 Dec 2016 15:09:17 +0000 Received: from [85.158.139.211] by server-17.bemta-5.messagelabs.com id 38/16-32108-C9E81485; Fri, 02 Dec 2016 15:09:16 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprFIsWRWlGSWpSXmKPExsVyuP0uq+7sPsc Ig/+7VSyWfFzM4sDocXT3b6YAxijWzLyk/IoE1ozte90L5vpUtO6+x9rA+MGki5GTQ0hgCaPE wVc1IDabgL1E15+jTCC2iIC0xLXPlxlBbGaBEommc53MILawgIvE2i83weIsAqoS904fBqvnF bCUeLjjCjuILSEgL7Hw/BGwOCdQ/EHLdUaIXRYSzTfusEDUC0qcnPkEyOYAmq8usX6eEMQqeY nmrbOZJzDyzkJSNQuhahaSqgWMzKsYNYpTi8pSi3SNTPWSijLTM0pyEzNzdA0NTPVyU4uLE9N TcxKTivWS83M3MQLDqZ6BgXEH4652v0OMkhxMSqK8pjmOEUJ8SfkplRmJxRnxRaU5qcWHGGU4 OJQkeJt7gXKCRanpqRVpmTnAwIZJS3DwKInwqoKkeYsLEnOLM9MhUqcYdTmmPVv8lEmIJS8/L 1VKnPcISJEASFFGaR7cCFiUXWKUlRLmZWRgYBDiKUgtys0sQZV/xSjOwagkzLsPZApPZl4J3K ZXQEcwAR3Rcd0e5IiSRISUVANj4XrX3RMuznZ+fFe+dIF99Z+A+m9JE1n23WCaMGFO4EarDSf XfRI4+3Ol2TT5xvuxAZ0mSQfLd/0RUvmf5qJnoJTLKL7oS+VprpSsyvpbSV+Mf15yCW5cF+t8 s+jxunnKvPmCLZOFLj9p0J/5KUSwYHtkUl781La6nPl7Q557v7O/+vw68/P9SizFGYmGWsxFx YkAde+cVq0CAAA= X-Env-Sender: cbosdonnat@suse.com X-Msg-Ref: server-12.tower-206.messagelabs.com!1480691352!37143338!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 42047 invoked from network); 2 Dec 2016 15:09:13 -0000 Received: from smtp.nue.novell.com (HELO smtp.nue.novell.com) (195.135.221.5) by server-12.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 2 Dec 2016 15:09:13 -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); Fri, 02 Dec 2016 16:09:14 +0100 From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= To: xen-devel@lists.xen.org Date: Fri, 2 Dec 2016 16:08:20 +0100 Message-Id: <20161202150841.31227-15-cbosdonnat@suse.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161202150841.31227-1-cbosdonnat@suse.com> References: <20161202150841.31227-1-cbosdonnat@suse.com> MIME-Version: 1.0 Cc: Ian Jackson , Wei Liu , Cedric Bosdonnat Subject: [Xen-devel] [PATCH v2 14/35] libxl/libxl_device.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: Cedric Bosdonnat Use LOG*D logging functions where possible instead of the LOG* ones. Signed-off-by: Cédric Bosdonnat Acked-by: Wei Liu --- tools/libxl/libxl_device.c | 70 ++++++++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 33 deletions(-) diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c index 3e7a102..5e22866 100644 --- a/tools/libxl/libxl_device.c +++ b/tools/libxl/libxl_device.c @@ -94,13 +94,13 @@ int libxl__nic_type(libxl__gc *gc, libxl__device *dev, libxl_nic_type *nictype) snictype = libxl__xs_read(gc, XBT_NULL, GCSPRINTF("%s/%s", be_path, "type")); if (!snictype) { - LOGE(ERROR, "unable to read nictype from %s", be_path); + LOGED(ERROR, dev->domid, "unable to read nictype from %s", be_path); rc = ERROR_FAIL; goto out; } rc = libxl_nic_type_from_string(snictype, nictype); if (rc) { - LOGE(ERROR, "unable to parse nictype from %s", be_path); + LOGED(ERROR, dev->domid, "unable to parse nictype from %s", be_path); goto out; } @@ -231,7 +231,7 @@ retry_transaction: if (errno == EAGAIN) goto retry_transaction; else { - LOGE(ERROR, "xs transaction failed"); + LOGED(ERROR, device->domid, "xs transaction failed"); return ERROR_FAIL; } } @@ -885,7 +885,7 @@ void libxl__wait_device_connection(libxl__egc *egc, libxl__ao_device *aodev) state_path, XenbusStateInitWait, LIBXL_INIT_TIMEOUT * 1000); if (rc) { - LOG(ERROR, "unable to initialize device %s", be_path); + LOGD(ERROR, aodev->dev->domid, "unable to initialize device %s", be_path); goto out; } @@ -914,14 +914,14 @@ void libxl__initiate_device_generic_remove(libxl__egc *egc, rc = libxl__get_domid(gc, &my_domid); if (rc) { - LOG(ERROR, "unable to get my domid"); + LOGD(ERROR, domid, "unable to get my domid"); goto out; } if (my_domid == LIBXL_TOOLSTACK_DOMID) { rc = libxl_domain_info(CTX, &info, domid); if (rc) { - LOG(ERROR, "unable to get info for domain %d", domid); + LOGD(ERROR, domid, "unable to get info for domain %d", domid); goto out; } if (QEMU_BACKEND(aodev->dev) && @@ -934,8 +934,8 @@ void libxl__initiate_device_generic_remove(libxl__egc *egc, device_qemu_timeout, LIBXL_QEMU_BODGE_TIMEOUT * 1000); if (rc) { - LOG(ERROR, "unable to register timeout for Qemu device %s", - be_path); + LOGD(ERROR, domid, "unable to register timeout for Qemu device %s", + be_path); goto out; } goto out_success; @@ -945,7 +945,7 @@ void libxl__initiate_device_generic_remove(libxl__egc *egc, for (;;) { rc = libxl__xs_transaction_start(gc, &t); if (rc) { - LOG(ERROR, "unable to start transaction"); + LOGD(ERROR, domid, "unable to start transaction"); goto out; } @@ -955,7 +955,7 @@ void libxl__initiate_device_generic_remove(libxl__egc *egc, rc = libxl__xs_read_checked(gc, t, state_path, &state); if (rc) { - LOG(ERROR, "unable to read device state from path %s", state_path); + LOGD(ERROR, domid, "unable to read device state from path %s", state_path); goto out; } @@ -970,7 +970,7 @@ void libxl__initiate_device_generic_remove(libxl__egc *egc, if (state && atoi(state) != XenbusStateClosed) { rc = libxl__xs_write_checked(gc, t, state_path, GCSPRINTF("%d", XenbusStateClosing)); if (rc) { - LOG(ERROR, "unable to write to xenstore path %s", state_path); + LOGD(ERROR, domid, "unable to write to xenstore path %s", state_path); goto out; } } @@ -985,7 +985,7 @@ void libxl__initiate_device_generic_remove(libxl__egc *egc, state_path, XenbusStateClosed, LIBXL_DESTROY_TIMEOUT * 1000); if (rc) { - LOG(ERROR, "unable to remove device %s", be_path); + LOGD(ERROR, domid, "unable to remove device %s", be_path); goto out; } @@ -1019,7 +1019,7 @@ static void device_qemu_timeout(libxl__egc *egc, libxl__ev_time *ev, for (;;) { rc = libxl__xs_transaction_start(gc, &t); if (rc) { - LOG(ERROR, "unable to start transaction"); + LOGD(ERROR, aodev->dev->domid, "unable to start transaction"); goto out; } @@ -1056,22 +1056,22 @@ static void device_backend_callback(libxl__egc *egc, libxl__ev_devstate *ds, libxl__ao_device *aodev = CONTAINER_OF(ds, *aodev, backend_ds); STATE_AO_GC(aodev->ao); - LOG(DEBUG, "calling device_backend_cleanup"); + LOGD(DEBUG, aodev->dev->domid, "calling device_backend_cleanup"); device_backend_cleanup(gc, aodev); if (rc == ERROR_TIMEDOUT && aodev->action == LIBXL__DEVICE_ACTION_REMOVE && !aodev->force) { - LOG(DEBUG, "Timeout reached, initiating forced remove"); + LOGD(DEBUG, aodev->dev->domid, "Timeout reached, initiating forced remove"); aodev->force = 1; libxl__initiate_device_generic_remove(egc, aodev); return; } if (rc) { - LOG(ERROR, "unable to %s device with path %s", - libxl__device_action_to_string(aodev->action), - libxl__device_backend_path(gc, aodev->dev)); + LOGD(ERROR, aodev->dev->domid, "unable to %s device with path %s", + libxl__device_action_to_string(aodev->action), + libxl__device_backend_path(gc, aodev->dev)); goto out; } @@ -1106,12 +1106,13 @@ static void device_hotplug(libxl__egc *egc, libxl__ao_device *aodev) */ rc = libxl__get_domid(gc, &domid); if (rc) { - LOG(ERROR, "Failed to get domid"); + LOGD(ERROR, aodev->dev->domid, "Failed to get domid"); goto out; } if (aodev->dev->backend_domid != domid) { - LOG(DEBUG, "Backend domid %d, domid %d, assuming driver domains", - aodev->dev->backend_domid, domid); + LOGD(DEBUG, aodev->dev->domid, + "Backend domid %d, domid %d, assuming driver domains", + aodev->dev->backend_domid, domid); if (aodev->action != LIBXL__DEVICE_ACTION_REMOVE) { LOG(DEBUG, "Not a remove, not executing hotplug scripts"); @@ -1125,7 +1126,8 @@ static void device_hotplug(libxl__egc *egc, libxl__ao_device *aodev) aodev->xswait.callback = device_destroy_be_watch_cb; rc = libxl__xswait_start(gc, &aodev->xswait); if (rc) { - LOG(ERROR, "Setup of backend removal watch failed (path %s)", be_path); + LOGD(ERROR, aodev->dev->domid, + "Setup of backend removal watch failed (path %s)", be_path); goto out; } @@ -1140,43 +1142,44 @@ static void device_hotplug(libxl__egc *egc, libxl__ao_device *aodev) switch (hotplug) { case 0: /* no hotplug script to execute */ - LOG(DEBUG, "No hotplug script to execute"); + LOGD(DEBUG, aodev->dev->domid, "No hotplug script to execute"); goto out; case 1: /* execute hotplug script */ break; default: /* everything else is an error */ - LOG(ERROR, "unable to get args/env to execute hotplug script for " - "device %s", libxl__device_backend_path(gc, aodev->dev)); + LOGD(ERROR, aodev->dev->domid, + "unable to get args/env to execute hotplug script for " + "device %s", libxl__device_backend_path(gc, aodev->dev)); rc = hotplug; goto out; } assert(args != NULL); - LOG(DEBUG, "calling hotplug script: %s %s", args[0], args[1]); - LOG(DEBUG, "extra args:"); + LOGD(DEBUG, aodev->dev->domid, "calling hotplug script: %s %s", args[0], args[1]); + LOGD(DEBUG, aodev->dev->domid, "extra args:"); { const char *arg; unsigned int x; for (x = 2; (arg = args[x]); x++) - LOG(DEBUG, "\t%s", arg); + LOGD(DEBUG, aodev->dev->domid, "\t%s", arg); } - LOG(DEBUG, "env:"); + LOGD(DEBUG, aodev->dev->domid, "env:"); if (env != NULL) { const char *k, *v; unsigned int x; for (x = 0; (k = env[x]); x += 2) { v = env[x+1]; - LOG(DEBUG, "\t%s: %s", k, v); + LOGD(DEBUG, aodev->dev->domid, "\t%s: %s", k, v); } } nullfd = open("/dev/null", O_RDONLY); if (nullfd < 0) { - LOG(ERROR, "unable to open /dev/null for hotplug script"); + LOGD(ERROR, aodev->dev->domid, "unable to open /dev/null for hotplug script"); rc = ERROR_FAIL; goto out; } @@ -1260,8 +1263,9 @@ static void device_destroy_be_watch_cb(libxl__egc *egc, if (rc) { if (rc == ERROR_TIMEDOUT) - LOG(ERROR, "timed out while waiting for %s to be removed", - xswait->path); + LOGD(ERROR, aodev->dev->domid, + "timed out while waiting for %s to be removed", + xswait->path); aodev->rc = rc; goto out; }