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

[Xen-devel] [PATCH 1/1] libxl: Use LOG_ERRNO rather than ERRNOVAL in libxl_pci.c



The xc_* functions (now) return -1 on error and set errno.

Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx>
CC: Ian Jackson <ian.jackson@xxxxxxxxxx>
CC: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 tools/libxl/libxl_pci.c |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c
index 88bf91e..b9960bb 100644
--- a/tools/libxl/libxl_pci.c
+++ b/tools/libxl/libxl_pci.c
@@ -889,7 +889,7 @@ static int do_pci_add(libxl__gc *gc, uint32_t domid, 
libxl_device_pci *pcidev, i
                 if (flags & PCI_BAR_IO) {
                     rc = xc_domain_ioport_permission(ctx->xch, domid, start, 
size, 1);
                     if (rc < 0) {
-                        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "Error: 
xc_domain_ioport_permission error 0x%llx/0x%llx", start, size);
+                        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Error: 
xc_domain_ioport_permission error 0x%llx/0x%llx", start, size);
                         fclose(f);
                         return ERROR_FAIL;
                     }
@@ -897,7 +897,7 @@ static int do_pci_add(libxl__gc *gc, uint32_t domid, 
libxl_device_pci *pcidev, i
                     rc = xc_domain_iomem_permission(ctx->xch, domid, 
start>>XC_PAGE_SHIFT,
                                                     
(size+(XC_PAGE_SIZE-1))>>XC_PAGE_SHIFT, 1);
                     if (rc < 0) {
-                        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "Error: 
xc_domain_iomem_permission error 0x%llx/0x%llx", start, size);
+                        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Error: 
xc_domain_iomem_permission error 0x%llx/0x%llx", start, size);
                         fclose(f);
                         return ERROR_FAIL;
                     }
@@ -915,13 +915,13 @@ static int do_pci_add(libxl__gc *gc, uint32_t domid, 
libxl_device_pci *pcidev, i
         if ((fscanf(f, "%u", &irq) == 1) && irq) {
             rc = xc_physdev_map_pirq(ctx->xch, domid, irq, &irq);
             if (rc < 0) {
-                LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "Error: 
xc_physdev_map_pirq irq=%d", irq);
+                LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Error: 
xc_physdev_map_pirq irq=%d", irq);
                 fclose(f);
                 return ERROR_FAIL;
             }
             rc = xc_domain_irq_permission(ctx->xch, domid, irq, 1);
             if (rc < 0) {
-                LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "Error: 
xc_domain_irq_permission irq=%d", irq);
+                LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Error: 
xc_domain_irq_permission irq=%d", irq);
                 fclose(f);
                 return ERROR_FAIL;
             }
@@ -946,7 +946,7 @@ out:
     if (!libxl_is_stubdom(ctx, domid, NULL)) {
         rc = xc_assign_device(ctx->xch, domid, pcidev_encode_bdf(pcidev));
         if (rc < 0 && (hvm || errno != ENOSYS)) {
-            LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "xc_assign_device 
failed");
+            LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_assign_device failed");
             return ERROR_FAIL;
         }
     }
@@ -1220,12 +1220,12 @@ static int do_pci_remove(libxl__gc *gc, uint32_t domid,
                 if (flags & PCI_BAR_IO) {
                     rc = xc_domain_ioport_permission(ctx->xch, domid, start, 
size, 0);
                     if (rc < 0)
-                        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, 
"xc_domain_ioport_permission error 0x%x/0x%x", start, size);
+                        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, 
"xc_domain_ioport_permission error 0x%x/0x%x", start, size);
                 } else {
                     rc = xc_domain_iomem_permission(ctx->xch, domid, 
start>>XC_PAGE_SHIFT,
                                                     
(size+(XC_PAGE_SIZE-1))>>XC_PAGE_SHIFT, 0);
                     if (rc < 0)
-                        LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, 
"xc_domain_iomem_permission error 0x%x/0x%x", start, size);
+                        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, 
"xc_domain_iomem_permission error 0x%x/0x%x", start, size);
                 }
             }
         }
@@ -1241,11 +1241,11 @@ skip1:
         if ((fscanf(f, "%u", &irq) == 1) && irq) {
             rc = xc_physdev_unmap_pirq(ctx->xch, domid, irq);
             if (rc < 0) {
-                LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, 
"xc_physdev_unmap_pirq irq=%d", irq);
+                LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_physdev_unmap_pirq 
irq=%d", irq);
             }
             rc = xc_domain_irq_permission(ctx->xch, domid, irq, 0);
             if (rc < 0) {
-                LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, 
"xc_domain_irq_permission irq=%d", irq);
+                LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, 
"xc_domain_irq_permission irq=%d", irq);
             }
         }
         fclose(f);
@@ -1263,7 +1263,7 @@ out:
     if (!libxl_is_stubdom(ctx, domid, NULL)) {
         rc = xc_deassign_device(ctx->xch, domid, pcidev_encode_bdf(pcidev));
         if (rc < 0 && (hvm || errno != ENOSYS))
-            LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc, "xc_deassign_device 
failed");
+            LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xc_deassign_device 
failed");
     }
 
     stubdomid = libxl_get_stubdom_id(ctx, domid);
-- 
1.7.9.5


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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