Merged
Conversation
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Add BufDesc enum to support both copy and zero-copy buffer operations in a unified API. The enum includes Slice variant for traditional buffer copy operations and AutoReg variant for auto buffer registration. - BufDesc::Slice holds buffer slice references for copy operations - BufDesc::AutoReg stores ublk_auto_buf_reg value (8 bytes) directly - Supports Debug and Clone traits as required - Part of unify-buffer-and-zero-copy feature implementation Signed-off-by: Ming Lei <tom.leiming@gmail.com>
…st enum - Add extensive documentation for BufDesc enum with usage examples - Implement BufDescList enum for batch buffer operations - Add library-level documentation for unified buffer management API - Include migration examples from legacy APIs to unified APIs - Document performance characteristics and validation requirements - Provide comprehensive examples for both copy and zero-copy modes This completes the foundational types for the unified buffer management system while ensuring users have clear guidance for adoption. Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Add validation methods to BufDesc enum that check compatibility between buffer descriptor types and device capabilities. This implements task 3 of the unify-buffer-and-zero-copy specification. Changes: - Add validate_compatibility() method to check device flag compatibility - Add from_io_buf() helper method for migration from IoBuf - Export BufDesc and BufDescList at crate level for public API access - Add comprehensive tests for validation logic - Remove len() and is_empty() methods as requested The validation ensures proper usage of buffer types: - BufDesc::Slice works with traditional buffer management and UBLK_F_USER_COPY - BufDesc::AutoReg requires UBLK_F_AUTO_BUF_REG flag - Invalid flag combinations return appropriate error codes Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Changes: - Added unified complete_io_cmd_unified() method that accepts BufDesc enum - Updated examples (null.rs, loop.rs) to use the new unified API - Modified all test cases in tests/basic.rs to use BufDesc::Slice() or BufDesc::AutoReg() - Replaced direct buffer pointer usage with buffer descriptor abstraction - Added validation logic for buffer descriptor compatibility with device flags Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Add unified submit_io_cmd_unified() method to UblkQueue that accepts BufDesc enum for both traditional buffer slices and auto buffer registration modes. Key changes: - Add submit_io_cmd_unified() method with comprehensive validation and dispatch - Update all examples (loop, null, ramdisk) to use unified API - Update all tests to use unified API with appropriate BufDesc variants - Add proper error handling and async pattern (unwrap().await) - Remove unused raw pointer variables from examples - Update README.md documentation example The unified method maintains zero runtime overhead through compile-time dispatch while providing a cleaner, more ergonomic API that works with both copy and zero-copy buffer management strategies. Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Add unified submit_fetch_commands_unified() method to UblkQueue that accepts BufDescList enum for both traditional buffer slices and auto buffer registration. Key changes: - Add submit_fetch_commands_unified() method with comprehensive validation and dispatch - Add BufDescList enum with Slices and AutoRegs variants for unified buffer list handling - Update all examples (loop, null) to use unified API with BufDescList::Slices - Update all tests to use unified API with appropriate BufDescList variants - Replace submit_fetch_commands_with_auto_buf_reg with BufDescList::AutoRegs usage - Add proper error handling and device capability validation - Include comprehensive documentation with usage examples The unified method maintains zero runtime overhead through compile-time dispatch while providing a cleaner, more ergonomic API that works with both copy and zero-copy buffer management strategies. This completes the unified buffer management API trilogy alongside submit_io_cmd_unified and complete_io_cmd_unified. 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.
No description provided.