XenevaOS
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Enumerations
xarray.h File Reference
#include <linux/bitmap.h>
#include <linux/bug.h>
#include <linux/compiler.h>
#include <linux/err.h>
#include <linux/gfp.h>
#include <linux/kconfig.h>
#include <linux/limits.h>
#include <linux/lockdep.h>
#include <linux/rcupdate.h>
#include <linux/sched/mm.h>
#include <linux/spinlock.h>
#include <linux/types.h>
Include dependency graph for xarray.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  xa_limit
 
struct  xarray
 
struct  xa_node
 
struct  xa_state
 

Macros

#define BITS_PER_XA_VALUE   (BITS_PER_LONG - 1)
 
#define XA_ZERO_ENTRY   xa_mk_internal(257)
 
#define XA_LIMIT(_min, _max)   (struct xa_limit) { .min = _min, .max = _max }
 
#define xa_limit_32b   XA_LIMIT(0, UINT_MAX)
 
#define xa_limit_31b   XA_LIMIT(0, INT_MAX)
 
#define xa_limit_16b   XA_LIMIT(0, USHRT_MAX)
 
#define XA_MARK_0   ((__force xa_mark_t)0U)
 
#define XA_MARK_1   ((__force xa_mark_t)1U)
 
#define XA_MARK_2   ((__force xa_mark_t)2U)
 
#define XA_PRESENT   ((__force xa_mark_t)8U)
 
#define XA_MARK_MAX   XA_MARK_2
 
#define XA_FREE_MARK   XA_MARK_0
 
#define XA_FLAGS_LOCK_IRQ   ((__force gfp_t)XA_LOCK_IRQ)
 
#define XA_FLAGS_LOCK_BH   ((__force gfp_t)XA_LOCK_BH)
 
#define XA_FLAGS_TRACK_FREE   ((__force gfp_t)4U)
 
#define XA_FLAGS_ZERO_BUSY   ((__force gfp_t)8U)
 
#define XA_FLAGS_ALLOC_WRAPPED   ((__force gfp_t)16U)
 
#define XA_FLAGS_ACCOUNT   ((__force gfp_t)32U)
 
#define XA_FLAGS_MARK(mark)
 
#define XA_FLAGS_ALLOC   (XA_FLAGS_TRACK_FREE | XA_FLAGS_MARK(XA_FREE_MARK))
 
#define XA_FLAGS_ALLOC1   (XA_FLAGS_TRACK_FREE | XA_FLAGS_ZERO_BUSY)
 
#define XARRAY_INIT(name, flags)
 

Typedefs

typedef unsigned __bitwise xa_mark_t
 

Enumerations

enum  xa_lock_type { XA_LOCK_IRQ = 1 , XA_LOCK_BH = 2 }
 

: A string that names your XArray.

DEFINE_XARRAY_ALLOC1() - Define an XArray which allocates IDs starting at 1.

This is intended for file scope definitions of allocating XArrays. See also DEFINE_XARRAY().

#define DEFINE_XARRAY_FLAGS(name, flags)    struct xarray name = XARRAY_INIT(name, flags)
 
#define DEFINE_XARRAY(name)   DEFINE_XARRAY_FLAGS(name, 0)
 
#define DEFINE_XARRAY_ALLOC(name)   DEFINE_XARRAY_FLAGS(name, XA_FLAGS_ALLOC)
 
#define DEFINE_XARRAY_ALLOC1(name)   DEFINE_XARRAY_FLAGS(name, XA_FLAGS_ALLOC1)
 
#define xa_for_each_range(xa, index, entry, start, last)
 
#define xa_for_each_start(xa, index, entry, start)    xa_for_each_range(xa, index, entry, start, ULONG_MAX)
 
#define xa_for_each(xa, index, entry)    xa_for_each_start(xa, index, entry, 0)
 
#define xa_for_each_marked(xa, index, entry, filter)
 
#define xa_trylock(xa)   spin_trylock(&(xa)->xa_lock)
 
#define xa_lock(xa)   spin_lock(&(xa)->xa_lock)
 
#define xa_unlock(xa)   spin_unlock(&(xa)->xa_lock)
 
