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

[Minios-devel] [UNIKRAFT PATCH v5 13/15] include/uk: add prefix to BITS_TO_LONG and BIT_WORD



Signed-off-by: Yuri Volchkov <yuri.volchkov@xxxxxxxxx>
Reviewed-by: Florian Schmidt <florian.schmidt@xxxxxxxxx>
---
 include/uk/bitmap.h | 26 +++++++++++++-------------
 include/uk/bitops.h |  6 +++---
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/include/uk/bitmap.h b/include/uk/bitmap.h
index cf1f82d..6a2b20f 100644
--- a/include/uk/bitmap.h
+++ b/include/uk/bitmap.h
@@ -35,7 +35,7 @@
 static inline void
 uk_bitmap_zero(unsigned long *addr, const unsigned int size)
 {
-       memset(addr, 0, BITS_TO_LONGS(size) * sizeof(long));
+       memset(addr, 0, UK_BITS_TO_LONGS(size) * sizeof(long));
 }
 
 static inline void
@@ -43,16 +43,16 @@ uk_bitmap_fill(unsigned long *addr, const unsigned int size)
 {
        const unsigned int tail = size & (UK_BITS_PER_LONG - 1);
 
-       memset(addr, 0xff, BIT_WORD(size) * sizeof(long));
+       memset(addr, 0xff, UK_BIT_WORD(size) * sizeof(long));
 
        if (tail)
-               addr[BIT_WORD(size)] = UK_BITMAP_LAST_WORD_MASK(tail);
+               addr[UK_BIT_WORD(size)] = UK_BITMAP_LAST_WORD_MASK(tail);
 }
 
 static inline int
 uk_bitmap_full(unsigned long *addr, const unsigned int size)
 {
-       const unsigned int end = BIT_WORD(size);
+       const unsigned int end = UK_BIT_WORD(size);
        const unsigned int tail = size & (UK_BITS_PER_LONG - 1);
        unsigned int i;
 
@@ -73,7 +73,7 @@ uk_bitmap_full(unsigned long *addr, const unsigned int size)
 static inline int
 uk_bitmap_empty(unsigned long *addr, const unsigned int size)
 {
-       const unsigned int end = BIT_WORD(size);
+       const unsigned int end = UK_BIT_WORD(size);
        const unsigned int tail = size & (UK_BITS_PER_LONG - 1);
        unsigned int i;
 
@@ -98,7 +98,7 @@ uk_bitmap_set(unsigned long *map, unsigned int start, int nr)
        int bits_to_set = UK_BITS_PER_LONG - (start % UK_BITS_PER_LONG);
        unsigned long mask_to_set = UK_BITMAP_FIRST_WORD_MASK(start);
 
-       map += BIT_WORD(start);
+       map += UK_BIT_WORD(start);
 
        while (nr - bits_to_set >= 0) {
                *map |= mask_to_set;
@@ -121,7 +121,7 @@ uk_bitmap_clear(unsigned long *map, unsigned int start, int 
nr)
        int bits_to_clear = UK_BITS_PER_LONG - (start % UK_BITS_PER_LONG);
        unsigned long mask_to_clear = UK_BITMAP_FIRST_WORD_MASK(start);
 
-       map += BIT_WORD(start);
+       map += UK_BIT_WORD(start);
 
        while (nr - bits_to_clear >= 0) {
                *map &= ~mask_to_clear;
@@ -207,7 +207,7 @@ uk_bitmap_release_region(unsigned long *bitmap, int pos, 
int order)
 static inline unsigned int
 uk_bitmap_weight(unsigned long *addr, const unsigned int size)
 {
-       const unsigned int end = BIT_WORD(size);
+       const unsigned int end = UK_BIT_WORD(size);
        const unsigned int tail = size & (UK_BITS_PER_LONG - 1);
        unsigned int retval = 0;
        unsigned int i;
@@ -227,7 +227,7 @@ static inline int
 uk_bitmap_equal(const unsigned long *pa,
        const unsigned long *pb, unsigned int size)
 {
-       const unsigned int end = BIT_WORD(size);
+       const unsigned int end = UK_BIT_WORD(size);
        const unsigned int tail = size & (UK_BITS_PER_LONG - 1);
        unsigned int i;
 
@@ -249,7 +249,7 @@ static inline void
 uk_bitmap_complement(unsigned long *dst, const unsigned long *src,
        const unsigned int size)
 {
-       const unsigned int end = BITS_TO_LONGS(size);
+       const unsigned int end = UK_BITS_TO_LONGS(size);
        unsigned int i;
 
        for (i = 0; i != end; i++)
@@ -260,7 +260,7 @@ static inline void
 uk_bitmap_or(unsigned long *dst, const unsigned long *src1,
        const unsigned long *src2, const unsigned int size)
 {
-       const unsigned int end = BITS_TO_LONGS(size);
+       const unsigned int end = UK_BITS_TO_LONGS(size);
        unsigned int i;
 
        for (i = 0; i != end; i++)
@@ -271,7 +271,7 @@ static inline void
 uk_bitmap_and(unsigned long *dst, const unsigned long *src1,
        const unsigned long *src2, const unsigned int size)
 {
-       const unsigned int end = BITS_TO_LONGS(size);
+       const unsigned int end = UK_BITS_TO_LONGS(size);
        unsigned int i;
 
        for (i = 0; i != end; i++)
@@ -282,7 +282,7 @@ static inline void
 uk_bitmap_xor(unsigned long *dst, const unsigned long *src1,
        const unsigned long *src2, const unsigned int size)
 {
-       const unsigned int end = BITS_TO_LONGS(size);
+       const unsigned int end = UK_BITS_TO_LONGS(size);
        unsigned int i;
 
        for (i = 0; i != end; i++)
diff --git a/include/uk/bitops.h b/include/uk/bitops.h
index 4927ff3..b916c27 100644
--- a/include/uk/bitops.h
+++ b/include/uk/bitops.h
@@ -52,10 +52,10 @@
 
 #define        UK_BITMAP_FIRST_WORD_MASK(start)  (~0UL << ((start) % 
UK_BITS_PER_LONG))
 #define        UK_BITMAP_LAST_WORD_MASK(n)       (~0UL >> (UK_BITS_PER_LONG - 
(n)))
-#define        BITS_TO_LONGS(n)               howmany((n), UK_BITS_PER_LONG)
+#define        UK_BITS_TO_LONGS(n)               howmany((n), UK_BITS_PER_LONG)
 #define        UK_BIT_MASK(nr) \
        (1UL << ((nr) & (UK_BITS_PER_LONG - 1)))
-#define BIT_WORD(nr)                   ((nr) / UK_BITS_PER_LONG)
+#define UK_BIT_WORD(nr)                   ((nr) / UK_BITS_PER_LONG)
 #define        UK_GENMASK(h, l) \
        (((~0UL) >> (UK_BITS_PER_LONG - (h) - 1)) & ((~0UL) << (l)))
 #define        UK_GENMASK_ULL(h, l) \
@@ -296,7 +296,7 @@ linux_reg_op(unsigned long *bitmap, int pos, int order, int 
reg_op)
        nbits_reg = 1 << order;
        index = pos / UK_BITS_PER_LONG;
        offset = pos - (index * UK_BITS_PER_LONG);
-       nlongs_reg = BITS_TO_LONGS(nbits_reg);
+       nlongs_reg = UK_BITS_TO_LONGS(nbits_reg);
        nbitsinlong = MIN(nbits_reg,  UK_BITS_PER_LONG);
 
        mask = (1UL << (nbitsinlong - 1));
-- 
2.18.0


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

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