Asterisk - The Open Source Telephony Project
18.5.0
|
A set of macros to manage doubly-linked lists. More...
#include "asterisk/lock.h"
Go to the source code of this file.
Macros | |
#define | AST_DLLIST_APPEND_DLLIST(head, list, field) |
Appends a whole list to the tail of a list. More... | |
#define | AST_DLLIST_EMPTY(head) (AST_DLLIST_FIRST(head) == NULL) |
Checks whether the specified list contains any entries. More... | |
#define | AST_DLLIST_ENTRY(type) AST_DLLIST_HEAD_NOLOCK(, type) |
Declare previous/forward links inside a list entry. More... | |
#define | AST_DLLIST_FIRST(head) ((head)->first) |
Returns the first entry contained in a list. More... | |
#define | AST_DLLIST_HEAD(name, type) |
Defines a structure to be used to hold a list of specified type. More... | |
#define | AST_DLLIST_HEAD_DESTROY(head) |
Destroys a list head structure. More... | |
#define | AST_DLLIST_HEAD_INIT(head) |
Initializes a list head structure. More... | |
#define | AST_DLLIST_HEAD_INIT_NOLOCK(head) |
Initializes a list head structure. More... | |
#define | AST_DLLIST_HEAD_INIT_VALUE |
Defines initial values for a declaration of AST_DLLIST_HEAD. More... | |
#define | AST_DLLIST_HEAD_NOLOCK(name, type) |
Defines a structure to be used to hold a list of specified type (with no lock). More... | |
#define | AST_DLLIST_HEAD_NOLOCK_INIT_VALUE |
Defines initial values for a declaration of AST_DLLIST_HEAD_NOLOCK. More... | |
#define | AST_DLLIST_HEAD_NOLOCK_STATIC(name, type) |
Defines a structure to be used to hold a list of specified type, statically initialized. More... | |
#define | AST_DLLIST_HEAD_SET(head, entry) |
Initializes a list head structure with a specified first entry. More... | |
#define | AST_DLLIST_HEAD_SET_NOLOCK(head, entry) |
Initializes a list head structure with a specified first entry. More... | |
#define | AST_DLLIST_HEAD_STATIC(name, type) |
Defines a structure to be used to hold a list of specified type, statically initialized. More... | |
#define | AST_DLLIST_INSERT_AFTER(head, listelm, elm, field) |
Inserts a list entry after a given entry. More... | |
#define | AST_DLLIST_INSERT_AFTER_CURRENT(elm, field) |
Inserts a list node after the current node during a traversal. More... | |
#define | AST_DLLIST_INSERT_BEFORE(head, listelm, elm, field) |
Inserts a list entry before a given entry. More... | |
#define | AST_DLLIST_INSERT_BEFORE_CURRENT(elm, field) |
Inserts a list node before the current node during a traversal. More... | |
#define | AST_DLLIST_INSERT_BEFORE_CURRENT_BACKWARDS(elm, field) AST_DLLIST_INSERT_AFTER_CURRENT(elm, field) |
Inserts a list entry after the current entry during a backwards traversal. Since this is a backwards traversal, this will insert the entry AFTER the current element. Since this is a backwards traveral, though, this would be BEFORE the current entry in traversal order. Confusing? More... | |
#define | AST_DLLIST_INSERT_HEAD(head, elm, field) |
Inserts a list entry at the head of a list. More... | |
#define | AST_DLLIST_INSERT_TAIL(head, elm, field) |
Appends a list entry to the tail of a list. More... | |
#define | AST_DLLIST_IS_MEMBER(head, elm, field) |
Checks whether the specified list contains the element. More... | |
#define | AST_DLLIST_LAST(head) ((head)->last) |
Returns the last entry contained in a list. More... | |
#define | AST_DLLIST_LOCK(head) ast_mutex_lock(&(head)->lock) |
Locks a list. More... | |
#define | AST_DLLIST_MOVE_CURRENT(newhead, field) |
Move the current list entry to another list at the tail. More... | |
#define | AST_DLLIST_MOVE_CURRENT_BACKWARDS(newhead, field) |
Move the current list entry to another list at the head. More... | |
#define | AST_DLLIST_NEXT(elm, field) AST_DLLIST_NEXT_DIRECTION(elm, field, first) |
Returns the next entry in the list after the given entry. More... | |
#define | AST_DLLIST_NEXT_DIRECTION(elm, field, direction) ((elm)->field.direction) |
#define | AST_DLLIST_PREV(elm, field) AST_DLLIST_NEXT_DIRECTION(elm, field, last) |
Returns the previous entry in the list before the given entry. More... | |
#define | AST_DLLIST_REMOVE(head, elm, field) |
Removes a specific entry from a list. More... | |
#define | AST_DLLIST_REMOVE_CURRENT(field) |
Removes the current entry from a list during a traversal. More... | |
#define | AST_DLLIST_REMOVE_HEAD(head, field) |
Removes and returns the head entry from a list. More... | |
#define | AST_DLLIST_REMOVE_TAIL(head, field) |
Removes and returns the tail node from a list. More... | |
#define | AST_DLLIST_REMOVE_VERIFY(head, elm, field) |
Removes a specific node from a list if it is in the list. More... | |
#define | AST_DLLIST_TRAVERSE(head, var, field) AST_DLLIST_TRAVERSE_DIRECTION(head, var, field, first) |
Loops over (traverses) the entries in a list. More... | |
#define | AST_DLLIST_TRAVERSE_BACKWARDS(head, var, field) AST_DLLIST_TRAVERSE_DIRECTION(head, var, field, last) |
Loops over (traverses) the entries in a list in reverse order, starting at the end. More... | |
#define | AST_DLLIST_TRAVERSE_BACKWARDS_SAFE_BEGIN(head, var, field) AST_DLLIST_TRAVERSE_DIRECTION_SAFE_BEGIN(head, var, field, last) |
Loops safely over (traverses) the entries in a list. More... | |
#define | AST_DLLIST_TRAVERSE_BACKWARDS_SAFE_END AST_DLLIST_TRAVERSE_DIRECTION_SAFE_END |
Closes a safe loop traversal block. More... | |
#define | AST_DLLIST_TRAVERSE_DIRECTION(head, var, field, start) for ((var) = (head)->start; (var); (var) = AST_DLLIST_NEXT_DIRECTION(var, field, start)) |
Traverse a doublly linked list using the specified direction list. More... | |
#define | AST_DLLIST_TRAVERSE_DIRECTION_SAFE_BEGIN(head, var, field, start) |
Safe traversal of a doublly linked list using the specified direction list. More... | |
#define | AST_DLLIST_TRAVERSE_DIRECTION_SAFE_END } while (0) |
#define | AST_DLLIST_TRAVERSE_SAFE_BEGIN(head, var, field) AST_DLLIST_TRAVERSE_DIRECTION_SAFE_BEGIN(head, var, field, first) |
Loops safely over (traverses) the entries in a list. More... | |
#define | AST_DLLIST_TRAVERSE_SAFE_END AST_DLLIST_TRAVERSE_DIRECTION_SAFE_END |
Closes a safe loop traversal block. More... | |
#define | AST_DLLIST_TRYLOCK(head) ast_mutex_trylock(&(head)->lock) |
Locks a list, without blocking if the list is locked. More... | |
#define | AST_DLLIST_UNLOCK(head) ast_mutex_unlock(&(head)->lock) |
Attempts to unlock a list. More... | |
#define | AST_RWDLLIST_APPEND_DLLIST AST_DLLIST_APPEND_DLLIST |
#define | AST_RWDLLIST_EMPTY AST_DLLIST_EMPTY |
#define | AST_RWDLLIST_ENTRY AST_DLLIST_ENTRY |
#define | AST_RWDLLIST_FIRST AST_DLLIST_FIRST |
#define | AST_RWDLLIST_HEAD(name, type) |
Defines a structure to be used to hold a read/write list of specified type. More... | |
#define | AST_RWDLLIST_HEAD_DESTROY(head) |
Destroys an rwlist head structure. More... | |
#define | AST_RWDLLIST_HEAD_INIT(head) |
Initializes an rwlist head structure. More... | |
#define | AST_RWDLLIST_HEAD_INIT_VALUE |
Defines initial values for a declaration of AST_RWDLLIST_HEAD. More... | |
#define | AST_RWDLLIST_HEAD_SET(head, entry) |
Initializes an rwlist head structure with a specified first entry. More... | |
#define | AST_RWDLLIST_HEAD_STATIC(name, type) |
Defines a structure to be used to hold a read/write list of specified type, statically initialized. More... | |
#define | AST_RWDLLIST_INSERT_AFTER AST_DLLIST_INSERT_AFTER |
#define | AST_RWDLLIST_INSERT_AFTER_CURRENT AST_DLLIST_INSERT_AFTER_CURRENT |
#define | AST_RWDLLIST_INSERT_BEFORE AST_DLLIST_INSERT_BEFORE |
#define | AST_RWDLLIST_INSERT_BEFORE_CURRENT AST_DLLIST_INSERT_BEFORE_CURRENT |
#define | AST_RWDLLIST_INSERT_BEFORE_CURRENT_BACKWARDS AST_DLLIST_INSERT_BEFORE_CURRENT_BACKWARDS |
#define | AST_RWDLLIST_INSERT_HEAD AST_DLLIST_INSERT_HEAD |
#define | AST_RWDLLIST_INSERT_TAIL AST_DLLIST_INSERT_TAIL |
#define | AST_RWDLLIST_IS_MEMBER AST_DLLIST_IS_MEMBER |
#define | AST_RWDLLIST_LAST AST_DLLIST_LAST |
#define | AST_RWDLLIST_MOVE_CURRENT AST_DLLIST_MOVE_CURRENT |
#define | AST_RWDLLIST_MOVE_CURRENT_BACKWARDS AST_DLLIST_MOVE_CURRENT_BACKWARDS |
#define | AST_RWDLLIST_NEXT AST_DLLIST_NEXT |
#define | AST_RWDLLIST_NEXT_DIRECTION AST_DLLIST_NEXT_DIRECTION |
#define | AST_RWDLLIST_PREV AST_DLLIST_PREV |
#define | AST_RWDLLIST_RDLOCK(head) ast_rwlock_rdlock(&(head)->lock) |
Read locks a list. More... | |
#define | AST_RWDLLIST_REMOVE AST_DLLIST_REMOVE |
#define | AST_RWDLLIST_REMOVE_CURRENT AST_DLLIST_REMOVE_CURRENT |
#define | AST_RWDLLIST_REMOVE_HEAD AST_DLLIST_REMOVE_HEAD |
#define | AST_RWDLLIST_REMOVE_TAIL AST_DLLIST_REMOVE_TAIL |
#define | AST_RWDLLIST_REMOVE_VERIFY AST_DLLIST_REMOVE_VERIFY |
#define | AST_RWDLLIST_TRAVERSE AST_DLLIST_TRAVERSE |
#define | AST_RWDLLIST_TRAVERSE_BACKWARDS AST_DLLIST_TRAVERSE_BACKWARDS |
#define | AST_RWDLLIST_TRAVERSE_BACKWARDS_SAFE_BEGIN AST_DLLIST_TRAVERSE_BACKWARDS_SAFE_BEGIN |
#define | AST_RWDLLIST_TRAVERSE_BACKWARDS_SAFE_END AST_DLLIST_TRAVERSE_BACKWARDS_SAFE_END |
#define | AST_RWDLLIST_TRAVERSE_DIRECTION AST_DLLIST_TRAVERSE_DIRECTION |
#define | AST_RWDLLIST_TRAVERSE_DIRECTION_SAFE_BEGIN AST_DLLIST_TRAVERSE_DIRECTION_SAFE_BEGIN |
#define | AST_RWDLLIST_TRAVERSE_DIRECTION_SAFE_END AST_DLLIST_TRAVERSE_DIRECTION_SAFE_END |
#define | AST_RWDLLIST_TRAVERSE_SAFE_BEGIN AST_DLLIST_TRAVERSE_SAFE_BEGIN |
#define | AST_RWDLLIST_TRAVERSE_SAFE_END AST_DLLIST_TRAVERSE_SAFE_END |
#define | AST_RWDLLIST_TRYRDLOCK(head) ast_rwlock_tryrdlock(&(head)->lock) |
Read locks a list, without blocking if the list is locked. More... | |
#define | AST_RWDLLIST_TRYWRLOCK(head) ast_rwlock_trywrlock(&(head)->lock) |
Write locks a list, without blocking if the list is locked. More... | |
#define | AST_RWDLLIST_UNLOCK(head) ast_rwlock_unlock(&(head)->lock) |
Attempts to unlock a read/write based list. More... | |
#define | AST_RWDLLIST_WRLOCK(head) ast_rwlock_wrlock(&(head)->lock) |
Write locks a list. More... | |
A set of macros to manage doubly-linked lists.
Definition in file dlinkedlists.h.
#define AST_DLLIST_APPEND_DLLIST | ( | head, | |
list, | |||
field | |||
) |
Appends a whole list to the tail of a list.
head | This is a pointer to the list head structure |
list | This is a pointer to the list to be appended. |
field | This is the name of the field (declared using AST_DLLIST_ENTRY()) used to link entries of this list together. |
Note: The source list (the list parameter) will be empty after calling this macro (the list entries are moved to the target list).
Definition at line 1115 of file dlinkedlists.h.
Referenced by AST_TEST_DEFINE().
#define AST_DLLIST_EMPTY | ( | head | ) | (AST_DLLIST_FIRST(head) == NULL) |
Checks whether the specified list contains any entries.
head | This is a pointer to the list head structure |
Definition at line 468 of file dlinkedlists.h.
Referenced by AST_TEST_DEFINE(), dll_tests(), hash_ao2_destroy(), and modules_shutdown().
#define AST_DLLIST_ENTRY | ( | type | ) | AST_DLLIST_HEAD_NOLOCK(, type) |
Declare previous/forward links inside a list entry.
type | This is the type of each list entry. |
This macro declares a structure to be used to doubly link list entries together. It must be used inside the definition of the structure named in type, as follows:
The field name list here is arbitrary, and can be anything you wish.
Definition at line 412 of file dlinkedlists.h.
#define AST_DLLIST_FIRST | ( | head | ) | ((head)->first) |
Returns the first entry contained in a list.
head | This is a pointer to the list head structure |
Definition at line 421 of file dlinkedlists.h.
Referenced by AST_TEST_DEFINE(), dll_tests(), hash_ao2_destroy(), hash_ao2_find_first(), hash_ao2_find_next(), hash_ao2_iterator_next(), and print_list_backwards().
Defines a structure to be used to hold a list of specified type.
name | This will be the name of the defined structure. |
type | This is the type of each list entry. |
This macro creates a structure definition that can be used to hold a list of the entries of type type. It does not actually declare (allocate) a structure; to do that, either follow this macro with the desired name of the instance you wish to declare, or use the specified name to declare instances elsewhere.
Example usage:
This would define struct
entry_list
, and declare an instance of it named entries, all intended to hold a list of type struct
entry
.
Definition at line 157 of file dlinkedlists.h.
#define AST_DLLIST_HEAD_DESTROY | ( | head | ) |
Destroys a list head structure.
head | This is a pointer to the list head structure |
This macro destroys a list head structure by setting the head entry to NULL (empty list) and destroying the embedded lock. It does not free the structure from memory.
Definition at line 963 of file dlinkedlists.h.
#define AST_DLLIST_HEAD_INIT | ( | head | ) |
Initializes a list head structure.
head | This is a pointer to the list head structure |
This macro initializes a list head structure by setting the head entry to NULL (empty list) and recreating the embedded lock.
Definition at line 932 of file dlinkedlists.h.
#define AST_DLLIST_HEAD_INIT_NOLOCK | ( | head | ) |
Initializes a list head structure.
head | This is a pointer to the list head structure |
This macro initializes a list head structure by setting the head entry to NULL (empty list). There is no embedded lock handling with this macro.
Definition at line 995 of file dlinkedlists.h.
#define AST_DLLIST_HEAD_INIT_VALUE |
Defines initial values for a declaration of AST_DLLIST_HEAD.
Definition at line 221 of file dlinkedlists.h.
Defines a structure to be used to hold a list of specified type (with no lock).
name | This will be the name of the defined structure. |
type | This is the type of each list entry. |
This macro creates a structure definition that can be used to hold a list of the entries of type type. It does not actually declare (allocate) a structure; to do that, either follow this macro with the desired name of the instance you wish to declare, or use the specified name to declare instances elsewhere.
Example usage:
This would define struct
entry_list
, and declare an instance of it named entries, all intended to hold a list of type struct
entry
.
Definition at line 211 of file dlinkedlists.h.
#define AST_DLLIST_HEAD_NOLOCK_INIT_VALUE |
Defines initial values for a declaration of AST_DLLIST_HEAD_NOLOCK.
Definition at line 243 of file dlinkedlists.h.
Defines a structure to be used to hold a list of specified type, statically initialized.
This is the same as AST_DLLIST_HEAD_STATIC, except without the lock included.
Definition at line 341 of file dlinkedlists.h.
#define AST_DLLIST_HEAD_SET | ( | head, | |
entry | |||
) |
Initializes a list head structure with a specified first entry.
head | This is a pointer to the list head structure |
entry | pointer to the list entry that will become the head of the list |
This macro initializes a list head structure by setting the head entry to the supplied value and recreating the embedded lock.
Definition at line 356 of file dlinkedlists.h.
#define AST_DLLIST_HEAD_SET_NOLOCK | ( | head, | |
entry | |||
) |
Initializes a list head structure with a specified first entry.
head | This is a pointer to the list head structure |
entry | pointer to the list entry that will become the head of the list |
This macro initializes a list head structure by setting the head entry to the supplied value.
Definition at line 388 of file dlinkedlists.h.
Defines a structure to be used to hold a list of specified type, statically initialized.
name | This will be the name of the defined structure. |
type | This is the type of each list entry. |
This macro creates a structure definition that can be used to hold a list of the entries of type type, and allocates an instance of it, initialized to be empty.
Example usage:
This would define struct
entry_list
, intended to hold a list of type struct
entry
.
Definition at line 284 of file dlinkedlists.h.
#define AST_DLLIST_INSERT_AFTER | ( | head, | |
listelm, | |||
elm, | |||
field | |||
) |
Inserts a list entry after a given entry.
head | This is a pointer to the list head structure |
listelm | This is a pointer to the entry after which the new entry should be inserted. |
elm | This is a pointer to the entry to be inserted. |
field | This is the name of the field (declared using AST_DLLIST_ENTRY()) used to link entries of this list together. |
Definition at line 1011 of file dlinkedlists.h.
Referenced by AST_TEST_DEFINE(), and dll_tests().
#define AST_DLLIST_INSERT_AFTER_CURRENT | ( | elm, | |
field | |||
) |
Inserts a list node after the current node during a traversal.
elm | This is a pointer to the node to be inserted. |
field | This is the name of the field (declared using AST_DLLIST_ENTRY()) used to link nodes of this list together. |
Definition at line 722 of file dlinkedlists.h.
Referenced by AST_TEST_DEFINE(), and hash_ao2_insert_node().
#define AST_DLLIST_INSERT_BEFORE | ( | head, | |
listelm, | |||
elm, | |||
field | |||
) |
Inserts a list entry before a given entry.
head | This is a pointer to the list head structure |
listelm | This is a pointer to the entry before which the new entry should be inserted. |
elm | This is a pointer to the entry to be inserted. |
field | This is the name of the field (declared using AST_DLLIST_ENTRY()) used to link entries of this list together. |
Definition at line 1037 of file dlinkedlists.h.
Referenced by AST_TEST_DEFINE().
#define AST_DLLIST_INSERT_BEFORE_CURRENT | ( | elm, | |
field | |||
) |
Inserts a list node before the current node during a traversal.
elm | This is a pointer to the entry to be inserted. |
field | This is the name of the field (declared using AST_DLLIST_ENTRY()) used to link nodes of this list together. |
Definition at line 695 of file dlinkedlists.h.
Referenced by AST_TEST_DEFINE(), dll_tests(), and hash_ao2_insert_node().
#define AST_DLLIST_INSERT_BEFORE_CURRENT_BACKWARDS | ( | elm, | |
field | |||
) | AST_DLLIST_INSERT_AFTER_CURRENT(elm, field) |
Inserts a list entry after the current entry during a backwards traversal. Since this is a backwards traversal, this will insert the entry AFTER the current element. Since this is a backwards traveral, though, this would be BEFORE the current entry in traversal order. Confusing?
elm | This is a pointer to the entry to be inserted. |
field | This is the name of the field (declared using AST_DLLIST_ENTRY()) used to link entries of this list together. |
Definition at line 903 of file dlinkedlists.h.
Referenced by dll_tests().
#define AST_DLLIST_INSERT_HEAD | ( | head, | |
elm, | |||
field | |||
) |
Inserts a list entry at the head of a list.
head | This is a pointer to the list head structure |
elm | This is a pointer to the entry to be inserted. |
field | This is the name of the field (declared using AST_DLLIST_ENTRY()) used to link entries of this list together. |
Definition at line 1061 of file dlinkedlists.h.
Referenced by AST_TEST_DEFINE(), dll_tests(), and hash_ao2_insert_node().
#define AST_DLLIST_INSERT_TAIL | ( | head, | |
elm, | |||
field | |||
) |
Appends a list entry to the tail of a list.
head | This is a pointer to the list head structure |
elm | This is a pointer to the entry to be appended. |
field | This is the name of the field (declared using AST_DLLIST_ENTRY()) used to link entries of this list together. |
Note: The link field in the appended entry is not modified, so if it is actually the head of a list itself, the entire list will be appended temporarily (until the next AST_DLLIST_INSERT_TAIL is performed).
Definition at line 1088 of file dlinkedlists.h.
Referenced by ast_module_register(), AST_TEST_DEFINE(), dll_tests(), hash_ao2_insert_node(), and start_resource().
#define AST_DLLIST_IS_MEMBER | ( | head, | |
elm, | |||
field | |||
) |
Checks whether the specified list contains the element.
head | This is a pointer to the list head structure |
elm | This is a pointer to the list element to see if in list. |
field | List node field for the next node information. |
Definition at line 482 of file dlinkedlists.h.
#define AST_DLLIST_LAST | ( | head | ) | ((head)->last) |
Returns the last entry contained in a list.
head | This is a pointer to the list head structure |
Definition at line 430 of file dlinkedlists.h.
Referenced by AST_TEST_DEFINE(), dll_tests(), hash_ao2_destroy(), hash_ao2_find_first(), hash_ao2_find_next(), hash_ao2_iterator_next(), and print_list().
#define AST_DLLIST_LOCK | ( | head | ) | ast_mutex_lock(&(head)->lock) |
Locks a list.
head | This is a pointer to the list head structure |
This macro attempts to place an exclusive lock in the list head structure pointed to by head.
0 | on success |
non-zero | on failure |
Definition at line 45 of file dlinkedlists.h.
Referenced by ast_load_resource(), ast_module_helper(), ast_module_register(), ast_module_reload(), ast_module_unregister(), ast_unload_resource(), ast_update_module_list(), ast_update_module_list_condition(), ast_update_module_list_data(), find_resource(), load_modules(), module_load_helper(), modules_shutdown(), and start_resource().
#define AST_DLLIST_MOVE_CURRENT | ( | newhead, | |
field | |||
) |
Move the current list entry to another list at the tail.
AST_DLLIST_REMOVE_CURRENT(field); AST_DLLIST_INSERT_TAIL(newhead, var, other_field);
Definition at line 781 of file dlinkedlists.h.
Referenced by dll_tests().
#define AST_DLLIST_MOVE_CURRENT_BACKWARDS | ( | newhead, | |
field | |||
) |
Move the current list entry to another list at the head.
AST_DLLIST_REMOVE_CURRENT(field); AST_DLLIST_INSERT_HEAD(newhead, var, other_field);
Definition at line 800 of file dlinkedlists.h.
Referenced by dll_tests().
#define AST_DLLIST_NEXT | ( | elm, | |
field | |||
) | AST_DLLIST_NEXT_DIRECTION(elm, field, first) |
Returns the next entry in the list after the given entry.
elm | This is a pointer to the current entry. |
field | This is the name of the field (declared using AST_DLLIST_ENTRY()) used to link entries of this list together. |
Definition at line 445 of file dlinkedlists.h.
Referenced by AST_TEST_DEFINE(), dll_tests(), hash_ao2_destroy(), hash_ao2_find_first(), hash_ao2_find_next(), and hash_ao2_iterator_next().
#define AST_DLLIST_NEXT_DIRECTION | ( | elm, | |
field, | |||
direction | |||
) | ((elm)->field.direction) |
Definition at line 434 of file dlinkedlists.h.
#define AST_DLLIST_PREV | ( | elm, | |
field | |||
) | AST_DLLIST_NEXT_DIRECTION(elm, field, last) |
Returns the previous entry in the list before the given entry.
elm | This is a pointer to the current entry. |
field | This is the name of the field (declared using AST_DLLIST_ENTRY()) used to link entries of this list together. |
Definition at line 456 of file dlinkedlists.h.
Referenced by AST_TEST_DEFINE(), dll_tests(), hash_ao2_destroy(), hash_ao2_find_first(), hash_ao2_find_next(), and hash_ao2_iterator_next().
#define AST_DLLIST_REMOVE | ( | head, | |
elm, | |||
field | |||
) |
Removes a specific entry from a list.
head | This is a pointer to the list head structure |
elm | This is a pointer to the entry to be removed. |
field | This is the name of the field (declared using AST_DLLIST_ENTRY()) used to link entries of this list together. |
Definition at line 1198 of file dlinkedlists.h.
Referenced by AST_TEST_DEFINE(), dll_tests(), hash_ao2_node_destructor(), and start_resource().
#define AST_DLLIST_REMOVE_CURRENT | ( | field | ) |
Removes the current entry from a list during a traversal.
field | This is the name of the field (declared using AST_DLLIST_ENTRY()) used to link entries of this list together. |
Definition at line 752 of file dlinkedlists.h.
Referenced by ast_module_unregister(), AST_TEST_DEFINE(), destroy_test_container(), dll_tests(), and modules_shutdown().
#define AST_DLLIST_REMOVE_HEAD | ( | head, | |
field | |||
) |
Removes and returns the head entry from a list.
head | This is a pointer to the list head structure |
field | This is the name of the field (declared using AST_DLLIST_ENTRY()) used to link entries of this list together. |
Removes the head entry from the list, and returns a pointer to it. This macro is safe to call on an empty list.
Definition at line 1141 of file dlinkedlists.h.
Referenced by AST_TEST_DEFINE(), dll_tests(), and loader_builtin_init().
#define AST_DLLIST_REMOVE_TAIL | ( | head, | |
field | |||
) |
Removes and returns the tail node from a list.
head | This is a pointer to the list head structure |
field | This is the name of the field (declared using AST_DLLIST_ENTRY()) used to link nodes of this list together. |
Removes the tail entry from the list, and returns a pointer to it. This macro is safe to call on an empty list.
Definition at line 1170 of file dlinkedlists.h.
Referenced by AST_TEST_DEFINE().
#define AST_DLLIST_REMOVE_VERIFY | ( | head, | |
elm, | |||
field | |||
) |
Removes a specific node from a list if it is in the list.
head | This is a pointer to the list head structure |
elm | This is a pointer to the node to be removed. |
field | This is the name of the field (declared using AST_DLLIST_ENTRY()) used to link nodes of this list together. |
Definition at line 1230 of file dlinkedlists.h.
Referenced by AST_TEST_DEFINE().
#define AST_DLLIST_TRAVERSE | ( | head, | |
var, | |||
field | |||
) | AST_DLLIST_TRAVERSE_DIRECTION(head, var, field, first) |
Loops over (traverses) the entries in a list.
head | This is a pointer to the list head structure |
var | This is the name of the variable that will hold a pointer to the current list entry on each iteration. It must be declared before calling this macro. |
field | This is the name of the field (declared using AST_DLLIST_ENTRY()) used to link entries of this list together. |
This macro is use to loop over (traverse) the entries in a list. It uses a for loop, and supplies the enclosed code with a pointer to each list entry as it loops. It is typically used as follows:
Definition at line 575 of file dlinkedlists.h.
Referenced by alpha_module_list_create(), ast_module_helper(), ast_module_reload(), dbl_list_expect_forward(), find_resource(), load_modules(), loader_builtin_init(), module_reffed_deps_add_dep_enhancers(), modules_shutdown(), and print_list().
#define AST_DLLIST_TRAVERSE_BACKWARDS | ( | head, | |
var, | |||
field | |||
) | AST_DLLIST_TRAVERSE_DIRECTION(head, var, field, last) |
Loops over (traverses) the entries in a list in reverse order, starting at the end.
head | This is a pointer to the list head structure |
var | This is the name of the variable that will hold a pointer to the current list entry on each iteration. It must be declared before calling this macro. |
field | This is the name of the field (declared using AST_DLLIST_ENTRY()) used to link entries of this list together. |
This macro is use to loop over (traverse) the entries in a list in reverse order. It uses a for loop, and supplies the enclosed code with a pointer to each list entry as it loops. It is typically used as follows:
Definition at line 617 of file dlinkedlists.h.
Referenced by dbl_list_expect_reverse(), and print_list_backwards().
#define AST_DLLIST_TRAVERSE_BACKWARDS_SAFE_BEGIN | ( | head, | |
var, | |||
field | |||
) | AST_DLLIST_TRAVERSE_DIRECTION_SAFE_BEGIN(head, var, field, last) |
Loops safely over (traverses) the entries in a list.
head | This is a pointer to the list head structure |
var | This is the name of the variable that will hold a pointer to the current list entry on each iteration. It must be declared before calling this macro. |
field | This is the name of the field (declared using AST_DLLIST_ENTRY()) used to link entries of this list together. |
This macro is used to safely loop over (traverse) the entries in a list. It uses a for loop, and supplies the enclosed code with a pointer to each list entry as it loops. It is typically used as follows:
It differs from AST_DLLIST_TRAVERSE() in that the code inside the loop can modify (or even free, after calling AST_DLLIST_REMOVE_CURRENT()) the entry pointed to by the current pointer without affecting the loop traversal.
Definition at line 887 of file dlinkedlists.h.
Referenced by ast_module_unregister(), AST_TEST_DEFINE(), destroy_test_container(), dll_tests(), hash_ao2_insert_node(), and modules_shutdown().
#define AST_DLLIST_TRAVERSE_BACKWARDS_SAFE_END AST_DLLIST_TRAVERSE_DIRECTION_SAFE_END |
Closes a safe loop traversal block.
Definition at line 920 of file dlinkedlists.h.
Referenced by ast_module_unregister(), AST_TEST_DEFINE(), destroy_test_container(), hash_ao2_insert_node(), and modules_shutdown().
#define AST_DLLIST_TRAVERSE_DIRECTION | ( | head, | |
var, | |||
field, | |||
start | |||
) | for ((var) = (head)->start; (var); (var) = AST_DLLIST_NEXT_DIRECTION(var, field, start)) |
Traverse a doublly linked list using the specified direction list.
head | List head structure pointer. |
var | This is the name of the variable that will hold a pointer to the current list node on each iteration. It must be declared before calling this macro. |
field | List node field for the next node information. (declared using AST_DLLIST_ENTRY()) |
start | Specified list node to start traversal: first or last |
This macro is use to loop over (traverse) the nodes in a list. It uses a for loop, and supplies the enclosed code with a pointer to each list node as it loops. It is typically used as follows:
Definition at line 533 of file dlinkedlists.h.
#define AST_DLLIST_TRAVERSE_DIRECTION_SAFE_BEGIN | ( | head, | |
var, | |||
field, | |||
start | |||
) |
Safe traversal of a doublly linked list using the specified direction list.
head | List head structure pointer. |
var | This is the name of the variable that will hold a pointer to the current list node on each iteration. It must be declared before calling this macro. |
field | List node field for the next node information. (declared using AST_DLLIST_ENTRY()) |
start | Specified list node to start traversal: first or last |
This macro is used to safely loop over (traverse) the nodes in a list. It uses a for loop, and supplies the enclosed code with a pointer to each list node as it loops. It is typically used as follows:
It differs from AST_DLLIST_TRAVERSE() in that the code inside the loop can modify (or even free, after calling AST_DLLIST_REMOVE_CURRENT()) the entry pointed to by the current pointer without affecting the loop traversal.
Definition at line 662 of file dlinkedlists.h.
#define AST_DLLIST_TRAVERSE_DIRECTION_SAFE_END } while (0) |
Definition at line 809 of file dlinkedlists.h.
#define AST_DLLIST_TRAVERSE_SAFE_BEGIN | ( | head, | |
var, | |||
field | |||
) | AST_DLLIST_TRAVERSE_DIRECTION_SAFE_BEGIN(head, var, field, first) |
Loops safely over (traverses) the entries in a list.
head | This is a pointer to the list head structure |
var | This is the name of the variable that will hold a pointer to the current list entry on each iteration. It must be declared before calling this macro. |
field | This is the name of the field (declared using AST_DLLIST_ENTRY()) used to link entries of this list together. |
This macro is used to safely loop over (traverse) the entries in a list. It uses a for loop, and supplies the enclosed code with a pointer to each list entry as it loops. It is typically used as follows:
It differs from AST_DLLIST_TRAVERSE() in that the code inside the loop can modify (or even free, after calling AST_DLLIST_REMOVE_CURRENT()) the entry pointed to by the current pointer without affecting the loop traversal.
Definition at line 848 of file dlinkedlists.h.
Referenced by AST_TEST_DEFINE(), dll_tests(), and hash_ao2_insert_node().
#define AST_DLLIST_TRAVERSE_SAFE_END AST_DLLIST_TRAVERSE_DIRECTION_SAFE_END |
Closes a safe loop traversal block.
Definition at line 912 of file dlinkedlists.h.
Referenced by AST_TEST_DEFINE(), dll_tests(), and hash_ao2_insert_node().
#define AST_DLLIST_TRYLOCK | ( | head | ) | ast_mutex_trylock(&(head)->lock) |
Locks a list, without blocking if the list is locked.
head | This is a pointer to the list head structure |
This macro attempts to place an exclusive lock in the list head structure pointed to by head.
0 | on success |
non-zero | on failure |
Definition at line 84 of file dlinkedlists.h.
#define AST_DLLIST_UNLOCK | ( | head | ) | ast_mutex_unlock(&(head)->lock) |
Attempts to unlock a list.
head | This is a pointer to the list head structure |
This macro attempts to remove an exclusive lock from the list head structure pointed to by head. If the list was not locked by this thread, this macro has no effect.
Definition at line 122 of file dlinkedlists.h.
Referenced by ast_load_resource(), ast_module_helper(), ast_module_register(), ast_module_reload(), ast_module_unregister(), ast_unload_resource(), ast_update_module_list(), ast_update_module_list_condition(), ast_update_module_list_data(), find_resource(), load_modules(), module_load_helper(), modules_shutdown(), and start_resource().
#define AST_RWDLLIST_APPEND_DLLIST AST_DLLIST_APPEND_DLLIST |
Definition at line 1129 of file dlinkedlists.h.
#define AST_RWDLLIST_EMPTY AST_DLLIST_EMPTY |
Definition at line 470 of file dlinkedlists.h.
#define AST_RWDLLIST_ENTRY AST_DLLIST_ENTRY |
Definition at line 414 of file dlinkedlists.h.
#define AST_RWDLLIST_FIRST AST_DLLIST_FIRST |
Definition at line 423 of file dlinkedlists.h.
Defines a structure to be used to hold a read/write list of specified type.
name | This will be the name of the defined structure. |
type | This is the type of each list entry. |
This macro creates a structure definition that can be used to hold a list of the entries of type type. It does not actually declare (allocate) a structure; to do that, either follow this macro with the desired name of the instance you wish to declare, or use the specified name to declare instances elsewhere.
Example usage:
This would define struct
entry_list
, and declare an instance of it named entries, all intended to hold a list of type struct
entry
.
Definition at line 184 of file dlinkedlists.h.
#define AST_RWDLLIST_HEAD_DESTROY | ( | head | ) |
Destroys an rwlist head structure.
head | This is a pointer to the list head structure |
This macro destroys a list head structure by setting the head entry to NULL (empty list) and destroying the embedded lock. It does not free the structure from memory.
Definition at line 979 of file dlinkedlists.h.
#define AST_RWDLLIST_HEAD_INIT | ( | head | ) |
Initializes an rwlist head structure.
head | This is a pointer to the list head structure |
This macro initializes a list head structure by setting the head entry to NULL (empty list) and recreating the embedded lock.
Definition at line 947 of file dlinkedlists.h.
#define AST_RWDLLIST_HEAD_INIT_VALUE |
Defines initial values for a declaration of AST_RWDLLIST_HEAD.
Definition at line 232 of file dlinkedlists.h.
#define AST_RWDLLIST_HEAD_SET | ( | head, | |
entry | |||
) |
Initializes an rwlist head structure with a specified first entry.
head | This is a pointer to the list head structure |
entry | pointer to the list entry that will become the head of the list |
This macro initializes a list head structure by setting the head entry to the supplied value and recreating the embedded lock.
Definition at line 372 of file dlinkedlists.h.
Defines a structure to be used to hold a read/write list of specified type, statically initialized.
name | This will be the name of the defined structure. |
type | This is the type of each list entry. |
This macro creates a structure definition that can be used to hold a list of the entries of type type, and allocates an instance of it, initialized to be empty.
Example usage:
This would define struct
entry_list
, intended to hold a list of type struct
entry
.
Definition at line 327 of file dlinkedlists.h.
#define AST_RWDLLIST_INSERT_AFTER AST_DLLIST_INSERT_AFTER |
Definition at line 1025 of file dlinkedlists.h.
#define AST_RWDLLIST_INSERT_AFTER_CURRENT AST_DLLIST_INSERT_AFTER_CURRENT |
Definition at line 739 of file dlinkedlists.h.
#define AST_RWDLLIST_INSERT_BEFORE AST_DLLIST_INSERT_BEFORE |
Definition at line 1051 of file dlinkedlists.h.
#define AST_RWDLLIST_INSERT_BEFORE_CURRENT AST_DLLIST_INSERT_BEFORE_CURRENT |
Definition at line 712 of file dlinkedlists.h.
#define AST_RWDLLIST_INSERT_BEFORE_CURRENT_BACKWARDS AST_DLLIST_INSERT_BEFORE_CURRENT_BACKWARDS |
Definition at line 906 of file dlinkedlists.h.
#define AST_RWDLLIST_INSERT_HEAD AST_DLLIST_INSERT_HEAD |
Definition at line 1074 of file dlinkedlists.h.
#define AST_RWDLLIST_INSERT_TAIL AST_DLLIST_INSERT_TAIL |
Definition at line 1102 of file dlinkedlists.h.
#define AST_RWDLLIST_IS_MEMBER AST_DLLIST_IS_MEMBER |
Definition at line 497 of file dlinkedlists.h.
#define AST_RWDLLIST_LAST AST_DLLIST_LAST |
Definition at line 432 of file dlinkedlists.h.
#define AST_RWDLLIST_MOVE_CURRENT AST_DLLIST_MOVE_CURRENT |
Definition at line 788 of file dlinkedlists.h.
#define AST_RWDLLIST_MOVE_CURRENT_BACKWARDS AST_DLLIST_MOVE_CURRENT_BACKWARDS |
Definition at line 807 of file dlinkedlists.h.
#define AST_RWDLLIST_NEXT AST_DLLIST_NEXT |
Definition at line 447 of file dlinkedlists.h.
#define AST_RWDLLIST_NEXT_DIRECTION AST_DLLIST_NEXT_DIRECTION |
Definition at line 436 of file dlinkedlists.h.
#define AST_RWDLLIST_PREV AST_DLLIST_PREV |
Definition at line 458 of file dlinkedlists.h.
#define AST_RWDLLIST_RDLOCK | ( | head | ) | ast_rwlock_rdlock(&(head)->lock) |
Read locks a list.
head | This is a pointer to the list head structure |
This macro attempts to place a read lock in the list head structure pointed to by head.
0 | on success |
non-zero | on failure |
Definition at line 71 of file dlinkedlists.h.
#define AST_RWDLLIST_REMOVE AST_DLLIST_REMOVE |
Definition at line 1217 of file dlinkedlists.h.
#define AST_RWDLLIST_REMOVE_CURRENT AST_DLLIST_REMOVE_CURRENT |
Definition at line 769 of file dlinkedlists.h.
#define AST_RWDLLIST_REMOVE_HEAD AST_DLLIST_REMOVE_HEAD |
Definition at line 1158 of file dlinkedlists.h.
#define AST_RWDLLIST_REMOVE_TAIL AST_DLLIST_REMOVE_TAIL |
Definition at line 1187 of file dlinkedlists.h.
#define AST_RWDLLIST_REMOVE_VERIFY AST_DLLIST_REMOVE_VERIFY |
Definition at line 1237 of file dlinkedlists.h.
#define AST_RWDLLIST_TRAVERSE AST_DLLIST_TRAVERSE |
Definition at line 578 of file dlinkedlists.h.
#define AST_RWDLLIST_TRAVERSE_BACKWARDS AST_DLLIST_TRAVERSE_BACKWARDS |
Definition at line 620 of file dlinkedlists.h.
#define AST_RWDLLIST_TRAVERSE_BACKWARDS_SAFE_BEGIN AST_DLLIST_TRAVERSE_BACKWARDS_SAFE_BEGIN |
Definition at line 890 of file dlinkedlists.h.
#define AST_RWDLLIST_TRAVERSE_BACKWARDS_SAFE_END AST_DLLIST_TRAVERSE_BACKWARDS_SAFE_END |
Definition at line 922 of file dlinkedlists.h.
#define AST_RWDLLIST_TRAVERSE_DIRECTION AST_DLLIST_TRAVERSE_DIRECTION |
Definition at line 536 of file dlinkedlists.h.
#define AST_RWDLLIST_TRAVERSE_DIRECTION_SAFE_BEGIN AST_DLLIST_TRAVERSE_DIRECTION_SAFE_BEGIN |
Definition at line 685 of file dlinkedlists.h.
#define AST_RWDLLIST_TRAVERSE_DIRECTION_SAFE_END AST_DLLIST_TRAVERSE_DIRECTION_SAFE_END |
Definition at line 812 of file dlinkedlists.h.
#define AST_RWDLLIST_TRAVERSE_SAFE_BEGIN AST_DLLIST_TRAVERSE_SAFE_BEGIN |
Definition at line 851 of file dlinkedlists.h.
#define AST_RWDLLIST_TRAVERSE_SAFE_END AST_DLLIST_TRAVERSE_SAFE_END |
Definition at line 914 of file dlinkedlists.h.
#define AST_RWDLLIST_TRYRDLOCK | ( | head | ) | ast_rwlock_tryrdlock(&(head)->lock) |
Read locks a list, without blocking if the list is locked.
head | This is a pointer to the list head structure |
This macro attempts to place a read lock in the list head structure pointed to by head.
0 | on success |
non-zero | on failure |
Definition at line 110 of file dlinkedlists.h.
#define AST_RWDLLIST_TRYWRLOCK | ( | head | ) | ast_rwlock_trywrlock(&(head)->lock) |
Write locks a list, without blocking if the list is locked.
head | This is a pointer to the list head structure |
This macro attempts to place an exclusive write lock in the list head structure pointed to by head.
0 | on success |
non-zero | on failure |
Definition at line 97 of file dlinkedlists.h.
#define AST_RWDLLIST_UNLOCK | ( | head | ) | ast_rwlock_unlock(&(head)->lock) |
Attempts to unlock a read/write based list.
head | This is a pointer to the list head structure |
This macro attempts to remove a read or write lock from the list head structure pointed to by head. If the list was not locked by this thread, this macro has no effect.
Definition at line 134 of file dlinkedlists.h.
#define AST_RWDLLIST_WRLOCK | ( | head | ) | ast_rwlock_wrlock(&(head)->lock) |
Write locks a list.
head | This is a pointer to the list head structure |
This macro attempts to place an exclusive write lock in the list head structure pointed to by head.
0 | on success |
non-zero | on failure |
Definition at line 58 of file dlinkedlists.h.