xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Kelley Nielsen <kelleynnn@gmail.com>
To: xen-devel@lists.xensource.com
Cc: anthony.perard@citrix.com
Subject: [PATCH v2] opw: libxl: macro LOG() used in place of LIBXL__LOG
Date: Sat, 9 Nov 2013 19:05:05 -0800	[thread overview]
Message-ID: <20131110030505.GA15262@kelleynnn-HP-Compaq-8510w> (raw)

Code cleanup -- no functional changes

Coding style has recently been changed for libxl. The convenience macro
LOG() has been introduced, and it is intended that it calls to the old
macro LIBXL__LOG() be replaced with it. Change 7 occurences of the old
macro (in functions that have a local libxl_gc *gc) to the new one.

Signed-off-by: Kelley Nielsen <kelleynnn@gmail.com>
---
Changes since v1:
* commit message updated to explain which occurrences of LIBXL__LOG
were changed

 tools/libxl/libxl_qmp.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/tools/libxl/libxl_qmp.c b/tools/libxl/libxl_qmp.c
index 395258e..1f76d53 100644
--- a/tools/libxl/libxl_qmp.c
+++ b/tools/libxl/libxl_qmp.c
@@ -31,7 +31,7 @@
 
 #ifdef DEBUG_RECEIVED
 #  define DEBUG_REPORT_RECEIVED(buf, len) \
-    LIBXL__LOG(qmp->ctx, LIBXL__LOG_DEBUG, "received: '%.*s'", len, buf)
+    LOG(DEBUG, "received: '%.*s'", len, buf)
 #else
 #  define DEBUG_REPORT_RECEIVED(buf, len) ((void)0)
 #endif
@@ -190,8 +190,7 @@ static int qmp_register_vnc_callback(libxl__qmp_handler *qmp,
     port = libxl__json_object_get_string(obj);
 
     if (!addr || !port) {
-        LIBXL__LOG(qmp->ctx, LIBXL__LOG_ERROR,
-                   "Failed to retreive VNC connect information.");
+        LOG(ERROR, "Failed to retreive VNC connect information.");
         goto out;
     }
 
@@ -435,7 +434,7 @@ static int qmp_next(libxl__gc *gc, libxl__qmp_handler *qmp)
 
         ret = select(qmp->qmp_fd + 1, &rfds, NULL, NULL, &timeout);
         if (ret == 0) {
-            LIBXL__LOG(qmp->ctx, LIBXL__LOG_ERROR, "timeout");
+            LOG(ERROR, "timeout");
             return -1;
         } else if (ret < 0) {
             if (errno == EINTR)
@@ -446,7 +445,7 @@ static int qmp_next(libxl__gc *gc, libxl__qmp_handler *qmp)
 
         rd = read(qmp->qmp_fd, qmp->buffer, QMP_RECEIVE_BUFFER_SIZE);
         if (rd == 0) {
-            LIBXL__LOG(qmp->ctx, LIBXL__LOG_ERROR, "Unexpected end of socket");
+            LOG(ERROR, "Unexpected end of socket");
             return -1;
         } else if (rd < 0) {
             LIBXL__LOG_ERRNO(qmp->ctx, LIBXL__LOG_ERROR, "Socket read error");
@@ -484,8 +483,7 @@ static int qmp_next(libxl__gc *gc, libxl__qmp_handler *qmp)
                 if (o) {
                     rc = qmp_handle_response(qmp, o);
                 } else {
-                    LIBXL__LOG(qmp->ctx, LIBXL__LOG_ERROR,
-                               "Parse error of : %s\n", s);
+                    LOG(ERROR, "Parse error of : %s\n", s);
                     return -1;
                 }
 
@@ -531,8 +529,7 @@ static char *qmp_send_prepare(libxl__gc *gc, libxl__qmp_handler *qmp,
     s = yajl_gen_get_buf(hand, &buf, &len);
 
     if (s) {
-        LIBXL__LOG(qmp->ctx, LIBXL__LOG_ERROR,
-                   "Failed to generate a qmp command");
+        LOG(ERROR, "Failed to generate a qmp command");
         goto out;
     }
 
@@ -550,7 +547,7 @@ static char *qmp_send_prepare(libxl__gc *gc, libxl__qmp_handler *qmp,
 
     ret = libxl__strndup(gc, (const char*)buf, len);
 
-    LIBXL__LOG(qmp->ctx, LIBXL__LOG_DEBUG, "next qmp command: '%s'", buf);
+    LOG(DEBUG, "next qmp command: '%s'", buf);
 
 out:
     yajl_gen_free(hand);
@@ -702,7 +699,7 @@ libxl__qmp_handler *libxl__qmp_initialize(libxl__gc *gc, uint32_t domid)
         return NULL;
     }
 
-    LIBXL__LOG(qmp->ctx, LIBXL__LOG_DEBUG, "connected to %s", qmp_socket);
+    LOG(DEBUG, "connected to %s", qmp_socket);
 
     /* Wait for the response to qmp_capabilities */
     while (!qmp->connected) {
@@ -712,7 +709,7 @@ libxl__qmp_handler *libxl__qmp_initialize(libxl__gc *gc, uint32_t domid)
     }
 
     if (!qmp->connected) {
-        LIBXL__LOG(qmp->ctx, LIBXL__LOG_ERROR, "Failed to connect to QMP");
+        LOG(ERROR, "Failed to connect to QMP");
         libxl__qmp_close(qmp);
         return NULL;
     }
-- 
1.8.1.2

             reply	other threads:[~2013-11-10  3:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-10  3:05 Kelley Nielsen [this message]
2013-11-11 12:18 ` [PATCH v2] opw: libxl: macro LOG() used in place of LIBXL__LOG Ian Campbell

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=20131110030505.GA15262@kelleynnn-HP-Compaq-8510w \
    --to=kelleynnn@gmail.com \
    --cc=anthony.perard@citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).