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

[Xen-devel] [PATCH 13/14] libxc: remove \n from strings passed to PERROR



Previously, the code was inconsistent: some calls to PERROR passed \n
and some did not.  With the new logging arrangements, passing \n is
definitely incorrect.

Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---
 tools/libxc/ia64/xc_ia64_hvm_build.c     |   30 +++++++++++++++---------------
 tools/libxc/ia64/xc_ia64_linux_restore.c |    2 +-
 tools/libxc/xc_domain.c                  |    2 +-
 tools/libxc/xc_domain_restore.c          |   14 +++++++-------
 tools/libxc/xc_domain_save.c             |    4 ++--
 tools/libxc/xc_hvm_build.c               |   10 +++++-----
 tools/libxc/xc_misc.c                    |    2 +-
 tools/libxc/xc_resume.c                  |    2 +-
 tools/libxc/xc_solaris.c                 |    2 +-
 9 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/tools/libxc/ia64/xc_ia64_hvm_build.c 
b/tools/libxc/ia64/xc_ia64_hvm_build.c
index d3d02aa..3f5f929 100644
--- a/tools/libxc/ia64/xc_ia64_hvm_build.c
+++ b/tools/libxc/ia64/xc_ia64_hvm_build.c
@@ -586,7 +586,7 @@ static int is_valid_address(void *addr)
     if ( p->signature == NVRAM_VALID_SIG )
         return 1;
     else {
-        PERROR("Invalid nvram signature. Nvram save failed!\n");
+        PERROR("Invalid nvram signature. Nvram save failed!");
         return 0;
     }
 }
@@ -613,7 +613,7 @@ copy_from_GFW_to_nvram(xc_interface *xc_handle, uint32_t 
dom, int nvram_fd)
     pfn_list = (xen_pfn_t *)malloc(sizeof(xen_pfn_t) * nr_pages);
     if ( NULL == pfn_list )
     {
-        PERROR("Cannot allocate memory for nvram save!\n");
+        PERROR("Cannot allocate memory for nvram save!");
         close(nvram_fd);
         return -1;
     }
