ia64/xen-unstable

changeset 19688:bd39df93a29e

libxc: export xc_map_m2p() so that it can be called outside.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Jun 01 14:12:53 2009 +0100 (2009-06-01)
parents 84c1f7c46444
children 4b2172c60a8c
files tools/libxc/xc_domain_save.c tools/libxc/xenguest.h
line diff
     1.1 --- a/tools/libxc/xc_domain_save.c	Mon Jun 01 14:08:58 2009 +0100
     1.2 +++ b/tools/libxc/xc_domain_save.c	Mon Jun 01 14:12:53 2009 +0100
     1.3 @@ -510,9 +510,10 @@ static int canonicalize_pagetable(unsign
     1.4      return race;
     1.5  }
     1.6  
     1.7 -static xen_pfn_t *xc_map_m2p(int xc_handle,
     1.8 +xen_pfn_t *xc_map_m2p(int xc_handle,
     1.9                                   unsigned long max_mfn,
    1.10 -                                 int prot)
    1.11 +                                 int prot,
    1.12 +                                 unsigned long *mfn0)
    1.13  {
    1.14      struct xen_machphys_mfn_list xmml;
    1.15      privcmd_mmap_entry_t *entries;
    1.16 @@ -561,7 +562,8 @@ static xen_pfn_t *xc_map_m2p(int xc_hand
    1.17          goto err2;
    1.18      }
    1.19  
    1.20 -    m2p_mfn0 = entries[0].mfn;
    1.21 +    if (mfn0)
    1.22 +        *mfn0 = entries[0].mfn;
    1.23  
    1.24  err2:
    1.25      free(entries);
    1.26 @@ -949,7 +951,7 @@ int xc_domain_save(int xc_handle, int io
    1.27      }
    1.28  
    1.29      /* Setup the mfn_to_pfn table mapping */
    1.30 -    if ( !(live_m2p = xc_map_m2p(xc_handle, max_mfn, PROT_READ)) )
    1.31 +    if ( !(live_m2p = xc_map_m2p(xc_handle, max_mfn, PROT_READ, &m2p_mfn0)) )
    1.32      {
    1.33          ERROR("Failed to map live M2P table");
    1.34          goto out;
     2.1 --- a/tools/libxc/xenguest.h	Mon Jun 01 14:08:58 2009 +0100
     2.2 +++ b/tools/libxc/xenguest.h	Mon Jun 01 14:12:53 2009 +0100
     2.3 @@ -163,4 +163,17 @@ int xc_mark_page_offline(int xc, unsigne
     2.4  int xc_query_page_offline_status(int xc, unsigned long start,
     2.5                                   unsigned long end, uint32_t *status);
     2.6  
     2.7 +
     2.8 +/**
     2.9 + * This function map m2p table
    2.10 + * @parm xc_handle a handle to an open hypervisor interface
    2.11 + * @parm max_mfn the max pfn
    2.12 + * @parm prot the flags to map, such as read/write etc
    2.13 + * @parm mfn0 return the first mfn, can be NULL
    2.14 + * @return mapped m2p table on success, NULL on failure
    2.15 + */
    2.16 +xen_pfn_t *xc_map_m2p(int xc_handle,
    2.17 +                      unsigned long max_mfn,
    2.18 +                      int prot,
    2.19 +                      unsigned long *mfn0);
    2.20  #endif /* XENGUEST_H */