Lines Matching full:you
14 resizable array. Unlike a hash, it allows you to sensibly go to the
25 ``ULONG_MAX`` then the XArray is not the data type for you. The most
30 the others. You can iterate over entries which are marked.
35 nor for function pointers. You can store pointers to statically allocated
38 You can also store integers between 0 and ``LONG_MAX`` in the XArray.
39 You must first convert it into an entry using xa_mk_value().
40 When you retrieve an entry from the XArray, you can check whether it is
72 You can then set entries using xa_store() and get entries
74 new entry and return the previous entry stored at that index. You can
80 You can conditionally replace an entry at an index by using
86 If you want to only store a new entry to an index if the current entry
87 at that index is ``NULL``, you can use xa_insert() which
90 You can enquire whether a mark is set on an entry by using
91 xa_get_mark(). If the entry is not ``NULL``, you can set a mark
93 calling xa_clear_mark(). You can ask whether any entry in the
96 You can copy entries out of the XArray into a plain array by calling
97 xa_extract(). Or you can iterate over the present entries in
98 the XArray by calling xa_for_each(). You may prefer to use
103 of indices. If you do this, some of the other operations will behave
109 Sometimes you need to ensure that a subsequent call to xa_store()
112 normal API will see this entry as containing ``NULL``. If you do
113 not need to use the reserved entry, you can call xa_release()
115 in the meantime, xa_release() will do nothing; if instead you
116 want the entry to become ``NULL``, you should use xa_erase().
122 Finally, you can remove all entries from an XArray by calling
123 xa_destroy(). If the XArray entries are pointers, you may wish
124 to free the entries first. You can do this by iterating over all present
130 If you use DEFINE_XARRAY_ALLOC() to define the XArray, or
134 You can call xa_alloc() to store the entry at an unused index
135 in the XArray. If you need to modify the array from interrupt context,
136 you can use xa_alloc_bh() or xa_alloc_irq() to disable
143 you only want to free the entry if it's ``NULL``).
145 By default, the lowest free entry is allocated starting from 0. If you
147 DEFINE_XARRAY_ALLOC1() or ``XA_FLAGS_ALLOC1``. If you want to
149 ID, you can use xa_alloc_cyclic().
151 You cannot use ``XA_MARK_0`` with an allocating XArray as this mark
164 It is possible for no memory to be allocatable, particularly if you pass
167 If you don't need to know exactly which error occurred, using
173 When using the Normal API, you do not have to worry about locking.
221 If you want to take advantage of the lock to protect the data structures
222 that you are storing in the XArray, you can call xa_lock()
224 object you have found before calling xa_unlock(). This will
226 up the object and incrementing the refcount. You can also use RCU to
234 If, for example, you want to store entries in the XArray in process
235 context and then erase them in softirq context, you can do that this way::
263 If you are going to modify the XArray from interrupt or softirq context,
264 you need to initialise the array using xa_init_flags(), passing
279 Sometimes you need to protect access to the XArray with a mutex because
281 not entitle you to use functions like __xa_erase() without taking
286 available for situations where you look up an entry and want to atomically
288 in this case, as it will save you from walking the tree twice.
295 No locking is done for you by the advanced API, and you are required
296 to use the xa_lock while modifying the array. You can choose whether
298 the array. You can mix advanced and normal operations on the same array;
303 structure which you declare on the stack using the XA_STATE()
306 in the XArray and let you compose various operations together without
309 The xa_state is also used to store errors. You can call
312 for you to check for an error after each call; you can make multiple
315 ``EINVAL``, but it supports arbitrary errors in case you want to call
320 cache it in the xa_state for the next attempt. The idea is that you take
323 likely to fail. Once you have dropped the lock, xas_nomem()
358 of this RCU period. You should restart the lookup from the head
378 You can use xas_init_marks() to reset the marks on an entry
382 xas_store() will not reset the marks on that entry; if you want
383 the marks reset, you should do that explicitly.
386 as it can. If you know the xa_state has already been walked to the
387 entry and need to check that the entry hasn't changed, you can use
390 If you need to move to a different index in the XArray, call
393 spot in the tree. If you want to move to the next or previous index,
398 You can search for the next present entry using xas_find(). This
416 After you have done the necessary work and wish to resume, the xa_state
418 you last processed. If you have interrupts disabled while iterating,
425 nothing if you have called xas_pause() or xas_set()
428 You can call xas_set_update() to have a callback function
446 You can create a multi-index entry by using XA_STATE_ORDER()