regfi
|
Functions | |
range_list * | range_list_new () |
Allocates a new range_list. | |
void | range_list_free (range_list *rl) |
Frees the memory associated with a range_list, including the elements, but not any data parameters referenced by those elements. | |
uint32_t | range_list_size (const range_list *rl) |
Query the current number of elements on a range_list. | |
bool | range_list_add (range_list *rl, uint32_t offset, uint32_t length, void *data) |
Adds an element to the range_list. | |
bool | range_list_remove (range_list *rl, uint32_t index) |
Removes an element from the list. | |
const range_list_element * | range_list_get (const range_list *rl, uint32_t index) |
Retrieves the element for a given index. | |
int32_t | range_list_find (const range_list *rl, uint32_t offset) |
Attempts to find the unique element whose range encompasses offset. | |
void * | range_list_find_data (const range_list *rl, uint32_t offset) |
Same as range_list_find(), but returns the data associated with an element. | |
bool | range_list_split_element (range_list *rl, uint32_t index, uint32_t offset) |
Splits an existing element into two elements in place. | |
bool | range_list_has_range (range_list *rl, uint32_t start, uint32_t length) |
Determines whether or not a specified range exists contiguously within the range_list. |
range_list* range_list_new | ( | ) |
Allocates a new range_list.
Referenced by regfi_alloc_cb(), and regfi_parse_unalloc_cells().
void range_list_free | ( | range_list * | rl | ) |
Frees the memory associated with a range_list, including the elements, but not any data parameters referenced by those elements.
If rl is NULL, does nothing.
rl | the range_list to be free()d. |
Referenced by regfi_alloc_cb(), regfi_load_big_data(), and regfi_parse_unalloc_cells().
uint32_t range_list_size | ( | const range_list * | rl | ) |
Query the current number of elements on a range_list.
rl | the range_list to query |
Referenced by regfi_get_rootkey(), and regfi_parse_unalloc_cells().
bool range_list_add | ( | range_list * | rl, |
uint32_t | offset, | ||
uint32_t | length, | ||
void * | data | ||
) |
Adds an element to the range_list.
The new element must not overlap with others. NOTE: this is a slow operation.
rl | the range list to update |
offset | the starting point for the range |
length | the length of the range |
data | misc data associated with this range element |
Failures can occur due to memory limitations, max_size limitations, or if the submitted range overlaps with an existing element. Other errors may also be possible.
Referenced by regfi_alloc_cb(), regfi_load_big_data(), and regfi_parse_unalloc_cells().
bool range_list_remove | ( | range_list * | rl, |
uint32_t | index | ||
) |
Removes an element from the list.
The element data structure will be freed, but the data property will not be.
rl | the range_list to modify |
index | the element index to remove |
const range_list_element* range_list_get | ( | const range_list * | rl, |
uint32_t | index | ||
) |
Retrieves the element for a given index.
rl | the range_list being queried. |
index | the element index desired. |
Referenced by regfi_get_rootkey(), regfi_load_big_data(), and regfi_parse_unalloc_cells().
int32_t range_list_find | ( | const range_list * | rl, |
uint32_t | offset | ||
) |
Attempts to find the unique element whose range encompasses offset.
rl | the range_list being queried. |
offset | the location for which an element is desired. |
Referenced by range_list_find_data(), and range_list_has_range().
void* range_list_find_data | ( | const range_list * | rl, |
uint32_t | offset | ||
) |
Same as range_list_find(), but returns the data associated with an element.
rl | the range_list being queried. |
offset | the address to search for in the ranges |
NOTE: May also return NULL if an element matched but the data element was never set.
References range_list_find().
Referenced by regfi_lookup_hbin().
bool range_list_split_element | ( | range_list * | rl, |
uint32_t | index, | ||
uint32_t | offset | ||
) |
Splits an existing element into two elements in place.
The resulting list will contain an additional element whose offset is the one provided and whose length extends to the end of the old element (the one identified by the index). The original element's offset will remain the same while it's length is shortened such that it is contiguous with the newly created element. The newly created element will have an index of one more than the current element.
Both the original element and the newly created element will reference the original element's data.
rl | the range_list to modify |
index | the index of the element to be split |
offset | the at which the element will be split |
bool range_list_has_range | ( | range_list * | rl, |
uint32_t | start, | ||
uint32_t | length | ||
) |
Determines whether or not a specified range exists contiguously within the range_list.
rl | the range_list to search |
start | the offset at the beginning of the range |
length | the length of the range |
References range_list_find().