-
Notifications
You must be signed in to change notification settings - Fork 353
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
Add callback support to FileDescription::read #4110
base: master
Are you sure you want to change the base?
Conversation
abfa97f
to
88cbd55
Compare
Hi @RalfJung, I wanted to share some updates and seek your guidance on a few points:
Thanks in advance for your help and guidance! Looking forward to your insights. |
@rustbot ready |
So this is blocked on #4106, I assume.
I would prefer if you could split this into two separate PRs. Refactoring an existing interface should not be done in the same changeset as adding new functionality, if it can be avoided. Splitting changes in smaller PRs greatly helps with making them easier to review. |
88cbd55
to
fb2d16a
Compare
Hi @RalfJung, Thank you for your feedback and for highlighting the review challenges—I completely understand. This PR focuses on two key changes:
Let me know if there's anything else you'd like me to adjust. Thanks! 🙂 |
@rustbot ready |
fb2d16a
to
59f70e8
Compare
This comment has been minimized.
This comment has been minimized.
src/shims/files.rs
Outdated
/// Represents an atomic I/O operation that handles data transfer between memory regions. | ||
/// Supports contiguous memory layouts for efficient I/O operations. | ||
#[derive(Clone)] | ||
pub struct IoTransferOperation<'tcx> { |
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.
I don't understand the point of all the new things you added here.
What I would expect is simply a new argument to read
that has a type like DynMachineCallback<Result<u64, IoError>>
. This can replace the existing dest: &MPlaceTy<'tcx>
.
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.
I don't understand the point of all the new things you added here.
What I would expect is simply a new argument to
read
that has a type likeDynMachineCallback<Result<u64, IoError>>
. This can replace the existingdest: &MPlaceTy<'tcx>
.
I need your guidance on the following:
-
I have not modified the signature of the
FileDescription::read()
function. Instead, I introduced a new function,FileDescription::read_with_callback()
, and integratedDynMachineCallback<Result<u64, IoError>>
as a replacement fordest: &MPlaceTy<'tcx>
. Below is the function definition for reference:fn read_with_callback<'tcx>( self: FileDescriptionRef<Self>, _communicate_allowed: bool, _ptr: Pointer, _len: usize, _completion_callback: DynFileIOCallback<'tcx>, _ecx: &mut MiriInterpCx<'tcx>, ) -> InterpResult<'tcx> { }
-
Modifying the signature of
FileDescription::read()
will affect the following modules. I need your input on how to adapt the signature changes for these modules:FileDescription for io::Stdin FileDescription for io::Stdout FileDescription for io::Stderr FileDescription for NullOutput FileDescription for AnonSocket FileDescription for Epoll FileDescription for EventFd
Let me know your thoughts and suggestions on how to proceed.
Now that #4106 landed, please rebase this over the latest miri HEAD. |
59f70e8
to
a54505c
Compare
src/concurrency/init_once.rs
Outdated
@@ -2,7 +2,7 @@ use std::collections::VecDeque; | |||
|
|||
use rustc_index::Idx; | |||
|
|||
use super::thread::DynUnblockCallback; | |||
use super::thread::DyMachineCallback; |
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.
You have changes in the first commit which are undone by the second commit -- please clea that up by squashing the two commits.
a54505c
to
d98f7a2
Compare
- Implementing atomic reads for contiguous buffers - Supports read operations with callback-based completion. Signed-off-by: shamb0 <r.raajey@gmail.com>
d98f7a2
to
dd7bea4
Compare
Key Changes
IoTransferOperation
to manage atomic file transfersFileDescription::read
Context
This work completes stages 2 of the async file operations roadmap discussed here:
FileDescription::read
(this PR)readv()
using callbacks (this PR)