Skip to content
This repository was archived by the owner on Dec 9, 2025. It is now read-only.

Conversation

@Anekoique
Copy link

This pull request introduces a new BufWriter type for buffered writing, expands trait implementations for references, and adds new utility methods for buffered I/O. It also makes some dependency and import updates to support these features.

Buffered I/O Enhancements:

  • Added a new BufWriter type for buffered writing, including its implementation and integration into the public API. This allows efficient batched writes similar to BufReader for reads. (src/buffered/writer.rs, src/buffered/mod.rs, src/lib.rs, src/prelude.rs)
  • Introduced the BufWrite trait, analogous to BufRead, with methods for flushing internal buffers, skipping bytes, and writing plain-old-data (POD) types. (src/lib.rs)
  • Added new methods to BufRead: read_val for reading POD types and read_cstring for reading C-style strings. (src/lib.rs)

Trait Implementation Improvements:

  • Implemented Read, Write, Seek, BufRead, and BufWrite for mutable references to types that implement those traits, improving composability and ergonomics. (src/impls.rs)
  • Updated imports to include necessary types for these new implementations. (src/impls.rs)

Dependency and Code Organization:

  • Added the bytemuck crate (with the derive feature) as a dependency to enable safe POD reads and writes. (Cargo.toml)
  • Moved the DEFAULT_BUF_SIZE constant to a shared location and updated its usage for consistency. (src/buffered/mod.rs, src/buffered/reader.rs, src/buffered/writer.rs)

These changes collectively modernize and extend the buffered I/O capabilities of the crate, making it easier to use and more feature-rich.

After that, I will submit a PR to support netlink based on this PR.

@AsakuraMizu
Copy link

Plz move this PR to https://github.com/arceos-org/axio/tree/dev. Also, I may need to completely refactor this crate before accepting your PR. I sincerely apologize for this.

@AsakuraMizu AsakuraMizu closed this Dec 4, 2025
@Anekoique
Copy link
Author

I will mark Starry-OS/arceos#25 and Starry-OS/StarryOS#71 as ready for review after the refactoring of the crate is completed.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants