Expand description
The kernel crate.
This crate contains the kernel APIs that have been ported or wrapped for usage by Rust code in the kernel and is shared by all of them.
In other words, all the rest of the Rust code in the kernel (e.g. kernel
modules written in Rust) depends on core, alloc and this crate.
If you need a kernel C API that is not ported or wrapped yet here, then do so first instead of bypassing this crate.
Re-exports
pub use macros;pub use uapi;
Modules
- Kernel errors.
- API to safely and fallibly initialize pinned
structs using in-place constructors. - ioctl() number definitions
- KUnit-based macros for Rust unit tests.
- Networking.
- The
kernelprelude. - Printing facilities.
- String representations.
- Synchronisation primitives.
- Tasks (threads and processes).
- Kernel types.
- Work queues.
Macros
- Creates a new
BStrfrom a string literal. - Asserts that a boolean expression is
trueat compile time. - Fails the build if the code path calling
build_error!can possibly be executed. - Creates a new
CStrfrom a string literal. - Returns the currently running task.
- A convenience alias for
core::format_args. - Used to safely implement the
HasWork<T, ID>trait. - Construct an in-place initializer for
structs. - Declares a kernel module for PHYs drivers.
- Creates a
CondVarinitialiser with the given name and a newly-created lock class. - Creates a
Mutexinitialiser with the given name and a newly-created lock class. - Creates a
SpinLockinitialiser with the given name and a newly-created lock class. - Creates a
Workinitialiser with the given name and a newly-created lock class. - Construct an in-place, pinned initializer for
structs. - Prints an alert-level message (level 1).
- Continues a previous log message in the same line.
- Prints a critical-level message (level 2).
- Prints a debug-level message (level 7).
- Prints an emergency-level message (level 0).
- Prints an error-level message (level 3).
- Prints an info-level message (level 6).
- Prints a notice-level message (level 5).
- Prints a warning-level message (level 4).
- Initialize and pin a type directly on the stack.
- Initialize and pin a type directly on the stack.
- Static assert (i.e. compile-time assert).
- Construct an in-place fallible initializer for
structs. - Construct an in-place, fallible pinned initializer for
structs.
Structs
- Equivalent to
THIS_MODULEin the C API.
Traits
- The top level entrypoint to implementing a kernel module.