# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1286892402 -3600
# Node ID e2e86e7d7af71f12956af780bd23cc53134920e5
# Parent 9c4485d27ea16109765386fc582e00156bf7676a
libxc: add xc_machphys_mfn_list to wrap XENMEM_machphys_mfn_list
Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
diff -r 9c4485d27ea1 -r e2e86e7d7af7 tools/libxc/xc_domain_save.c
--- a/tools/libxc/xc_domain_save.c Tue Oct 12 15:06:42 2010 +0100
+++ b/tools/libxc/xc_domain_save.c Tue Oct 12 15:06:42 2010 +0100
@@ -623,7 +623,6 @@ xen_pfn_t *xc_map_m2p(xc_interface *xch,
int prot,
unsigned long *mfn0)
{
- struct xen_machphys_mfn_list xmml;
privcmd_mmap_entry_t *entries;
unsigned long m2p_chunks, m2p_size;
xen_pfn_t *m2p;
@@ -634,18 +633,14 @@ xen_pfn_t *xc_map_m2p(xc_interface *xch,
m2p_size = M2P_SIZE(max_mfn);
m2p_chunks = M2P_CHUNKS(max_mfn);
- xmml.max_extents = m2p_chunks;
-
extent_start = calloc(m2p_chunks, sizeof(xen_pfn_t));
if ( !extent_start )
{
ERROR("failed to allocate space for m2p mfns");
goto err0;
}
- set_xen_guest_handle(xmml.extent_start, extent_start);
- if ( xc_memory_op(xch, XENMEM_machphys_mfn_list, &xmml) ||
- (xmml.nr_extents != m2p_chunks) )
+ if ( xc_machphys_mfn_list(xch, m2p_chunks, extent_start) )
{
PERROR("xc_get_m2p_mfns");
goto err1;
diff -r 9c4485d27ea1 -r e2e86e7d7af7 tools/libxc/xc_private.c
--- a/tools/libxc/xc_private.c Tue Oct 12 15:06:42 2010 +0100
+++ b/tools/libxc/xc_private.c Tue Oct 12 15:06:42 2010 +0100
@@ -549,6 +549,20 @@ long long xc_domain_get_cpu_usage( xc_in
return domctl.u.getvcpuinfo.cpu_time;
}
+int xc_machphys_mfn_list(xc_interface *xch,
+ unsigned long max_extents,
+ xen_pfn_t *extent_start)
+{
+ int rc;
+ struct xen_machphys_mfn_list xmml = {
+ .max_extents = max_extents,
+ };
+ set_xen_guest_handle(xmml.extent_start, extent_start);
+ rc = xc_memory_op(xch, XENMEM_machphys_mfn_list, &xmml);
+ if (rc || xmml.nr_extents != max_extents)
+ return -1;
+ return 0;
+}
#ifndef __ia64__
int xc_get_pfn_list(xc_interface *xch,
diff -r 9c4485d27ea1 -r e2e86e7d7af7 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h Tue Oct 12 15:06:42 2010 +0100
+++ b/tools/libxc/xenctrl.h Tue Oct 12 15:06:42 2010 +0100
@@ -752,6 +752,10 @@ int xc_numainfo(xc_interface *xch, xc_nu
int xc_sched_id(xc_interface *xch,
int *sched_id);
+
+int xc_machphys_mfn_list(xc_interface *xch,
+ unsigned long max_extents,
+ xen_pfn_t *extent_start);
typedef xen_sysctl_cpuinfo_t xc_cpuinfo_t;
int xc_getcpuinfo(xc_interface *xch, int max_cpus,
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|