WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 09 of 18] libxc: add xc_machphys_mfn_list to wrap XEN

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 09 of 18] libxc: add xc_machphys_mfn_list to wrap XENMEM_machphys_mfn_list
From: Ian Campbell <ian.campbell@xxxxxxxxxx>
Date: Tue, 12 Oct 2010 15:16:27 +0100
Cc: Ian Campbell <ian.campbell@xxxxxxxxxx>
Delivery-date: Tue, 12 Oct 2010 07:33:32 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1286892978@xxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
# 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

<Prev in Thread] Current Thread [Next in Thread>