mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
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@eu.citrix.com> CC: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
This commit is contained in:
1 parent
0119ce9860
commit
c5e9596cd0
1 file changed
+10
-10
+10
-10
@@ -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);
|
||||
|
||||