summaryrefslogtreecommitdiffstats
path: root/lib/uuid.c
diff options
context:
space:
mode:
authorMatthew Wilcox <willy@infradead.org>2018-11-06 20:13:35 +0100
committerMatthew Wilcox <willy@infradead.org>2019-02-06 19:32:25 +0100
commit2fa044e51a1f35d7b04cbde07ec513b0ba195e38 (patch)
treeca7f9f39820ca4f8241caf7a6eef8f044db5d38a /lib/uuid.c
parentXArray: Redesign xa_alloc API (diff)
downloadlinux-2fa044e51a1f35d7b04cbde07ec513b0ba195e38.tar.xz
linux-2fa044e51a1f35d7b04cbde07ec513b0ba195e38.zip
XArray: Add cyclic allocation
This differs slightly from the IDR equivalent in five ways. 1. It can allocate up to UINT_MAX instead of being limited to INT_MAX, like xa_alloc(). Also like xa_alloc(), it will write to the 'id' pointer before placing the entry in the XArray. 2. The 'next' cursor is allocated separately from the XArray instead of being part of the IDR. This saves memory for all the users which do not use the cyclic allocation API and suits some users better. 3. It returns -EBUSY instead of -ENOSPC. 4. It will attempt to wrap back to the minimum value on memory allocation failure as well as on an -EBUSY error, assuming that a user would rather allocate a small ID than suffer an ID allocation failure. 5. It reports whether it has wrapped, which is important to some users. Signed-off-by: Matthew Wilcox <willy@infradead.org>
Diffstat (limited to 'lib/uuid.c')
0 files changed, 0 insertions, 0 deletions