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
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§
Modules§
- Implementation of the kernel’s memory allocation infrastructure.
- Types for working with the block layer.
- Credentials management.
- Generic devices that are part of the kernel’s driver model.
- Generic implementation of device IDs.
- Devres abstraction
- Direct memory access (DMA).
- Generic support for drivers of different buses (e.g., PCI, Platform, Amba, etc.).
- Kernel errors.
- Abstractions for the faux bus.
- Firmware abstraction
- Kernel file systems.
- Extensions to the
pin-init
crate. - Memory-mapped IO.
ioctl()
number definitions.- Logic for static keys.
- KUnit-based macros for Rust unit tests.
- A linked list implementation.
- Miscdevice support.
- Networking.
- Device Tree / Open Firmware abstractions.
- Kernel page allocation and management.
- Abstractions for the PCI bus.
- Pid namespaces.
- Abstractions for the platform bus.
- The
kernel
prelude. - Printing facilities.
- Red-black trees.
- Revocable objects.
- Linux Security Modules (LSM).
- Seq file bindings.
- Commonly used sizes.
- String representations.
- Synchronisation primitives.
- Tasks (threads and processes).
- Time related primitives.
- Logic for tracepoints.
- Traits for transmuting types.
- Kernel types.
- Slices to user space memory regions.
- Work queues.
Macros§
- Wrapper around
asm!
configured for use in the kernel. - 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.
- Returns the currently running task’s pid namespace.
- Declare the Rust entry point for a tracepoint.
- Defines getters for a
ListArcField
. - Prints an alert-level message (level 1) prefixed with device information.
- Prints a critical-level message (level 2) prefixed with device information.
- Prints a debug-level message (level 7) prefixed with device information.
- Prints an emergency-level message (level 0) prefixed with device information.
- Prints an error-level message (level 3) prefixed with device information.
- Prints an info-level message (level 6) prefixed with device information.
- Prints a notice-level message (level 5) prefixed with device information.
- Prints a warning-level message (level 4) prefixed with device information.
- Reads a field of an item from an allocated region of structs.
- Writes to a field of an item from an allocated region of structs.
- A convenience alias for
core::format_args
. - Defines a global lock.
- Use to implement the
HasHrTimer<T>
trait. - Implements the
HasListLinks
trait for the given type. - Implements the
HasListLinks
andHasSelfPtr
traits for the given type. - Used to safely implement the
HasWork<T, ID>
trait. - Declares that this type supports
ListArc
. - Implements the
ListItem
trait for the given type. - Create a
KVec
containing the arguments. - Create device table alias for modpost.
- Declares a kernel module that exposes a single driver.
- Create firmware .modinfo entries.
- Declares a kernel module that exposes a single PCI driver.
- Declares a kernel module for PHYs drivers.
- Declares a kernel module that exposes a single platform driver.
- 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
PollCondVar
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. - Create an OF
IdTable
with an “alias” for modpost. - Create a PCI
IdTable
with its alias for modpost. - 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).
- Write to a
SeqFile
with the ordinary Rust formatting syntax. - Static assert (i.e. compile-time assert).
- Branch based on a static key.
- 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§
- A module that is pinned and initialised in-place.
- The top level entrypoint to implementing a kernel module.
- Metadata attached to a
Module
orInPlaceModule
.