This is a port of the Binder data structure introduced in commit
15d9da3f81 ("binder: use bitmap for faster descriptor lookup") to
Rust.
Like drivers/android/dbitmap.h, the ID pool abstraction lets
clients acquire and release IDs. The implementation uses a bitmap to
know what IDs are in use, and gives clients fine-grained control over
the time of allocation. This fine-grained control is needed in the
Android Binder. We provide an example that release a spinlock for
allocation and unit tests (rustdoc examples).
The implementation does not permit shrinking below capacity below
BITS_PER_LONG.
Suggested-by: Alice Ryhl <[email protected]>
Suggested-by: Yury Norov <[email protected]>
Reviewed-by: Alice Ryhl <[email protected]>
Signed-off-by: Burak Emir <[email protected]>
Signed-off-by: Yury Norov (NVIDIA) <[email protected]>