From: Vitaly Kuznetsov Subject: [PATCH RFCv3 4/8] libxc: support XEN_DOMCTL_set_recipient Date: Tue, 7 Oct 2014 15:10:09 +0200 Message-ID: <1412687413-22818-5-git-send-email-vkuznets@redhat.com> References: <1412687413-22818-1-git-send-email-vkuznets@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XbUXE-0005sF-Al for xen-devel@lists.xenproject.org; Tue, 07 Oct 2014 13:10:36 +0000 In-Reply-To: <1412687413-22818-1-git-send-email-vkuznets@redhat.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Andrew Jones , Ian Campbell , Andrew Cooper , David Vrabel , Jan Beulich List-Id: xen-devel@lists.xenproject.org Introduce new xc_domain_set_recipient() function to support XEN_DOMCTL_set_recipient. Signed-off-by: Vitaly Kuznetsov --- tools/libxc/xc_domain.c | 10 ++++++++++ tools/libxc/xenctrl.h | 14 ++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c index 14f4666..2c69087 100644 --- a/tools/libxc/xc_domain.c +++ b/tools/libxc/xc_domain.c @@ -92,6 +92,16 @@ int xc_domain_destroy(xc_interface *xch, return ret; } +int xc_domain_set_recipient(xc_interface *xch, + uint32_t domid, uint32_t recipient) +{ + DECLARE_DOMCTL; + domctl.cmd = XEN_DOMCTL_set_recipient; + domctl.domain = (domid_t)domid; + domctl.u.recipient.recipient = (domid_t)recipient; + return do_domctl(xch, &domctl); +} + int xc_domain_shutdown(xc_interface *xch, uint32_t domid, int reason) diff --git a/tools/libxc/xenctrl.h b/tools/libxc/xenctrl.h index 514b241..e59c718 100644 --- a/tools/libxc/xenctrl.h +++ b/tools/libxc/xenctrl.h @@ -551,6 +551,20 @@ int xc_domain_unpause(xc_interface *xch, int xc_domain_destroy(xc_interface *xch, uint32_t domid); +/** + * This function sets a 'recipient' domain for a domain (when the source domain + * releases memory it is being reassigned to the recipient domain instead of + * being freed). The destination domain is supposed to have enough max_mem. + * Supplying DOMID_INVALID as a recipient cleans things up. + * + * @parm xch a handle to an open hypervisor interface + * @parm domid the source domain id + * @parm recipient the destrination domain id + * @return 0 on success, -1 on failure + */ +int xc_domain_set_recipient(xc_interface *xch, + uint32_t domid, uint32_t recipient); + /** * This function resumes a suspended domain. The domain should have -- 1.9.3