aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_domain_restore.c
diff options
context:
space:
mode:
authorIan Campbell <ian.campbell@citrix.com>2010-10-18 16:54:42 +0100
committerIan Campbell <ian.campbell@citrix.com>2010-10-18 16:54:42 +0100
commit2674a296982598b97ffdd90fa407e4cdd1df3e13 (patch)
treeed8d08336c8bc9ea7a82ba3975d5074e1766b185 /tools/libxc/xc_domain_restore.c
parentf5c808b428244f42b2310ddf173c624d9a2a842c (diff)
downloadxen-2674a296982598b97ffdd90fa407e4cdd1df3e13.tar.gz
xen-2674a296982598b97ffdd90fa407e4cdd1df3e13.tar.bz2
xen-2674a296982598b97ffdd90fa407e4cdd1df3e13.zip
libxc: wrappers for XENMEM {increase,decrease}_reservation and populate_physmap
Currently the wrappers for these hypercalls swallow partial success and return failure to the caller. In order to use these functions more widely instead of open-coding uses of XENMEM_* and xc_memory_op add variants which return the actual hypercall result. Therefore add the following functions: xc_domain_increase_reservation xc_domain_decrease_reservation xc_domain_populate_physmap and implement the existing semantics using these new functions as xc_domain_increase_reservation_exact xc_domain_decrease_reservation_exact xc_domain_populate_physmap_exact replacing the existing xc_domain_memory_* functions. Use these new functions to replace all open coded uses of XENMEM_increase_reservation, XENMEM_decrease_reservation and XENMEM_populate_physmap. Also rename xc_domain_memory_*_pod_target to xc_domain_*_pod_target for consistency. Temporarily add a compatibility macro for xc_domain_memory_populate_physmap to allow time for qemu to catch up. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxc/xc_domain_restore.c')
-rw-r--r--tools/libxc/xc_domain_restore.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/tools/libxc/xc_domain_restore.c b/tools/libxc/xc_domain_restore.c
index 48da1ba535..316f32dac5 100644
--- a/tools/libxc/xc_domain_restore.c
+++ b/tools/libxc/xc_domain_restore.c
@@ -147,7 +147,7 @@ static int uncanonicalize_pagetable(
/* Allocate the requisite number of mfns. */
if ( nr_mfns &&
- (xc_domain_memory_populate_physmap(xch, dom, nr_mfns, 0, 0,
+ (xc_domain_populate_physmap_exact(xch, dom, nr_mfns, 0, 0,
ctx->p2m_batch) != 0) )
{
ERROR("Failed to allocate memory for batch.!\n");
@@ -888,7 +888,7 @@ static int apply_batch(xc_interface *xch, uint32_t dom, struct restore_ctx *ctx,
/* Now allocate a bunch of mfns for this batch */
if ( nr_mfns &&
- (xc_domain_memory_populate_physmap(xch, dom, nr_mfns, 0,
+ (xc_domain_populate_physmap_exact(xch, dom, nr_mfns, 0,
0, ctx->p2m_batch) != 0) )
{
ERROR("Failed to allocate memory for batch.!\n");
@@ -1529,15 +1529,7 @@ int xc_domain_restore(xc_interface *xch, int io_fd, uint32_t dom,
if ( nr_frees > 0 )
{
- struct xen_memory_reservation reservation = {
- .nr_extents = nr_frees,
- .extent_order = 0,
- .domid = dom
- };
- set_xen_guest_handle(reservation.extent_start, tailbuf.u.pv.pfntab);
-
- if ( (frc = xc_memory_op(xch, XENMEM_decrease_reservation,
- &reservation)) != nr_frees )
+ if ( (frc = xc_domain_decrease_reservation(xch, dom, nr_frees, 0, tailbuf.u.pv.pfntab)) != nr_frees )
{
PERROR("Could not decrease reservation : %d", frc);
goto out;