sys_bitarray_alloc

Function sys_bitarray_alloc 

Source
pub unsafe extern "C" fn sys_bitarray_alloc(
    bitarray: *mut sys_bitarray,
    num_bits: usize,
    offset: *mut usize,
) -> i32
Expand description

Allocate bits in a bit array

This finds a number of bits (@p num_bits) in a contiguous of previously unallocated region. If such a region exists, the bits are marked as allocated and the offset to the start of this region is returned via @p offset.

@param[in] bitarray Bitarray struct @param[in] num_bits Number of bits to allocate @param[out] offset Offset to the start of allocated region if successful

@retval 0 Allocation successful @retval -EINVAL Invalid argument (e.g. allocating more bits than the bitarray has, trying to allocate 0 bits, etc.) @retval -ENOSPC No contiguous region big enough to accommodate the allocation