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

[Xen-changelog] [xen-unstable] libxc: add xc_machphys_mfn_list to wrap XENMEM_machphys_mfn_list



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1287418619 -3600
# Node ID 9bb14bf353a8ddddbeb8e605171db6795a3f4085
# Parent  d923bf8456ad69b2745db2b1ace9d50e179062af
libxc: add xc_machphys_mfn_list to wrap XENMEM_machphys_mfn_list

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxc/xc_domain_save.c |    9 ++-------
 tools/libxc/xc_private.c     |   14 ++++++++++++++
 tools/libxc/xenctrl.h        |    4 ++++
 3 files changed, 20 insertions(+), 7 deletions(-)

diff -r d923bf8456ad -r 9bb14bf353a8 tools/libxc/xc_domain_save.c
--- a/tools/libxc/xc_domain_save.c      Mon Oct 18 17:16:13 2010 +0100
+++ b/tools/libxc/xc_domain_save.c      Mon Oct 18 17:16:59 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 d923bf8456ad -r 9bb14bf353a8 tools/libxc/xc_private.c
--- a/tools/libxc/xc_private.c  Mon Oct 18 17:16:13 2010 +0100
+++ b/tools/libxc/xc_private.c  Mon Oct 18 17:16:59 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 d923bf8456ad -r 9bb14bf353a8 tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h     Mon Oct 18 17:16:13 2010 +0100
+++ b/tools/libxc/xenctrl.h     Mon Oct 18 17:16:59 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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.