0a122b
From 5ff68375e65250c295b6ed5ba946dc792df3cd55 Mon Sep 17 00:00:00 2001
0a122b
Message-Id: <5ff68375e65250c295b6ed5ba946dc792df3cd55.1387382496.git.minovotn@redhat.com>
0a122b
In-Reply-To: <c5386144fbf09f628148101bc674e2421cdd16e3.1387382496.git.minovotn@redhat.com>
0a122b
References: <c5386144fbf09f628148101bc674e2421cdd16e3.1387382496.git.minovotn@redhat.com>
0a122b
From: Nigel Croxon <ncroxon@redhat.com>
0a122b
Date: Thu, 14 Nov 2013 22:52:58 +0100
0a122b
Subject: [PATCH 22/46] rdma: correct newlines in error statements
0a122b
0a122b
RH-Author: Nigel Croxon <ncroxon@redhat.com>
0a122b
Message-id: <1384469598-13137-23-git-send-email-ncroxon@redhat.com>
0a122b
Patchwork-id: 55712
0a122b
O-Subject: [RHEL7.0 PATCH 22/42] rdma: correct newlines in error statements
0a122b
Bugzilla: 1011720
0a122b
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
0a122b
RH-Acked-by: Amit Shah <amit.shah@redhat.com>
0a122b
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
0a122b
0a122b
Bugzilla: 1011720
0a122b
https://bugzilla.redhat.com/show_bug.cgi?id=1011720
0a122b
0a122b
>From commit ID:
0a122b
commit 66988941251ef64044aa3b951ebd84162e5a4e3a
0a122b
Author: Michael R. Hines <mrhines@us.ibm.com>
0a122b
Date:   Sat Aug 3 22:54:50 2013 -0400
0a122b
0a122b
    rdma: correct newlines in error statements
0a122b
0a122b
    Don't print newlines on the error_setg() function,
0a122b
    but still allow newlines on fprintf().
0a122b
0a122b
    Signed-off-by: Michael R. Hines <mrhines@us.ibm.com>
0a122b
    Message-id: 1375584894-9917-4-git-send-email-mrhines@linux.vnet.ibm.com
0a122b
    Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
0a122b
---
0a122b
 migration-rdma.c |   68 +++++++++++++++++++++++++++---------------------------
0a122b
 1 files changed, 34 insertions(+), 34 deletions(-)
0a122b
0a122b
Signed-off-by: Michal Novotny <minovotn@redhat.com>
0a122b
---
0a122b
 migration-rdma.c | 68 ++++++++++++++++++++++++++++----------------------------
0a122b
 1 file changed, 34 insertions(+), 34 deletions(-)
0a122b
0a122b
diff --git a/migration-rdma.c b/migration-rdma.c
0a122b
index fe6118d..c958e5f 100644
0a122b
--- a/migration-rdma.c
0a122b
+++ b/migration-rdma.c
0a122b
@@ -60,7 +60,7 @@
0a122b
  */
0a122b
 #define ERROR(errp, fmt, ...) \
