table of contents
IDR_ALLOC(9) | Basic Kernel Library Functions | IDR_ALLOC(9) |
NAME¶
idr_alloc - allocate an id
SYNOPSIS¶
int idr_alloc(struct idr * idr, void * ptr, int start, int end, gfp_t gfp);
ARGUMENTS¶
struct idr * idr
void * ptr
int start
int end
gfp_t gfp
DESCRIPTION¶
Allocates an unused ID in the range [start, end). Returns -ENOSPC if there are no unused IDs in that range.
Note that end is treated as max when <= 0. This is to always allow using start + N as end as long as N is inside integer range.
Simultaneous modifications to the idr are not allowed and should be prevented by the user, usually with a lock. idr_alloc may be called concurrently with read-only accesses to the idr, such as idr_find and idr_for_each_entry.
COPYRIGHT¶
July 2017 | Kernel Hackers Manual 4.11 |