From patchwork Thu Nov 17 17:36:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cedric Bosdonnat X-Patchwork-Id: 9434865 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 E746160755 for ; Thu, 17 Nov 2016 17:39:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D85E020499 for ; Thu, 17 Nov 2016 17:39:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CD3FD29687; Thu, 17 Nov 2016 17:39:22 +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 41DD720499 for ; Thu, 17 Nov 2016 17:39:22 +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 1c7QcQ-0000YI-T6; Thu, 17 Nov 2016 17:37:02 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c7QcP-0000UT-Q0 for xen-devel@lists.xen.org; Thu, 17 Nov 2016 17:37:01 +0000 Received: from [85.158.139.211] by server-6.bemta-5.messagelabs.com id D8/50-14841-DBAED285; Thu, 17 Nov 2016 17:37:01 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupnkeJIrShJLcpLzFFi42I53H6XVXfPK90 Ig1cLZS2WfFzM4sDocXT3b6YAxijWzLyk/IoE1oy9axpZCqbaVtxtW8vUwPhSu4uRi0NIYAmj RNel2yxdjJwcbAL2El1/jjKB2CIC0hLXPl9mBLGZBUok9j7tALOFBRwl9q1eD2azCKhKtDzcy Qxi8wpYSKz78YMdxJYQkJe4cPUU2ExOoPiBw+fAaoQEzCXevFnABFEvKHFy5hOgGg6g+eoS6+ cJQaySl2jeOpt5AiPvLCRVsxCqZiGpWsDIvIpRvTi1qCy1SNdCL6koMz2jJDcxM0fX0MBULze 1uDgxPTUnMalYLzk/dxMjMKAYgGAH48Fm50OMkhxMSqK8zC91I4T4kvJTKjMSizPii0pzUosP McpwcChJ8BaA5ASLUtNTK9Iyc4ChDZOW4OBREuGVBEnzFhck5hZnpkOkTjEqSonzngZJCIAkM krz4Npg8XSJUVZKmJcR6BAhnoLUotzMElT5V4ziHIxKwryLQKbwZOaVwE1/BbSYCWjxHgEdkM UliQgpqQZGJUPPPa+Yt4tnvP8orvvOr3VlsP+V/WLppplvj+9luHfaeK73/TkmVTU/7xcmKb3 a02n2Oer2Vg9uAf9iVVUuCYPFHhOX1z7hXxca+v+gw60f93xSdfZ77PX84LS69tvxXcxxuwwO 3744NVhHvCeho4dJRfTsb7ndjK8l5WfbF3zLSpGbpJSqxFKckWioxVxUnAgAS0m0AaICAAA= X-Env-Sender: cbosdonnat@suse.com X-Msg-Ref: server-12.tower-206.messagelabs.com!1479404218!34534264!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 28074 invoked from network); 17 Nov 2016 17:36:59 -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; 17 Nov 2016 17:36:59 -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); Thu, 17 Nov 2016 18:36:59 +0100 From: =?UTF-8?q?C=C3=A9dric=20Bosdonnat?= To: xen-devel@lists.xen.org Date: Thu, 17 Nov 2016 18:36:10 +0100 Message-Id: <20161117173617.6697-29-cbosdonnat@suse.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20161117173617.6697-1-cbosdonnat@suse.com> References: <20161117173617.6697-1-cbosdonnat@suse.com> MIME-Version: 1.0 Cc: Wei Liu , Ian Jackson , 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 --- 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; }