Skip to content

Conversation

@bonzini
Copy link
Member

@bonzini bonzini commented Nov 7, 2025

Summary of the PR

As discussed in #327, make the main interface to vm-memory the one that includes permissions and lets fewer aspects of the implementation through.

Based on #361.

Requirements

Before submitting your PR, please make sure you addressed the following
requirements:

  • All commits in this PR have Signed-Off-By trailers (with
    git commit -s), and the commit message has max 60 characters for the
    summary and max 75 characters for each description line.
  • All added/changed functionality has a corresponding unit/integration
    test.
  • All added/changed public-facing functionality has entries in the "Upcoming
    Release" section of CHANGELOG.md (if no such section exists, please create one).
  • Any newly added unsafe code is properly documented.

The purpose of the function is exactly to change a pointer obtained
from a mutable VolatileSlice into a reference, and doing so is
unsafe.  So just shut up clippy.

Signed-off-by: Paolo Bonzini <[email protected]>
Rename GuestMemory to GuestMemoryBackend, IoMemory to GuestMemory.
This allows users of vm-memory to be aware of access permissions
for memory, with no change to callers that just use the `Bytes`
interface.

Signed-off-by: Paolo Bonzini <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
After the rename, the primary interface to vm-memory is almost
completely absent in DESIGN.md.  Give it more importance and
remove some details of GuestMemoryBackend that are now
obsolete.

Signed-off-by: Paolo Bonzini <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
@bonzini
Copy link
Member Author

bonzini commented Nov 7, 2025

I'm not sure if this should be 0.18.0 or 0.19.0.

@XanClic, I think the current main branch causes some breakage for vhost_kern? If so, the "semver trick" release should be 0.18.0 and the one with renamed symbols would be 0.19.0. Then 0.18.0 would be an easy upgrade for everyone except vhost_kern, whereas 0.19.0 could be more tricky.

@bonzini bonzini marked this pull request as draft November 7, 2025 10:00
@bonzini bonzini changed the title Rename iomemory Rename GuestMemory->GuestMemoryBackend, IoMemory->GuestMemory Nov 7, 2025
@likebreath likebreath mentioned this pull request Nov 7, 2025
4 tasks
`GuestMemory`; therefore, all callers that just use the `Bytes` interface
remain completely unchanged.

- \[[#362](https://github.com/rust-vmm/vm-memory/pull/362)\] Rename `GuestMemory` to `GuestMemoryBackend`, `IoMemory` to `GuestMemoryBackend`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: IoMemory to GuestMemoryBackend GuestMemory

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, this hunk should probably be squashed into the prior commit.

//! - [`GuestMemoryRegion`](trait.GuestMemoryRegion.html): represent a continuous region of guest's
//! physical memory.
//! - [`GuestMemory`](trait.GuestMemory.html): represent a collection of `GuestMemoryRegion`
//! - [`GuestMemoryBackend`](trait.GuestMemory.html): represent a collection of `GuestMemoryRegion`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I count seven places like this, where the documentation link isn’t updated – did you leave out the g on the sed? (I know I did (to get a state to compare against) and got the same result at first 😅)

/// `GuestAddressSpace` provides a way to retrieve a `GuestMemoryBackend` object.
/// The vm-memory crate already provides trivial implementation for
/// references to `GuestMemory` or reference-counted `GuestMemory` objects,
/// references to `GuestMemoryBackend` or reference-counted `GuestMemory` objects,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Mainly asking about the g because of this, where the second instance isn’t updated.)

Comment on lines -588 to +591
/// Thanks to the [blanket implementation of `IoMemory` for all `GuestMemory`
/// types](../io_memory/trait.IoMemory.html#impl-IoMemory-for-M), this blanket implementation
/// extends to all [`GuestMemory`] types.
impl<T: IoMemory + ?Sized> Bytes<GuestAddress> for T {
/// Thanks to the [blanket implementation of `GuestMemory` for all `GuestMemoryBackend`
/// types](../io_memory/trait.GuestMemory.html#impl-IoMemory-for-M), this blanket implementation
/// extends to all [`GuestMemoryBackend`] types.
impl<T: GuestMemory + ?Sized> Bytes<GuestAddress> for T {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the documentation link should be ../guest_memory/trait.GuestMemory.html#impl-GuestMemory-for-M.

(I think I’m already to blame for the wrong directory, though.)

@XanClic
Copy link
Collaborator

XanClic commented Nov 10, 2025

Thanks! 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants