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

[Xen-devel] [PATCH 15 of 26 V3] libxl: pci: use _init/_setdefault



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

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

diff -r af38d2c2926a -r b66dbc17bc1b tools/libxl/libxl.h
--- a/tools/libxl/libxl.h       Thu Feb 23 12:31:17 2012 +0000
+++ b/tools/libxl/libxl.h       Thu Feb 23 12:31:17 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 af38d2c2926a -r b66dbc17bc1b tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h      Thu Feb 23 12:31:17 2012 +0000
+++ b/tools/libxl/libxl_internal.h      Thu Feb 23 12:31:17 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 af38d2c2926a -r b66dbc17bc1b tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c   Thu Feb 23 12:31:17 2012 +0000
+++ b/tools/libxl/libxl_pci.c   Thu Feb 23 12:31:17 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 af38d2c2926a -r b66dbc17bc1b tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Thu Feb 23 12:31:17 2012 +0000
+++ b/tools/libxl/xl_cmdimpl.c  Thu Feb 23 12:31:17 2012 +0000
@@ -1016,7 +1016,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®.