Skip to content

Remove all possible warnings#17

Merged
LuernOutOfOrder merged 7 commits intodevelopfrom
15-fix-all-warnings
Nov 10, 2025
Merged

Remove all possible warnings#17
LuernOutOfOrder merged 7 commits intodevelopfrom
15-fix-all-warnings

Conversation

@LuernOutOfOrder
Copy link
Owner

This pull request refactors the serial device and console management code to improve safety, encapsulation, and maintainability. The main changes include replacing global mutable statics with thread-safe structures, introducing new manager types for serial devices and the kernel console, and updating related code to use these abstractions.

Serial device and console management improvements:

  • Introduced a SerialManager struct (SERIAL_DEVICES) to encapsulate and safely manage the array of UART devices, replacing the previous global UART_DEVICES static. This adds methods for adding devices and retrieving the default console. [1] [2] [3] [4]
  • Added a KernelConsole struct (KCONSOLE) to manage the kernel console in a thread-safe manner, replacing the previous global mutable static. Methods for setting and getting the console were added. [1] [2]
  • Updated the print and write_fmt functions in src/print.rs to use the new SerialManager and KernelConsole abstractions, ensuring safer access to shared resources. [1] [2]

Code quality and safety improvements:

  • Removed the #![warn(static_mut_refs)] lint, as the new abstractions eliminate the need for direct static mut references.
  • Added Copy and Clone derives to DriverRegion and Ns16550 structs for easier and safer usage. [1] [2]

API and naming consistency:

  • Renamed the _default_console field in UartDevice to default_console for clarity and consistency. [1] [2]

These changes collectively make serial device and console management more robust and idiomatic in Rust, reducing the risk of data races and undefined behavior.

@LuernOutOfOrder LuernOutOfOrder self-assigned this Nov 10, 2025
@LuernOutOfOrder LuernOutOfOrder added the enhancement New feature or request label Nov 10, 2025
@LuernOutOfOrder LuernOutOfOrder linked an issue Nov 10, 2025 that may be closed by this pull request
@LuernOutOfOrder LuernOutOfOrder changed the base branch from main to develop November 10, 2025 10:48
@LuernOutOfOrder LuernOutOfOrder merged commit 92906b3 into develop Nov 10, 2025
1 check passed
@LuernOutOfOrder LuernOutOfOrder deleted the 15-fix-all-warnings branch November 10, 2025 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix all warnings

1 participant