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

[Xen-devel] [PATCH 06 of 24] libxc: add to xc_domain_maximum_gpfn



# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1283779691 -3600
# Node ID e79d9a42c67e1d03f79d40529b2578578a5aa547
# Parent  b4aa42793b8a8434aa3d7371e22e86dcca4f5a7a
libxc: add to xc_domain_maximum_gpfn
to replace various open-coded calls to XENMEM_maximum_gpfn

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r b4aa42793b8a -r e79d9a42c67e tools/libxc/ia64/xc_ia64_linux_save.c
--- a/tools/libxc/ia64/xc_ia64_linux_save.c     Mon Sep 06 14:28:11 2010 +0100
+++ b/tools/libxc/ia64/xc_ia64_linux_save.c     Mon Sep 06 14:28:11 2010 +0100
@@ -487,7 +487,7 @@ xc_domain_save(xc_interface *xch, int io
         goto out;
     }
 
-    p2m_size = xc_memory_op(xch, XENMEM_maximum_gpfn, &dom) + 1;
+    p2m_size = xc_domain_maximum_gpfn(xch, dom);
 
     /* This is expected by xm restore.  */
     if (write_exact(io_fd, &p2m_size, sizeof(unsigned long))) {
diff -r b4aa42793b8a -r e79d9a42c67e tools/libxc/ia64/xc_ia64_stubs.c
--- a/tools/libxc/ia64/xc_ia64_stubs.c  Mon Sep 06 14:28:11 2010 +0100
+++ b/tools/libxc/ia64/xc_ia64_stubs.c  Mon Sep 06 14:28:11 2010 +0100
@@ -114,7 +114,7 @@ xc_ia64_copy_memmap(xc_interface *xch, u
 
     int ret;
 
-    gpfn_max_prev = xc_memory_op(xch, XENMEM_maximum_gpfn, &domid);
+    gpfn_max_prev = xc_domain_maximum_gpfn(xch, domid);
     if (gpfn_max_prev < 0)
         return -1;
 
@@ -143,7 +143,7 @@ xc_ia64_copy_memmap(xc_interface *xch, u
         goto again;
     }
 
-    gpfn_max_post = xc_memory_op(xch, XENMEM_maximum_gpfn, &domid);
+    gpfn_max_post = xc_domain_maximum_gpfn(xch, domid);
     if (gpfn_max_prev < 0) {
         free(memmap_info);
         return -1;
@@ -190,7 +190,7 @@ xc_ia64_map_foreign_p2m(xc_interface *xc
     int ret;
     int saved_errno;
 
-    gpfn_max = xc_memory_op(xch, XENMEM_maximum_gpfn, &dom);
+    gpfn_max = xc_domain_maximum_gpfn(xch, dom);
     if (gpfn_max < 0)
         return NULL;
     p2m_size =
diff -r b4aa42793b8a -r e79d9a42c67e tools/libxc/xc_core_x86.c
--- a/tools/libxc/xc_core_x86.c Mon Sep 06 14:28:11 2010 +0100
+++ b/tools/libxc/xc_core_x86.c Mon Sep 06 14:28:11 2010 +0100
@@ -40,11 +40,6 @@ xc_core_arch_gpfn_may_present(struct xc_
 }
 
 
-static int nr_gpfns(xc_interface *xch, domid_t domid)
-{
-    return xc_memory_op(xch, XENMEM_maximum_gpfn, &domid) + 1;
-}
-
 int
 xc_core_arch_auto_translated_physmap(const xc_dominfo_t *info)
 {
@@ -57,7 +52,7 @@ xc_core_arch_memory_map_get(xc_interface
                             xc_core_memory_map_t **mapp,
                             unsigned int *nr_entries)
 {
-    unsigned long p2m_size = nr_gpfns(xch, info->domid);
+    unsigned long p2m_size = xc_domain_maximum_gpfn(xch, info->domid);
     xc_core_memory_map_t *map;
 
     map = malloc(sizeof(*map));
@@ -92,7 +87,7 @@ xc_core_arch_map_p2m_rw(xc_interface *xc
     int err;
     int i;
 
-    dinfo->p2m_size = nr_gpfns(xch, info->domid);
+    dinfo->p2m_size = xc_domain_maximum_gpfn(xch, info->domid);
     if ( dinfo->p2m_size < info->nr_pages  )
     {
         ERROR("p2m_size < nr_pages -1 (%lx < %lx", dinfo->p2m_size, 
info->nr_pages - 1);
diff -r b4aa42793b8a -r e79d9a42c67e tools/libxc/xc_domain.c
--- a/tools/libxc/xc_domain.c   Mon Sep 06 14:28:11 2010 +0100
+++ b/tools/libxc/xc_domain.c   Mon Sep 06 14:28:11 2010 +0100
@@ -578,6 +578,11 @@ int xc_domain_get_tsc_info(xc_interface 
     return rc;
 }
 
+
+int xc_domain_maximum_gpfn(xc_interface *xch, domid_t domid)
+{
+    return xc_memory_op(xch, XENMEM_maximum_gpfn, &domid) + 1;
+}
 
 int xc_domain_memory_increase_reservation(xc_interface *xch,
                                           uint32_t domid,
diff -r b4aa42793b8a -r e79d9a42c67e tools/libxc/xc_domain_save.c
--- a/tools/libxc/xc_domain_save.c      Mon Sep 06 14:28:11 2010 +0100
+++ b/tools/libxc/xc_domain_save.c      Mon Sep 06 14:28:11 2010 +0100
@@ -979,7 +979,7 @@ int xc_domain_save(xc_interface *xch, in
     }
 
     /* Get the size of the P2M table */
-    dinfo->p2m_size = xc_memory_op(xch, XENMEM_maximum_gpfn, &dom) + 1;
+    dinfo->p2m_size = xc_domain_maximum_gpfn(xch, dom);
 
     if ( dinfo->p2m_size > ~XEN_DOMCTL_PFINFO_LTAB_MASK )
     {
diff -r b4aa42793b8a -r e79d9a42c67e tools/libxc/xenctrl.h
--- a/tools/libxc/xenctrl.h     Mon Sep 06 14:28:11 2010 +0100
+++ b/tools/libxc/xenctrl.h     Mon Sep 06 14:28:11 2010 +0100
@@ -784,6 +784,9 @@ int xc_domain_get_tsc_info(xc_interface 
                            uint32_t *incarnation);
 
 int xc_domain_disable_migrate(xc_interface *xch, uint32_t domid);
+
+int xc_domain_maximum_gpfn(xc_interface *xch, domid_t domid);
+
 
 int xc_domain_memory_increase_reservation(xc_interface *xch,
                                           uint32_t domid,

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

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