ia64/xen-unstable

changeset 18123:c049e70af85f

libxc: add xc_gnttab_map_domain_grant_refs.

xc_gnttab_map_domain_grant_refs permits to simply map several pages
from the same domain.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Jul 21 14:02:53 2008 +0100 (2008-07-21)
parents 85a83b919653
children f150da74abc3
files tools/libxc/xc_linux.c tools/libxc/xenctrl.h
line diff
     1.1 --- a/tools/libxc/xc_linux.c	Mon Jul 21 10:39:15 2008 +0100
     1.2 +++ b/tools/libxc/xc_linux.c	Mon Jul 21 14:02:53 2008 +0100
     1.3 @@ -418,9 +418,10 @@ void *xc_gnttab_map_grant_ref(int xcg_ha
     1.4      return addr;
     1.5  }
     1.6  
     1.7 -void *xc_gnttab_map_grant_refs(int xcg_handle,
     1.8 +static void *do_gnttab_map_grant_refs(int xcg_handle,
     1.9                                 uint32_t count,
    1.10                                 uint32_t *domids,
    1.11 +                               int domids_stride,
    1.12                                 uint32_t *refs,
    1.13                                 int prot)
    1.14  {
    1.15 @@ -435,7 +436,7 @@ void *xc_gnttab_map_grant_refs(int xcg_h
    1.16  
    1.17      for ( i = 0; i < count; i++ )
    1.18      {
    1.19 -        map->refs[i].domid = domids[i];
    1.20 +        map->refs[i].domid = domids[i * domids_stride];
    1.21          map->refs[i].ref   = refs[i];
    1.22      }
    1.23  
    1.24 @@ -464,6 +465,24 @@ void *xc_gnttab_map_grant_refs(int xcg_h
    1.25      return addr;
    1.26  }
    1.27  
    1.28 +void *xc_gnttab_map_grant_refs(int xcg_handle,
    1.29 +                               uint32_t count,
    1.30 +                               uint32_t *domids,
    1.31 +                               uint32_t *refs,
    1.32 +                               int prot)
    1.33 +{
    1.34 +    return do_gnttab_map_grant_refs(xcg_handle, count, domids, 1, refs, prot);
    1.35 +}
    1.36 +
    1.37 +void *xc_gnttab_map_domain_grant_refs(int xcg_handle,
    1.38 +                               uint32_t count,
    1.39 +                               uint32_t domid,
    1.40 +                               uint32_t *refs,
    1.41 +                               int prot)
    1.42 +{
    1.43 +    return do_gnttab_map_grant_refs(xcg_handle, count, &domid, 0, refs, prot);
    1.44 +}
    1.45 +
    1.46  int xc_gnttab_munmap(int xcg_handle,
    1.47                       void *start_address,
    1.48                       uint32_t count)
     2.1 --- a/tools/libxc/xenctrl.h	Mon Jul 21 10:39:15 2008 +0100
     2.2 +++ b/tools/libxc/xenctrl.h	Mon Jul 21 14:02:53 2008 +0100
     2.3 @@ -865,6 +865,23 @@ void *xc_gnttab_map_grant_refs(int xcg_h
     2.4                                 uint32_t *refs,
     2.5                                 int prot);
     2.6  
     2.7 +/**
     2.8 + * Memory maps one or more grant references from one domain to a
     2.9 + * contiguous local address range. Mappings should be unmapped with
    2.10 + * xc_gnttab_munmap.  Returns NULL on failure.
    2.11 + *
    2.12 + * @parm xcg_handle a handle on an open grant table interface
    2.13 + * @parm count the number of grant references to be mapped
    2.14 + * @parm domid the domain to map memory from
    2.15 + * @parm refs an array of @count grant references to be mapped
    2.16 + * @parm prot same flag as in mmap()
    2.17 + */
    2.18 +void *xc_gnttab_map_domain_grant_refs(int xcg_handle,
    2.19 +                                      uint32_t count,
    2.20 +                                      uint32_t domid,
    2.21 +                                      uint32_t *refs,
    2.22 +                                      int prot);
    2.23 +
    2.24  /*
    2.25   * Unmaps the @count pages starting at @start_address, which were mapped by a
    2.26   * call to xc_gnttab_map_grant_ref or xc_gnttab_map_grant_refs. Returns zero