From patchwork Fri Dec 2 15:08:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cedric Bosdonnat X-Patchwork-Id: 9458731 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 CAB8360756 for ; Fri, 2 Dec 2016 15:11:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BCC8D2847C for ; Fri, 2 Dec 2016 15:11:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AEBB52855C; Fri, 2 Dec 2016 15:11:52 +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 2EC402855C for ; Fri, 2 Dec 2016 15:11:52 +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 1cCpSp-0003RQ-F7; Fri, 02 Dec 2016 15:09:27 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cCpSn-000388-O0 for xen-devel@lists.xen.org; Fri, 02 Dec 2016 15:09:25 +0000 Received: from [85.158.137.68] by server-5.bemta-3.messagelabs.com id A2/2C-15840-5AE81485; Fri, 02 Dec 2016 15:09:25 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnkeJIrShJLcpLzFFi42I53H6XVXdJn2O EwcZWa4slHxezODB6HN39mymAMYo1My8pvyKBNWP9qaWsBXttK2ZeNm1g7NXpYuTiEBJYwiix dtti1i5GTg42AXuJrj9HmUBsEQFpiWufLzOC2MwCJRJN5zqZQWxhAUeJfavXg8VZBFQlbs27z AJi8wpYSrR/WQo2R0JAXmLh+SNgcziB4g9aroPVCwlYSDTfuANVLyhxcuYTIJsDaL66xPp5Qh Cr5CWat85mnsDIOwtJ1SyEqllIqhYwMq9i1ChOLSpLLdI1NNNLKspMzyjJTczM0TU0MNbLTS0 uTkxPzUlMKtZLzs/dxAgMKAYg2MG4arvnIUZJDiYlUV7THMcIIb6k/JTKjMTijPii0pzU4kOM MhwcShK8zb1AOcGi1PTUirTMHGBow6QlOHiURHhVQdK8xQWJucWZ6RCpU4yKUuK8ziAJAZBER mkeXBssni4xykoJ8zICHSLEU5BalJtZgir/ilGcg1FJmJcLZApPZl4J3PRXQIuZgBZ3XLcHWV ySiJCSamDMLKo4suhx43+hXz9qnxk6PatkjO+fEDqLJz9+1YEu+Yl/asTuSRav1Fi+ncN9e/h +y/4uxiu3w3Ndr/if8zfiXmvzIaa/9Fv7D8vM6K5kAdHrsrYr5m3ftGwGe6j4ikzmaD6G1OjZ h/Y3iZ8UDRTT+Kz35vEshvzHf66mq8dFrL31ftL2d8ZKLMUZiYZazEXFiQBaUjTaogIAAA== X-Env-Sender: cbosdonnat@suse.com X-Msg-Ref: server-10.tower-31.messagelabs.com!1480691364!73481029!1 X-Originating-IP: [195.135.221.5] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG, SUBJECT_RANDOMQ X-StarScan-Received: X-StarScan-Version: 9.0.16; banners=-,-,- X-VirusChecked: Checked Received: (qmail 33631 invoked from network); 2 Dec 2016 15:09:24 -0000 Received: from smtp.nue.novell.com (HELO smtp.nue.novell.com) (195.135.221.5) by server-10.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 2 Dec 2016 15:09:24 -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:23 +0100 From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= To: xen-devel@lists.xen.org Date: Fri, 2 Dec 2016 16:08:34 +0100 Message-Id: <20161202150841.31227-29-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 28/35] libxl/libxl_qmp.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_qmp.c | 56 ++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/tools/libxl/libxl_qmp.c b/tools/libxl/libxl_qmp.c index f8addf9..ad22ad4 100644 --- a/tools/libxl/libxl_qmp.c +++ b/tools/libxl/libxl_qmp.c @@ -30,10 +30,10 @@ /* #define DEBUG_RECEIVED */ #ifdef DEBUG_RECEIVED -# define DEBUG_REPORT_RECEIVED(buf, len) \ - LOG(DEBUG, "received: '%.*s'", len, buf) +# define DEBUG_REPORT_RECEIVED(dom, buf, len) \ + LOGD(DEBUG, dom, "received: '%.*s'", len, buf) #else -# define DEBUG_REPORT_RECEIVED(buf, len) ((void)0) +# define DEBUG_REPORT_RECEIVED(dom, buf, len) ((void)0) #endif /* @@ -137,15 +137,15 @@ static int register_serials_chardev_callback(libxl__qmp_handler *qmp, s += strlen("serial"); port_number = strtol(s, &endptr, 10); if (*s == 0 || *endptr != 0) { - LIBXL__LOG(qmp->ctx, LIBXL__LOG_ERROR, - "Invalid serial port number: %s", s); + LIBXL__LOGD(qmp->ctx, LIBXL__LOG_ERROR, qmp->domid, + "Invalid serial port number: %s", s); return -1; } ret = store_serial_port_info(qmp, chardev, port_number); if (ret) { - LIBXL__LOG_ERRNO(qmp->ctx, LIBXL__LOG_ERROR, - "Failed to store serial port information" - " in xenstore"); + LIBXL__LOGD_ERRNO(qmp->ctx, LIBXL__LOG_ERROR, qmp->domid, + "Failed to store serial port information" + " in xenstore"); return ret; } } @@ -190,7 +190,7 @@ static int qmp_register_vnc_callback(libxl__qmp_handler *qmp, port = libxl__json_object_get_string(obj); if (!addr || !port) { - LOG(ERROR, "Failed to retreive VNC connect information."); + LOGD(ERROR, qmp->domid, "Failed to retreive VNC connect information."); goto out; } @@ -283,8 +283,8 @@ static void qmp_handle_error_response(libxl__gc *gc, libxl__qmp_handler *qmp, free(pp); } - LOG(ERROR, "received an error message from QMP server: %s", - libxl__json_object_get_string(resp)); + LOGD(ERROR, qmp->domid, "received an error message from QMP server: %s", + libxl__json_object_get_string(resp)); } static int qmp_handle_response(libxl__gc *gc, libxl__qmp_handler *qmp, @@ -293,7 +293,7 @@ static int qmp_handle_response(libxl__gc *gc, libxl__qmp_handler *qmp, libxl__qmp_message_type type = LIBXL__QMP_MESSAGE_TYPE_INVALID; type = qmp_response_type(qmp, resp); - LOG(DEBUG, "message type: %s", libxl__qmp_message_type_to_string(type)); + LOGD(DEBUG, qmp->domid, "message type: %s", libxl__qmp_message_type_to_string(type)); switch (type) { case LIBXL__QMP_MESSAGE_TYPE_QMP: @@ -342,7 +342,7 @@ static libxl__qmp_handler *qmp_init_handler(libxl__gc *gc, uint32_t domid) qmp = calloc(1, sizeof (libxl__qmp_handler)); if (qmp == NULL) { - LOGE(ERROR, "Failed to allocate qmp_handler"); + LOGED(ERROR, domid, "Failed to allocate qmp_handler"); return NULL; } qmp->ctx = CTX; @@ -440,26 +440,26 @@ static int qmp_next(libxl__gc *gc, libxl__qmp_handler *qmp) ret = select(qmp->qmp_fd + 1, &rfds, NULL, NULL, &timeout); if (ret == 0) { - LOG(ERROR, "timeout"); + LOGD(ERROR, qmp->domid, "timeout"); return -1; } else if (ret < 0) { if (errno == EINTR) continue; - LOGE(ERROR, "Select error"); + LOGED(ERROR, qmp->domid, "Select error"); return -1; } rd = read(qmp->qmp_fd, qmp->buffer, QMP_RECEIVE_BUFFER_SIZE); if (rd == 0) { - LOG(ERROR, "Unexpected end of socket"); + LOGD(ERROR, qmp->domid, "Unexpected end of socket"); return -1; } else if (rd < 0) { - LOGE(ERROR, "Socket read error"); + LOGED(ERROR, qmp->domid, "Socket read error"); return rd; } qmp->buffer[rd] = '\0'; - DEBUG_REPORT_RECEIVED(qmp->buffer, rd); + DEBUG_REPORT_RECEIVED(qmp->domid, qmp->buffer, rd); do { char *end = NULL; @@ -490,7 +490,7 @@ static int qmp_next(libxl__gc *gc, libxl__qmp_handler *qmp) if (o) { rc = qmp_handle_response(gc, qmp, o); } else { - LOG(ERROR, "Parse error of : %s", s); + LOGD(ERROR, qmp->domid, "Parse error of : %s", s); return -1; } @@ -536,13 +536,13 @@ static char *qmp_send_prepare(libxl__gc *gc, libxl__qmp_handler *qmp, s = yajl_gen_get_buf(hand, &buf, &len); if (s) { - LOG(ERROR, "Failed to generate a qmp command"); + LOGD(ERROR, qmp->domid, "Failed to generate a qmp command"); goto out; } elm = malloc(sizeof (callback_id_pair)); if (elm == NULL) { - LOGE(ERROR, "Failed to allocate a QMP callback"); + LOGED(ERROR, qmp->domid, "Failed to allocate a QMP callback"); goto out; } elm->id = qmp->last_id_used; @@ -553,7 +553,7 @@ static char *qmp_send_prepare(libxl__gc *gc, libxl__qmp_handler *qmp, ret = libxl__strndup(gc, (const char*)buf, len); - LOG(DEBUG, "next qmp command: '%s'", buf); + LOGD(DEBUG, qmp->domid, "next qmp command: '%s'", buf); out: yajl_gen_free(hand); @@ -699,12 +699,12 @@ libxl__qmp_handler *libxl__qmp_initialize(libxl__gc *gc, uint32_t domid) qmp_socket = GCSPRINTF("%s/qmp-libxl-%d", libxl__run_dir_path(), domid); if ((ret = qmp_open(qmp, qmp_socket, QMP_SOCKET_CONNECT_TIMEOUT)) < 0) { - LOGE(ERROR, "Connection error"); + LOGED(ERROR, domid, "Connection error"); qmp_free_handler(qmp); return NULL; } - LOG(DEBUG, "connected to %s", qmp_socket); + LOGD(DEBUG, domid, "connected to %s", qmp_socket); /* Wait for the response to qmp_capabilities */ while (!qmp->connected) { @@ -714,7 +714,7 @@ libxl__qmp_handler *libxl__qmp_initialize(libxl__gc *gc, uint32_t domid) } if (!qmp->connected) { - LOG(ERROR, "Failed to connect to QMP"); + LOGD(ERROR, domid, "Failed to connect to QMP"); libxl__qmp_close(qmp); return NULL; } @@ -736,14 +736,14 @@ void libxl__qmp_cleanup(libxl__gc *gc, uint32_t domid) qmp_socket = GCSPRINTF("%s/qmp-libxl-%d", libxl__run_dir_path(), domid); if (unlink(qmp_socket) == -1) { if (errno != ENOENT) { - LOGE(ERROR, "Failed to remove QMP socket file %s", qmp_socket); + LOGED(ERROR, domid, "Failed to remove QMP socket file %s", qmp_socket); } } qmp_socket = GCSPRINTF("%s/qmp-libxenstat-%d", libxl__run_dir_path(), domid); if (unlink(qmp_socket) == -1) { if (errno != ENOENT) { - LOGE(ERROR, "Failed to remove QMP socket file %s", qmp_socket); + LOGED(ERROR, domid, "Failed to remove QMP socket file %s", qmp_socket); } } } @@ -1012,7 +1012,7 @@ static int query_cpus_callback(libxl__qmp_handler *qmp, o = libxl__json_map_get("CPU", cpu, JSON_INTEGER); if (!o) { - LOG(ERROR, "Failed to retrieve CPU index."); + LOGD(ERROR, qmp->domid, "Failed to retrieve CPU index."); rc = ERROR_FAIL; goto out; }