From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Vrabel Subject: [PATCHv1 2/5] tools/libxc: add xc_domain_get_param() and xc_domain_set_param() Date: Thu, 18 Feb 2016 18:52:07 +0000 Message-ID: <1455821530-4263-3-git-send-email-david.vrabel@citrix.com> References: <1455821530-4263-1-git-send-email-david.vrabel@citrix.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 1aWTgd-0002UJ-O5 for xen-devel@lists.xenproject.org; Thu, 18 Feb 2016 18:52:23 +0000 In-Reply-To: <1455821530-4263-1-git-send-email-david.vrabel@citrix.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 Cooper , David Vrabel , Jan Beulich List-Id: xen-devel@lists.xenproject.org These are a thin wrapper around the XEN_DOMCTL_param hypercall. Signed-off-by: David Vrabel --- tools/libxc/include/xenctrl.h | 5 +++++ tools/libxc/xc_domain.c | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h index 42eafa4..862c748 100644 --- a/tools/libxc/include/xenctrl.h +++ b/tools/libxc/include/xenctrl.h @@ -812,6 +812,11 @@ int xc_domain_hvm_setcontext(xc_interface *xch, const char *xc_domain_get_native_protocol(xc_interface *xch, uint32_t domid); +int xc_domain_get_param(xc_interface *xch, unsigned int domid, + uint32_t param, uint64_t *value); +int xc_domain_set_param(xc_interface *xch, unsigned int domid, + uint32_t param, uint64_t value, uint64_t *old_value); + /** * This function returns information about the execution context of a * particular vcpu of a domain. diff --git a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c index 4fa993a..4caa250 100644 --- a/tools/libxc/xc_domain.c +++ b/tools/libxc/xc_domain.c @@ -2574,6 +2574,41 @@ int xc_domain_soft_reset(xc_interface *xch, domctl.domain = (domid_t)domid; return do_domctl(xch, &domctl); } + +static int xc_domain_param(xc_interface *xch, unsigned int domid, + uint32_t param, int set, uint64_t *value) +{ + int ret; + DECLARE_DOMCTL; + + domctl.cmd = XEN_DOMCTL_param; + domctl.domain = domid; + domctl.u.param.param = param | (set ? XEN_DOMCTL_PARAM_SET : 0); + domctl.u.param.value = *value; + + ret = do_domctl(xch, &domctl); + if ( ret == 0 ) + *value = domctl.u.param.value; + return ret; +} + +int xc_domain_get_param(xc_interface *xch, unsigned int domid, + uint32_t param, uint64_t *value) +{ + return xc_domain_param(xch, domid, param, 0, value); +} + +int xc_domain_set_param(xc_interface *xch, unsigned int domid, + uint32_t param, uint64_t value, uint64_t *old_value) +{ + int ret; + + ret = xc_domain_param(xch, domid, param, 1, &value); + if ( ret == 0 && old_value ) + *old_value = value; + return ret; +} + /* * Local variables: * mode: C -- 2.1.4