Barrelfish
Functions
numa_bitmap.c File Reference

Bitmap manipulation. More...

Functions

struct bitmap * numa_parse_nodestring (char *string)
 parses a character string list of nodes into a bit mask. More...
 
struct bitmap * numa_parse_cpustring (char *string)
 parses a character string list of cpus into a bit mask. More...
 
struct bitmap * numa_allocate_cpumask (void)
 allocating a bitmap to hold all the configured CPUs More...
 
void numa_free_cpumask (struct bitmap *cpumask)
 frees a previously allocated CPU bitmask More...
 
struct bitmap * numa_allocate_nodemask (void)
 allocates a bit mask to represent the nodes in the system More...
 
void numa_free_nodemask (struct bitmap *nodemask)
 frees a previously allocated node bitmask More...
 
struct bitmap * numa_bitmask_alloc (unsigned int n)
 allocates a bitmask structure and its associated bit mask More...
 
struct bitmap * numa_bitmask_clearall (struct bitmap *bmp)
 sets all bits in the bit mask to 0. More...
 
struct bitmap * numa_bitmask_clearbit (struct bitmap *bmp, unsigned int n)
 clears the n-th bit of a bitmask More...
 
bool numa_bitmask_equal (const struct bitmap *bmp1, const struct bitmap *bmp2)
 checks if two bitmasks are equal More...
 
void numa_bitmask_free (struct bitmap *bmp)
 frees the memory of a bitmask More...
 
bool numa_bitmask_isbitset (const struct bitmap *bmp, unsigned int n)
 checks if the n-th bit is set in the bitmask More...
 
size_t numa_bitmask_nbytes (struct bitmap *bmp)
 returns the size (in bytes) of the bit mask More...
 
struct bitmap * numa_bitmask_setall (struct bitmap *bmp)
 sets all bits of a bitmask to 1 More...
 
struct bitmap * numa_bitmask_setbit (struct bitmap *bmp, unsigned int n)
 sets the n-th bit of a bitmask to 1 More...
 
void copy_bitmask_to_nodemask (struct bitmap *bmp, nodemask_t *nodemask)
 copies the bitmask to a nodemask More...
 
void copy_nodemask_to_bitmask (nodemask_t *nodemask, struct bitmap *bmp)
 copies the contents of a nodemask into the bitmask More...
 
void copy_bitmask_to_bitmask (struct bitmap *bmpfrom, struct bitmap *bmpto)
 copies one bitmask into another More...
 
uint32_t numa_bitmask_weight (const struct bitmap *bmp)
 returns a count of the bits that are set in the body of the bitmask More...
 

Detailed Description

Bitmap manipulation.

Function Documentation

void copy_bitmask_to_bitmask ( struct bitmap *  bmpfrom,
struct bitmap *  bmpto 
)

copies one bitmask into another

Parameters
bmpfromthe source bitmask
bmptothe destination bitmask

If the two areas differ in size, the copy is truncated to the size of the receiving field or zero-filled.

void copy_bitmask_to_nodemask ( struct bitmap *  bmp,
nodemask_t *  nodemask 
)

copies the bitmask to a nodemask

Parameters
bmpthe bitmask to copy
nodemaskthe destination nodemask

If the two areas differ in size, the copy is truncated to the size of the receiving field or zero-filled.

void copy_nodemask_to_bitmask ( nodemask_t *  nodemask,
struct bitmap *  bmp 
)

copies the contents of a nodemask into the bitmask

Parameters
nodemasknode mask to copy from
bmpbitmap to copy into

If the two areas differ in size, the copy is truncated to the size of the receiving field or zero-filled.

struct bitmap* numa_allocate_cpumask ( void  )

allocating a bitmap to hold all the configured CPUs

allocates a bit mask to represent the cores in the system

Returns
struct bitmap* numa_allocate_nodemask ( void  )

allocates a bit mask to represent the nodes in the system

Returns
pointer to a new bitmask NULL on failure
struct bitmap* numa_bitmask_alloc ( unsigned int  n)

allocates a bitmask structure and its associated bit mask

Parameters
nthe number of bits
Returns
pointer to the bitmask NULL on error
struct bitmap* numa_bitmask_clearall ( struct bitmap *  bmp)

sets all bits in the bit mask to 0.

Parameters
bmppointer to the bitmap
Returns
pointer to the cleared bit map
struct bitmap* numa_bitmask_clearbit ( struct bitmap *  bmp,
unsigned int  n 
)

clears the n-th bit of a bitmask

Parameters
bmpthe bitmask
nthe bit to clear
Returns
pointer to the bitmask
bool numa_bitmask_equal ( const struct bitmap *  bmp1,
const struct bitmap *  bmp2 
)

checks if two bitmasks are equal

Parameters
bmp1bitmask 1
bmp2bitmask 2
Returns
TRUE if the bitmasks are equal FALSE if the are distinct
void numa_bitmask_free ( struct bitmap *  bmp)

frees the memory of a bitmask

Parameters
bmpthe bitmask to be freed
bool numa_bitmask_isbitset ( const struct bitmap *  bmp,
unsigned int  n 
)

checks if the n-th bit is set in the bitmask

Parameters
bmpthe bitmap
nwhich bit to check
Returns
TRUE if the n-th bit is set FALSE otherwise
size_t numa_bitmask_nbytes ( struct bitmap *  bmp)

returns the size (in bytes) of the bit mask

Parameters
bmpthe bitmask
Returns
the size of the memory in bytes rounded up to a multiple of wordsize
struct bitmap* numa_bitmask_setall ( struct bitmap *  bmp)

sets all bits of a bitmask to 1

Parameters
bmpthe bitmask
Returns
the bitmask
struct bitmap* numa_bitmask_setbit ( struct bitmap *  bmp,
unsigned int  n 
)

sets the n-th bit of a bitmask to 1

Parameters
bmpthe bitmask
nwhich bit to activate
Returns
the bitmask
uint32_t numa_bitmask_weight ( const struct bitmap *  bmp)

returns a count of the bits that are set in the body of the bitmask

Parameters
bmpthe bitmask to count the set bits
Returns
number of set bits in this bitmask
void numa_free_cpumask ( struct bitmap *  cpumask)

frees a previously allocated CPU bitmask

Parameters
cpumaskpointer to a previously allocated CPU bitmask
void numa_free_nodemask ( struct bitmap *  nodemask)

frees a previously allocated node bitmask

Parameters
nodemaskpointer to a previously allocated node bitmask
struct bitmap* numa_parse_cpustring ( char *  string)

parses a character string list of cpus into a bit mask.

Parameters
stringcharacter string to parse
Returns
NUMA bitmask on SUCCESS NULL if the string is invalid

The string is a comma-separated list of cpu numbers or cpu ranges Examples: 1-5,7,10 !4-5 +0-3

struct bitmap* numa_parse_nodestring ( char *  string)

parses a character string list of nodes into a bit mask.

Parameters
stringcharacter string to parse
Returns
NUMA bitmask on SUCCESS NULL if the string is invalid

The string is a comma-separated list of node numbers or node ranges Examples: 1-5,7,10 !4-5 +0-3

If the string length is zero, then the numa_no_nodes_ptr is returned