Go to the source code of this file.
Data Structures | |
| struct | ocs_array_t |
| struct | ocs_varray_t |
| Void pointer array structure. More... | |
Macros | |
| #define | DEFAULT_SLAB_LEN (16*1024) |
Functions | |
| void | ocs_array_set_slablen (uint32_t len) |
| Set array slab allocation length. More... | |
| ocs_array_t * | ocs_array_alloc (ocs_os_handle_t os, uint32_t size, uint32_t count) |
| Allocate an array object. More... | |
| void | ocs_array_free (ocs_array_t *array) |
| Free an array object. More... | |
| void * | ocs_array_get (ocs_array_t *array, uint32_t idx) |
| Return reference to an element of an array object. More... | |
| uint32_t | ocs_array_get_count (ocs_array_t *array) |
| Return number of elements in an array. More... | |
| uint32_t | ocs_array_get_size (ocs_array_t *array) |
| Return size of array elements in bytes. More... | |
| ocs_varray_t * | ocs_varray_alloc (ocs_os_handle_t os, uint32_t array_count) |
| Allocate a void pointer array. More... | |
| void | ocs_varray_free (ocs_varray_t *va) |
| Free a void pointer array. More... | |
| int32_t | ocs_varray_add (ocs_varray_t *va, void *entry) |
| Add an entry to a void pointer array. More... | |
| void | ocs_varray_iter_reset (ocs_varray_t *va) |
| Reset the void pointer array iterator. More... | |
| void * | ocs_varray_iter_next (ocs_varray_t *va) |
| Return next entry from a void pointer array. More... | |
| void * | _ocs_varray_iter_next (ocs_varray_t *va) |
| Return next entry from a void pointer array. More... | |
| void | ocs_varray_lock (ocs_varray_t *va) |
| Take void pointer array lock. More... | |
| void | ocs_varray_unlock (ocs_varray_t *va) |
| Release void pointer array lock. More... | |
| uint32_t | ocs_varray_get_count (ocs_varray_t *va) |
| Return entry count for a void pointer array. More... | |
Variables | |
| static uint32_t | slab_len = DEFAULT_SLAB_LEN |
| #define DEFAULT_SLAB_LEN (16*1024) |
Definition at line 41 of file ocs_array.c.
| void* _ocs_varray_iter_next | ( | ocs_varray_t * | va | ) |
Return next entry from a void pointer array.
The next entry in the void pointer array is returned.
| va | Pointer to void point array |
Note: doesn't take the void pointer array lock
Definition at line 357 of file ocs_array.c.
| ocs_array_t* ocs_array_alloc | ( | ocs_os_handle_t | os, |
| uint32_t | size, | ||
| uint32_t | count | ||
| ) |
Allocate an array object.
An array object of size and number of elements is allocated
| os | OS handle |
| size | size of array elements in bytes |
| count | number of elements in array |
Definition at line 87 of file ocs_array.c.
| void ocs_array_free | ( | ocs_array_t * | array | ) |
Free an array object.
Frees a prevously allocated array object
| array | pointer to array object |
Definition at line 139 of file ocs_array.c.
| void* ocs_array_get | ( | ocs_array_t * | array, |
| uint32_t | idx | ||
| ) |
Return reference to an element of an array object.
Return the address of an array element given an index
| array | pointer to array object |
| idx | array element index |
Definition at line 166 of file ocs_array.c.
| uint32_t ocs_array_get_count | ( | ocs_array_t * | array | ) |
Return number of elements in an array.
Return the number of elements in an array
| array | pointer to array object |
Definition at line 188 of file ocs_array.c.
| uint32_t ocs_array_get_size | ( | ocs_array_t * | array | ) |
Return size of array elements in bytes.
Returns the size in bytes of each array element
| array | pointer to array object |
Definition at line 203 of file ocs_array.c.
| void ocs_array_set_slablen | ( | uint32_t | len | ) |
Set array slab allocation length.
The slab length is the maximum allocation length that the array uses. The default 64k slab length may be overridden using this function.
| len | new slab length. |
Definition at line 70 of file ocs_array.c.
| int32_t ocs_varray_add | ( | ocs_varray_t * | va, |
| void * | entry | ||
| ) |
Add an entry to a void pointer array.
An entry is added to the void pointer array
| va | Pointer to void pointer array |
| entry | Pointer to entry to add |
Definition at line 290 of file ocs_array.c.
| ocs_varray_t* ocs_varray_alloc | ( | ocs_os_handle_t | os, |
| uint32_t | array_count | ||
| ) |
Allocate a void pointer array.
A void pointer array of given length is allocated.
| os | OS handle |
| array_count | Array size |
Definition at line 238 of file ocs_array.c.
| void ocs_varray_free | ( | ocs_varray_t * | va | ) |
Free a void pointer array.
The void pointer array object is free'd
| va | Pointer to void pointer array |
Definition at line 268 of file ocs_array.c.
| uint32_t ocs_varray_get_count | ( | ocs_varray_t * | va | ) |
Return entry count for a void pointer array.
The entry count for a void pointer array is returned
| va | Pointer to void pointer array |
Definition at line 408 of file ocs_array.c.
| void* ocs_varray_iter_next | ( | ocs_varray_t * | va | ) |
Return next entry from a void pointer array.
The next entry in the void pointer array is returned.
| va | Pointer to void point array |
Note: takes the void pointer array lock
Definition at line 333 of file ocs_array.c.
| void ocs_varray_iter_reset | ( | ocs_varray_t * | va | ) |
Reset the void pointer array iterator.
The next index value of the void pointer array iterator is cleared.
| va | Pointer to void pointer array |
Definition at line 314 of file ocs_array.c.
| void ocs_varray_lock | ( | ocs_varray_t * | va | ) |
Take void pointer array lock.
Takes the lock for the given void pointer array
| va | Pointer to void pointer array |
Definition at line 378 of file ocs_array.c.
| void ocs_varray_unlock | ( | ocs_varray_t * | va | ) |
Release void pointer array lock.
Releases the lock for the given void pointer array
| va | Pointer to void pointer array |
Definition at line 393 of file ocs_array.c.
|
static |
Definition at line 57 of file ocs_array.c.