Lines Matching +full:termination +full:- +full:current
1 /* SPDX-License-Identifier: GPL-2.0-only */
5 * 2002-10-18 written by Jim Houston jim.houston@ccur.com
15 #include <linux/radix-tree.h>
42 * IDR_INIT() - Initialise an IDR.
45 * A freshly-initialised IDR contains no IDs.
50 * DEFINE_IDR() - Define a statically-allocated IDR.
59 * idr_get_cursor - Return the current position of the cyclic allocator
68 return READ_ONCE(idr->idr_next); in idr_get_cursor()
72 * idr_set_cursor - Set the current position of the cyclic allocator
81 WRITE_ONCE(idr->idr_next, val); in idr_set_cursor()
86 * idr synchronization (stolen from radix-tree.h)
90 * Other readers (lock-free or otherwise) and modifications may be running
94 * lifetimes of the items. So if RCU lock-free lookups are used, typically
96 * lock-free access; and that the items are freed by RCU (or only freed after
101 #define idr_lock(idr) xa_lock(&(idr)->idr_rt)
102 #define idr_unlock(idr) xa_unlock(&(idr)->idr_rt)
103 #define idr_lock_bh(idr) xa_lock_bh(&(idr)->idr_rt)
104 #define idr_unlock_bh(idr) xa_unlock_bh(&(idr)->idr_rt)
105 #define idr_lock_irq(idr) xa_lock_irq(&(idr)->idr_rt)
106 #define idr_unlock_irq(idr) xa_unlock_irq(&(idr)->idr_rt)
108 xa_lock_irqsave(&(idr)->idr_rt, flags)
110 xa_unlock_irqrestore(&(idr)->idr_rt, flags)
128 * idr_init_base() - Initialise an IDR.
137 INIT_RADIX_TREE(&idr->idr_rt, IDR_RT_MARKER); in idr_init_base()
138 idr->idr_base = base; in idr_init_base()
139 idr->idr_next = 0; in idr_init_base()
143 * idr_init() - Initialise an IDR.
155 * idr_is_empty() - Are there any IDs allocated?
162 return radix_tree_empty(&idr->idr_rt) && in idr_is_empty()
163 radix_tree_tagged(&idr->idr_rt, IDR_FREE); in idr_is_empty()
167 * idr_preload_end - end preload section started with idr_preload()
178 * idr_for_each_entry() - Iterate over an IDR's elements of a given type.
184 * after normal termination @entry is left with the value NULL. This
191 * idr_for_each_entry_ul() - Iterate over an IDR's elements of a given type.
198 * after normal termination @entry is left with the value NULL. This
207 * idr_for_each_entry_continue() - Continue iteration over an IDR's elements of a given type
212 * Continue to iterate over entries, continuing after the current position.
220 * idr_for_each_entry_continue_ul() - Continue iteration over an IDR's elements of a given type
226 * Continue to iterate over entries, continuing after the current position.
227 * After normal termination @entry is left with the value NULL. This
236 * IDA - ID Allocator, use when translation from id to pointer isn't necessary.
262 * ida_alloc() - Allocate an unused ID.
270 * Return: The allocated ID, or %-ENOMEM if memory could not be allocated,
271 * or %-ENOSPC if there are no free IDs.
279 * ida_alloc_min() - Allocate an unused ID.
288 * Return: The allocated ID, or %-ENOMEM if memory could not be allocated,
289 * or %-ENOSPC if there are no free IDs.
297 * ida_alloc_max() - Allocate an unused ID.
306 * Return: The allocated ID, or %-ENOMEM if memory could not be allocated,
307 * or %-ENOSPC if there are no free IDs.
316 xa_init_flags(&ida->xa, IDA_INIT_FLAGS); in ida_init()
324 ida_alloc_range(ida, start, (end) - 1, gfp)
329 return xa_empty(&ida->xa); in ida_is_empty()