mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-31 06:14:39 +01:00
Add read_poll_timeout function which polls periodically until a condition is met, an error occurs, or the timeout is reached. The C's read_poll_timeout (include/linux/iopoll.h) is a complicated macro and a simple wrapper for Rust doesn't work. So this implements the same functionality in Rust. The C version uses usleep_range() while the Rust version uses fsleep(), which uses the best sleep method so it works with spans that usleep_range() doesn't work nicely with. The sleep_before_read argument isn't supported since there is no user for now. It's rarely used in the C version. Reviewed-by: Andreas Hindborg <[email protected]> Reviewed-by: Fiona Behrens <[email protected]> Reviewed-by: Alexandre Courbot <[email protected]> Tested-by: Alexandre Courbot <[email protected]> Reviewed-by: Daniel Almeida <[email protected]> Tested-by: Daniel Almeida <[email protected]> Reviewed-by: Alice Ryhl <[email protected]> Signed-off-by: FUJITA Tomonori <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ Fix a minor typo and add missing backticks. - Danilo ] Signed-off-by: Danilo Krummrich <[email protected]>