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

[Xen-devel] [PATCH QEMU-XEN v5 5/9] xen: Switch uses of xc_map_foreign_pages into xc_map_foreign_bulk



In Xen 4.7 we are refactoring parts libxenctrl into a number of
separate libraries which will provide backward and forward API and ABI
compatiblity.

One such library will be libxenforeignmemory which provides access to
privileged foreign mappings and which will provide an interface
equivalent to xc_map_foreign_bulk.

In preparation for this switch both uses of xc_map_foreign_pages
(which both happen to be in xenfb_map_fb) to xc_map_foreign_bulk. This
simply requires allocating and passing a new err array (the same one
for both calls).

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Acked-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
---
v4: Fix indentation
---
 hw/display/xenfb.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/hw/display/xenfb.c b/hw/display/xenfb.c
index e913bf6..71de556 100644
--- a/hw/display/xenfb.c
+++ b/hw/display/xenfb.c
@@ -433,6 +433,7 @@ static int xenfb_map_fb(struct XenFB *xenfb)
     int n_fbdirs;
     xen_pfn_t *pgmfns = NULL;
     xen_pfn_t *fbmfns = NULL;
+    int *errs = NULL;
     void *map, *pd;
     int mode, ret = -1;
 
@@ -492,17 +493,18 @@ static int xenfb_map_fb(struct XenFB *xenfb)
 
     pgmfns = g_malloc0(sizeof(xen_pfn_t) * n_fbdirs);
     fbmfns = g_malloc0(sizeof(xen_pfn_t) * xenfb->fbpages);
+    errs = g_malloc0(sizeof(int) * n_fbdirs);
 
     xenfb_copy_mfns(mode, n_fbdirs, pgmfns, pd);
-    map = xc_map_foreign_pages(xen_xc, xenfb->c.xendev.dom,
-                              PROT_READ, pgmfns, n_fbdirs);
+    map = xc_map_foreign_bulk(xen_xc, xenfb->c.xendev.dom,
+                              PROT_READ, pgmfns, errs, n_fbdirs);
     if (map == NULL)
        goto out;
     xenfb_copy_mfns(mode, xenfb->fbpages, fbmfns, map);
     munmap(map, n_fbdirs * XC_PAGE_SIZE);
 
-    xenfb->pixels = xc_map_foreign_pages(xen_xc, xenfb->c.xendev.dom,
-            PROT_READ, fbmfns, xenfb->fbpages);
+    xenfb->pixels = xc_map_foreign_bulk(xen_xc, xenfb->c.xendev.dom,
+            PROT_READ, fbmfns, errs, xenfb->fbpages);
     if (xenfb->pixels == NULL)
        goto out;
 
@@ -511,6 +513,7 @@ static int xenfb_map_fb(struct XenFB *xenfb)
 out:
     g_free(pgmfns);
     g_free(fbmfns);
+    g_free(errs);
     return ret;
 }
 
-- 
2.1.4


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