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

Re: [Xen-devel] [PATCH QEMU-XEN v3 4/8] xen: Switch uses of xc_map_foreign_pages into xc_map_foreign_bulk



On Wed, 7 Oct 2015, Ian Campbell wrote:
> 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 <ian.campbell@xxxxxxxxxx>
> ---
>  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 e3fdf33..f9442b7 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);

Please take this opportunity to fix the indentation. Aside from this

Acked-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>


>      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
> 

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