Barrelfish
Typedefs | Functions
coreset.h File Reference

Typedefs

typedef errval_t(* coreset_iterator_fn) (void *st, coreid_t id)
 Function pointer used to call on every core in the coreset. More...
 

Functions

errval_t coreset_new (struct coreset **set)
 Initialize a coreset. More...
 
void coreset_destroy (struct coreset *set)
 Destroy a coreset. More...
 
errval_t coreset_add (struct coreset *set, coreid_t id)
 Add a core to the coreset. More...
 
errval_t coreset_remove (struct coreset *set, coreid_t id)
 Remove a core from the coreset. More...
 
bool coreset_test (struct coreset *set, coreid_t id)
 Test if a core is specified in a coreset. More...
 
errval_t coreset_get_next (struct coreset *set, coreset_token_t *token, coreid_t *id)
 Get the next item in the set. More...
 
errval_t coreset_iterate (struct coreset *set, void *st, coreset_iterator_fn func)
 Iterate over all cores in the coreset. More...
 
errval_t coreset_to_coremask (struct coreset *set, coremask_t *mask)
 Covert a coreset to coremask. More...
 
errval_t coreset_from_coremask (coremask_t mask, struct coreset **set)
 Covert a coremask to coreset. More...
 
coreid_t coreset_count (struct coreset *set)
 Count the number of cores in the coreset. More...
 

Typedef Documentation

typedef errval_t(* coreset_iterator_fn) (void *st, coreid_t id)

Function pointer used to call on every core in the coreset.

Parameters
stUser supplied state
idThe core id this is called for

Refer to coreset_iterate.

Function Documentation

errval_t coreset_add ( struct coreset *  set,
coreid_t  id 
)

Add a core to the coreset.

Parameters
setThe coreset in which to add
idThe core to add
coreid_t coreset_count ( struct coreset *  set)

Count the number of cores in the coreset.

Parameters
setThe coreset to count
countReturn the count of cores
void coreset_destroy ( struct coreset *  set)

Destroy a coreset.

Parameters
setThe coreset to destroy. It cannot be used anymore
errval_t coreset_from_coremask ( coremask_t  mask,
struct coreset **  set 
)

Covert a coremask to coreset.

Parameters
maskThe mask to covert
setThe returned set

The returned set is allocated using coreset_new and should be destroyed

errval_t coreset_get_next ( struct coreset *  set,
coreset_token_t *  token,
coreid_t *  id 
)

Get the next item in the set.

Parameters
setThe coreset
tokenToken to maintain internal state
idPointer to return the coreid_t

Iterates over all elements in #set. #CORESET_INIT_TOKEN is used for the #token the first time the function is called. The function updates the token for subsequent calls.

Use this as an alternative to coreset_iterate if you want control over exactly when the next element in the set is retrived.

errval_t coreset_iterate ( struct coreset *  set,
void *  st,
coreset_iterator_fn  func 
)

Iterate over all cores in the coreset.

Parameters
setThe coreset to iterate over
stSome user supplied state
funcThe function pointer to use

This will call #func on every core that exists in the coreset in ascending order. If #func ever returns a non-success errval_t, then this will terminate early and return that errval_t to user.

errval_t coreset_new ( struct coreset **  retset)

Initialize a coreset.

Parameters
setUsed to return the allocated coreset
errval_t coreset_remove ( struct coreset *  set,
coreid_t  id 
)

Remove a core from the coreset.

Parameters
setThe coreset in which to remove
idThe core to remove
bool coreset_test ( struct coreset *  set,
coreid_t  id 
)

Test if a core is specified in a coreset.

Parameters
setThe coreset in which to test
idThe core to test for
errval_t coreset_to_coremask ( struct coreset *  set,
coremask_t *  mask 
)

Covert a coreset to coremask.

Parameters
setThe coreset to convert
maskUse to return the mask