XenevaOS
Loading...
Searching...
No Matches
Macros
bitmap.h File Reference
#include <linux/kernel.h>
Include dependency graph for bitmap.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define BITS_TO_LONGS(nr)   (((nr) + BITS_PER_LONG - 1) / BITS_PER_LONG)
 
#define DECLARE_BITMAP(name, bits)    unsigned long name[BITS_TO_LONGS(bits)]
 
#define set_bit(nr, addr)    ((addr)[(nr) / BITS_PER_LONG] |= (1UL << ((nr) % BITS_PER_LONG)))
 
#define clear_bit(nr, addr)    ((addr)[(nr) / BITS_PER_LONG] &= ~(1UL << ((nr) % BITS_PER_LONG)))
 
#define test_bit(nr, addr)    (!!((addr)[(nr) / BITS_PER_LONG] & (1UL << ((nr) % BITS_PER_LONG))))
 
#define test_and_set_bit(nr, addr)    ({int __old = test_bit(nr, addr); set_bit(nr, addr); __old; })
 
#define test_and_clear_bit(nr, addr)    ({ int __old = test_bit(nr, addr); clear_bit(nr,addr); __old;})
 
#define bitmap_zero(dst, nbits)    memset(dst, 0, BITS_TO_LONGS(nbits) * sizeof(unsigned long))
 
#define bitmap_copy(dst, src, nbits)    memcpy(dst, src, BITS_TO_LONGS(nbits) * sizeof(unsigned long))
 

Macro Definition Documentation

◆ bitmap_copy

#define bitmap_copy (   dst,
  src,
  nbits 
)     memcpy(dst, src, BITS_TO_LONGS(nbits) * sizeof(unsigned long))

◆ bitmap_zero

#define bitmap_zero (   dst,
  nbits 
)     memset(dst, 0, BITS_TO_LONGS(nbits) * sizeof(unsigned long))

◆ BITS_TO_LONGS

#define BITS_TO_LONGS (   nr)    (((nr) + BITS_PER_LONG - 1) / BITS_PER_LONG)

◆ clear_bit

#define clear_bit (   nr,
  addr 
)     ((addr)[(nr) / BITS_PER_LONG] &= ~(1UL << ((nr) % BITS_PER_LONG)))

◆ DECLARE_BITMAP

#define DECLARE_BITMAP (   name,
  bits 
)     unsigned long name[BITS_TO_LONGS(bits)]

◆ set_bit

#define set_bit (   nr,
  addr 
)     ((addr)[(nr) / BITS_PER_LONG] |= (1UL << ((nr) % BITS_PER_LONG)))

◆ test_and_clear_bit

#define test_and_clear_bit (   nr,
  addr 
)     ({ int __old = test_bit(nr, addr); clear_bit(nr,addr); __old;})

◆ test_and_set_bit

#define test_and_set_bit (   nr,
  addr 
)     ({int __old = test_bit(nr, addr); set_bit(nr, addr); __old; })

◆ test_bit

#define test_bit (   nr,
  addr 
)     (!!((addr)[(nr) / BITS_PER_LONG] & (1UL << ((nr) % BITS_PER_LONG))))