rust-osdev / rust-osdev/x86_64

feature request: integrating with the `os_units` crate

Open
#288 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
940
Forks
157
Avg merge
1d 10h
Merged PRs (30d)
3

Description

I'd like to suggest integrating my os_units crate into the x86_64 crate.

Descriptions

The os_units crate provides two types: Bytes and NumOfPages. These types are interactive because of two methods: Bytes::as_num_of_pages and NumOfPages::as_bytes. Note that Bytes::as_num_of_pages returns the number of pages that is more than the bytes the instance of Bytes contains.

Advantages

Some methods will have more explicit return types. For example, Page implements Sub<Self>. However, the return type is u64, and it doesn't provide the information whether the number represents the bytes of pages or the number of pages (at first, I thought it was former). The users can read the docs (by the way, there is no information of its return type except the source code), but returning NumOfPages will prevent bugs because of the mismatch of types.

Drawbacks

The users will have to call as_usize (or as_u64 to match with the address types) each time, increasing the size of the code.

Notes

These two types use usize, not u64. However, changing the type to u64 will be better because this crate mainly uses it.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the x86_64 crate's public Page arithmetic and the os_units Bytes and NumOfPages APIs described in the issue. Determine which return types and conversions would be affected, then establish the integration scope and compatibility requirements. Done means the project has an agreed API design and corresponding implementation and tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.