Skip to content

feat(block): optimize ramdisk, add static variant#8

Open
eternalcomet wants to merge 9 commits intoarceos-org:mainfrom
eternalcomet:feat-ramdisk
Open

feat(block): optimize ramdisk, add static variant#8
eternalcomet wants to merge 9 commits intoarceos-org:mainfrom
eternalcomet:feat-ramdisk

Conversation

@eternalcomet
Copy link
Contributor

@eternalcomet eternalcomet commented Dec 26, 2025

  • Redesigned the heap-backed RAM disk to use a raw heap allocation (NonNull<[u8]>) instead of a Vec<u8>, beacause we doesn't use any method in Vec.
  • Added a static variant that utilizes an existing memory region as a RAM disk, enabling the use of the initrd image loaded into memory by the bootloader.

Copy link

Copilot AI left a 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 optimizes the RAM disk implementation and adds a new static RAM disk variant. The heap-backed RAM disk is refactored from using Vec<u8> to a raw heap allocation with NonNull<[u8]>, and a new static RAM disk driver that operates on statically allocated memory buffers is introduced.

Key Changes

  • Refactored heap-backed RAM disk to use NonNull<[u8]> instead of Vec<u8> for more direct memory management
  • Added new ramdisk_static.rs module providing a RAM disk backed by a 'static mut [u8] buffer
  • Added ramdisk-static feature flag to Cargo.toml

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 10 comments.

File Description
axdriver_block/src/ramdisk.rs Refactored to use raw heap allocation with manual memory management instead of Vec
axdriver_block/src/ramdisk_static.rs New static RAM disk implementation for statically allocated buffers
axdriver_block/src/lib.rs Added ramdisk_static module export with feature gate
axdriver_block/Cargo.toml Added ramdisk-static feature flag and reorganized features alphabetically

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@AsakuraMizu AsakuraMizu changed the title feat(block): optimize ramdisk, add static ramdisk feat(block): optimize ramdisk, add static variant Dec 31, 2025
@AsakuraMizu
Copy link
Contributor

Update on 1.13: considering using Tagged pointer to save a usize.

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