#define xa_lock_bh(xa)   spin_lock_bh(&(xa)->xa_lock)
 
#define xa_unlock_bh(xa)   spin_unlock_bh(&(xa)->xa_lock)
 
#define xa_lock_irq(xa)   spin_lock_irq(&(xa)->xa_lock)
 
#define xa_unlock_irq(xa)   spin_unlock_irq(&(xa)->xa_lock)
 
#define xa_lock_irqsave(xa, flags)    spin_lock_irqsave(&(xa)->xa_lock, flags)
 
#define xa_unlock_irqrestore(xa, flags)    spin_unlock_irqrestore(&(xa)->xa_lock, flags)
 
#define xa_lock_nested(xa, subclass)    spin_lock_nested(&(xa)->xa_lock, subclass)
 
#define xa_lock_bh_nested(xa, subclass)    spin_lock_bh_nested(&(xa)->xa_lock, subclass)
 
#define xa_lock_irq_nested(xa, subclass)    spin_lock_irq_nested(&(xa)->xa_lock, subclass)
 
#define xa_lock_irqsave_nested(xa, flags, subclass)    spin_lock_irqsave_nested(&(xa)->xa_lock, flags, subclass)
 
#define XA_CHUNK_SHIFT   (IS_ENABLED(CONFIG_BASE_SMALL) ? 4 : 6)
 
#define XA_CHUNK_SIZE   (1UL << XA_CHUNK_SHIFT)
 
#define XA_CHUNK_MASK   (XA_CHUNK_SIZE - 1)
 
#define XA_MAX_MARKS   3
 
#define XA_MARK_LONGS   BITS_TO_LONGS(XA_CHUNK_SIZE)
 
#define XA_BUG_ON(xa, x)   do { } while (0)
 
#define XA_NODE_BUG_ON(node, x)   do { } while (0)
 
#define XA_RETRY_ENTRY   xa_mk_internal(256)
 
#define XA_ERROR(errno)   ((struct xa_node *)(((unsigned long)errno << 2) | 2UL))
 
#define XAS_BOUNDS   ((struct xa_node *)1UL)
 
#define XAS_RESTART   ((struct xa_node *)3UL)
 
#define __XA_STATE(array, index, shift, sibs)
 
typedef void(* xa_update_node_t) (struct xa_node *node)
 
void * xa_load (struct xarray *, unsigned long index)
 
void * xa_store (struct xarray *, unsigned long index, void *entry, gfp_t)
 
void * xa_erase (struct xarray *, unsigned long index)
 
void * xa_store_range (struct xarray *, unsigned long first, unsigned long last, void *entry, gfp_t)
 
bool xa_get_mark (struct xarray *, unsigned long index, xa_mark_t)
 
void xa_set_mark (struct xarray *, unsigned long index, xa_mark_t)
 
void xa_clear_mark (struct xarray *, unsigned long index, xa_mark_t)
 
void * xa_find (struct xarray *xa, unsigned long *index, unsigned long max, xa_mark_t) __attribute__((nonnull(2)))
 
void * xa_find_after (struct xarray *xa, unsigned long *index, unsigned long max, xa_mark_t) __attribute__((nonnull(2)))
 
unsigned int xa_extract (struct xarray *, void **dst, unsigned long start, unsigned long max, unsigned int n, xa_mark_t)
 
void xa_destroy (struct xarray *)
 
void * __xa_erase (struct xarray *, unsigned long index)
 
void * __xa_store (struct xarray *, unsigned long index, void *entry, gfp_t)
 
void * __xa_cmpxchg (struct xarray *, unsigned long index, void *old, void *entry, gfp_t)
 
int __must_check __xa_insert (struct xarray *, unsigned long index, void *entry, gfp_t)
 
int __must_check __xa_alloc (struct xarray *, u32 *id, void *entry, struct xa_limit, gfp_t)
 
int __must_check __xa_alloc_cyclic (struct xarray *, u32 *id, void *entry, struct xa_limit, u32 *next, gfp_t)
 
void __xa_set_mark (struct xarray *, unsigned long index, xa_mark_t)
 
