#include <linux/slab.h>
#include <linux/module.h>
#include "ulist.h"
Go to the source code of this file.
ulist_add - add an element to the ulist : ulist to add the element to : value to add to ulist : auxiliary value to store along with val : flags to use for allocation
Note: locking must be provided by the caller. In case of rwlocks write locking is needed
Add an element to a ulist. The will only be added if it doesn't already exist. If it is added, the auxiliary value is stored along with it. In case already exists in the ulist, is ignored, even if it differs from the already stored value.
ulist_add returns 0 if already exists in ulist and 1 if has been inserted. In case of allocation failure -ENOMEM is returned and the ulist stays unaltered.
Definition at line 146 of file ulist.c.
ulist_alloc - dynamically allocate a ulist : allocation flags to for base allocation
The allocated ulist will be returned in an initialized state.
Definition at line 98 of file ulist.c.
ulist_fini - free up additionally allocated memory for the ulist : the ulist from which to free the additional memory
This is useful in cases where the base 'struct ulist' has been statically allocated.
Definition at line 66 of file ulist.c.
ulist_free - free dynamically allocated ulist : ulist to free
It is not necessary to call ulist_fini before.
Definition at line 117 of file ulist.c.
ulist_init - freshly initialize a ulist : the ulist to initialize
Note: don't use this function to init an already used ulist, use ulist_reinit instead.
Definition at line 51 of file ulist.c.
ulist_next - iterate ulist : ulist to iterate : iterator variable, initialized with ULIST_ITER_INIT(&iterator)
Note: locking must be provided by the caller. In case of rwlocks only read locking is needed
This function is used to iterate an ulist. It returns the next element from the ulist or NULL when the end is reached. No guarantee is made with respect to the order in which the elements are returned. They might neither be returned in order of addition nor in ascending order. It is allowed to call ulist_add during an enumeration. Newly added items are guaranteed to show up in the running enumeration.
Definition at line 212 of file ulist.c.
ulist_reinit - prepare a ulist for reuse : ulist to be reused
Free up all additional memory allocated for the list elements and reinit the ulist.
Definition at line 85 of file ulist.c.