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

[Xen-changelog] [xen-unstable] libxl: pci: use _init/_setdefault



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1330604774 0
# Node ID a207b589a972a9168ef53d24035ce48b6adffa49
# Parent  d36443bc098c28c2649f3e494ae6f44722870261
libxl: pci: use _init/_setdefault

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


diff -r d36443bc098c -r a207b589a972 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h       Thu Mar 01 12:26:14 2012 +0000
+++ b/tools/libxl/libxl.h       Thu Mar 01 12:26:14 2012 +0000
@@ -552,7 +552,7 @@
 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 d36443bc098c -r a207b589a972 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h      Thu Mar 01 12:26:14 2012 +0000
+++ b/tools/libxl/libxl_internal.h      Thu Mar 01 12:26:14 2012 +0000
@@ -196,6 +196,7 @@
 _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 d36443bc098c -r a207b589a972 tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c   Thu Mar 01 12:26:14 2012 +0000
+++ b/tools/libxl/libxl_pci.c   Thu Mar 01 12:26:14 2012 +0000
@@ -765,6 +765,16 @@
     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 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 d36443bc098c -r a207b589a972 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Thu Mar 01 12:26:14 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c  Thu Mar 01 12:26:14 2012 +0000
@@ -1021,7 +1021,7 @@
 
             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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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