-
Notifications
You must be signed in to change notification settings - Fork 103
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
Cleanup of deprecated functions + Behavioral Clarifications #307
base: main
Are you sure you want to change the base?
Commits on Nov 13, 2024
-
fix: move .cargo/config to .cargo/config.toml
This fixes a cargo warning printed in recent toolchains. Since we do not support toolchains older than 1.38, there is no need to symlink to the new file to the old one. Signed-off-by: Patrick Roy <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 5e62fa9 - Browse repository at this point
Copy the full SHA 5e62fa9View commit details -
fix: remove superfluous calls to
.subslice
in io.rsThe call to `.subslice()` ensures that the range `[0, total]` is a valid subslice of the `buf: VolatileSlice` passed in. But `total = min(buf.len(), self.len()) <= buf.len()`, and thus `[0, total]` is definitely a valid subslice of `buf`. The `copy_{from,to}_volatile_slice` functions do not actually care about the length of the `VolatileSlice` passed in - it relies on the safety invariant to ensure that the passed slice has length at least `total`. Thus it doesn't matter if we pass a slice of length `total`, or of a length greater than `total`. It will simply access the first `total` bytes in the slice. Also clarify the safety comment, as some slightly mistakes seemingly snuck in when copying them. Signed-off-by: Patrick Roy <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 1264194 - Browse repository at this point
Copy the full SHA 1264194View commit details -
Clarify behavior of
VolatileMemory::compute_end_offset
Fix the doc comment, and add a unit test for this functions. Particularly the "allow length 0 accesses at the end of the slice" behavior was undocumented before. Signed-off-by: Patrick Roy <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 8179125 - Browse repository at this point
Copy the full SHA 8179125View commit details -
Drop assert from
read/write_volatile
inGuestMemory
The comment on the assertion was wrong, as we are not even doing anything unsafe in the first place. Additionally, the `offset` variable is unused by these functions, so the assertion is at best a sanity check that the `try_access` implementation is correct, although I don't particularly see the value of that. Remove the assertion to prevent confusion. Signed-off-by: Patrick Roy <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 807e68d - Browse repository at this point
Copy the full SHA 807e68dView commit details -
Implement
VolatileMemory::get_slice
in terms ofsubslice
The two functions contain exactly the same body, so just have one call the other. No functional change intended. Signed-off-by: Patrick Roy <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 31e32c1 - Browse repository at this point
Copy the full SHA 31e32c1View commit details -
add
retry_eintr!
utility macroAdd a macro that automatically retries a given I/O operation if EINTR is returned. This is a fairly common pattern in vm-memory. Signed-off-by: Patrick Roy <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 1e8512a - Browse repository at this point
Copy the full SHA 1e8512aView commit details -
Introduce
VolatileSlice::truncate
This function reduces the length of a volatile slice. Many of the I/O primitives rely on volatile slice lengths to determine how many bytes should be read/written, and in cases where we want to read/write "up to X bytes", calling `.truncate` is needed. Signed-off-by: Patrick Roy <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 7b4d418 - Browse repository at this point
Copy the full SHA 7b4d418View commit details -
chore: remove deprecated methods
The old `Read`/`Write` based APIs for operating on guest memory have been deprecated for a fairly long time now, and are superseceded by their `ReadVolatile`/`WriteVolatile` equivalents. The `fold` and friends functions have been deprecated for way longer. Various `.as_ptr` APIs in volatile_memory.rs are deprecated in favor of pointer guards. Let's clean up the crate and remove all of these. Signed-off-by: Patrick Roy <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 09a0fad - Browse repository at this point
Copy the full SHA 09a0fadView commit details -
fix: move volatile memory access methods to
Bytes
traitThe `read_[exact_]_volatile_from` and `write_[all_]volatile_to` functions were intended to be replacements for their `Read` and `Write` based counterparts. However, those used to live in the `Bytes` trait, not the `GuestMemory` trait. Fix up this goof on my part by moving them to the `Bytes` trait. Signed-off-by: Patrick Roy <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 96443bb - Browse repository at this point
Copy the full SHA 96443bbView commit details -
doc: clarify behavior of
Bytes::read
and coCapture the actual behavior of various edge cases around empty buffers and containers in the doc comment. Signed-off-by: Patrick Roy <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for e7fa4d4 - Browse repository at this point
Copy the full SHA e7fa4d4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8fd12ef - Browse repository at this point
Copy the full SHA 8fd12efView commit details