From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47896) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZovFH-0004hq-IT for qemu-devel@nongnu.org; Wed, 21 Oct 2015 11:24:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZovFG-00085k-QL for qemu-devel@nongnu.org; Wed, 21 Oct 2015 11:24:07 -0400 Received: from smtp.citrix.com ([66.165.176.89]:36404) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZovFG-00084w-Ls for qemu-devel@nongnu.org; Wed, 21 Oct 2015 11:24:06 -0400 From: Ian Campbell Date: Wed, 21 Oct 2015 16:23:54 +0100 Message-ID: <1445441038-25903-6-git-send-email-ian.campbell@citrix.com> In-Reply-To: <1445441038-25903-1-git-send-email-ian.campbell@citrix.com> References: <1445440941.9563.163.camel@citrix.com> <1445441038-25903-1-git-send-email-ian.campbell@citrix.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Qemu-devel] [PATCH QEMU-XEN v4 5/9] xen: Switch uses of xc_map_foreign_pages into xc_map_foreign_bulk List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: ian.jackson@eu.citrix.com, wei.liu2@citrix.com, xen-devel@lists.xen.org Cc: Ian Campbell , qemu-devel@nongnu.org, stefano.stabellini@eu.citrix.com 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). Build tested with 4.0 and 4.5. Signed-off-by: Ian Campbell Acked-by: Stefano Stabellini --- 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 10cefed..b0ac1e6 100644 --- a/hw/display/xenfb.c +++ b/hw/display/xenfb.c @@ -428,6 +428,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; @@ -487,17 +488,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; @@ -506,6 +508,7 @@ static int xenfb_map_fb(struct XenFB *xenfb) out: g_free(pgmfns); g_free(fbmfns); + g_free(errs); return ret; } -- 2.1.4