Skip to content

Refactor mock ring accessor API; add typed accessors #352

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

wongnelson
Copy link

Summary of the PR

Addresses #123

This PR refactors the mock queue ring API by:

  • Introducing the RingAccess trait to handle endianness conversions for ring elements in tests.
  • Adding typed accessor methods (load_flags, store_flags, load_event, store_event, etc.) to SplitQueueRing so that test code no longer directly manipulates raw memory or does manual endianness conversion.
  • Providing a minimal unit test for the new flag and event accessors.

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.

- Introduces the RingAccess trait for endianness conversion in mock ring elements
- Adds typed accessor methods (e.g., load_flags, store_ring) to SplitQueueRing
- Refactors test/mocks to use the new accessors instead of raw Ref/ArrayRef and manual conversion
- Adds minimal test coverage for flag and event accessors
- Fixes rust-vmm#123

Signed-off-by: Nelson Wong <[email protected]>
@wongnelson wongnelson force-pushed the issue123-typed-ring-accessors branch from 167651b to 3d5be44 Compare July 24, 2025 02:47
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.

1 participant