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§
- Extensions to the
alloc
crate. - Types for working with the block layer.
- Generic devices that are part of the kernel’s driver model.
- Kernel errors.
- API to safely and fallibly initialize pinned
struct
s using in-place constructors. ioctl()
number definitions.- KUnit-based macros for Rust unit tests.
- Networking.
- Kernel page allocation and management.
- The
kernel
prelude. - Printing facilities.
- String representations.
- Synchronisation primitives.
- Tasks (threads and processes).
- Time related primitives.
- Kernel types.
- Slices to user space memory regions.
- Work queues.
Macros§
- Creates a new
BStr
from a string literal. - Asserts that a boolean expression is
true
at compile time. - Fails the build if the code path calling
build_error!
can possibly be executed. - Creates a new
CStr
from a string literal. - Produces a pointer to an object from a pointer to one of its fields.
- 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
struct
s. - Declares a kernel module for PHYs drivers.
- Creates a
CondVar
initialiser with the given name and a newly-created lock class. - Creates a
Mutex
initialiser with the given name and a newly-created lock class. - Creates a
SpinLock
initialiser with the given name and a newly-created lock class. - Creates a
Work
initialiser with the given name and a newly-created lock class. - Construct an in-place, pinned initializer for
struct
s. - 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
struct
s. - Construct an in-place, fallible pinned initializer for
struct
s.
Structs§
- Equivalent to
THIS_MODULE
in the C API.
Traits§
- The top level entrypoint to implementing a kernel module.