void __xa_clear_mark (struct xarray *, unsigned long index, xa_mark_t)
 
void xa_dump (const struct xarray *)
 
void xa_dump_node (const struct xa_node *)
 
void xa_delete_node (struct xa_node *, xa_update_node_t)
 

: Name of this operation state (usually xas).

XA_STATE_ORDER() - Declare an XArray operation state.

@array: Array to operate on. @index: Initial index of interest. @order: Order of entry.

Declare and initialise an xa_state on the stack. This variant of XA_STATE() allows you to specify the 'order' of the element you want to operate on.`

#define XA_STATE(name, array, index)    struct xa_state name = __XA_STATE(array, index, 0, 0)
 
#define XA_STATE_ORDER(name, array, index, order)
 
#define xas_marked(xas, mark)   xa_marked((xas)->xa, (mark))
 
#define xas_trylock(xas)   xa_trylock((xas)->xa)
 
#define xas_lock(xas)   xa_lock((xas)->xa)
 
#define xas_unlock(xas)   xa_unlock((xas)->xa)
 
#define xas_lock_bh(xas)   xa_lock_bh((xas)->xa)
 
#define xas_unlock_bh(xas)   xa_unlock_bh((xas)->xa)
 
#define xas_lock_irq(xas)   xa_lock_irq((xas)->xa)
 
#define xas_unlock_irq(xas)   xa_unlock_irq((xas)->xa)
 
#define xas_lock_irqsave(xas, flags)    xa_lock_irqsave((xas)->xa, flags)
 
#define xas_unlock_irqrestore(xas, flags)    xa_unlock_irqrestore((xas)->xa, flags)
 
#define xas_for_each(xas, entry, max)
 
#define xas_for_each_marked(xas, entry, max, mark)
 
#define xas_for_each_conflict(xas, entry)    while ((entry = xas_find_conflict(xas)))
 
enum  { XA_CHECK_SCHED = 4096 }
 
void * xas_load (struct xa_state *)
 
void * xas_store (struct xa_state *, void *entry)
 
void * xas_find (struct xa_state *, unsigned long max)
 
void * xas_find_conflict (struct xa_state *)
 
bool xas_get_mark (const struct xa_state *, xa_mark_t)
 
void xas_set_mark (const struct xa_state *, xa_mark_t)
 
void xas_clear_mark (const struct xa_state *, xa_mark_t)
 
void * xas_find_marked (struct xa_state *, unsigned long max, xa_mark_t)
 
void xas_init_marks (const struct xa_state *)
 
bool xas_nomem (struct xa_state *, gfp_t)
 
void xas_destroy (struct xa_state *)
 
void xas_pause (struct xa_state *)
 
void xas_create_range (struct xa_state *)
 
void * __xas_next (struct xa_state *)
 
void * __xas_prev (struct xa_state *)
 

Macro Definition Documentation

◆ __XA_STATE

#define __XA_STATE (   array,
  index,
  shift,
  sibs 
)
Value:
{ \
.xa = array, \
.xa_index = index, \
.xa_shift = shift, \
.xa_sibs = sibs, \
.xa_offset = 0, \
.xa_pad = 0, \
.xa_node = XAS_RESTART, \
.xa_alloc = NULL, \
.xa_update = NULL, \
.xa_lru = NULL, \
}
#define index(str, chr)
Definition string.h:66
#define NULL
Definition actypes.h:561
#define XAS_RESTART
Definition xarray.h:1392

◆ BITS_PER_XA_VALUE

#define BITS_PER_XA_VALUE   (BITS_PER_LONG - 1)

◆ DEFINE_XARRAY

#define DEFINE_XARRAY (   name)    DEFINE_XARRAY_FLAGS(name, 0)

◆ DEFINE_XARRAY_ALLOC

#define DEFINE_XARRAY_ALLOC (   name)    DEFINE_XARRAY_FLAGS(name, XA_FLAGS_ALLOC)

◆ DEFINE_XARRAY_ALLOC1

#define DEFINE_XARRAY_ALLOC1 (   name)    DEFINE_XARRAY_FLAGS(name, XA_FLAGS_ALLOC1)

◆ DEFINE_XARRAY_FLAGS

#define DEFINE_XARRAY_FLAGS (   name,
  flags 
)     struct xarray name = XARRAY_INIT(name, flags)

◆ XA_BUG_ON

#define XA_BUG_ON (   xa,
  x 
)    do { } while (0)

◆ XA_CHUNK_MASK

#define XA_CHUNK_MASK   (XA_CHUNK_SIZE - 1)

◆ XA_CHUNK_SHIFT

#define XA_CHUNK_SHIFT   (IS_ENABLED(CONFIG_BASE_SMALL) ? 4 : 6)

◆ XA_CHUNK_SIZE

#define XA_CHUNK_SIZE   (1UL << XA_CHUNK_SHIFT)

◆ XA_ERROR

#define XA_ERROR (   errno)    ((struct xa_node *)(((unsigned long)errno << 2) | 2UL))

◆ XA_FLAGS_ACCOUNT

#define XA_FLAGS_ACCOUNT   ((__force gfp_t)32U)

◆ XA_FLAGS_ALLOC

#define XA_FLAGS_ALLOC   (XA_FLAGS_TRACK_FREE | XA_FLAGS_MARK(XA_FREE_MARK))

◆ XA_FLAGS_ALLOC1

#define XA_FLAGS_ALLOC1   (XA_FLAGS_TRACK_FREE | XA_FLAGS_ZERO_BUSY)

◆ XA_FLAGS_ALLOC_WRAPPED

#define XA_FLAGS_ALLOC_WRAPPED   ((__force gfp_t)16U)

◆ XA_FLAGS_LOCK_BH

#define XA_FLAGS_LOCK_BH   ((__force gfp_t)XA_LOCK_BH)

◆ XA_FLAGS_LOCK_IRQ

#define XA_FLAGS_LOCK_IRQ   ((__force gfp_t)XA_LOCK_IRQ)

◆ XA_FLAGS_MARK

#define XA_FLAGS_MARK (   mark)
Value:
((__force gfp_t)((1U << __GFP_BITS_SHIFT) << \
(__force unsigned)(mark)))
#define __force
Definition compiler.h:60
#define __GFP_BITS_SHIFT
Definition gfp_types.h:299
unsigned int gfp_t
Definition kernel.h:56

◆ XA_FLAGS_TRACK_FREE

#define XA_FLAGS_TRACK_FREE   ((__force gfp_t)4U)

◆ XA_FLAGS_ZERO_BUSY

#define XA_FLAGS_ZERO_BUSY   ((__force gfp_t)8U)

◆ xa_for_each

#define xa_for_each (   xa,
  index,
  entry 
)     xa_for_each_start(xa, index, entry, 0)

xa_for_each() - Iterate over present entries in an XArray. @xa: XArray. @index: Index of @entry. @entry: Entry retrieved from array.

During the iteration, @entry will have the value of the entry stored in @xa at @index. You may modify @index during the iteration if you want to skip or reprocess indices. It is safe to modify the array during the iteration. At the end of the iteration, @entry will be set to NULL and @index will have a value less than or equal to max.

xa_for_each() is O(n.log(n)) while xas_for_each() is O(n). You have to handle your own locking with xas_for_each(), and if you have to unlock after each iteration, it will also end up being O(n.log(n)). xa_for_each() will spin if it hits a retry entry; if you intend to see retry entries, you should use the xas_for_each() iterator instead. The xas_for_each() iterator will expand into more inline code than xa_for_each().

Context: Any context. Takes and releases the RCU lock.

◆ xa_for_each_marked

#define xa_for_each_marked (   xa,
  index,
  entry,
  filter 
)
Value:
for (index = 0, entry = xa_find(xa, &index, ULONG_MAX, filter); \
#define ULONG_MAX
Definition limits.h:56
void(* entry)(void *)
Definition process.h:101
void * xa_find_after(struct xarray *xa, unsigned long *index, unsigned long max, xa_mark_t) __attribute__((nonnull(2)))
void * xa_find(struct xarray *xa, unsigned long *index, unsigned long max, xa_mark_t) __attribute__((nonnull(2)))

xa_for_each_marked() - Iterate over marked entries in an XArray. @xa: XArray. @index: Index of @entry. @entry: Entry retrieved from array. @filter: Selection criterion.

During the iteration, @entry will have the value of the entry stored in @xa at @index. The iteration will skip all entries in the array which do not match @filter. You may modify @index during the iteration if you want to skip or reprocess indices. It is safe to modify the array during the iteration. At the end of the iteration, @entry will be set to NULL and @index will have a value less than or equal to max.

xa_for_each_marked() is O(n.log(n)) while xas_for_each_marked() is O(n). You have to handle your own locking with xas_for_each(), and if you have to unlock after each iteration, it will also end up being O(n.log(n)). xa_for_each_marked() will spin if it hits a retry entry; if you intend to see retry entries, you should use the xas_for_each_marked() iterator instead. The xas_for_each_marked() iterator will expand into more inline code than xa_for_each_marked().

Context: Any context. Takes and releases the RCU lock.

◆ xa_for_each_range

#define xa_for_each_range (   xa,
  index,
  entry,
  start,
  last 
)
Value:
for (index = start, \
entry; \
TTY * last
Definition tty.cpp:48
#define XA_PRESENT
Definition xarray.h:277

xa_for_each_range() - Iterate over a portion of an XArray. @xa: XArray. @index: Index of @entry. @entry: Entry retrieved from array. @start: First index to retrieve from array. @last: Last index to retrieve from array.

During the iteration, @entry will have the value of the entry stored in @xa at @index. You may modify @index during the iteration if you want to skip or reprocess indices. It is safe to modify the array during the iteration. At the end of the iteration, @entry will be set to NULL and @index will have a value less than or equal to max.

xa_for_each_range() is O(n.log(n)) while xas_for_each() is O(n). You have to handle your own locking with xas_for_each(), and if you have to unlock after each iteration, it will also end up being O(n.log(n)). xa_for_each_range() will spin if it hits a retry entry; if you intend to see retry entries, you should use the xas_for_each() iterator instead. The xas_for_each() iterator will expand into more inline code than xa_for_each_range().

Context: Any context. Takes and releases the RCU lock.

◆ xa_for_each_start

#define xa_for_each_start (   xa,
  index,
  entry,
  start 
)     xa_for_each_range(xa, index, entry, start, ULONG_MAX)

xa_for_each_start() - Iterate over a portion of an XArray. @xa: XArray. @index: Index of @entry. @entry: Entry retrieved from array. @start: First index to retrieve from array.

During the iteration, @entry will have the value of the entry stored in @xa at @index. You may modify @index during the iteration if you want to skip or reprocess indices. It is safe to modify the array during the iteration. At the end of the iteration, @entry will be set to NULL and @index will have a value less than or equal to max.

xa_for_each_start() is O(n.log(n)) while xas_for_each() is O(n). You have to handle your own locking with xas_for_each(), and if you have to unlock after each iteration, it will also end up being O(n.log(n)). xa_for_each_start() will spin if it hits a retry entry; if you intend to see retry entries, you should use the xas_for_each() iterator instead. The xas_for_each() iterator will expand into more inline code than xa_for_each_start().

Context: Any context. Takes and releases the RCU lock.

◆ XA_FREE_MARK

#define XA_FREE_MARK   XA_MARK_0

◆ XA_LIMIT

#define XA_LIMIT (   _min,
  _max 
)    (struct xa_limit) { .min = _min, .max = _max }

◆ xa_limit_16b

#define xa_limit_16b   XA_LIMIT(0, USHRT_MAX)

◆ xa_limit_31b

#define xa_limit_31b   XA_LIMIT(0, INT_MAX)

◆ xa_limit_32b

#define xa_limit_32b   XA_LIMIT(0, UINT_MAX)

◆ xa_lock

#define xa_lock (   xa)    spin_lock(&(xa)->xa_lock)

◆ xa_lock_bh

#define xa_lock_bh (   xa)    spin_lock_bh(&(xa)->xa_lock)

◆ xa_lock_bh_nested

#define xa_lock_bh_nested (   xa,
  subclass 
)     spin_lock_bh_nested(&(xa)->xa_lock, subclass)

◆ xa_lock_irq

#define xa_lock_irq (   xa)    spin_lock_irq(&(xa)->xa_lock)

◆ xa_lock_irq_nested

#define xa_lock_irq_nested (   xa,
  subclass 
)     spin_lock_irq_nested(&(xa)->xa_lock, subclass)

◆ xa_lock_irqsave

#define xa_lock_irqsave (   xa,
  flags 
)     spin_lock_irqsave(&(xa)->xa_lock, flags)

◆ xa_lock_irqsave_nested

#define xa_lock_irqsave_nested (   xa,
  flags,
  subclass 
)     spin_lock_irqsave_nested(&(xa)->xa_lock, flags, subclass)

◆ xa_lock_nested

#define xa_lock_nested (   xa,
  subclass 
)     spin_lock_nested(&(xa)->xa_lock, subclass)

◆ XA_MARK_0

#define XA_MARK_0   ((__force xa_mark_t)0U)

◆ XA_MARK_1

#define XA_MARK_1   ((__force xa_mark_t)1U)

◆ XA_MARK_2

#define XA_MARK_2   ((__force xa_mark_t)2U)

◆ XA_MARK_LONGS

#define XA_MARK_LONGS   BITS_TO_LONGS(XA_CHUNK_SIZE)

◆ XA_MARK_MAX

#define XA_MARK_MAX   XA_MARK_2

◆ XA_MAX_MARKS

#define XA_MAX_MARKS   3

◆ XA_NODE_BUG_ON

#define XA_NODE_BUG_ON (   node,
  x 
)    do { } while (0)

◆ XA_PRESENT

#define XA_PRESENT   ((__force xa_mark_t)8U)

◆ XA_RETRY_ENTRY

#define XA_RETRY_ENTRY   xa_mk_internal(256)

◆ XA_STATE

#define XA_STATE (   name,
  array,
  index 
)     struct xa_state name = __XA_STATE(array, index, 0, 0)

◆ XA_STATE_ORDER

#define XA_STATE_ORDER (   name,
  array,
  index,
  order 
)
Value:
struct xa_state name = __XA_STATE(array, \
(index >> order) << order, \
order - (order % XA_CHUNK_SHIFT), \
(1U << (order % XA_CHUNK_SHIFT)) - 1)
struct drm_crtc struct drm_plane struct drm_plane const struct drm_crtc_funcs const char * name
Definition drm_crtc.h:1242
Definition xarray.h:1373
#define __XA_STATE(array, index, shift, sibs)
Definition xarray.h:1394
#define XA_CHUNK_SHIFT
Definition xarray.h:1173

◆ xa_trylock

#define xa_trylock (   xa)    spin_trylock(&(xa)->xa_lock)

◆ xa_unlock

#define xa_unlock (   xa)    spin_unlock(&(xa)->xa_lock)

◆ xa_unlock_bh

#define xa_unlock_bh (   xa)    spin_unlock_bh(&(xa)->xa_lock)

◆ xa_unlock_irq

#define xa_unlock_irq (   xa)    spin_unlock_irq(&(xa)->xa_lock)

◆ xa_unlock_irqrestore

#define xa_unlock_irqrestore (   xa,
  flags 
)     spin_unlock_irqrestore(&(xa)->xa_lock, flags)

◆ XA_ZERO_ENTRY

#define XA_ZERO_ENTRY   xa_mk_internal(257)

◆ XARRAY_INIT

#define XARRAY_INIT (   name,
  flags 
)
Value:
{ \
.xa_lock = __SPIN_LOCK_UNLOCKED(name.xa_lock), \
.xa_flags = flags, \
.xa_head = NULL, \
}
uint8_t flags
Definition virtio.h:0
#define __SPIN_LOCK_UNLOCKED(lockname)
Definition spinlock.h:129

◆ XAS_BOUNDS

#define XAS_BOUNDS   ((struct xa_node *)1UL)

◆ xas_for_each

#define xas_for_each (   xas,
  entry,
  max 
)
Value:
for (entry = xas_find(xas, max); entry; \
entry = xas_next_entry(xas, max))
#define max(a, b)
Definition minmax.h:28
void * xas_find(struct xa_state *, unsigned long max)

xas_for_each() - Iterate over a range of an XArray. @xas: XArray operation state. @entry: Entry retrieved from the array. @max: Maximum index to retrieve from array.

The loop body will be executed for each entry present in the xarray between the current xas position and @max. @entry will be set to the entry retrieved from the xarray. It is safe to delete entries from the array in the loop body. You should hold either the RCU lock or the xa_lock while iterating. If you need to drop the lock, call xas_pause() first.

◆ xas_for_each_conflict

#define xas_for_each_conflict (   xas,
  entry 
)     while ((entry = xas_find_conflict(xas)))

xas_for_each_conflict() - Iterate over a range of an XArray. @xas: XArray operation state. @entry: Entry retrieved from the array.

The loop body will be executed for each entry in the XArray that lies within the range specified by @xas. If the loop terminates normally, @entry will be NULL. The user may break out of the loop, which will leave @entry set to the conflicting entry. The caller may also call xa_set_err() to exit the loop while setting an error to record the reason.

◆ xas_for_each_marked

#define xas_for_each_marked (   xas,
  entry,
  max,
  mark 
)
Value:
for (entry = xas_find_marked(xas, max, mark); entry; \
entry = xas_next_marked(xas, max, mark))
void * xas_find_marked(struct xa_state *, unsigned long max, xa_mark_t)

xas_for_each_marked() - Iterate over a range of an XArray. @xas: XArray operation state. @entry: Entry retrieved from the array. @max: Maximum index to retrieve from array. @mark: Mark to search for.

The loop body will be executed for each marked entry in the xarray between the current xas position and @max. @entry will be set to the entry retrieved from the xarray. It is safe to delete entries from the array in the loop body. You should hold either the RCU lock or the xa_lock while iterating. If you need to drop the lock, call xas_pause() first.

◆ xas_lock

#define xas_lock (   xas)    xa_lock((xas)->xa)

◆ xas_lock_bh

#define xas_lock_bh (   xas)    xa_lock_bh((xas)->xa)

◆ xas_lock_irq

#define xas_lock_irq (   xas)    xa_lock_irq((xas)->xa)

◆ xas_lock_irqsave

#define xas_lock_irqsave (   xas,
  flags 
)     xa_lock_irqsave((xas)->xa, flags)

◆ xas_marked

#define xas_marked (   xas,
  mark 
)    xa_marked((xas)->xa, (mark))

◆ XAS_RESTART

#define XAS_RESTART   ((struct xa_node *)3UL)

◆ xas_trylock

#define xas_trylock (   xas)    xa_trylock((xas)->xa)

◆ xas_unlock

#define xas_unlock (   xas)    xa_unlock((xas)->xa)

◆ xas_unlock_bh

#define xas_unlock_bh (   xas)    xa_unlock_bh((xas)->xa)

◆ xas_unlock_irq

#define xas_unlock_irq (   xas)    xa_unlock_irq((xas)->xa)

◆ xas_unlock_irqrestore

#define xas_unlock_irqrestore (   xas,
  flags 
)     xa_unlock_irqrestore((xas)->xa, flags)

Typedef Documentation

◆ xa_mark_t

typedef unsigned __bitwise xa_mark_t

◆ xa_update_node_t

typedef void(* xa_update_node_t) (struct xa_node *node)

typedef xa_update_node_t - A callback function from the XArray. @node: The node which is being processed

This function is called every time the XArray updates the count of present and value entries in a node. It allows advanced users to maintain the private_list in the node.

Context: The xa_lock is held and interrupts may be disabled. Implementations should not drop the xa_lock, nor re-enable interrupts.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
XA_CHECK_SCHED 

◆ xa_lock_type

Enumerator
XA_LOCK_IRQ 
XA_LOCK_BH 

Function Documentation

◆ __xa_alloc()

int __must_check __xa_alloc ( struct xarray *  ,
u32 *  id,
void *  entry,
struct xa_limit  ,
gfp_t   
)

◆ __xa_alloc_cyclic()

int __must_check __xa_alloc_cyclic ( struct xarray *  ,
u32 *  id,
void *  entry,
struct xa_limit  ,
u32 *  next,
gfp_t   
)

◆ __xa_clear_mark()

void __xa_clear_mark ( struct xarray *  ,
unsigned long  index,
xa_mark_t   
)

◆ __xa_cmpxchg()

void * __xa_cmpxchg ( struct xarray *  ,
unsigned long  index,
void *  old,
void *  entry,
gfp_t   
)

◆ __xa_erase()

void * __xa_erase ( struct xarray *  ,
unsigned long  index 
)

◆ __xa_insert()

int __must_check __xa_insert ( struct xarray *  ,
unsigned long  index,
void *  entry,
gfp_t   
)

◆ __xa_set_mark()

void __xa_set_mark ( struct xarray *  ,
unsigned long  index,
xa_mark_t   
)

◆ __xa_store()

void * __xa_store ( struct xarray *  ,
unsigned long  index,
void *  entry,
gfp_t   
)

◆ __xas_next()

void * __xas_next ( struct xa_state *  )

◆ __xas_prev()

void * __xas_prev ( struct xa_state *  )

◆ xa_clear_mark()

void xa_clear_mark ( struct xarray *  ,
unsigned long  index,
xa_mark_t   
)

◆ xa_delete_node()

void xa_delete_node ( struct xa_node *  ,
xa_update_node_t   
)

◆ xa_destroy()

void xa_destroy ( struct xarray *  )

◆ xa_dump()

void xa_dump ( const struct xarray *  )

◆ xa_dump_node()

void xa_dump_node ( const struct xa_node *  )

◆ xa_erase()

void * xa_erase ( struct xarray *  ,
unsigned long  index 
)

◆ xa_extract()

unsigned int xa_extract ( struct xarray *  ,
void **  dst,
unsigned long  start,
unsigned long  max,
unsigned int  n,
xa_mark_t   
)

◆ xa_find()

void * xa_find ( struct xarray *  xa,
unsigned long *  index,
unsigned long  max,
xa_mark_t   
)

◆ xa_find_after()

void * xa_find_after ( struct xarray *  xa,
unsigned long *  index,
unsigned long  max,
xa_mark_t   
)

◆ xa_get_mark()

bool xa_get_mark ( struct xarray *  ,
unsigned long  index,
xa_mark_t   
)

◆ xa_load()

void * xa_load ( struct xarray *  ,
unsigned long  index 
)

◆ xa_set_mark()

void xa_set_mark ( struct xarray *  ,
unsigned long  index,
xa_mark_t   
)

◆ xa_store()

void * xa_store ( struct xarray *  ,
unsigned long  index,
void *  entry,
gfp_t   
)

◆ xa_store_range()

void * xa_store_range ( struct xarray *  ,
unsigned long  first,
unsigned long  last,
void *  entry,
gfp_t   
)

◆ xas_clear_mark()

void xas_clear_mark ( const struct xa_state *  ,
xa_mark_t   
)

◆ xas_create_range()

void xas_create_range ( struct xa_state *  )

◆ xas_destroy()

void xas_destroy ( struct xa_state *  )

◆ xas_find()

void * xas_find ( struct xa_state *  ,
unsigned long  max 
)

◆ xas_find_conflict()

void * xas_find_conflict ( struct xa_state *  )

◆ xas_find_marked()

void * xas_find_marked ( struct xa_state *  ,
unsigned long  max,
xa_mark_t   
)

◆ xas_get_mark()

bool xas_get_mark ( const struct xa_state *  ,
xa_mark_t   
)

◆ xas_init_marks()

void xas_init_marks ( const struct xa_state *  )

◆ xas_load()

void * xas_load ( struct xa_state *  )

◆ xas_nomem()

bool xas_nomem ( struct xa_state *  ,
gfp_t   
)

◆ xas_pause()

void xas_pause ( struct xa_state *  )

◆ xas_set_mark()

void xas_set_mark ( const struct xa_state *  ,
xa_mark_t   
)

◆ xas_store()

void * xas_store ( struct xa_state *  ,
void *  entry 
)