-
Notifications
You must be signed in to change notification settings - Fork 13
Feature/zero copy #129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/zero copy #129
Conversation
bugfix in cli local/remote path detection
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements zero-copy I/O operations for the SMB client by introducing an IoVec abstraction that can hold both owned and shared buffer references. This reduces memory allocations and copying during data transfers.
Key changes:
- Introduces
IoVecandIoVecBuftypes for zero-copy buffer management - Refactors message signing, encryption, and transport layers to work with
IoVec - Adds progress reporting capabilities to file copy operations
Reviewed Changes
Copilot reviewed 28 out of 29 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
crates/smb/src/util/iovec.rs |
New module defining IoVec and IoVecBuf for zero-copy buffer management |
crates/smb/src/util.rs |
Module declaration for iovec utilities |
crates/smb/src/session/signer.rs |
Updated to use IoVec instead of &[u8] for message signing |
crates/smb/src/session/encryptor_decryptor.rs |
Modified encryption to work with IoVec |
crates/smb/src/resource/pipe.rs |
Updated to use zero-copy outgoing messages |
crates/smb/src/resource/file_util.rs |
Added progress reporting and visibility improvements to copy operations |
crates/smb/src/resource/file.rs |
Added zero-copy write methods |
crates/smb/src/resource.rs |
Added sendo_recvo method for zero-copy message handling |
crates/smb/src/msg_handler.rs |
Updated message structures to support IoVec and additional data |
crates/smb/src/connection/transformer.rs |
Refactored to use IoVec throughout transformation pipeline |
crates/smb/src/connection/transport/traits.rs |
Updated transport layer to send IoVec data |
crates/smb-msg/src/file.rs |
Modified WriteRequest to support zero-copy operations |
crates/smb-cli/src/copy.rs |
Enhanced with progress bar support for file operations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
crates/smb/src/session/signer.rs
Outdated
| fn calculate_signature(&mut self, header: &mut Header, raw_data: &[u8]) -> crate::Result<u128> { | ||
| fn _calculate_signature(&mut self, header: &mut Header, data: &IoVec) -> crate::Result<u128> { | ||
| // Write header with signature set to 0. | ||
| let signture_backup = header.signature; |
Copilot
AI
Sep 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable name 'signture_backup' contains a typo. It should be 'signature_backup'.
| /// pass the return value to start_parallel_copy to start the copy. | ||
| /// | ||
| /// this is mostly useful for cases that require an additional interaction with the | ||
| /// state, beyond the copy workers themselves - for example, reporting progress. | ||
| /// if you don't need that, just use the [`block_copy`] function directly. |
Copilot
AI
Sep 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation comment has inconsistent capitalization. Sentences should start with capital letters: 'Pass the return value to start_parallel_copy to start the copy. This is mostly useful for cases that require an additional interaction with the state, beyond the copy workers themselves - for example, reporting progress. If you don't need that, just use the [block_copy] function directly.'
| /// pass the return value to start_parallel_copy to start the copy. | |
| /// | |
| /// this is mostly useful for cases that require an additional interaction with the | |
| /// state, beyond the copy workers themselves - for example, reporting progress. | |
| /// if you don't need that, just use the [`block_copy`] function directly. | |
| /// Pass the return value to start_parallel_copy to start the copy. | |
| /// | |
| /// This is mostly useful for cases that require an additional interaction with the | |
| /// state, beyond the copy workers themselves - for example, reporting progress. | |
| /// If you don't need that, just use the [`block_copy`] function directly. |
| /// # Notes | ||
| /// - To report progress, use the [`prepare_parallel_copy`] function to get a `CopyState`, and then | ||
| /// use that to report progress while the copy is running. |
Copilot
AI
Sep 13, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation comment has inconsistent punctuation. It should end with a period: '- To report progress, use the [prepare_parallel_copy] function to get a CopyState, and then use that to report progress while the copy is running.'
No description provided.