[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v3 1/7] libxl: improve return codes for some pci related functions
*libxl__device_from_pcidev() initialize the values of libxl__device struct and can be void. *libxl__create_pci_backend(), libxl__device_pci_destroy_all() should propagate the success/error, rather than always returning 0. Signed-off-by: Paulina Szubarczyk <paulinaszubarczyk@xxxxxxxxx> --- Changes since v2: - changed the changelog as indicated by Dario. --- tools/libxl/libxl_pci.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c index 300fd4d..b4be967 100644 --- a/tools/libxl/libxl_pci.c +++ b/tools/libxl/libxl_pci.c @@ -64,7 +64,7 @@ static void libxl_create_pci_backend_device(libxl__gc *gc, flexarray_t *back, in flexarray_append_pair(back, GCSPRINTF("state-%d", num), GCSPRINTF("%d", XenbusStateInitialising)); } -static int libxl__device_from_pcidev(libxl__gc *gc, uint32_t domid, +static void libxl__device_from_pcidev(libxl__gc *gc, uint32_t domid, libxl_device_pci *pcidev, libxl__device *device) { @@ -74,8 +74,6 @@ static int libxl__device_from_pcidev(libxl__gc *gc, uint32_t domid, device->devid = 0; device->domid = domid; device->kind = LIBXL__DEVICE_KIND_PCI; - - return 0; } int libxl__create_pci_backend(libxl__gc *gc, uint32_t domid, @@ -84,13 +82,11 @@ int libxl__create_pci_backend(libxl__gc *gc, uint32_t domid, flexarray_t *front = NULL; flexarray_t *back = NULL; libxl__device device; - int ret = ERROR_NOMEM, i; + int i; front = flexarray_make(gc, 16, 1); back = flexarray_make(gc, 16, 1); - ret = 0; - LOG(DEBUG, "Creating pci backend"); /* add pci device */ @@ -108,12 +104,10 @@ int libxl__create_pci_backend(libxl__gc *gc, uint32_t domid, flexarray_append_pair(front, "backend-id", GCSPRINTF("%d", 0)); flexarray_append_pair(front, "state", GCSPRINTF("%d", XenbusStateInitialising)); - libxl__device_generic_add(gc, XBT_NULL, &device, - libxl__xs_kvs_of_flexarray(gc, back, back->count), - libxl__xs_kvs_of_flexarray(gc, front, front->count), - NULL); - - return 0; + return libxl__device_generic_add(gc, XBT_NULL, &device, + libxl__xs_kvs_of_flexarray(gc, back, back->count), + libxl__xs_kvs_of_flexarray(gc, front, front->count), + NULL); } static int libxl__device_pci_add_xenstore(libxl__gc *gc, uint32_t domid, libxl_device_pci *pcidev, int starting) @@ -1612,7 +1606,7 @@ int libxl__device_pci_destroy_all(libxl__gc *gc, uint32_t domid) } free(pcidevs); - return 0; + return rc; } int libxl__grant_vga_iomem_permission(libxl__gc *gc, const uint32_t domid, -- 1.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |