[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 12 of 23] libxl: pci: use _init/_setdefault
# HG changeset patch # User Ian Campbell <ian.campbell@xxxxxxxxxx> # Date 1329148133 0 # Node ID cb563f911986275f93ea8dd003b69d44d8745adf # Parent b2934eb211360cdc6f996940410fd82d435ca059 libxl: pci: use _init/_setdefault Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx> diff -r b2934eb21136 -r cb563f911986 tools/libxl/libxl.h --- a/tools/libxl/libxl.h Mon Feb 13 15:48:52 2012 +0000 +++ b/tools/libxl/libxl.h Mon Feb 13 15:48:53 2012 +0000 @@ -556,7 +556,7 @@ int libxl_device_vfb_remove(libxl_ctx *c int libxl_device_vfb_destroy(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb); /* PCI Passthrough */ -int libxl_device_pci_init(libxl_ctx *ctx, libxl_device_pci *pci); +void libxl_device_pci_init(libxl_device_pci *pci); int libxl_device_pci_add(libxl_ctx *ctx, uint32_t domid, libxl_device_pci *pcidev); int libxl_device_pci_remove(libxl_ctx *ctx, uint32_t domid, libxl_device_pci *pcidev); int libxl_device_pci_destroy(libxl_ctx *ctx, uint32_t domid, libxl_device_pci *pcidev); diff -r b2934eb21136 -r cb563f911986 tools/libxl/libxl_internal.h --- a/tools/libxl/libxl_internal.h Mon Feb 13 15:48:52 2012 +0000 +++ b/tools/libxl/libxl_internal.h Mon Feb 13 15:48:53 2012 +0000 @@ -196,6 +196,7 @@ _hidden int libxl__device_disk_setdefaul _hidden int libxl__device_nic_setdefault(libxl__gc *gc, libxl_device_nic *nic); _hidden int libxl__device_vfb_setdefault(libxl__gc *gc, libxl_device_vfb *vfb); _hidden int libxl__device_vkb_setdefault(libxl__gc *gc, libxl_device_vkb *vkb); +_hidden int libxl__device_pci_setdefault(libxl__gc *gc, libxl_device_pci *pci); struct libxl__evgen_domain_death { uint32_t domid; diff -r b2934eb21136 -r cb563f911986 tools/libxl/libxl_pci.c --- a/tools/libxl/libxl_pci.c Mon Feb 13 15:48:52 2012 +0000 +++ b/tools/libxl/libxl_pci.c Mon Feb 13 15:48:53 2012 +0000 @@ -765,6 +765,16 @@ static int libxl__device_pci_reset(libxl return -1; } +void libxl_device_pci_init(libxl_device_pci *pci) +{ + memset(pci, '\0', sizeof(*pci)); +} + +int libxl__device_pci_setdefault(libxl__gc *gc, libxl_device_pci *pci) +{ + return 0; +} + int libxl_device_pci_add(libxl_ctx *ctx, uint32_t domid, libxl_device_pci *pcidev) { GC_INIT(ctx); @@ -782,6 +792,9 @@ int libxl__device_pci_add(libxl__gc *gc, int num_assigned, i, rc; int stubdomid = 0; + rc = libxl__device_pci_setdefault(gc, pcidev); + if (rc) goto out; + rc = get_all_assigned_devices(gc, &assigned, &num_assigned); if ( rc ) { LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "cannot determine if device is assigned, refusing to continue"); diff -r b2934eb21136 -r cb563f911986 tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Mon Feb 13 15:48:52 2012 +0000 +++ b/tools/libxl/xl_cmdimpl.c Mon Feb 13 15:48:53 2012 +0000 @@ -1014,7 +1014,7 @@ skip_vfb: d_config->pcidevs = (libxl_device_pci *) realloc(d_config->pcidevs, sizeof (libxl_device_pci) * (d_config->num_pcidevs + 1)); pcidev = d_config->pcidevs + d_config->num_pcidevs; - memset(pcidev, 0x00, sizeof(libxl_device_pci)); + libxl_device_pci_init(pcidev); pcidev->msitranslate = pci_msitranslate; pcidev->power_mgmt = pci_power_mgmt; _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |