|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v3 1/3] libxl/cpumap: Add xc_cpumap_[setcpu, clearcpu, testcpu] to complement xc_cpumap_alloc.
We export the xc_cpumap_alloc but not the bit operations.
One could include 'xc_bitops.h' but that is naughty - so instead
we just export the proper functions to do it on the xc_cpumap_t
typedef.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
---
tools/libxc/include/xenctrl.h | 9 +++++++++
tools/libxc/xc_misc.c | 16 ++++++++++++++++
2 files changed, 25 insertions(+)
diff --git a/tools/libxc/include/xenctrl.h b/tools/libxc/include/xenctrl.h
index 4e9537e..565f098 100644
--- a/tools/libxc/include/xenctrl.h
+++ b/tools/libxc/include/xenctrl.h
@@ -394,6 +394,15 @@ int xc_get_cpumap_size(xc_interface *xch);
/* allocate a cpumap */
xc_cpumap_t xc_cpumap_alloc(xc_interface *xch);
+/* clear an CPU from the cpumap. */
+void xc_cpumap_clearcpu(int cpu, xc_cpumap_t map);
+
+/* set an CPU in the cpumap. */
+void xc_cpumap_setcpu(int cpu, xc_cpumap_t map);
+
+/* Test whether the CPU in cpumap is set. */
+int xc_cpumap_testcpu(int cpu, xc_cpumap_t map);
+
/*
* NODEMAP handling
*/
diff --git a/tools/libxc/xc_misc.c b/tools/libxc/xc_misc.c
index be68291..7514b84 100644
--- a/tools/libxc/xc_misc.c
+++ b/tools/libxc/xc_misc.c
@@ -18,6 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
*/
+#include "xc_bitops.h"
#include "xc_private.h"
#include <xen/hvm/hvm_op.h>
@@ -93,6 +94,21 @@ xc_cpumap_t xc_cpumap_alloc(xc_interface *xch)
return calloc(1, sz);
}
+void xc_cpumap_clearcpu(int cpu, xc_cpumap_t map)
+{
+ clear_bit(cpu, (unsigned long *)map);
+}
+
+void xc_cpumap_setcpu(int cpu, xc_cpumap_t map)
+{
+ set_bit(cpu, (unsigned long *)map);
+}
+
+int xc_cpumap_testcpu(int cpu, xc_cpumap_t map)
+{
+ return test_bit(cpu, (unsigned long *)map);
+}
+
xc_nodemap_t xc_nodemap_alloc(xc_interface *xch)
{
int sz;
--
2.1.0
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |