|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCHv1 2/5] tools/libxc: add xc_domain_get_param() and xc_domain_set_param()
These are a thin wrapper around the XEN_DOMCTL_param hypercall.
Signed-off-by: David Vrabel <david.vrabel@xxxxxxxxxx>
---
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
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |