[PATCH v2] Remove new lines from debug messages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



VIR_DEBUG will automatically add a new line to the message, having "\n"
at the end or at the beginning of the message results in empty lines.

Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
---
 src/nwfilter/nwfilter_dhcpsnoop.c      |  2 +-
 src/nwfilter/nwfilter_gentech_driver.c |  2 +-
 src/nwfilter/nwfilter_learnipaddr.c    | 10 +++++-----
 src/rpc/virnetsocket.c                 |  2 +-
 src/util/virfile.c                     |  2 +-
 src/util/virhash.c                     |  2 +-
 src/util/virnetdevmacvlan.c            | 26 ++++++++++++------------
 src/util/virprocess.c                  |  2 +-
 src/xen/xend_internal.c                |  2 +-
 tests/virhostdevtest.c                 | 36 +++++++++++++++++-----------------
 tests/virnetsockettest.c               |  2 +-
 tests/virtimetest.c                    |  2 +-
 12 files changed, 45 insertions(+), 45 deletions(-)

diff --git a/src/nwfilter/nwfilter_dhcpsnoop.c b/src/nwfilter/nwfilter_dhcpsnoop.c
index f05d4a8..bd6d25f 100644
--- a/src/nwfilter/nwfilter_dhcpsnoop.c
+++ b/src/nwfilter/nwfilter_dhcpsnoop.c
@@ -2017,7 +2017,7 @@ static void
 virNWFilterSnoopJoinThreads(void)
 {
     while (virAtomicIntGet(&virNWFilterSnoopState.nThreads) != 0) {
-        VIR_WARN("Waiting for snooping threads to terminate: %u\n",
+        VIR_WARN("Waiting for snooping threads to terminate: %u",
                  virAtomicIntGet(&virNWFilterSnoopState.nThreads));
         usleep(1000 * 1000);
     }
diff --git a/src/nwfilter/nwfilter_gentech_driver.c b/src/nwfilter/nwfilter_gentech_driver.c
index 701f8d8..5a4cff1 100644
--- a/src/nwfilter/nwfilter_gentech_driver.c
+++ b/src/nwfilter/nwfilter_gentech_driver.c
@@ -540,7 +540,7 @@ virNWFilterDetermineMissingVarsRec(virNWFilterDefPtr filter,
             if (rc)
                 break;
         } else if (inc) {
-            VIR_DEBUG("Following filter %s\n", inc->filterref);
+            VIR_DEBUG("Following filter %s", inc->filterref);
             obj = virNWFilterObjFindByName(&driver->nwfilters, inc->filterref);
             if (obj) {
 
diff --git a/src/nwfilter/nwfilter_learnipaddr.c b/src/nwfilter/nwfilter_learnipaddr.c
index 5b55055..1adbadb 100644
--- a/src/nwfilter/nwfilter_learnipaddr.c
+++ b/src/nwfilter/nwfilter_learnipaddr.c
@@ -413,7 +413,7 @@ learnIPAddressThread(void *arg)
     handle = pcap_open_live(listen_if, BUFSIZ, 0, PKT_TIMEOUT_MS, errbuf);
 
     if (handle == NULL) {
-        VIR_DEBUG("Couldn't open device %s: %s\n", listen_if, errbuf);
+        VIR_DEBUG("Couldn't open device %s: %s", listen_if, errbuf);
         req->status = ENODEV;
         goto done;
     }
@@ -448,13 +448,13 @@ learnIPAddressThread(void *arg)
     filter = virBufferContentAndReset(&buf);
 
     if (pcap_compile(handle, &fp, filter, 1, 0) != 0) {
-        VIR_DEBUG("Couldn't compile filter '%s'.\n", filter);
+        VIR_DEBUG("Couldn't compile filter '%s'", filter);
         req->status = EINVAL;
         goto done;
     }
 
     if (pcap_setfilter(handle, &fp) != 0) {
-        VIR_DEBUG("Couldn't set filter '%s'.\n", filter);
+        VIR_DEBUG("Couldn't set filter '%s'", filter);
         req->status = EINVAL;
         pcap_freecode(&fp);
         goto done;
@@ -626,7 +626,7 @@ learnIPAddressThread(void *arg)
                                                    req->filtername,
                                                    req->filterparams);
             VIR_DEBUG("Result from applying firewall rules on "
-                      "%s with IP addr %s : %d\n", req->ifname, inetaddr, ret);
+                      "%s with IP addr %s : %d", req->ifname, inetaddr, ret);
         }
     } else {
         if (showError)
@@ -638,7 +638,7 @@ learnIPAddressThread(void *arg)
         techdriver->applyDropAllRules(req->ifname);
     }
 
-    VIR_DEBUG("pcap thread terminating for interface %s\n", req->ifname);
+    VIR_DEBUG("pcap thread terminating for interface %s", req->ifname);
 
     virNWFilterUnlockIface(req->ifname);
 
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index 5e5f1ab..526d291 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -196,7 +196,7 @@ int virNetSocketCheckProtocols(bool *hasIPv4,
 
     freeaddrinfo(ai);
 
-    VIR_DEBUG("Protocols: v4 %d v6 %d\n", *hasIPv4, *hasIPv6);
+    VIR_DEBUG("Protocols: v4 %d v6 %d", *hasIPv4, *hasIPv6);
 
     ret = 0;
  cleanup:
diff --git a/src/util/virfile.c b/src/util/virfile.c
index e5cf2c5..f45e18f 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -681,7 +681,7 @@ static int virFileLoopDeviceOpen(char **dev_name)
     if (virFileLoopDeviceOpenLoopCtl(dev_name, &loop_fd) < 0)
         return -1;
 
-    VIR_DEBUG("Return from loop-control got fd %d\n", loop_fd);
+    VIR_DEBUG("Return from loop-control got fd %d", loop_fd);
 
     if (loop_fd >= 0)
         return loop_fd;
diff --git a/src/util/virhash.c b/src/util/virhash.c
index bc90c44..fab621b 100644
--- a/src/util/virhash.c
+++ b/src/util/virhash.c
@@ -287,7 +287,7 @@ virHashGrow(virHashTablePtr table, size_t size)
     VIR_FREE(oldtable);
 
 #ifdef DEBUG_GROW
-    VIR_DEBUG("virHashGrow : from %d to %d, %ld elems\n", oldsize,
+    VIR_DEBUG("virHashGrow : from %d to %d, %ld elems", oldsize,
               size, nbElem);
 #endif
 
diff --git a/src/util/virnetdevmacvlan.c b/src/util/virnetdevmacvlan.c
index 89985b8..de345e6 100644
--- a/src/util/virnetdevmacvlan.c
+++ b/src/util/virnetdevmacvlan.c
@@ -473,16 +473,16 @@ virNetDevMacVLanVPortProfileCallback(struct nlmsghdr *hdr,
     case RTM_DELLINK:
     case RTM_SETLINK:
     case RTM_GETLINK:
-        VIR_DEBUG(" IFINFOMSG\n");
-        VIR_DEBUG("        ifi_family = 0x%02x\n",
+        VIR_DEBUG(" IFINFOMSG");
+        VIR_DEBUG("        ifi_family = 0x%02x",
             ((struct ifinfomsg *)data)->ifi_family);
-        VIR_DEBUG("        ifi_type   = 0x%x\n",
+        VIR_DEBUG("        ifi_type   = 0x%x",
             ((struct ifinfomsg *)data)->ifi_type);
-        VIR_DEBUG("        ifi_index  = %i\n",
+        VIR_DEBUG("        ifi_index  = %i",
             ((struct ifinfomsg *)data)->ifi_index);
-        VIR_DEBUG("        ifi_flags  = 0x%04x\n",
+        VIR_DEBUG("        ifi_flags  = 0x%04x",
             ((struct ifinfomsg *)data)->ifi_flags);
-        VIR_DEBUG("        ifi_change = 0x%04x\n",
+        VIR_DEBUG("        ifi_change = 0x%04x",
             ((struct ifinfomsg *)data)->ifi_change);
     }
     /* DEBUG end */
@@ -544,23 +544,23 @@ virNetDevMacVLanVPortProfileCallback(struct nlmsghdr *hdr,
 
     if (tb[IFLA_IFNAME]) {
         ifname = (char *)RTA_DATA(tb[IFLA_IFNAME]);
-        VIR_DEBUG("IFLA_IFNAME = %s\n", ifname);
+        VIR_DEBUG("IFLA_IFNAME = %s", ifname);
     }
 
     if (tb[IFLA_OPERSTATE]) {
         rem = *(unsigned short *)RTA_DATA(tb[IFLA_OPERSTATE]);
-        VIR_DEBUG("IFLA_OPERSTATE = %d\n", rem);
+        VIR_DEBUG("IFLA_OPERSTATE = %d", rem);
     }
 
     if (tb[IFLA_VF_PORTS]) {
         struct nlattr *tb_vf_ports;
 
-        VIR_DEBUG("found IFLA_VF_PORTS\n");
+        VIR_DEBUG("found IFLA_VF_PORTS");
         nla_for_each_nested(tb_vf_ports, tb[IFLA_VF_PORTS], rem) {
 
-            VIR_DEBUG("iterating\n");
+            VIR_DEBUG("iterating");
             if (nla_type(tb_vf_ports) != IFLA_VF_PORT) {
-                VIR_DEBUG("not a IFLA_VF_PORT. skipping\n");
+                VIR_DEBUG("not a IFLA_VF_PORT. skipping");
                 continue;
             }
             if (nla_parse_nested(tb3, IFLA_PORT_MAX, tb_vf_ports,
@@ -600,7 +600,7 @@ virNetDevMacVLanVPortProfileCallback(struct nlmsghdr *hdr,
                 uuid = (unsigned char *)
                     RTA_DATA(tb3[IFLA_PORT_INSTANCE_UUID]);
                 instance2str(uuid, instance, sizeof(instance));
-                VIR_DEBUG("IFLA_PORT_INSTANCE_UUID = %s\n",
+                VIR_DEBUG("IFLA_PORT_INSTANCE_UUID = %s",
                           instance);
             }
 
@@ -615,7 +615,7 @@ virNetDevMacVLanVPortProfileCallback(struct nlmsghdr *hdr,
             }
 
             if (tb3[IFLA_PORT_RESPONSE]) {
-                VIR_DEBUG("IFLA_PORT_RESPONSE = %d\n", *(uint16_t *)
+                VIR_DEBUG("IFLA_PORT_RESPONSE = %d", *(uint16_t *)
                     RTA_DATA(tb3[IFLA_PORT_RESPONSE]));
             }
         }
diff --git a/src/util/virprocess.c b/src/util/virprocess.c
index 43118f8..103c114 100644
--- a/src/util/virprocess.c
+++ b/src/util/virprocess.c
@@ -407,7 +407,7 @@ virProcessKillPainfully(pid_t pid, bool force)
 int virProcessSetAffinity(pid_t pid, virBitmapPtr map)
 {
     size_t i;
-    VIR_DEBUG("Set process affinity on %lld\n", (long long)pid);
+    VIR_DEBUG("Set process affinity on %lld", (long long)pid);
 # ifdef CPU_ALLOC
     /* New method dynamically allocates cpu mask, allowing unlimted cpus */
     int numcpus = 1024;
diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c
index 62ce930..21d99e3 100644
--- a/src/xen/xend_internal.c
+++ b/src/xen/xend_internal.c
@@ -507,7 +507,7 @@ xend_op_ext(virConnectPtr xend, const char *path, const char *key, va_list ap)
         return -1;
 
     content = virBufferContentAndReset(&buf);
-    VIR_DEBUG("xend op: %s\n", content);
+    VIR_DEBUG("xend op: %s", content);
     ret = http2unix(xend_post(xend, path, content));
     VIR_FREE(content);
 
diff --git a/tests/virhostdevtest.c b/tests/virhostdevtest.c
index 065b825..faebdd4 100644
--- a/tests/virhostdevtest.c
+++ b/tests/virhostdevtest.c
@@ -169,14 +169,14 @@ testVirHostdevPreparePCIHostdevs_unmanaged(const void *oaque ATTRIBUTE_UNUSED)
     count2 = virPCIDeviceListCount(mgr->inactivePCIHostdevs);
 
     /* Test normal functionality */
-    VIR_DEBUG("Test 0 hostdevs\n");
+    VIR_DEBUG("Test 0 hostdevs");
     if (virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid,
                                     NULL, 0, 0) < 0)
         goto cleanup;
     CHECK_LIST_COUNT(mgr->activePCIHostdevs, count1);
 
     /* Test unmanaged hostdevs */
-    VIR_DEBUG("Test >=1 unmanaged hostdevs\n");
+    VIR_DEBUG("Test >=1 unmanaged hostdevs");
     if (virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid,
                                     hostdevs, nhostdevs, 0) < 0)
         goto cleanup;
@@ -186,21 +186,21 @@ testVirHostdevPreparePCIHostdevs_unmanaged(const void *oaque ATTRIBUTE_UNUSED)
     /* Test conflict */
     count1 = virPCIDeviceListCount(mgr->activePCIHostdevs);
     count2 = virPCIDeviceListCount(mgr->inactivePCIHostdevs);
-    VIR_DEBUG("Test: prepare same hostdevs for same driver/domain again\n");
+    VIR_DEBUG("Test: prepare same hostdevs for same driver/domain again");
     if (!virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid,
                                      &hostdevs[0], 1, 0))
         goto cleanup;
     CHECK_LIST_COUNT(mgr->activePCIHostdevs, count1);
     CHECK_LIST_COUNT(mgr->inactivePCIHostdevs, count2);
 
-    VIR_DEBUG("Test: prepare same hostdevs for same driver, diff domain again\n");
+    VIR_DEBUG("Test: prepare same hostdevs for same driver, diff domain again");
     if (!virHostdevPreparePCIDevices(mgr, drv_name, "test_domain1", uuid,
                                      &hostdevs[1], 1, 0))
         goto cleanup;
     CHECK_LIST_COUNT(mgr->activePCIHostdevs, count1);
     CHECK_LIST_COUNT(mgr->inactivePCIHostdevs, count2);
 
-    VIR_DEBUG("Test: prepare same hostdevs for diff driver/domain again\n");
+    VIR_DEBUG("Test: prepare same hostdevs for diff driver/domain again");
     if (!virHostdevPreparePCIDevices(mgr, "test_driver1", dom_name, uuid,
                                      &hostdevs[2], 1, 0))
         goto cleanup;
@@ -223,7 +223,7 @@ testVirHostdevReAttachPCIHostdevs_unmanaged(const void *oaque ATTRIBUTE_UNUSED)
 
     for (i = 0; i < nhostdevs; i++) {
         if (hostdevs[i]->managed != false) {
-            VIR_DEBUG("invalid test\n");
+            VIR_DEBUG("invalid test");
             return -1;
         }
     }
@@ -231,11 +231,11 @@ testVirHostdevReAttachPCIHostdevs_unmanaged(const void *oaque ATTRIBUTE_UNUSED)
     count1 = virPCIDeviceListCount(mgr->activePCIHostdevs);
     count2 = virPCIDeviceListCount(mgr->inactivePCIHostdevs);
 
-    VIR_DEBUG("Test 0 hostdevs\n");
+    VIR_DEBUG("Test 0 hostdevs");
     virHostdevReAttachPCIDevices(mgr, drv_name, dom_name, NULL, 0, NULL);
     CHECK_LIST_COUNT(mgr->activePCIHostdevs, count1);
 
-    VIR_DEBUG("Test >=1 unmanaged hostdevs\n");
+    VIR_DEBUG("Test >=1 unmanaged hostdevs");
     virHostdevReAttachPCIDevices(mgr, drv_name, dom_name,
                                   hostdevs, nhostdevs, NULL);
     CHECK_LIST_COUNT(mgr->activePCIHostdevs, count1 - 3);
@@ -261,7 +261,7 @@ testVirHostdevPreparePCIHostdevs_managed(const void *oaque ATTRIBUTE_UNUSED)
     count1 = virPCIDeviceListCount(mgr->activePCIHostdevs);
 
     /* Test normal functionality */
-    VIR_DEBUG("Test >=1 hostdevs\n");
+    VIR_DEBUG("Test >=1 hostdevs");
     if (virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid,
                                      hostdevs, nhostdevs, 0) < 0)
         goto cleanup;
@@ -269,19 +269,19 @@ testVirHostdevPreparePCIHostdevs_managed(const void *oaque ATTRIBUTE_UNUSED)
 
     /* Test conflict */
     count1 = virPCIDeviceListCount(mgr->activePCIHostdevs);
-    VIR_DEBUG("Test: prepare same hostdevs for same driver/domain again\n");
+    VIR_DEBUG("Test: prepare same hostdevs for same driver/domain again");
     if (!virHostdevPreparePCIDevices(mgr, drv_name, dom_name, uuid,
                                       &hostdevs[0], 1, 0))
         goto cleanup;
     CHECK_LIST_COUNT(mgr->activePCIHostdevs, count1);
 
-    VIR_DEBUG("Test: prepare same hostdevs for same driver, diff domain again\n");
+    VIR_DEBUG("Test: prepare same hostdevs for same driver, diff domain again");
     if (!virHostdevPreparePCIDevices(mgr, drv_name, "test_domain1", uuid,
                                       &hostdevs[1], 1, 0))
         goto cleanup;
     CHECK_LIST_COUNT(mgr->activePCIHostdevs, count1);
 
-    VIR_DEBUG("Test: prepare same hostdevs for diff driver/domain again\n");
+    VIR_DEBUG("Test: prepare same hostdevs for diff driver/domain again");
     if (!virHostdevPreparePCIDevices(mgr, "test_driver1", dom_name, uuid,
                                       &hostdevs[2], 1, 0))
         goto cleanup;
@@ -303,18 +303,18 @@ testVirHostdevReAttachPCIHostdevs_managed(const void *oaque ATTRIBUTE_UNUSED)
 
     for (i = 0; i < nhostdevs; i++) {
         if (hostdevs[i]->managed != true) {
-            VIR_DEBUG("invalid test\n");
+            VIR_DEBUG("invalid test");
             return -1;
         }
     }
 
     count1 = virPCIDeviceListCount(mgr->activePCIHostdevs);
 
-    VIR_DEBUG("Test 0 hostdevs\n");
+    VIR_DEBUG("Test 0 hostdevs");
     virHostdevReAttachPCIDevices(mgr, drv_name, dom_name, NULL, 0, NULL);
     CHECK_LIST_COUNT(mgr->activePCIHostdevs, count1);
 
-    VIR_DEBUG("Test >=1 hostdevs\n");
+    VIR_DEBUG("Test >=1 hostdevs");
     virHostdevReAttachPCIDevices(mgr, drv_name, dom_name,
                                   hostdevs, nhostdevs, NULL);
     CHECK_LIST_COUNT(mgr->activePCIHostdevs, count1 - 3);
@@ -392,13 +392,13 @@ testVirHostdevUpdateActivePCIHostdevs(const void *oaque ATTRIBUTE_UNUSED)
 
     count1 = virPCIDeviceListCount(mgr->activePCIHostdevs);
 
-    VIR_DEBUG("Test 0 hostdevs\n");
+    VIR_DEBUG("Test 0 hostdevs");
     if (virHostdevUpdateActivePCIDevices(mgr, NULL, 0,
                                          drv_name, dom_name) < 0)
         goto cleanup;
     CHECK_LIST_COUNT(mgr->activePCIHostdevs, count1);
 
-    VIR_DEBUG("Test >=1 hostdevs\n");
+    VIR_DEBUG("Test >=1 hostdevs");
     if (virHostdevUpdateActivePCIDevices(mgr, hostdevs, nhostdevs,
                                          drv_name, dom_name) < 0)
         goto cleanup;
@@ -432,7 +432,7 @@ mymain(void)
 
 # define DO_TEST(fnc)                                   \
     do {                                                \
-        VIR_DEBUG("\nTesting: %s", #fnc);                 \
+        VIR_DEBUG("Testing: %s", #fnc);                 \
         if (virtTestRun(#fnc, fnc, NULL) < 0)           \
             ret = -1;                                   \
     } while (0)
diff --git a/tests/virnetsockettest.c b/tests/virnetsockettest.c
index ce9eeab..5786870 100644
--- a/tests/virnetsockettest.c
+++ b/tests/virnetsockettest.c
@@ -105,7 +105,7 @@ checkProtocols(bool *hasIPv4, bool *hasIPv6,
         break;
     }
 
-    VIR_DEBUG("Choose port %d\n", *freePort);
+    VIR_DEBUG("Choose port %d", *freePort);
 
     ret = 0;
 
diff --git a/tests/virtimetest.c b/tests/virtimetest.c
index 9ab38ae..49040d3 100644
--- a/tests/virtimetest.c
+++ b/tests/virtimetest.c
@@ -92,7 +92,7 @@ testTimeLocalOffset(const void *args)
         return -1;
 
     if (data->offset != actual) {
-        VIR_DEBUG("Expect Offset %ld got %ld\n",
+        VIR_DEBUG("Expect Offset %ld got %ld",
                   data->offset, actual);
         return -1;
     }
-- 
2.6.2

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]