Commit 2cdae413 authored by Burak Emir's avatar Burak Emir Committed by Yury Norov (NVIDIA)
Browse files

rust: add dynamic ID pool abstraction for bitmap



This is a port of the Binder data structure introduced in commit
15d9da3f ("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: default avatarAlice Ryhl <aliceryhl@google.com>
Suggested-by: default avatarYury Norov <yury.norov@gmail.com>
Reviewed-by: default avatarAlice Ryhl <aliceryhl@google.com>
Signed-off-by: default avatarBurak Emir <bqe@google.com>
Signed-off-by: default avatarYury Norov (NVIDIA) <yury.norov@gmail.com>
parent 38cc91db
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment