Linux Kernel
3.7.1
|
Go to the source code of this file.
Data Structures | |
struct | ulist_iterator |
struct | ulist_node |
struct | ulist |
Macros | |
#define | ULIST_SIZE 16 |
#define | ULIST_ITER_INIT(uiter) ((uiter)->i = 0) |
Functions | |
void | ulist_init (struct ulist *ulist) |
void | ulist_fini (struct ulist *ulist) |
void | ulist_reinit (struct ulist *ulist) |
struct ulist * | ulist_alloc (gfp_t gfp_mask) |
void | ulist_free (struct ulist *ulist) |
int | ulist_add (struct ulist *ulist, u64 val, u64 aux, gfp_t gfp_mask) |
int | ulist_add_merge (struct ulist *ulist, u64 val, u64 aux, u64 *old_aux, gfp_t gfp_mask) |
struct ulist_node * | ulist_next (struct ulist *ulist, struct ulist_iterator *uiter) |
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.
|
read |
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.