0a122b
     do { \
0a122b
-        fprintf(stderr, "RDMA ERROR: " fmt, ## __VA_ARGS__); \
0a122b
+        fprintf(stderr, "RDMA ERROR: " fmt "\n", ## __VA_ARGS__); \
0a122b
         if (errp && (*(errp) == NULL)) { \
0a122b
             error_setg(errp, "RDMA ERROR: " fmt, ## __VA_ARGS__); \
0a122b
         } \
0a122b
@@ -748,21 +748,21 @@ static int qemu_rdma_resolve_host(RDMAContext *rdma, Error **errp)
0a122b
     int af = rdma->ipv6 ? PF_INET6 : PF_INET;
0a122b
 
0a122b
     if (rdma->host == NULL || !strcmp(rdma->host, "")) {
0a122b
-        ERROR(errp, "RDMA hostname has not been set\n");
0a122b
+        ERROR(errp, "RDMA hostname has not been set");
0a122b
         return -1;
0a122b
     }
0a122b
 
0a122b
     /* create CM channel */
0a122b
     rdma->channel = rdma_create_event_channel();
0a122b
     if (!rdma->channel) {
0a122b
-        ERROR(errp, "could not create CM channel\n");
0a122b
+        ERROR(errp, "could not create CM channel");
0a122b
         return -1;
0a122b
     }
0a122b
 
0a122b
     /* create CM id */
0a122b
     ret = rdma_create_id(rdma->channel, &rdma->cm_id, NULL, RDMA_PS_TCP);
0a122b
     if (ret) {
0a122b
-        ERROR(errp, "could not create channel id\n");
0a122b
+        ERROR(errp, "could not create channel id");
0a122b
         goto err_resolve_create_id;
0a122b
     }
0a122b
 
0a122b
@@ -771,7 +771,7 @@ static int qemu_rdma_resolve_host(RDMAContext *rdma, Error **errp)
0a122b
 
0a122b
     ret = getaddrinfo(rdma->host, port_str, NULL, &res;;
0a122b
     if (ret < 0) {
0a122b
-        ERROR(errp, "could not getaddrinfo address %s\n", rdma->host);
0a122b
+        ERROR(errp, "could not getaddrinfo address %s", rdma->host);
0a122b
         goto err_resolve_get_addr;
0a122b
     }
0a122b
 
0a122b
@@ -783,7 +783,7 @@ static int qemu_rdma_resolve_host(RDMAContext *rdma, Error **errp)
0a122b
     ret = rdma_resolve_addr(rdma->cm_id, NULL, res->ai_addr,
0a122b
             RDMA_RESOLVE_TIMEOUT_MS);
0a122b
     if (ret) {
0a122b
-        ERROR(errp, "could not resolve address %s\n", rdma->host);
0a122b
+        ERROR(errp, "could not resolve address %s", rdma->host);
0a122b
         goto err_resolve_get_addr;
0a122b
     }
0a122b
 
0a122b
@@ -791,12 +791,12 @@ static int qemu_rdma_resolve_host(RDMAContext *rdma, Error **errp)
0a122b
 
0a122b
     ret = rdma_get_cm_event(rdma->channel, &cm_event);
0a122b
     if (ret) {
0a122b
-        ERROR(errp, "could not perform event_addr_resolved\n");
0a122b
+        ERROR(errp, "could not perform event_addr_resolved");
0a122b
         goto err_resolve_get_addr;
0a122b
     }
0a122b
 
0a122b
     if (cm_event->event != RDMA_CM_EVENT_ADDR_RESOLVED) {
0a122b
-        ERROR(errp, "result not equal to event_addr_resolved %s\n",
0a122b
+        ERROR(errp, "result not equal to event_addr_resolved %s",
0a122b
                 rdma_event_str(cm_event->event));
0a122b
         perror("rdma_resolve_addr");
0a122b
         goto err_resolve_get_addr;
0a122b
@@ -806,17 +806,17 @@ static int qemu_rdma_resolve_host(RDMAContext *rdma, Error **errp)
0a122b
     /* resolve route */
0a122b
     ret = rdma_resolve_route(rdma->cm_id, RDMA_RESOLVE_TIMEOUT_MS);
0a122b
     if (ret) {
0a122b
-        ERROR(errp, "could not resolve rdma route\n");
0a122b
+        ERROR(errp, "could not resolve rdma route");
0a122b
         goto err_resolve_get_addr;
0a122b
     }
0a122b
 
0a122b
     ret = rdma_get_cm_event(rdma->channel, &cm_event);
0a122b
     if (ret) {
0a122b
-        ERROR(errp, "could not perform event_route_resolved\n");
0a122b
+        ERROR(errp, "could not perform event_route_resolved");
0a122b
         goto err_resolve_get_addr;
0a122b
     }
0a122b
     if (cm_event->event != RDMA_CM_EVENT_ROUTE_RESOLVED) {
0a122b
-        ERROR(errp, "result not equal to event_route_resolved: %s\n",
0a122b
+        ERROR(errp, "result not equal to event_route_resolved: %s",
0a122b
                         rdma_event_str(cm_event->event));
0a122b
         rdma_ack_cm_event(cm_event);
0a122b
         goto err_resolve_get_addr;
0a122b
@@ -2117,26 +2117,26 @@ static int qemu_rdma_source_init(RDMAContext *rdma, Error **errp, bool pin_all)
0a122b
     if (ret) {
0a122b
         ERROR(temp, "rdma migration: error allocating pd and cq! Your mlock()"
0a122b
                     " limits may be too low. Please check $ ulimit -a # and "
0a122b
-                    "search for 'ulimit -l' in the output\n");
0a122b
+                    "search for 'ulimit -l' in the output");
0a122b
         goto err_rdma_source_init;
0a122b
     }
0a122b
 
0a122b
     ret = qemu_rdma_alloc_qp(rdma);
0a122b
     if (ret) {
0a122b
-        ERROR(temp, "rdma migration: error allocating qp!\n");
0a122b
+        ERROR(temp, "rdma migration: error allocating qp!");
0a122b
         goto err_rdma_source_init;
0a122b
     }
0a122b
 
0a122b
     ret = qemu_rdma_init_ram_blocks(rdma);
0a122b
     if (ret) {
0a122b
-        ERROR(temp, "rdma migration: error initializing ram blocks!\n");
0a122b
+        ERROR(temp, "rdma migration: error initializing ram blocks!");
0a122b
         goto err_rdma_source_init;
0a122b
     }
0a122b
 
0a122b
     for (idx = 0; idx <= RDMA_WRID_MAX; idx++) {
0a122b
         ret = qemu_rdma_reg_control(rdma, idx);
0a122b
         if (ret) {
0a122b
-            ERROR(temp, "rdma migration: error registering %d control!\n",
0a122b
+            ERROR(temp, "rdma migration: error registering %d control!",
0a122b
                                                             idx);
0a122b
             goto err_rdma_source_init;
0a122b
         }
0a122b
@@ -2178,7 +2178,7 @@ static int qemu_rdma_connect(RDMAContext *rdma, Error **errp)
0a122b
     ret = rdma_connect(rdma->cm_id, &conn_param);
0a122b
     if (ret) {
0a122b
         perror("rdma_connect");
0a122b
-        ERROR(errp, "connecting to destination!\n");
0a122b
+        ERROR(errp, "connecting to destination!");
0a122b
         rdma_destroy_id(rdma->cm_id);
0a122b
         rdma->cm_id = NULL;
0a122b
         goto err_rdma_source_connect;
0a122b
@@ -2187,7 +2187,7 @@ static int qemu_rdma_connect(RDMAContext *rdma, Error **errp)
0a122b
     ret = rdma_get_cm_event(rdma->channel, &cm_event);
0a122b
     if (ret) {
0a122b
         perror("rdma_get_cm_event after rdma_connect");
0a122b
-        ERROR(errp, "connecting to destination!\n");
0a122b
+        ERROR(errp, "connecting to destination!");
0a122b
         rdma_ack_cm_event(cm_event);
0a122b
         rdma_destroy_id(rdma->cm_id);
0a122b
         rdma->cm_id = NULL;
0a122b
@@ -2196,7 +2196,7 @@ static int qemu_rdma_connect(RDMAContext *rdma, Error **errp)
0a122b
 
0a122b
     if (cm_event->event != RDMA_CM_EVENT_ESTABLISHED) {
0a122b
         perror("rdma_get_cm_event != EVENT_ESTABLISHED after rdma_connect");
0a122b
-        ERROR(errp, "connecting to destination!\n");
0a122b
+        ERROR(errp, "connecting to destination!");
0a122b
         rdma_ack_cm_event(cm_event);
0a122b
         rdma_destroy_id(rdma->cm_id);
0a122b
         rdma->cm_id = NULL;
0a122b
@@ -2212,7 +2212,7 @@ static int qemu_rdma_connect(RDMAContext *rdma, Error **errp)
0a122b
      */
0a122b
     if (rdma->pin_all && !(cap.flags & RDMA_CAPABILITY_PIN_ALL)) {
0a122b
         ERROR(errp, "Server cannot support pinning all memory. "
0a122b
-                        "Will register memory dynamically.\n");
0a122b
+                        "Will register memory dynamically.");
0a122b
         rdma->pin_all = false;
0a122b
     }
0a122b
 
0a122b
@@ -2222,7 +2222,7 @@ static int qemu_rdma_connect(RDMAContext *rdma, Error **errp)
0a122b
 
0a122b
     ret = qemu_rdma_post_recv_control(rdma, 0);
0a122b
     if (ret) {
0a122b
-        ERROR(errp, "posting second control recv!\n");
0a122b
+        ERROR(errp, "posting second control recv!");
0a122b
         goto err_rdma_source_connect;
0a122b
     }
0a122b
 
0a122b
@@ -2251,14 +2251,14 @@ static int qemu_rdma_dest_init(RDMAContext *rdma, Error **errp)
0a122b
     }
0a122b
 
0a122b
     if (rdma->host == NULL) {
0a122b
-        ERROR(errp, "RDMA host is not set!\n");
0a122b
+        ERROR(errp, "RDMA host is not set!");
0a122b
         rdma->error_state = -EINVAL;
0a122b
         return -1;
0a122b
     }
0a122b
     /* create CM channel */
0a122b
     rdma->channel = rdma_create_event_channel();
0a122b
     if (!rdma->channel) {
0a122b
-        ERROR(errp, "could not create rdma event channel\n");
0a122b
+        ERROR(errp, "could not create rdma event channel");
0a122b
         rdma->error_state = -EINVAL;
0a122b
         return -1;
0a122b
     }
0a122b
@@ -2266,7 +2266,7 @@ static int qemu_rdma_dest_init(RDMAContext *rdma, Error **errp)
0a122b
     /* create CM id */
0a122b
     ret = rdma_create_id(rdma->channel, &listen_id, NULL, RDMA_PS_TCP);
0a122b
     if (ret) {
0a122b
-        ERROR(errp, "could not create cm_id!\n");
0a122b
+        ERROR(errp, "could not create cm_id!");
0a122b
         goto err_dest_init_create_listen_id;
0a122b
     }
0a122b
 
0a122b
@@ -2279,7 +2279,7 @@ static int qemu_rdma_dest_init(RDMAContext *rdma, Error **errp)
0a122b
     if (rdma->host && strcmp("", rdma->host)) {
0a122b
         ret = getaddrinfo(rdma->host, port_str, NULL, &res;;
0a122b
         if (ret < 0) {
0a122b
-            ERROR(errp, "could not getaddrinfo address %s\n", rdma->host);
0a122b
+            ERROR(errp, "could not getaddrinfo address %s", rdma->host);
0a122b
             goto err_dest_init_bind_addr;
0a122b
         }
0a122b
 
0a122b
@@ -2287,7 +2287,7 @@ static int qemu_rdma_dest_init(RDMAContext *rdma, Error **errp)
0a122b
         inet_ntop(af, &((struct sockaddr_in *) res->ai_addr)->sin_addr,
0a122b
                                     ip, sizeof ip);
0a122b
     } else {
0a122b
-        ERROR(errp, "migration host and port not specified!\n");
0a122b
+        ERROR(errp, "migration host and port not specified!");
0a122b
         ret = -EINVAL;
0a122b
         goto err_dest_init_bind_addr;
0a122b
     }
0a122b
@@ -2296,7 +2296,7 @@ static int qemu_rdma_dest_init(RDMAContext *rdma, Error **errp)
0a122b
 
0a122b
     ret = rdma_bind_addr(listen_id, res->ai_addr);
0a122b
     if (ret) {
0a122b
-        ERROR(errp, "Error: could not rdma_bind_addr!\n");
0a122b
+        ERROR(errp, "Error: could not rdma_bind_addr!");
0a122b
         goto err_dest_init_bind_addr;
0a122b
     }
0a122b
 
0a122b
@@ -3036,7 +3036,7 @@ static int qemu_rdma_registration_stop(QEMUFile *f, void *opaque,
0a122b
                     &reg_result_idx, rdma->pin_all ?
0a122b
                     qemu_rdma_reg_whole_ram_blocks : NULL);
0a122b
         if (ret < 0) {
0a122b
-            ERROR(errp, "receiving remote info!\n");
0a122b
+            ERROR(errp, "receiving remote info!");
0a122b
             return ret;
0a122b
         }
0a122b
 
0a122b
@@ -3061,7 +3061,7 @@ static int qemu_rdma_registration_stop(QEMUFile *f, void *opaque,
0a122b
         if (local->nb_blocks != nb_remote_blocks) {
0a122b
             ERROR(errp, "ram blocks mismatch #1! "
0a122b
                         "Your QEMU command line parameters are probably "
0a122b
-                        "not identical on both the source and destination.\n");
0a122b
+                        "not identical on both the source and destination.");
0a122b
             return -EINVAL;
0a122b
         }
0a122b
 
0a122b
@@ -3077,7 +3077,7 @@ static int qemu_rdma_registration_stop(QEMUFile *f, void *opaque,
0a122b
                 if (rdma->block[i].length != local->block[j].length) {
0a122b
                     ERROR(errp, "ram blocks mismatch #2! "
0a122b
                         "Your QEMU command line parameters are probably "
0a122b
-                        "not identical on both the source and destination.\n");
0a122b
+                        "not identical on both the source and destination.");
0a122b
                     return -EINVAL;
0a122b
                 }
0a122b
                 local->block[j].remote_host_addr =
0a122b
@@ -3089,7 +3089,7 @@ static int qemu_rdma_registration_stop(QEMUFile *f, void *opaque,
0a122b
             if (j >= local->nb_blocks) {
0a122b
                 ERROR(errp, "ram blocks mismatch #3! "
0a122b
                         "Your QEMU command line parameters are probably "
0a122b
-                        "not identical on both the source and destination.\n");
0a122b
+                        "not identical on both the source and destination.");
0a122b
                 return -EINVAL;
0a122b
             }
0a122b
         }
0a122b
@@ -3163,7 +3163,7 @@ static void rdma_accept_incoming_migration(void *opaque)
0a122b
     ret = qemu_rdma_accept(rdma);
0a122b
 
0a122b
     if (ret) {
0a122b
-        ERROR(errp, "RDMA Migration initialization failed!\n");
0a122b
+        ERROR(errp, "RDMA Migration initialization failed!");
0a122b
         return;
0a122b
     }
0a122b
 
0a122b
@@ -3171,7 +3171,7 @@ static void rdma_accept_incoming_migration(void *opaque)
0a122b
 
0a122b
     f = qemu_fopen_rdma(rdma, "rb");
0a122b
     if (f == NULL) {
0a122b
-        ERROR(errp, "could not qemu_fopen_rdma!\n");
0a122b
+        ERROR(errp, "could not qemu_fopen_rdma!");
0a122b
         qemu_rdma_cleanup(rdma);
0a122b
         return;
0a122b
     }
0a122b
@@ -3204,7 +3204,7 @@ void rdma_start_incoming_migration(const char *host_port, Error **errp)
0a122b
     ret = rdma_listen(rdma->listen_id, 5);
0a122b
 
0a122b
     if (ret) {
0a122b
-        ERROR(errp, "listening on socket!\n");
0a122b
+        ERROR(errp, "listening on socket!");
0a122b
         goto err;
0a122b
     }
0a122b
 
0a122b
@@ -3228,7 +3228,7 @@ void rdma_start_outgoing_migration(void *opaque,
0a122b
     int ret = 0;
0a122b
 
0a122b
     if (rdma == NULL) {
0a122b
-        ERROR(temp, "Failed to initialize RDMA data structures! %d\n", ret);
0a122b
+        ERROR(temp, "Failed to initialize RDMA data structures! %d", ret);
0a122b
         goto err;
0a122b
     }
0a122b
 
0a122b
-- 
0a122b
1.7.11.7
0a122b