@@ -630,7 +630,7 @@ copy_from_GFW_to_nvram(xc_interface *xc_handle, uint32_t 
dom, int nvram_fd)
 
     if ( NULL == tmp_ptr )
     {
-        PERROR("Cannot get nvram data from GFW!\n");
+        PERROR("Cannot get nvram data from GFW!");
         free(pfn_list);
         close(nvram_fd);
         return -1;
@@ -659,7 +659,7 @@ copy_from_GFW_to_nvram(xc_interface *xc_handle, uint32_t 
dom, int nvram_fd)
                                            pfn_list, nr_pages);
     if ( NULL == tmp_ptr )
     {
-        PERROR("Cannot get nvram data from GFW!\n");
+        PERROR("Cannot get nvram data from GFW!");
         free(pfn_list);
         close(nvram_fd);
         return -1;
@@ -675,7 +675,7 @@ copy_from_GFW_to_nvram(xc_interface *xc_handle, uint32_t 
dom, int nvram_fd)
     lseek(nvram_fd, 0, SEEK_SET);
     if ( write(nvram_fd, buf, NVRAM_SIZE) != NVRAM_SIZE )
     {
-        PERROR("Save to nvram fail!\n");
+        PERROR("Save to nvram fail!");
         return -1;
     }
 
@@ -703,7 +703,7 @@ int xc_ia64_save_to_nvram(xc_interface *xc_handle, uint32_t 
dom)
     xc_get_hvm_param(xc_handle, dom, HVM_PARAM_NVRAM_FD, &nvram_fd);
 
     if ( !IS_VALID_NVRAM_FD(nvram_fd) )
-        PERROR("Nvram not initialized. Nvram save failed!\n");
+        PERROR("Nvram not initialized. Nvram save failed!");
     else
         copy_from_GFW_to_nvram(xc_handle, dom, (int)nvram_fd); 
 
@@ -744,7 +744,7 @@ int xc_ia64_nvram_init(xc_interface *xc_handle, char 
*dom_name, uint32_t dom)
     if ( strlen(nvram_path) + strlen(NVRAM_FILE_PREFIX) +
          strlen(dom_name) + 1 > sizeof(nvram_path) )
     {
-        PERROR("Nvram file path is too long!\n");
+        PERROR("Nvram file path is too long!");
         return -1;
     }
     strcat(nvram_path, NVRAM_FILE_PREFIX);
@@ -800,7 +800,7 @@ xc_ia64_setup_memmap_info(xc_interface *xc_handle, uint32_t 
dom,
                                        PROT_READ | PROT_WRITE,
                                        memmap_info_pfn);
     if (memmap_info == NULL) {
-        PERROR("Could not map memmmap_info page.\n");
+        PERROR("Could not map memmmap_info page.");
         return -1;
     }
     memset(memmap_info, 0, PAGE_SIZE * memmap_info_num_pages);
@@ -925,7 +925,7 @@ setup_guest(xc_interface *xc_handle, uint32_t dom, unsigned 
long memsize,
 
     pfn_list = malloc(nr_pages * sizeof(xen_pfn_t));
     if (pfn_list == NULL) {
-        PERROR("Could not allocate memory.\n");
+        PERROR("Could not allocate memory.");
         return -1;
     }
 
@@ -952,7 +952,7 @@ setup_guest(xc_interface *xc_handle, uint32_t dom, unsigned 
long memsize,
     rc = xc_domain_memory_populate_physmap(xc_handle, dom, nr_pages, 0, 0,
                                            &pfn_list[0]);
     if (rc != 0) {
-        PERROR("Could not allocate normal memory for Vti guest.\n");
+        PERROR("Could not allocate normal memory for Vti guest.");
         goto error_out;
     }
 
@@ -965,7 +965,7 @@ setup_guest(xc_interface *xc_handle, uint32_t dom, unsigned 
long memsize,
     rc = xc_domain_memory_populate_physmap(xc_handle, dom, GFW_PAGES,
                                            0, 0, &pfn_list[0]);
     if (rc != 0) {
-        PERROR("Could not allocate GFW memory for Vti guest.\n");
+        PERROR("Could not allocate GFW memory for Vti guest.");
         goto error_out;
     }
 
@@ -981,7 +981,7 @@ setup_guest(xc_interface *xc_handle, uint32_t dom, unsigned 
long memsize,
     rc = xc_domain_memory_populate_physmap(xc_handle, dom, nr_special_pages,
                                            0, 0, &pfn_list[0]);
     if (rc != 0) {
-        PERROR("Could not allocate IO page or store page or buffer io 
page.\n");
+        PERROR("Could not allocate IO page or store page or buffer io page.");
         goto error_out;
     }
 
@@ -1013,13 +1013,13 @@ setup_guest(xc_interface *xc_handle, uint32_t dom, 
unsigned long memsize,
     if (xc_ia64_setup_memmap_info(xc_handle, dom, dom_memsize,
                                   pfn_list, nr_special_pages,
                                   memmap_info_pfn, memmap_info_num_pages)) {
-        PERROR("Could not build memmap info\n");
+        PERROR("Could not build memmap info");
         goto error_out;
     }
     if (xc_ia64_setup_shared_info(xc_handle, dom,
                                   domctl.u.getdomaininfo.shared_info_frame,
                                   memmap_info_pfn, memmap_info_num_pages)) {
-        PERROR("Could not setup shared_info\n");
+        PERROR("Could not setup shared_info");
         goto error_out;
     }
 
@@ -1035,7 +1035,7 @@ setup_guest(xc_interface *xc_handle, uint32_t dom, 
unsigned long memsize,
 
     // Hand-off state passed to guest firmware 
     if (xc_ia64_build_hob(xc_handle, dom, dom_memsize, vcpus, nvram_start) < 
0) {
-        PERROR("Could not build hob\n");
+        PERROR("Could not build hob");
         goto error_out;
     }
 
diff --git a/tools/libxc/ia64/xc_ia64_linux_restore.c 
b/tools/libxc/ia64/xc_ia64_linux_restore.c
index 68a3873..d52e6c4 100644
--- a/tools/libxc/ia64/xc_ia64_linux_restore.c
+++ b/tools/libxc/ia64/xc_ia64_linux_restore.c
@@ -534,7 +534,7 @@ xc_ia64_hvm_domain_setup(xc_interface *xc_handle, uint32_t 
dom)
     rc = xc_domain_memory_populate_physmap(xc_handle, dom, nr_pages,
                                            0, 0, &pfn_list[0]);
     if (rc != 0)
-        PERROR("Could not allocate IO page or buffer io page.\n");
+        PERROR("Could not allocate IO page or buffer io page.");
     return rc;
 }
 
diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c
index c575eff..ae323fe 100644
--- a/tools/libxc/xc_domain.c
+++ b/tools/libxc/xc_domain.c
@@ -948,7 +948,7 @@ int xc_get_device_group(
 
     if ( lock_pages(sdev_array, max_sdevs * sizeof(*sdev_array)) != 0 )
     {
-        PERROR("Could not lock memory for xc_get_device_group\n");
+        PERROR("Could not lock memory for xc_get_device_group");
         return -ENOMEM;
     }
     rc = do_domctl(xch, &domctl);
diff --git a/tools/libxc/xc_domain_restore.c b/tools/libxc/xc_domain_restore.c
index fd34636..12af375 100644
--- a/tools/libxc/xc_domain_restore.c
+++ b/tools/libxc/xc_domain_restore.c
@@ -124,7 +124,7 @@ static int break_super_page(xc_interface *xch,
 
     if ( ram_base == NULL )
     {
-        PERROR("map batch failed\n");
+        PERROR("map batch failed");
         rc = 1;
         goto out;
     }
@@ -136,7 +136,7 @@ static int break_super_page(xc_interface *xch,
     if ( xc_domain_memory_decrease_reservation(xch, dom, 1,
                                    SUPERPAGE_PFN_SHIFT, &start_pfn) != 0 )
     {
-        PERROR("free 2M page failure @ 0x%ld.\n", next_pfn);
+        PERROR("free 2M page failure @ 0x%ld.", next_pfn);
         rc = 1;
         goto out;
     }
@@ -153,7 +153,7 @@ static int break_super_page(xc_interface *xch,
         if (xc_domain_memory_populate_physmap(xch, dom, 1, 0,
                                               0, &mfn) != 0)
         {
-            PERROR("Failed to allocate physical memory.!\n");
+            PERROR("Failed to allocate physical memory.!");
             errno = ENOMEM;
             rc = 1;
             goto out;
@@ -171,7 +171,7 @@ static int break_super_page(xc_interface *xch,
                                     page_array, tot_pfns);
     if ( ram_base == NULL )
     {
-        PERROR("map batch failed\n");
+        PERROR("map batch failed");
         rc = 1;
         goto out;
     }
@@ -283,7 +283,7 @@ normal_page:
             if (xc_domain_memory_populate_physmap(xch, dom, 1, 0,
                         0, &mfn) != 0)
             {
-                PERROR("Failed to allocate physical memory.! pfn=0x%lx, 
mfn=0x%lx.\n",
+                PERROR("Failed to allocate physical memory.! pfn=0x%lx, 
mfn=0x%lx.",
                         pfn, mfn);
                 errno = ENOMEM;
                 return 1;
@@ -1497,7 +1497,7 @@ int xc_domain_restore(xc_interface *xch, int io_fd, 
uint32_t dom,
         if ( !completed ) {
             pagebuf.nr_physpages = pagebuf.nr_pages = 0;
             if ( pagebuf_get_one(xch, &pagebuf, io_fd, dom) < 0 ) {
-                PERROR("Error when reading batch\n");
+                PERROR("Error when reading batch");
                 goto out;
             }
         }
@@ -1929,7 +1929,7 @@ int xc_domain_restore(xc_interface *xch, int io_fd, 
uint32_t dom,
         frc = xc_domctl(xch, &domctl);
         if ( frc != 0 )
         {
-            PERROR("Couldn't set extended vcpu%d info\n", i);
+            PERROR("Couldn't set extended vcpu%d info", i);
             goto out;
         }
     }
diff --git a/tools/libxc/xc_domain_save.c b/tools/libxc/xc_domain_save.c
index 624b17c..2cc8a8c 100644
--- a/tools/libxc/xc_domain_save.c
+++ b/tools/libxc/xc_domain_save.c
@@ -1625,7 +1625,7 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t 
dom, uint32_t max_iter
         
         if ( wrexact(io_fd, hvm_buf, rec_size) )
         {
-            PERROR("write HVM info failed!\n");
+            PERROR("write HVM info failed!");
             goto out;
         }
         
@@ -1785,7 +1785,7 @@ int xc_domain_save(xc_interface *xch, int io_fd, uint32_t 
dom, uint32_t max_iter
 
     /* Flush last write and discard cache for file. */
     if ( outbuf_flush(xch, &ob, io_fd) < 0 ) {
-        PERROR("Error when flushing output buffer\n");
+        PERROR("Error when flushing output buffer");
         rc = 1;
     }
 
diff --git a/tools/libxc/xc_hvm_build.c b/tools/libxc/xc_hvm_build.c
index 82cbf1f..7fe666d 100644
--- a/tools/libxc/xc_hvm_build.c
+++ b/tools/libxc/xc_hvm_build.c
@@ -152,13 +152,13 @@ static int setup_guest(xc_interface *xch,
 
     if ( xc_version(xch, XENVER_capabilities, &caps) != 0 )
     {
-        PERROR("Could not get Xen capabilities\n");
+        PERROR("Could not get Xen capabilities");
         goto error_out;
     }
 
     if ( (elf.pstart & (PAGE_SIZE - 1)) != 0 )
     {
-        PERROR("Guest OS must load to a page boundary.\n");
+        PERROR("Guest OS must load to a page boundary.");
         goto error_out;
     }
 
@@ -172,7 +172,7 @@ static int setup_guest(xc_interface *xch,
 
     if ( (page_array = malloc(nr_pages * sizeof(xen_pfn_t))) == NULL )
     {
-        PERROR("Could not allocate memory.\n");
+        PERROR("Could not allocate memory.");
         goto error_out;
     }
 
@@ -317,7 +317,7 @@ static int setup_guest(xc_interface *xch,
 
     if ( rc != 0 )
     {
-        PERROR("Could not allocate memory for HVM guest.\n");
+        PERROR("Could not allocate memory for HVM guest.");
         goto error_out;
     }
 
@@ -362,7 +362,7 @@ static int setup_guest(xc_interface *xch,
         rc = xc_domain_memory_populate_physmap(xch, dom, 1, 0, 0, &pfn);
         if ( rc != 0 )
         {
-            PERROR("Could not allocate %d'th special page.\n", i);
+            PERROR("Could not allocate %d'th special page.", i);
             goto error_out;
         }
         if ( xc_clear_domain_page(xch, dom, special_pfn(i)) )
diff --git a/tools/libxc/xc_misc.c b/tools/libxc/xc_misc.c
index 5ec3795..82d96d3 100644
--- a/tools/libxc/xc_misc.c
+++ b/tools/libxc/xc_misc.c
@@ -142,7 +142,7 @@ int xc_mca_op(xc_interface *xch, struct xen_mc *mc)
     mc->interface_version = XEN_MCA_INTERFACE_VERSION;
     if ( lock_pages(mc, sizeof(mc)) )
     {
-        PERROR("Could not lock xen_mc memory\n");
+        PERROR("Could not lock xen_mc memory");
         return -EINVAL;
     }
 
diff --git a/tools/libxc/xc_resume.c b/tools/libxc/xc_resume.c
index de93f41..7f85e3f 100644
--- a/tools/libxc/xc_resume.c
+++ b/tools/libxc/xc_resume.c
@@ -47,7 +47,7 @@ static int modify_returncode(xc_interface *xch, uint32_t 
domid)
         /* HVM guests have host address width. */
         if ( xc_version(xch, XENVER_capabilities, &caps) != 0 )
         {
-            PERROR("Could not get Xen capabilities\n");
+            PERROR("Could not get Xen capabilities");
             return -1;
         }
         dinfo->guest_width = strstr(caps, "x86_64") ? 8 : 4;
diff --git a/tools/libxc/xc_solaris.c b/tools/libxc/xc_solaris.c
index b4830de..53ec642 100644
--- a/tools/libxc/xc_solaris.c
+++ b/tools/libxc/xc_solaris.c
@@ -139,7 +139,7 @@ void *xc_map_foreign_ranges(xc_interface *xch, uint32_t dom,
 ioctl_failed:
     rc = munmap(addr, size);
     if (rc == -1)
-        PERROR("%s: error in error path\n", __FUNCTION__);
+        PERROR("%s: error in error path", __FUNCTION__);
 
 mmap_failed:
     return NULL;
-- 
1.5.6.5


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.