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

[Xen-changelog] [xen master] libxl: introduce libxl__device_from_pcidev



commit 7e56e7855e13da418baa402669ba0800389127b7
Author:     Wei Liu <wei.liu2@xxxxxxxxxx>
AuthorDate: Thu Sep 4 23:43:12 2014 +0100
Commit:     Ian Campbell <ian.campbell@xxxxxxxxxx>
CommitDate: Tue Sep 9 12:46:23 2014 +0100

    libxl: introduce libxl__device_from_pcidev
    
    Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 tools/libxl/libxl_pci.c |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c
index 2782d0e..0500cf3 100644
--- a/tools/libxl/libxl_pci.c
+++ b/tools/libxl/libxl_pci.c
@@ -64,6 +64,20 @@ static void libxl_create_pci_backend_device(libxl__gc *gc, 
flexarray_t *back, in
     flexarray_append_pair(back, libxl__sprintf(gc, "state-%d", num), 
libxl__sprintf(gc, "%d", 1));
 }
 
+static int libxl__device_from_pcidev(libxl__gc *gc, uint32_t domid,
+                                     libxl_device_pci *pcidev,
+                                     libxl__device *device)
+{
+    device->backend_devid = 0;
+    device->backend_domid = 0;
+    device->backend_kind = LIBXL__DEVICE_KIND_PCI;
+    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,
                               libxl_device_pci *pcidev, int num)
 {
@@ -81,12 +95,7 @@ int libxl__create_pci_backend(libxl__gc *gc, uint32_t domid,
     LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Creating pci backend");
 
     /* add pci device */
-    device.backend_devid = 0;
-    device.backend_domid = 0;
-    device.backend_kind = LIBXL__DEVICE_KIND_PCI;
-    device.devid = 0;
-    device.domid = domid;
-    device.kind = LIBXL__DEVICE_KIND_PCI;
+    libxl__device_from_pcidev(gc, domid, pcidev, &device);
 
     flexarray_append_pair(back, "frontend-id", libxl__sprintf(gc, "%d", 
domid));
     flexarray_append_pair(back, "online", "1");
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
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®.