[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 06 of 18] libxc: add xc_domain_memory_exchange_pages to wrap XENMEM_exchange
# HG changeset patch # User Ian Campbell <ian.campbell@xxxxxxxxxx> # Date 1286892402 -3600 # Node ID d284f5cbda808a8ac816829bdd67c8a9f692c8e4 # Parent 6834151bfad74e84e201062d4e8f3ae58155cd43 libxc: add xc_domain_memory_exchange_pages to wrap XENMEM_exchange Generalised from exchange_page in xc_offline_page.c Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx> diff -r 6834151bfad7 -r d284f5cbda80 tools/libxc/xc_domain.c --- a/tools/libxc/xc_domain.c Tue Oct 12 15:06:42 2010 +0100 +++ b/tools/libxc/xc_domain.c Tue Oct 12 15:06:42 2010 +0100 @@ -726,6 +726,37 @@ int xc_domain_populate_physmap_exact(xc_ } return err; +} + +int xc_domain_memory_exchange_pages(xc_interface *xch, + int domid, + unsigned long nr_in_extents, + unsigned int in_order, + xen_pfn_t *in_extents, + unsigned long nr_out_extents, + unsigned int out_order, + xen_pfn_t *out_extents) +{ + int rc; + + struct xen_memory_exchange exchange = { + .in = { + .nr_extents = nr_in_extents, + .extent_order = in_order, + .domid = domid + }, + .out = { + .nr_extents = nr_out_extents, + .extent_order = out_order, + .domid = domid + } + }; + set_xen_guest_handle(exchange.in.extent_start, in_extents); + set_xen_guest_handle(exchange.out.extent_start, out_extents); + + rc = xc_memory_op(xch, XENMEM_exchange, &exchange); + + return rc; } static int xc_domain_pod_target(xc_interface *xch, diff -r 6834151bfad7 -r d284f5cbda80 tools/libxc/xc_offline_page.c --- a/tools/libxc/xc_offline_page.c Tue Oct 12 15:06:42 2010 +0100 +++ b/tools/libxc/xc_offline_page.c Tue Oct 12 15:06:42 2010 +0100 @@ -512,35 +512,6 @@ static int clear_pte(xc_interface *xch, __clear_pte, mfn); } -static int exchange_page(xc_interface *xch, xen_pfn_t mfn, - xen_pfn_t *new_mfn, int domid) -{ - int rc; - xen_pfn_t out_mfn; - - struct xen_memory_exchange exchange = { - .in = { - .nr_extents = 1, - .extent_order = 0, - .domid = domid - }, - .out = { - .nr_extents = 1, - .extent_order = 0, - .domid = domid - } - }; - set_xen_guest_handle(exchange.in.extent_start, &mfn); - set_xen_guest_handle(exchange.out.extent_start, &out_mfn); - - rc = xc_memory_op(xch, XENMEM_exchange, &exchange); - - if (!rc) - *new_mfn = out_mfn; - - return rc; -} - /* * Check if a page can be exchanged successfully */ @@ -704,7 +675,9 @@ int xc_exchange_page(xc_interface *xch, goto failed; } - rc = exchange_page(xch, mfn, &new_mfn, domid); + rc = xc_domain_memory_exchange_pages(xch, domid, + 1, 0, &mfn, + 1, 0, &new_mfn); if (rc) { diff -r 6834151bfad7 -r d284f5cbda80 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 @@ -828,6 +828,15 @@ int xc_domain_populate_physmap_exact(xc_ /* Temporary for compatibility */ #define xc_domain_memory_populate_physmap(x, d, nr, eo, mf, es) \ xc_domain_populate_physmap_exact(x, d, nr, eo, mf, es) + +int xc_domain_memory_exchange_pages(xc_interface *xch, + int domid, + unsigned long nr_in_extents, + unsigned int in_order, + xen_pfn_t *in_extents, + unsigned long nr_out_extents, + unsigned int out_order, + xen_pfn_t *out_extents); int xc_domain_set_pod_target(xc_interface *xch, uint32_t domid, _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |