Merged
Conversation
Collaborator
ming1
commented
Sep 15, 2025
- Add UblkCtrlAsync for ctrl async/.await only
- improve for_each_dev_id()
Separate async and sync control APIs by moving all async methods from UblkCtrl to a new dedicated UblkCtrlAsync struct. This refactoring improves API clarity and enforces proper async/sync usage patterns. Changes: - Create new UblkCtrlAsync struct with async-only methods - Move async methods (*_async, *_async_await) from UblkCtrl to UblkCtrlAsync - Extract async dependencies and helper functions to ctrl_async.rs - Migrate async test cases to UblkCtrlAsync module - Add ctrl_async module to lib.rs exports - Remove 692 lines of async code from ctrl.rs, add 845 lines to ctrl_async.rs This separation ensures that: - Sync users only see sync APIs (UblkCtrl) - Async users get dedicated async APIs (UblkCtrlAsync) - No accidental mixing of sync/async patterns - Cleaner, more focused API surface for each use case The refactoring maintains full backward compatibility for existing sync code while providing a clean async-first interface for new async applications. Also: Add async versions of UblkDev creation methods that accept &UblkCtrlAsync references, enabling proper async/sync API separation while maximizing code reuse. Changes: - Refactor UblkDev::new() to extract common logic into new_with_info() helper - Add UblkDev::new_async() method that accepts &UblkCtrlAsync - Update async tests to use new_async() instead of temporary sync controllers - Add comprehensive documentation examples for both sync and async usage Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Unexport UblkCtrlAsync now, and so get more time to think about the interface and usage. Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Replace runtime directory parsing with /sys/class/ublk-char iteration to extract device IDs directly from kernel-exposed character devices. This approach is more reliable and kernel-centric. Signed-off-by: Ming Lei <tom.leiming@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.