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

[Xen-devel] [PATCH 15 of 27 V4] libxl: pci: use _init/_setdefault



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1330533036 0
# Node ID 0b79a94f4cab781fea6692414a8d7f8734309bfc
# Parent  5a3e6c301be716a994f54195857a7dd9cff56296
libxl: pci: use _init/_setdefault

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r 5a3e6c301be7 -r 0b79a94f4cab tools/libxl/libxl.h
--- a/tools/libxl/libxl.h       Wed Feb 29 16:30:36 2012 +0000
+++ b/tools/libxl/libxl.h       Wed Feb 29 16:30:36 2012 +0000
@@ -552,7 +552,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 5a3e6c301be7 -r 0b79a94f4cab tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h      Wed Feb 29 16:30:36 2012 +0000
+++ b/tools/libxl/libxl_internal.h      Wed Feb 29 16:30:36 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 5a3e6c301be7 -r 0b79a94f4cab tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c   Wed Feb 29 16:30:36 2012 +0000
+++ b/tools/libxl/libxl_pci.c   Wed Feb 29 16:30:36 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 5a3e6c301be7 -r 0b79a94f4cab tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Wed Feb 29 16:30:36 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c  Wed Feb 29 16:30:36 2012 +0000
@@ -1021,7 +1021,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@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®.