[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v3 03/13] xen: introduce cpumask_from_bitmap



Introduce a new cpumask function that takes a pointer to bits in memory,
builds a cpumask with them and returns it.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
CC: keir@xxxxxxx
CC: JBeulich@xxxxxxxx

---
 xen/include/xen/cpumask.h |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/xen/include/xen/cpumask.h b/xen/include/xen/cpumask.h
index f931cf2..f6ad154 100644
--- a/xen/include/xen/cpumask.h
+++ b/xen/include/xen/cpumask.h
@@ -265,6 +265,17 @@ static inline const cpumask_t *cpumask_of(unsigned int cpu)
 
 #define cpumask_bits(maskp) ((maskp)->bits)
 
+static inline cpumask_t cpumask_from_bitmap(unsigned long *bits, int nr_bits)
+{
+    cpumask_t mask;
+    int len = nr_bits < nr_cpumask_bits ? nr_bits : nr_cpumask_bits;
+
+    memset(&mask, 0x00, sizeof(mask));
+       bitmap_copy(mask.bits, bits, len);
+
+    return mask;
+}
+
 static inline int cpumask_scnprintf(char *buf, int len,
                                    const cpumask_t *srcp)
 {
-- 
1.7.2.5


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.