Arax -8d09c51940345c86062e8ef2427c705ae66e5926
A Runtime Framework for Decoupling Applications from Heterogeneous Accelerators
Loading...
Searching...
No Matches
list.h File Reference
#include <stddef.h>
#include <stdint.h>
+ Include dependency graph for list.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  utils_list_node
 
struct  utils_list_s
 

Macros

#define utils_list_for_each(list, itr)
 
#define utils_list_for_each_safe(list, itr, tmp)
 
#define utils_list_for_each_reverse(list, itr)
 

Typedefs

typedef struct utils_list_node utils_list_node_s
 

Functions

utils_list_sutils_list_init (void *mem)
 
void utils_list_add (utils_list_s *list, utils_list_node_s *node)
 
utils_list_node_sutils_list_del (utils_list_s *list, utils_list_node_s *node)
 
utils_list_node_sutils_list_pop_head (utils_list_s *list)
 
utils_list_node_sutils_list_pop_tail (utils_list_s *list)
 
size_t utils_list_to_array (utils_list_s *list, void **array)
 
void utils_list_node_init (utils_list_node_s *node, void *owner)
 
int utils_list_node_linked (utils_list_node_s *node)
 

Macro Definition Documentation

◆ utils_list_for_each

#define utils_list_for_each ( list,
itr )
Value:
for (itr = (list).head.next; itr != (void *) &list; itr = itr->next)

Iterate through a utils_list_s nodes.

Parameters
listPointer to a valid utils_list_s instance.
itrA utils_list_node_s* variable.

Definition at line 96 of file list.h.

Referenced by arax_accel_list(), arax_data_ref_offset(), arax_pipe_delete_accel(), arax_pipe_find_accel(), arax_pipe_find_proc(), and utils_list_to_array().

◆ utils_list_for_each_reverse

#define utils_list_for_each_reverse ( list,
itr )
Value:
for (itr = (list).head.prev; itr != (void *) &list; itr = itr->prev)

Iterate through a utils_list_s nodes.

Parameters
listPointer to a valid utils_list_s instance.
itrA utils_list_node_s* variable.

Definition at line 115 of file list.h.

◆ utils_list_for_each_safe

#define utils_list_for_each_safe ( list,
itr,
tmp )
Value:
for (itr = (list).head.next; (itr != (void *) &list) && (tmp = itr->next); itr = tmp)

Iterate through a utils_list_s nodes safely(can call utils_list_del).

Parameters
listPointer to a valid utils_list_s instance.
itrA utils_list_node_s* variable pointing to the current element.
tmpA utils_list_node_s* variable pointing to the next element.

Definition at line 106 of file list.h.

Referenced by async_thread().

Typedef Documentation

◆ utils_list_node_s

Function Documentation

◆ utils_list_add()

void utils_list_add ( utils_list_s * list,
utils_list_node_s * node )

Add node to list as the new head of the list.

Definition at line 20 of file list.c.

References utils_list_s::head, utils_list_s::length, and utils_list_node_add().

Referenced by _add_completion(), arax_accel_add_vaccel(), arax_object_register(), arax_pipe_add_orphan_vaccel(), and async_semaphore_dec().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ utils_list_del()

utils_list_node_s * utils_list_del ( utils_list_s * list,
utils_list_node_s * node )

Delete node from list.

Returns
The deleted node, NULL on failure.

Definition at line 26 of file list.c.

References utils_list_s::length, utils_list_node::next, and utils_list_node::prev.

Referenced by arax_accel_del_vaccel(), arax_object_ref_dec(), arax_object_ref_dec_pre_locked(), arax_pipe_remove_orphan_vaccel(), async_semaphore_inc(), async_thread(), utils_list_pop_head(), and utils_list_pop_tail().

+ Here is the caller graph for this function:

◆ utils_list_init()

utils_list_s * utils_list_init ( void * mem)

Initialize a utils_list_s instance in node.

Parameters
memAn allocated buffer of at least sizeof(utils_list_s) size.
Returns
Equal to mem if successful, NULL on failure.

Definition at line 3 of file list.c.

References utils_list_s::head, utils_list_s::length, and utils_list_node_init().

Referenced by arax_accel_init(), arax_object_repo_init(), arax_pipe_init(), async_meta_init_once(), and async_semaphore_init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ utils_list_node_init()

void utils_list_node_init ( utils_list_node_s * node,
void * owner )

Initialize a utils_list_node_s.

Parameters
nodeThe utils_list_node_s to be initialized.
ownerPointer to the node 'usefull' data

Definition at line 74 of file list.c.

References utils_list_node::next, utils_list_node::owner, and utils_list_node::prev.

Referenced by arax_object_register(), arax_vaccel_init(), async_completion_init(), and utils_list_init().

+ Here is the caller graph for this function:

◆ utils_list_node_linked()

int utils_list_node_linked ( utils_list_node_s * node)

Return if node is part of some list.

Parameters
nodeThe utils_list_node_s to be initialized.
Returns
0 if not is not part of a list, non zero if it is part of a list.

Definition at line 81 of file list.c.

References utils_list_node::next.

Referenced by arax_pipe_remove_orphan_vaccel().

+ Here is the caller graph for this function:

◆ utils_list_pop_head()

utils_list_node_s * utils_list_pop_head ( utils_list_s * list)

Remove first node from list and return to caller.

Note
Not thread safe!
Parameters
listA valid utils_list_s instance.
Returns
The node that was first in list, NULL if list was empty

Definition at line 36 of file list.c.

References utils_list_s::head, utils_list_s::length, utils_list_node::next, and utils_list_del().

Referenced by arax_pipe_get_orphan_vaccel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ utils_list_pop_tail()

utils_list_node_s * utils_list_pop_tail ( utils_list_s * list)

Remove last node from list and return to caller.

Note
Not thread safe!
Parameters
listA valid utils_list_s instance.
Returns
The node that was last in list, NULL if list was empty

Definition at line 47 of file list.c.

References utils_list_s::head, utils_list_s::length, utils_list_node::prev, and utils_list_del().

+ Here is the call graph for this function:

◆ utils_list_to_array()

size_t utils_list_to_array ( utils_list_s * list,
void ** array )

Convert list to array and return number of entries.

If array is NULL just return the number of list node in list. If array is not NULL, fill array with the node->owner values of all nodes.

Parameters
listA valid utils_list_s instance.
arrayAn array of pointers to all node->owner.
Returns
Number of elements in list.

Definition at line 58 of file list.c.

References utils_list_s::length, utils_list_node::owner, and utils_list_for_each.

Referenced by arax_accel_get_assigned_vaccels().

+ Here is the caller graph for this function: