summaryrefslogtreecommitdiffstats
path: root/include/linux/xarray.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/xarray.h')
-rw-r--r--include/linux/xarray.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/include/linux/xarray.h b/include/linux/xarray.h
index 57cf35c4d094..99dd0838b4ba 100644
--- a/include/linux/xarray.h
+++ b/include/linux/xarray.h
@@ -220,10 +220,13 @@ enum xa_lock_type {
220#define XA_FLAGS_LOCK_IRQ ((__force gfp_t)XA_LOCK_IRQ) 220#define XA_FLAGS_LOCK_IRQ ((__force gfp_t)XA_LOCK_IRQ)
221#define XA_FLAGS_LOCK_BH ((__force gfp_t)XA_LOCK_BH) 221#define XA_FLAGS_LOCK_BH ((__force gfp_t)XA_LOCK_BH)
222#define XA_FLAGS_TRACK_FREE ((__force gfp_t)4U) 222#define XA_FLAGS_TRACK_FREE ((__force gfp_t)4U)
223#define XA_FLAGS_ZERO_BUSY ((__force gfp_t)8U)
223#define XA_FLAGS_MARK(mark) ((__force gfp_t)((1U << __GFP_BITS_SHIFT) << \ 224#define XA_FLAGS_MARK(mark) ((__force gfp_t)((1U << __GFP_BITS_SHIFT) << \
224 (__force unsigned)(mark))) 225 (__force unsigned)(mark)))
225 226
227/* ALLOC is for a normal 0-based alloc. ALLOC1 is for an 1-based alloc */
226#define XA_FLAGS_ALLOC (XA_FLAGS_TRACK_FREE | XA_FLAGS_MARK(XA_FREE_MARK)) 228#define XA_FLAGS_ALLOC (XA_FLAGS_TRACK_FREE | XA_FLAGS_MARK(XA_FREE_MARK))
229#define XA_FLAGS_ALLOC1 (XA_FLAGS_TRACK_FREE | XA_FLAGS_ZERO_BUSY)
227 230
228/** 231/**
229 * struct xarray - The anchor of the XArray. 232 * struct xarray - The anchor of the XArray.
@@ -279,7 +282,7 @@ struct xarray {
279#define DEFINE_XARRAY(name) DEFINE_XARRAY_FLAGS(name, 0) 282#define DEFINE_XARRAY(name) DEFINE_XARRAY_FLAGS(name, 0)
280 283
281/** 284/**
282 * DEFINE_XARRAY_ALLOC() - Define an XArray which can allocate IDs. 285 * DEFINE_XARRAY_ALLOC() - Define an XArray which allocates IDs starting at 0.
283 * @name: A string that names your XArray. 286 * @name: A string that names your XArray.
284 * 287 *
285 * This is intended for file scope definitions of allocating XArrays. 288 * This is intended for file scope definitions of allocating XArrays.
@@ -287,6 +290,15 @@ struct xarray {
287 */ 290 */
288#define DEFINE_XARRAY_ALLOC(name) DEFINE_XARRAY_FLAGS(name, XA_FLAGS_ALLOC) 291#define DEFINE_XARRAY_ALLOC(name) DEFINE_XARRAY_FLAGS(name, XA_FLAGS_ALLOC)
289 292
293/**
294 * DEFINE_XARRAY_ALLOC1() - Define an XArray which allocates IDs starting at 1.
295 * @name: A string that names your XArray.
296 *
297 * This is intended for file scope definitions of allocating XArrays.
298 * See also DEFINE_XARRAY().
299 */
300#define DEFINE_XARRAY_ALLOC1(name) DEFINE_XARRAY_FLAGS(name, XA_FLAGS_ALLOC1)
301
290void *xa_load(struct xarray *, unsigned long index); 302void *xa_load(struct xarray *, unsigned long index);
291void *xa_store(struct xarray *, unsigned long index, void *entry, gfp_t); 303void *xa_store(struct xarray *, unsigned long index, void *entry, gfp_t);
292void *xa_erase(struct xarray *, unsigned long index); 304void *xa_erase(struct xarray *, unsigned long index);